Skip to content

lags in regressions

2 messages · Tobias Muhlhofer, Brian Ripley

#
Hi!

I am trying to get R to run regressions for me of a variable on lagged 
differences of itself.

Specifically:

x-x(-1) = a + b1(x(-1)-rx(-2))+b2(x(-4)-rx(-5))+e

I need to do this a lot of times, altering the value of r.

What I've been trying to do was to use the lag() command to create 
lagged versions of these variables and then constructing these 
differences by hand (i.e. creating new variables containing these 
differences).

When I put all of those into the lm() command I get a singularity 
problem: it seems that R is unlagging the time series as it constructs 
the object matrix, instead of simply truncating away observations that 
don't exist for all the series due to the "pushing over" that is 
happening in the lagging.

What do I do? Do I need to truncate these by hand and if yes how? Or is 
there a different way?

Thanks,
	TM
#
You need to do tsunion (or something like it) on the time series.  lm()  
does not know about time series and you are merely supplying vectors as
far as it is concerned.
On Fri, 23 Jan 2004, Tobias M?hlhofer wrote: