[Rd] HoltWinters fitted level parameter not bounded between 0 and 1 (PR#11469)

David Meyer david.meyer at wu-wien.ac.at
Fri May 16 13:20:17 CEST 2008


I get John's value (48.8789) in 2.7.0 and R-devel (both on Ubuntu). 
Really seems to be a numeric issue:

 > HoltWinters(x, beta = 0, gamma = 0)$alpha
    alpha
48.87989

 > HoltWinters(x * 1.0000000001, beta = 0, gamma = 0)$alpha
     alpha
0.6881547

 > HoltWinters(x * 1.00000000001, beta = 0, gamma = 0)$alpha
    alpha
48.87989

Providing starting values seems to help, but not always:

 > HoltWinters(x, beta = 0, gamma = 0, l.start = 0.00001)$alpha
    alpha
48.88999
 > HoltWinters(x, beta = 0, gamma = 0, l.start = 0.0001)$alpha
     alpha
0.6880582

Yes, it's easy to use optimize() instead of optim() in the univariate 
cases, will do.

David.

Prof Brian Ripley wrote:
> It doesn't do it on my system (I get a value of about 0.688 in R 2.7.0 
> patched on Linux), and 2.5.1 is not current.  Does a better starting 
> value help?
> 
> However, HoltWinters is using optim() in a case it is not designed for 
> (one-dimensional optimization): see the note on its help page.  I think 
> this could easily be changed, but as HoltWinters is contributed code I 
> am Cc:ing the author for comment.
> 
> On Fri, 16 May 2008, john.bodley at gmail.com wrote:
> 
>> Full_Name: John Bodley
>> Version: 2.5.1 (2007-06-27)
>> OS: Windows XP
>> Submission from: (NULL) (12.144.182.66)
>>
>>
>> I was fitting a number of time series in R using the 
>> stats::HoltWinters method
>> to define a single exponential smoothing model, i.e., beta = gamma = 0.
>>
>> I came across an example where the fitted value of alpha was not 
>> defined in the
>> [0, 1] interval which seems to violate the lower and upper bound 
>> constraints
>> used for the optim method. On my computer the following code returns a 
>> value of
>> 48.87989.
>>
>> R code:
>>
>> x <- c(
>> 0,
>> 0.000843170320404722,
>> 0,
>> 0,
>> 0,
>> 0.0103773584905660,
>> 0.00832466181061394,
>> 0.0038560411311054,
>> 0,
>> 0,
>> 0.00484966052376334,
>> 0,
>> 0,
>> 0,
>> 0.00274348422496571,
>> 0,
>> 0,
>> 0,
>> 0,
>> 0,
>> 0.0207064555420219,
>> 0.0334975369458128,
>> 0.0334975369458128,
>> 0.00338983050847458,
>> 0.00483675937122128,
>> 0,
>> 0,
>> 0.00224971878515186,
>> 0,
>> 0,
>> 0,
>> 0.00135685210312076,
>> 0,
>> 0,
>> 0,
>> 0.0035377358490566,
>> 0.0035377358490566,
>> 0.00501002004008016,
>> 0.0107632093933464,
>> 0,
>> 0,
>> 0.0143329658213892,
>> 0.0330459770114943,
>> 0,
>> 0,
>> 0,
>> 0,
>> 0.0109890109890110,
>> 0,
>> 0.00118623962040332,
>> 0.007380073800738,
>> 0.00695410292072323,
>> 0.0104895104895105,
>> 0.00278551532033426,
>> 0.00278551532033426
>> );
>>
>> # Single exponential smoothing
>> m <- stats::HoltWinters(x, beta = 0, gamma = 0);
>> m$alpha
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
> 

-- 
Dr. David Meyer
Department of Information Systems and Operations

Vienna University of Economics and Business Administration
Augasse 2-6, A-1090 Wien, Austria, Europe
Tel: +43-1-313 36 4393
Fax: +43-1-313 36 90 4393
HP:  http://wi.wu-wien.ac.at/~meyer/



More information about the R-devel mailing list