[R] Time Series smoothing

Giovanni Petris GPetris at uark.edu
Fri Aug 7 19:41:54 CEST 2009


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

> HoltWinters(x, gamma = 0)

Best,
Giovanni

> Date: Thu, 06 Aug 2009 15:06:26 -0700 (PDT)
> From: voidobscura <nshah171 at gmail.com>
> Sender: r-help-bounces at r-project.org
> Precedence: list
> 
> 
> 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).  
> 
> > HoltWinters(x)
> 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:
> > 
> > 
> > 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
> > 
> >> Date: Thu, 06 Aug 2009 11:33:58 -0700 (PDT)
> >> From: voidobscura <nshah171 at gmail.com>
> >> Sender: r-help-bounces at r-project.org
> >> Precedence: list
> >> 
> >> 
> >> 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.  
> >> 
> >> > A <- as.ts(read.table(choose.files()))
> >> > x <- as.ts(A[,10])
> >> > plot(x)
> >> > > plot(smooth(x))
> >> 
> >> plot(smooth(x)) looks exactly like plot(x).  Also,
> >> 
> >> > StructTS(x)
> >> 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.
> >> -- 
> >> View this message in context:
> >> http://www.nabble.com/Time-Series-smoothing-tp24852054p24852054.html
> >> Sent from the R help mailing list archive at Nabble.com.
> >> 
> >> ______________________________________________
> >> R-help at r-project.org mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide
> >> http://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >> 
> >>
> > 
> > ______________________________________________
> > R-help at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> > 
> > 
> 
> -- 
> View this message in context: http://www.nabble.com/Time-Series-smoothing-tp24852054p24855346.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
>




More information about the R-help mailing list