From ripley at stats.ox.ac.uk  Fri May 16 12:50:48 2008
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Fri, 16 May 2008 11:50:48 +0100 (BST)
Subject: [Rd] HoltWinters fitted level parameter not bounded between 0
 and 1 (PR#11469)
In-Reply-To: <20080516004504.3CAEB2834170@mail.pubhealth.ku.dk>
References: <20080516004504.3CAEB2834170@mail.pubhealth.ku.dk>
Message-ID: <alpine.LFD.1.10.0805161143340.27836@gannet.stats.ox.ac.uk>

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
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



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