I have been trying to do some basic analysis on some timeseries data. However, I keep getting this error on anything I am trying to do
Error in decompose(data_ts, type = c("additive")) :
time series has no or less than 2 periods
I assume the problem is that I am not setting the data correctly for time series analysis. I am working with data that runs M-F for about a year. Below is the code that I am using to convert the series to time series
train=xts(data$x,as.Date(data$Date,format='%m/%d/%Y'),frequency=365)
data_ts=as.ts(train)
attributes(data_ts)
$tsp
[1] 1 277 1
$class
[1] "ts"
But when I try to do any type of analysis on the time series data, I receive this:
dcomp=decompose(data_ts,type=c('additive'))
Error in decompose(data_ts, type = c("additive")) :
time series has no or less than 2 periods
Am I setting up the time series incorrectly? Is there a better period that I should pick for frequency because technically I don't have a full year worth of data?
Thank you!