Skip to content
Back to formatted view

Raw Message

Message-ID: <8a83e5000503040510433fc792@mail.gmail.com>
Date: 2005-03-04T13:10:50Z
From: Matthieu Cornec
Subject: lm and time series

Hello,


I create a multivariate time series containing NA values (that could
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)?
######

Matthieu Cornec