我有一个ets对象(使用ets()
函数from预测获得)并想要绘制它。
fit <- ets (myTimeSeries) # myTimeSeries obtained via ts()
plot (fit) # works fine
plot (fit, main="my title") # fails with error
错误是:
Error in plotts(x = x, y = y, plot.type = plot.type, xy.labels = xy.labels, :
formal argument "main" matched by multiple actual arguments
我不明白我需要做什么,该属性会显示在帮助中。
我加载的包(如果有关于调用哪个plot()实现的冲突):
> sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] lattice_0.20-29 forecast_5.4 timeDate_3010.98 zoo_1.7-11 ggplot2_0.9.3.1
loaded via a namespace (and not attached):
[1] colorspace_1.2-4 digest_0.6.4 fracdiff_1.4-2 grid_3.1.0 gtable_0.1.2
[6] labeling_0.2 MASS_7.3-31 munsell_0.4.2 nnet_7.3-8 parallel_3.1.0
[11] plyr_1.8.1 proto_0.3-10 quadprog_1.5-5 Rcpp_0.11.1 reshape2_1.4
[16] scales_0.2.4 stringr_0.6.2 tools_3.1.0 tseries_0.10-32
答案 0 :(得分:1)
如果您确实想要在问题中指定的拟合函数的绘图中添加标题(使用USAccDeaths数据进行测试),这里有一个可行的选项:
> plot.ts(cbind(observed = myTimeSeries, level = fit$states[, 1], season = fit$states[, "s1"]), main = "New Title")