[R} seasonal differencing
Hi,
-----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Joseph Magagnoli Sent: Thursday, April 02, 2009 5:36 PM To: r-help at r-project.org Subject: [R] [R} seasonal differencing Hi all, I was wondering how to construct a seasonal differenced time series variable. I used the following code to construct a 12 span seasonal difference seasonal<-diff(V2, lag=12, differences=1) is this correct? thank you in advance joe
I think this is fine. Just playing around (see below), I obtained what I would expect. :-)
V2 <- rep(x=1:12, times=5) seasonal <- diff(V2, lag=12, differences=1) V2
[1] 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 [26] 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 [51] 3 4 5 6 7 8 9 10 11 12
seasonal
[1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [39] 0 0 0 0 0 0 0 0 0 0
Hope this helps, Roland ---------- This mail has been sent through the MPI for Demographic Research. Should you receive a mail that is apparently from a MPI user without this text displayed, then the address has most likely been faked. If you are uncertain about the validity of this message, please check the mail header or ask your system administrator for assistance.