R计算auto.arima()确认Arma.sim()为真的次数 [英] R Count How Many Time `auto.arima()` Confirm`arima.sim()` to be True
问题描述
通常我会使用 arima.sim()
函数来模拟 ARIMA
模型,然后再通过 auto.arima()
函数进行发现 ARIMA
模型与我在 arima.sim()
函数中指定的模型不同.
我进一步研究了如何通过模拟相同的 我该如何放置一个 在 十(10)次 如果我们需要在 或者如果它基于结果",则与向量进行比较,获得 Often times I make use of I went further to investigate to know how does the How do I put up an ten(10) times in a If we need to get the
Or if it is based on the 'result', then do a comparison with the vector, get the
这篇关于R计算auto.arima()确认Arma.sim()为真的次数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! ARIMA
模型来了解 arima.sim()
在模拟 ARIMA
模型方面如何公平相同的 arima.sim()
详细说明了很多次,然后使用 auto.arima()
%auto.arima()%&%;%arimaorder()}结果#p d q#1 0 1#1 0 0#1 0 0#1 0 0#2 0 1#1 0 0#1 0 0#1 0 0#1 0 0#4 0 3 R
代码,该代码将计算多少我运行时出现 ARIMA(1、0、0)
次
num< -60for(1:10中的i){ar1<-arima.sim(n = num,model = list(ar = 0.8,order = c(1,0,0)))auto.arima(ar1)}
循环
for
循环中获取 count
,
cnt<-0for(我在1:10中){ar1<-arima.sim(n = num,model = list(ar = 0.8,order = c(1,0,0)))ar2<-auto.arima(ar1)if(all(arimaorder(ar2)== c(1,0,0)))cnt<-cnt + 1}碳纳米管#[1] 3
rowSums
,并检查单行中是否有3个TRUE,以及 sum
sum(rowSums(result == c(1,0,0)[col(result)])== 3)
arima.sim()
function to simulate ARIMA
model and later discover through auto.arima()
function that the ARIMA
model simulated is not the same with what I specified in arima.sim()
function.arima.sim()
fair in simulating ARIMA
model by simulating same ARIMA
model with the same arima.sim()
detail good number of times and then check each out with auto.arima()
here.result <- matrix(NA_integer_, nrow = 10, ncol = 3)
colnames(result) <- c("p","d","q")
num<-60
set.seed(1234)
for(i in 1:10){
result[i, ] <- arima.sim(n = num, model=list(ar=0.8, order = c(1, 0, 0))) %>%
auto.arima() %>%
arimaorder()
}
result
#p d q
#1 0 1
#1 0 0
#1 0 0
#1 0 0
#2 0 1
#1 0 0
#1 0 0
#1 0 0
#1 0 0
#4 0 3
R
code that will count how many
times ARIMA(1, 0, 0)
comes up when I runnum<-60
for(i in 1:10){
ar1 <- arima.sim(n = num, model=list(ar=0.8, order = c(1, 0, 0)))
auto.arima(ar1)
}
loop
count
within the for
loopcnt <- 0
for(i in 1:10) {
ar1 <- arima.sim(n = num, model=list(ar=0.8, order = c(1, 0, 0)))
ar2 <- auto.arima(ar1)
if(all(arimaorder(ar2) == c(1, 0, 0))) cnt <- cnt + 1}
cnt
#[1] 3
rowSums
, and check if we have 3 TRUE in a single row, and sum
sum(rowSums(result == c(1, 0, 0)[col(result)]) == 3)