Re: [R] Plotting Standard Regression Fit-Am I wrong or a bug?

From: uep <>
Date: Sat, 08 Nov 2008 14:23:18 -0800 (PST)

Thank you Daniel,

I did try to change xlim's and ylim's, but the fitted line still doesn't appear on the plot.
Below is a small expample I've created (I'm sorry for using names, but I het confused with x's and y's):


Unfortunately for me, this example works and does plot fitted line and predicted points. I really don't understand why I can't make the same commands work when trying with my real life data.

Anyway, thanks for getting back to me earlier on. Regards

uep wrote:
> I'm trying to plot a time series (quarterly observations, seasonal effect,
> T=56),regression line and predicted point on the same plot.
> I'm using following commands:
>> plot(qdts,xlim=c(1982,1997))
>> lines(fitted(m2)~time,data=qd,col="red")
>> points(predict(m2,newdata=nqd),col="blue")
> where:
> qdts<-ts(qd$durables,start=c(1982,1),freq=4)
> m2<-lm(qdts~time+quar)
> time<-seq(1,length(qdts),1)
> nqd<-data.frame(time=c(57),quar=c(1))
> Unfortunately once I enter all three commands the fitted line and
> predicted point don't appear on the plot. What surprises me is that I am
> not getting any error message.
> What I am doing wrong?
> Many thanks in advance
> Ula

View this message in context:
Sent from the R help mailing list archive at

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Sat 08 Nov 2008 - 22:27:01 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 08 Nov 2008 - 23:30:23 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive