On 06/25/2010 10:02 AM, phani kishan wrote:> Hey,
> I have a data frame x which consists of say 10 vectors. I essentially want
> to find out the best fit exponential smoothing for each of the vectors.
>
> The problem while I'm getting results when i say
>
>> lapply(x,ets)
>>
> I am getting an error when I say
>
>>> myprint
>>>
> function(x)
> {
> for(i in 1:length(x))
> {
> ets(x[i],model="AZZ",opt.crit=c("amse"))
>
Hi,
Please provide a reproducible example, as stated in the posting guide.
My guess is that replacing x[i] by x[[i]] would solve the problem.
Double brackets return a vector in stead of a data.frame that has just
column i.
cheers,
Paul> }
> }
>
> The error message is that* "Error in ets(x[i], model =
"AZZ", opt.crit > c("amse")) :
> y should be a univariate time series"*
>
> Could someone please explain why this is happening? I also want to be able
> to extract data like coef's, errors (MAPE,MSE etc.)
>
> Thanks and regards,
> Phani
>
--
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone: +3130 253 5773
http://intamap.geo.uu.nl/~paul
http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770