Remigijus Lapinskas maf.vu.lt> writes:
:
: I use the following two function for a lagged regression:
:
: lm.lag=function(y,lag=1) summary(lm(embed(y,lag+1)[,1]~embed(y,lag+1)[,2:
(lag+1)]))
: lm.lag.x=function(y,x,lag=1) summary(lm(embed(y,lag+1)[,1]~embed(x,lag+1)[,2:
(lag+1)]))
:
: for, resp
Dirk Eddelbuettel debian.org> writes:
>
> Spencer,
>
> You may want to peruse the list archive for posts that match 'ts' and are
> written by Brian Ripley -- these issues have come up before.
>
> The ts class is designed for arima and friends (like Kalman filtering), and
> very useful in that
I use the following two function for a lagged regression:
lm.lag=function(y,lag=1)
summary(lm(embed(y,lag+1)[,1]~embed(y,lag+1)[,2:(lag+1)]))
lm.lag.x=function(y,x,lag=1)
summary(lm(embed(y,lag+1)[,1]~embed(x,lag+1)[,2:(lag+1)]))
for, respectively,
y_t=a+b_1*y_t-1+...+b_lag*y_t-lag
y_t=a+b_1*
Spencer Graves pdf.com> writes:
:
: Is it possible to fit a lagged regression, "y[t]=b0+b1*x[t-1]+e",
: using the function "lag"? If so, how? If not, of what use is the
: function "lag"? I get the same answer from y~x as y~lag(x), whether
: using lm or arima. I found it using y~c(NA, x[-l
Spencer,
You may want to peruse the list archive for posts that match 'ts' and are
written by Brian Ripley -- these issues have come up before.
The ts class is designed for arima and friends (like Kalman filtering), and
very useful in that context, but possibly not so much anywhere else. lag()
Is it possible to fit a lagged regression, "y[t]=b0+b1*x[t-1]+e",
using the function "lag"? If so, how? If not, of what use is the
function "lag"? I get the same answer from y~x as y~lag(x), whether
using lm or arima. I found it using y~c(NA, x[-length(x)])). Consider
the following: