[R] Confused: Looping in dataframes

From: phani kishan <phanikishan_at_gmail.com>
Date: Fri, 25 Jun 2010 13:32:27 +0530


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")) }
}

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

-- 
A. Phani Kishan
3rd Year B.Tech
Dept. of Computer Science & Engineering
IIT MADRAS
Ph: +919962363545

	[[alternative HTML version deleted]]

______________________________________________
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.
Received on Fri 25 Jun 2010 - 08:05:14 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 25 Jun 2010 - 08:40:35 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive