Jonathan-

First, consider starting the algorithm at this alternative solution.  You
do this with  the optim.start option.

HoltWinters( .... , optim.start = c(alpha = 0.99, beta = 0.001, gamma =
0.001))

If this solution is indeed better, the function should not converge to the
old solution.  If it does converge to the old solution, it indicates that
the implementation may be different in the two software options.

Second, you can modify the function to your heart's content.  (Depending on
your comfort level with R, this may not be the best option.)  If you type
HoltWinters into the console and hit enter, you'll see the internal
workings of the function.  You'll see where the different optimization
functions come into play.  If you want to use a different optimization
method, copy the code, modify it, and call it MyHoltWinters.

-tgs


On Wed, Nov 28, 2012 at 3:42 PM, Jonathan Seaver <seave...@gmail.com> wrote:

> Hello all,
>
> I am looking for some help in understanding how to change the way R
> optimizes the smoothing constant selection process for the HoltWinters
> function.
>
> I'm a SAS veteran but very new to R and still learning my way around.
>
> Here is some sample data and the current HoltWinters code I'm using:
>
> rawdata <- c(294, 316, 427, 487, 441, 395, 473, 423, 389, 422, 458, 411,
> 433, 454, 551, 623, 552, 520, 553, 510, 565, 547, 529, 526, 550, 577, 588,
> 606, 595, 622, 603, 672, 733, 793, 890, 830)
> timeseries_01 <- ts(rawdata, frequency=12, start=c(2009,1))
> plot.ts(timeseries_01)
>
> m <- HoltWinters(timeseries_01, alpha = NULL, beta = NULL, gamma = TRUE,
>             seasonal = c("multiplicative"),
>             start.periods = 2, l.start = NULL, b.start = NULL, s.start =
> NULL)
> p <- predict(m, 24, prediction.interval = TRUE)
> plot(m, p)
>
>
> My problem is that I disagree with how R is choosing these smoothing
> constants and I would like to explore how some of the other methodologies
> listed in the OPTIM function [such as Nelder-Mead, BFGS, CG, L-BFGS-B,
> SANN, and Brent], but it is unclear to me how I would go about doing this.
>
> For example, the above code results in the following constants:
>
> alpha:  0.7952587
> beta :  0.01382988
> gamma:  1
>
>
> However, using alternate software, I find that...
>
>  alpha:  0.990
>  beta :  0.001
>  gamma:  0.001
>
>
> ...actually fit this series much better, thus I would like to see if I can
> adjust R to reproduce this method of optimizing the three smoothing
> constants.
>
> Can anyone help?
>
> Thank you,
> Jonathan
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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.
>
>
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to