R 从具有多个统计测试结果列表的列表中提取statiscal值
我在r中做了一个Ljung-Box独立性测试,有36个滞后,并将结果存储在一个列表中R 从具有多个统计测试结果列表的列表中提取statiscal值,r,statistics,time-series,normal-distribution,stat,R,Statistics,Time Series,Normal Distribution,Stat,我在r中做了一个Ljung-Box独立性测试,有36个滞后,并将结果存储在一个列表中 for (lag in c(1:36)){ box.test.list[[lag]] <- (Box.test(btcr, type = "Ljung", lag)) } for(滞后于c(1:36)){ box.test.list[[lag]]和测试数据 set.seed(7) btcr <- rnorm(100) box.test.list <- lapply(1:36, functi
for (lag in c(1:36)){
box.test.list[[lag]] <- (Box.test(btcr, type = "Ljung", lag))
}
for(滞后于c(1:36)){
box.test.list[[lag]]和测试数据
set.seed(7)
btcr <- rnorm(100)
box.test.list <- lapply(1:36, function(i) Box.test(btcr, type = "Ljung", i))
results <- data.frame(
lag = 1:36,
xsquared = sapply(box.test.list, "[[", "statistic"),
pvalue = sapply(box.test.list, "[[", "p.value")
)
head(results)
# lag xsquared pvalue
# 1 1 3.659102 0.05576369
# 2 2 7.868083 0.01956444
# 3 3 8.822760 0.03174261
# 4 4 9.654935 0.04665920
# 5 5 11.190969 0.04772238
# 6 6 12.607454 0.04971085