开发者

ets() error in R

I have a time serie and when applying ets I get an error which I dont know where is generated. My timeserie is not as big or has no such big values.

Do you spot anything wrong?

> ts
       Jan   Feb   Mar   Apr   May   Jun   Jul   Aug   Sep   Oct   Nov   Dec
2005    开发者_运维知识库   22.84 21.58 21.93 25.25 28.69 30.63 34.47 28.72 36.49 34.77 40.65
2006 36.73 31.55 38.07 34.77 36.91 39.16 36.07 35.37 39.34 35.62 27.58 33.37
2007 37.11 33.32 34.09 34.64 21.05 41.60 36.52 37.63 42.66 38.17 39.26 39.95
2008 35.33 38.63 38.04 36.90 33.56 35.14 33.82 36.18 29.30 25.65 20.71 21.63
2009 17.12 19.02 22.48 24.42 16.94 19.75 24.56 22.55 16.68 17.86 20.83 18.41
2010 14.74 16.49 19.75 22.88 24.11 27.02 27.46 26.47 26.81 26.59 23.56 18.88

> fit = ets (ts)
Error in `-.default`(y, e$e) : non-numeric argument to binary operator
In addition: Warning message:
In ets(ts) :
  Very large numbers which may cause numerical problems. Try scaling the data first
> 

Thanks.

Update with a traceback:

Traceback:
7: NextMethod(.Generic)
6: Ops.ts(y, e$e)
5: etsmodel(y, errortype[i], trendtype[j], seasontype[k], damped[l], 
       alpha, beta, gamma, phi, lower = lower, upper = upper, opt.crit = opt.crit, 
       nmse = nmse, bounds = bounds)
4: ets(ts)
3: eval(expr, envir, enclos)
2: eval(i, envir)
1: sys.source(file = "1.R", envir = .rAenv)


It appears that my ts variable was a wrong format.

mode(ts) // should be "numerical" not "character"

After casting it with as.numeric it worked.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜