0

I have a problem here. I have imported my data set into R studio. When I wanted to do STL decomposition, the error that came out is "only univariate series are allowed". How I can overcome this problem?

This is my code to convert my data into a time series data.

data<-ts(TS,start=c(1970,1),end=c(1980,12),frequency=12)

   Jan    Feb    Mar    Apr    May    Jun    Jul    Aug    Sep

1970 324.60 325.57 326.55 327.80 327.80 327.54 326.28 324.63 323.12 1971 326.12 326.61 327.16 327.92 329.14 328.80 327.52 325.62 323.61 1972 326.93 327.83 327.95 329.91 330.22 329.25 328.11 326.39 324.97 1973 328.73 329.69 330.47 331.69 332.65 332.24 331.03 329.36 327.60 1974 329.45 330.89 331.63 332.85 333.28 332.47 331.34 329.53 327.57 1975 330.45 330.97 331.64 332.87 333.61 333.55 331.90 330.05 328.58 1976 331.63 332.46 333.36 334.45 334.82 334.32 333.05 330.87 329.24 1977 332.81 333.23 334.55 335.82 336.44 335.99 334.65 332.41 331.32 1978 334.66 335.07 336.33 337.39 337.65 337.57 336.25 334.39 332.44 1979 335.89 336.44 337.63 338.54 339.06 338.95 337.41 335.71 333.68 1980 337.81 338.16 339.88 340.57 341.19 340.87 339.25 337.19 335.49 Oct Nov Dec 1970 323.11 323.99 325.09 1971 323.80 325.10 326.25 1972 325.32 326.54 327.71 1973 327.29 328.28 328.79 1974 327.57 328.53 329.69 1975 328.31 329.41 330.63 1976 328.87 330.18 331.50 1977 330.73 332.05 333.53 1978 332.25 333.59 334.76 1979 333.69 335.05 336.53 1980 336.63 337.74 338.36

When I ran a STL decomposition with this code:

decomp<-stl(data,s.window="periodic")

This error came out:

Error in stl(data, s.window = "periodic") : only univariate series are allowed

Damien90
  • 1
  • 1
  • 3
    Please provide a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input data and the code you ran that generated the error. – MrFlick Dec 06 '14 at 03:48
  • Yes. Code... we need code. Voting to close as unclear in its current form. You should edit to include an example and what you have done so far. – IRTFM Dec 06 '14 at 05:49
  • @MrFlick i have edited my questions to include the commands – Damien90 Dec 06 '14 at 14:12
  • 2
    ... but still no data :( We have no idea what `TS` looks like. Post `dput(TS)`, or if that's too long `dput(head(TS))`. – Gregor Thomas Dec 06 '14 at 17:55
  • @Gregor i have put in my data. Sorry for the mess. – Damien90 Dec 07 '14 at 02:42
  • Turns out, i just need to edit my code into this: data<-ts(TS[[1]],start=c(1970,1),end=c(1980,12),frequency=12) Now, I can run STL decomposition on my data. Thanks guys! – Damien90 Dec 07 '14 at 06:58

0 Answers0