R中的ets()错误

时间:2011-02-24 09:32:03

标签: r time-series

我有一个时间系列,当我申请时,我得到一个错误,我不知道在哪里生成。我的时间表不是那么大,也没有那么大的价值观。

你发现有什么不对吗?

> 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
> 

感谢。

使用追溯更新:

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)

1 个答案:

答案 0 :(得分:0)

我的 ts 变量似乎是错误的格式。

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

使用as.numeric进行投射后,它可以正常工作。