Avoiding seasonality assumption for stl() or decompose() in R
Posted
by user303922
on Stack Overflow
See other posts from Stack Overflow
or by user303922
Published on 2010-03-29T04:06:31Z
Indexed on
2010/03/29
4:13 UTC
Read the original article
Hit count: 248
r
Hello everybody, I have high frequency commodity price data that I need to analyze. My objective is to not assume any seasonal component and just identify a trend. Here is where I run into problems with R. There are two main functions that I know of to analyze this time series: decompose() and stl(). The problem is that they both take a ts object type with a frequency parameter greater than or equal to 2. Is there some way I can assume a frequency of 1 per unit time and still analyze this time series using R? I'm afraid that if I assume frequency greater than 1 per unit time, and seasonality is calculated using the frequency parameter, then my forecasts are going to depend on that assumption.
names(crude.data)=c('Date','Time','Price')
names(crude.data)
freq = 2
win.graph()
plot(crude.data$Time,crude.data$Price, type="l")
crude.data$Price = ts(crude.data$Price,frequency=freq)
I want frequency to be 1 per unit time but then decompose() and stl() don't work!
dim(crude.data$Price)
decom = decompose(crude.data$Price)
win.graph()
plot(decom$random[2:200],type="line")
acf(decom$random[freq:length(decom$random-freq)])
Thank you.
© Stack Overflow or respective owner