Displaying 1 result from an estimated 1 matches for "ts_logprice".
2007 Mar 18
2
Lag operator in R does not work
...t makes the lag operator does not work for my time series. I have a time series of length about 200000 elements. I would like to have a lag 1 of this time series. I did the following:
logprice = log(price, base=exp(1))
# this is my log price which is a vector of price time series of length 200000
ts_logprice = as.ts(logprice, frequency=1) # convert to time series
lag_logprice = lag(ts_logprice, 1) # get the lag
When I do:
ts_logprice[1:10] == lag_logprice[1:10]
The result returns TRUE for the first 10 elements which I do not expect that.
Is there any reason to this? I'd appreciate if you could...