[R] Plot binomial regression line

Jörgen Svan jorgen.svan at gmail.com
Thu May 26 10:45:52 CEST 2011


Dear all,

I am quite new with R and I have a problem with plotting a binomial
regression line in a plot.

This is what I type in:
> model<-glm(Para~Size,binomial)
> par(mfrow=c(1,1))
> xv<-seq(3.2,4.5,0.01)
> yv<-predict(model,list(area=xv),type="response")
> plot(Size,Para)
> lines(xv,yv)

The error message that I get is:

> Error in xy.coords(x, y) : 'x' and 'y' lengths differ

My txt-file is attached. Could someone please help me to find out what I did
wrong.

Thank you on beforehand,
Jörgen
-------------- next part --------------
Para	Size
1	4.464285714
1	4.196428571
1	4.151785714
1	4.151785714
1	3.973214286
1	4.285714286
1	4.0625
1	4.241071429
1	4.0625
1	4.017857143
1	4.0625
1	4.017857143
1	4.241071429
1	4.151785714
1	4.0625
1	4.285714286
1	4.196428571
1	4.107142857
1	4.0625
1	4.330357143
1	4.375
1	4.196428571
1	4.196428571
1	3.928571429
1	4.0625
1	4.0625
1	4.107142857
1	4.196428571
1	3.928571429
1	4.151785714
1	3.705357143
1	3.75
1	4.107142857
1	3.839285714
1	3.616071429
1	4.0625
1	3.75
1	4.017857143
1	3.571428571
1	4.151785714
1	3.883928571
1	3.705357143
1	4.017857143
1	4.0625
1	4.0625
1	4.196428571
1	3.839285714
1	4.107142857
1	4.017857143
1	3.839285714
1	3.526785714
1	4.196428571
1	4.017857143
1	3.883928571
1	4.0625
1	4.107142857
1	4.285714286
1	3.928571429
1	3.794642857
1	4.107142857
1	4.107142857
1	3.839285714
1	4.241071429
1	4.285714286
1	4.375
0	4.115044248
0	3.495575221
0	4.203539823
0	3.982300885
0	4.026548673
0	4.07079646
0	3.805309735
0	4.07079646
0	3.982300885
0	4.247787611
0	4.203539823
0	3.982300885
0	3.849557522
0	4.115044248
0	3.849557522
0	4.07079646
0	4.203539823
0	3.849557522
0	4.247787611
0	4.026548673
0	4.07079646
0	4.203539823
0	4.026548673
0	3.982300885
0	4.026548673
0	3.584070796
0	4.026548673
0	3.982300885
0	3.761061947
0	3.230088496
0	3.495575221
0	3.982300885
0	3.938053097
0	3.849557522
0	3.982300885
0	3.849557522
0	4.026548673
0	3.938053097
0	4.159292035
0	3.849557522
0	4.026548673
0	3.672566372
0	4.159292035
0	3.761061947
0	4.247787611
0	4.115044248
0	3.539823009
0	3.89380531
0	4.115044248
0	3.849557522
0	4.115044248
0	4.115044248
0	4.07079646
0	3.584070796
0	3.407079646
0	4.203539823


More information about the R-help mailing list