r - “x”是一个列表,但没有组件“x”和“y”(预测)
问题描述
我正在尝试计算和绘制该系列未来 2 年的下一个预测。
这是我的代码
library(astsa)
data(jj)
Amodel=arima(log(jj),order=c(0,1,1),seasonal=list(order=c(0,1,1),period=4))
plot(Amodel,n1=c(1978,1),n.ahead=8,pch=19,ylab='Log(Earnings)')
但 Rstudio 表明Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' is a list, but does not have components 'x' and 'y'
解决办法是什么?
解决方案
arima
返回包含模型输出的列表。您可以使用操作符(即)查看列表的这些元素names()
并访问模型的各个部分。您将需要决定要绘制模型的哪一部分,因为该函数将期望与提供的输入不同的输入。此外,并且不是参数。$
Amodel$arma
plot()
arima
n.ahead
n1
plot()
library(astsa)
data(jj)
Amodel <- arima(log(jj),order=c(0,1,1),seasonal=list(order=c(0,1,1),period=4))
names(Amodel) #see parts of the model
plot(Amodel$arma,pch=19,ylab='Log(Earnings)') #plot example - change as you wish
推荐阅读
- c++ - 使用数据练习:日、月、年
- php - ldap_add():服务器不愿意执行——使用PHP向AD中插入记录
- android - 使用 Kotlin 在 Android 10 上对标记进行聚类
- mysql - 是否可以选择从 Hive 中的哪个数据库中选择
- php - 从 Google Cloud 的免费层升级后,Wordpress 网站停止工作
- python - 根据 2 个(或更多列值)查找下一个相关行
- include - 我正在尝试包括
在我的 Redhat Enterprise linux 服务器上的源代码中,需要安装它 - flutter - Flutter:如何在 Flutter 中向 http 包添加标头
- c - 计算子进程的问题
- c - 如何在 Linux 中解码系统调用的输入标志?