Logistic regression fit line plot

4 vues (au cours des 30 derniers jours)
Asma
Asma le 16 Fév 2016
Commenté : Kevin Claytor le 16 Fév 2016
I am trying to find the logistic regression between one independent variable and one dependent variable. And then to plot a regression line (on scatter plot). My dependent variable is continuous (i.e. no categories). My question is can I plot the line for such type of data. For reference my data is also attached where 1st column is independent variable. And the code I am using is as below: (But it gives me a flat line). Any ideas or example links?
[b,dev,stats] = glmfit(x,[y1 repmat(100,size(y1))], 'binomial', 'link', 'logit')
xx = linspace(min(x), max(x), 50);
yfit = glmval(b,xx,'logit');
figure(2),plot(x,y1,'o',xx,yfit,'-')
  1 commentaire
Kevin Claytor
Kevin Claytor le 16 Fév 2016
Why do you pad your data in glmfit - what does 'repmat(100,size(y1))' do? To me, this generates a flat line at a level of 100. If I were to fit this, the logistic curve should be flat.

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by