[R] basic plot() question

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Sun Dec 10 22:02:29 CET 2000

Tord Snall <tord.snall at ebc.uu.se> writes:

> Dear all,
> I try to plot a logstic regression model as follows:
> Valkror<- read.table("Valkror.txt", header=T)
> np.bark<- glm(Npinc~bark, family=binomial, data=Valkror)
> plot.formula(np.bark$fitted.values~ Valkror$bark)
> The above looks nice but I want to connect the points with a line so I try:
> plot.formula(np.bark$fitted.values~ Valkror$bark, type="b")
> but it gives a somewhat! unexpected figure.     :(
> Could someone please give a clue....

Not having your data, I can't see what is wrong with your plot, but
I'd wager that it is because the x values are out of sequence. You
could try 


and then


which is also safer than your strategy in case there are missing
values in your data.

   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list