[R] (no subject)
Upananda Pani
up@n@nd@@p@n| @end|ng |rom gm@||@com
Mon Jan 16 21:55:22 CET 2023
Dear Members,
Greetings! I would like to know how to create the lag variable for my data.
# Load data and create time series object ----
oil <- read_xlsx("crudefinal.xlsx")
pricet=ts(oil$price, start = c(2020, 22), frequency = 365)
roilt=ts(diff(log(oil$price))*100,start=c(2020,22),freq=365)
# Fit MSW model ----
roilt.lag0 = window(roilt,start=c(2020,23),end=c(2021,215),freq=365) # get
al the lags right
roilt.lag1 = window(roilt,start=c(2020,22),end=c(2021,214),freq=365)
roilt.lag2 = window(roilt,start=c(2020,20),end=c(2021,213),freq=365)
roilt.lag3 = window(roilt,start=c(2020,20),end=c(2021,212),freq=365)
roilt.lag4 = window(roilt,start=c(2020,19),end=c(2021,211),freq=365)
I am getting error (length is not matching), while creating lag. I will
grateful to you if you can tell me where I am making mistakes.
Regards,
Upananda Pani
[[alternative HTML version deleted]]
More information about the R-help
mailing list