[R] Using time series and lm

From: Matthieu Cornec <matthieu.cornec_at_gmail.com>
Date: Wed 02 Mar 2005 - 21:34:06 EST

Hello,

I apologize for this question that may has been asked a lot of times but I could not go through it.

I create a multivariate time series containing NA values. (This dataset of time series can come directly from an imported file). I want to compute a linear regression and obtain a time serie for both residuals and fitted values. I have tried the trick ts.intersect, without success.

Could you help me out of this?
####

Example:

y<-ts(1:10+rnorm(10))
x<-ts(1:10)
datats<-cbind(y,lagx=lag(x))

Notice the datats could come directly from an imported file, that is why I did not use ts.intersect(y,lagx=lag(x))

fit<-lm(y~lagx,data=datats,na.action=na.omit)

but how do I get a time serie of residuals instead of a vector residuals(fit)?
######



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Mar 02 21:47:40 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:39 EST