我想从使用auto.arima
创建的几个模型中提取AR系数。问题是我想得到AR系数的总和,但没有截距/均值。
bsp_ts <- ts(c(1,2,1,2,3,2,3,2,4,3,4,3,4,5,4,3,5,6,5,4,5,6,7,6))
bsp_auto <- auto.arima(bsp_ts, max.p = 12, max.q = 0, seasonal = FALSE, d=0)
summary(bsp_auto)
sum(coef(bsp_auto))
如何只访问AR系数?我知道系数保存在auto.arima
的列表中,因此我认为解决方案是使用相应的“列表语言”访问系数,但我仍然没有列表的经验。有人可以帮忙吗? :)提前感谢...
编辑:多个模型
bsp1_ts <- ts(c(1,2,1,2,3,2,3,2,4,3,4,3,4,5,4,3,5,6,5,4,5,6,7,6))
bsp2_ts <- ts(c(1,2,1,2,3,2,3,2,4,3,4,3,4,5,4,3,5,6,5,4,5,6,7,6))
bsp3_ts <- ts(c(1,2,1,2,3,2,3,2,4,3,4,3,4,5,4,3,5,6,5,4,5,6,7,6))
bsp_ts <- list(bsp1_ts, bsp2_ts, bsp3_ts)
bsp_auto <- lapply(bsp_ts, function(x) auto.arima(x, max.p = 12, max.q = 0, seasonal = FALSE, d=0))
多个模型的系数提取,如下所示:
ARcoef_li <- lapply(ARpers_li, function(x) sum(ARpers_li$x$coef)
答案 0 :(得分:0)
单一模式
my_coefficients = bsp_auto$coef
my_coefficients[!names(my_coefficients) == 'intercept']
你可以这样做:
bsp_auto$
请注意,当您键入bsp_auto$coef
时,RStudio会为您提供有关从模型中提取的可用对象的建议。这些信息可能会在将来帮助您完成类似任务。 ar1 intercept
0.7877316 3.6909753
返回一个命名向量:
intercept
所以我的答案中的第二行用于从我们的向量中“放弃”bsp1_ts <- ts(c(1,2,1,2,3,2,3,2,4,3,4,3,4,5,4,3,5,6,5,4,5,6,7,6))
bsp2_ts <- ts(c(1,2,1,2,3,2,3,2,4,3,4,3,4,5,4,3,5,6,5,4,5,6,7,6))
bsp3_ts <- ts(c(1,2,1,2,3,2,3,2,4,3,4,3,4,5,4,3,5,6,5,4,5,6,7,6))
bsp_ts <- list(bsp1_ts, bsp2_ts, bsp3_ts)
bsp_auto <- lapply(bsp_ts, function(x) auto.arima(x, max.p = 12, max.q = 0, seasonal = FALSE, d=0))
lapply(bsp_auto,function(x){ x$coef[!names(x$coef)=='intercept']} )
。
希望这有帮助!
多个模型
Set RegExp = CreateObject("VBScript.RegExp")
RegExp.IgnoreCase = True
RegExp.Global = True
RegExp.Pattern = "address=/(.*)/([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})"
File.ResponseBody = RegExp.Replace(File.ResponseBody, "local-zone: \""$1\"" redirect $1" & ret & ">local-data: \""$1 3600 IN A $2\""")
Set RegExp = Nothing