Skip to content

Time Series smoothing

4 messages · voidobscura, Giovanni Petris

#
I have a set of data (in a matrix).  I spliced a column out and parsed it
as.ts (time series).  I then plotted the time series but I found that it was
very noisy.  I wanted to smooth it out.  However, I am having some problems
smoothing and plotting the smoothed version.
plot(smooth(x)) looks exactly like plot(x).  Also,
Error in optim(init[mask], getLike, method = "L-BFGS-B", lower = rep(0,  :
 L-BFGS-B needs finite values of 'fn'

The HoltWinters smoothing or the Kalman smoothing don't work either for
various errors... I'm not quite sure what's wrong.

Thanks.
#
Please do read the posting guides and give us a reproducible
example. We don't know what the errors you get from HoltWinters
are. I guess we need to see the data you are using etc.

Giovanni Petris
#
Hello,

[5956] 10242.793600 10233.872700 10229.265400 10230.835200 10230.715500
[5961] 10233.706500 10231.821200 10235.511800 10232.515900 10240.365800
[5966] 10244.216100 10252.208800 10249.710600 10249.591500 10258.640800
[5971] 10263.172300 10263.327800 10271.161200 10268.512200 10268.465800
[5976] 10272.819000 10273.321700 10278.570500 10265.448300 10278.325400
[5981] 10274.210000 10281.323700 10274.569600 10276.431600 10279.039900
[5986] 10279.232600 10276.020600 10271.650200 10267.213500 10262.682000
[5991] 10261.586500 10253.623600 10243.466400 10245.071800 10242.889200
[5996] 10241.417900 10240.785600 10234.565600 10236.755200 10229.893600
[6001] 10225.274200

There is a sample from the dataset (which happens to be quite large, a
subset of energy release values from fusion reactions).
Error in decompose(ts(x[1L:wind], start = start(x), frequency = f),
seasonal) : 
  time series has no or less than 2 periods

Thanks.
Giovanni Petris wrote:

  
    
#
My guess is that your data, 'x', has frequency 1, or is not a ts
object altogether. In both cases there is no meaningful way of
extracting a sesonal component from the data. However, as you can see
in the help page, HoltWinters has an argument 'gamma' that, when given
the value 0, allows to fit non-seasonal models. Cross your finger and
try
Best,
Giovanni