gpt4 book ai didi

r - ARIMA 拟合值

转载 作者:行者123 更新时间:2023-12-03 23:37:11 30 4
gpt4 key购买 nike

您好,我想知道是否可以仅提取 ARIMA 模型的值?每当我只查找它创建的一组值时,我都无法在它创建的列表中找到它们。我看到残差、系数等,但值在哪里。我知道我可能会误解 ARIMA 在 R 中所做的事情,所以如果是这种情况,有人可以解释一下,谢谢。

R 中的航空旅客数据有效,我创建了一个 ARIMA(0,1,1,0,1,1) 模型。

Airpassengers
arima(AirPassengers, order = c(0,1,1), seasonal = c(0,1,1))

最佳答案

您可以使用 forecast 库中的 fitted

fit <- arima(AirPassengers, order = c(0,1,1), seasonal = c(0,1,1));

library(forecast);
fitted(fit);
Jan Feb Mar Apr May Jun Jul Aug
1949 111.9353 117.9664 131.9662 128.9774 120.9892 134.9782 147.9692 147.9731
1950 115.4270 121.2503 138.6147 137.2487 127.6823 139.8852 159.2323 166.6764
1951 134.1263 152.1283 165.5518 168.4758 154.9039 189.6596 201.7493 199.8486
1952 171.3468 176.6946 205.5717 182.8817 188.5624 192.5367 231.0488 230.3238
1953 198.7185 205.4725 213.3843 216.8044 231.9187 261.9805 261.8160 274.0365
1954 205.0068 205.2384 230.5769 231.4297 223.2844 246.6350 278.7757 303.1225
1955 230.2247 224.1841 276.2318 262.4723 272.6868 299.3189 346.2402 351.3759
1956 286.4063 275.1861 311.7244 316.3640 315.5436 360.4678 417.4348 398.4281
1957 314.3600 307.5277 342.5083 348.3719 352.7393 408.9296 457.8908 453.9524
1958 347.1516 328.9301 374.7077 358.4100 357.9580 427.1143 475.2355 486.9678
1959 343.6155 333.8798 384.4964 386.0595 407.0446 487.3209 531.2969 555.4295
1960 421.1932 399.9652 455.7262 419.9815 471.2763 525.8525 605.8736 628.1925
Sep Oct Nov Dec
1949 135.9874 119.0049 104.0187 118.0778
1950 156.9741 140.6376 120.3347 130.0241
1951 187.2618 160.8567 143.0722 169.8213
1952 223.7181 191.3121 174.8197 193.3780
1953 241.5973 219.9645 195.0597 206.4882
1954 261.5510 234.5981 201.0488 223.4879
1955 314.2891 283.2235 250.4517 266.6247
1956 368.0723 321.9502 275.0628 311.5857
1957 414.5951 359.5507 315.7816 343.7934
1958 438.0051 358.4936 317.5859 343.8214
1959 461.1497 416.2466 361.6861 389.3844
1960 516.7699 455.7619 414.0427 438.7539

或者由于 arima 返回对象包含残差,您可以轻松地将拟合值直接计算为

AirPassengers - fit$residual

给出相同的结果。

关于r - ARIMA 拟合值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50033720/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com