how to lag a variable?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

how to lag a variable?

jimjohn
for example, i have one variable that is a date, it contains all dates from January 2004 till May 2008. then i have another variable that has a rate for each date. then i have a third variable that has another rate for each date, but it only starts from June 2005. i ran a correlation on these two variables (only including the cases for which i had both rates). i think that there is a lag effect, that my third variable needs to be lagged 1,2,or 3 months behind for it to be really highly correlated with my second variable. Is there any way I can change my third variable like this so that every rate goes up so many rows? Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: how to lag a variable?

Richard Ristow
At 05:42 PM 6/26/2008, jimjohn wrote:

>i have one variable that is a date, another variable that has a rate
>for each date, then i have a third variable that has another rate
>for each date. i ran a correlation on these two variables i think
>that there is a lag effect, that my third variable needs to be
>lagged 1,2,or 3 months behind for it to be really highly correlated
>with my second variable.

What's the matter with
COMPUTE Third.1 = LAG(Third,1).
COMPUTE Third.2 = LAG(Third,2).
COMPUTE Third.3 = LAG(Third,3).

Lag(x,1) and LAG(x,2) are available under Miscellaneous functions in
the Compute Variable dialog under menu Transform.

And all this is available in SPSS documentation, which may be why you
haven't heard back before.




>  Is there any way I can change my third variable like this so that
> every rate goes up so many rows? Thanks!
>--
>View this message in context:
>http://www.nabble.com/how-to-lag-a-variable--tp18143745p18143745.html
>Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
>=====================
>To manage your subscription to SPSSX-L, send a message to
>[hidden email] (not to SPSSX-L), with no body text except the
>command. To leave the list, send the command
>SIGNOFF SPSSX-L
>For a list of commands to manage subscriptions, send the command
>INFO REFCARD
>
>
>
>--
>No virus found in this incoming message.
>Checked by AVG.
>Version: 7.5.524 / Virus Database: 270.4.1/1521 - Release Date:
>6/26/2008 11:20 AM

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD