How do I write this for a column wise analysis such that a matrix with 2 rows ( "F[2]" and "Pr(>F)[2]") and two columns is returned as results please?推荐答案这是否朝着正确的方向发展?Does this go into the right direction?library(lmtest)M1<- matrix( c(2,3, 1, 4, 3, 3, 1,1, 5, 7), nrow=5, ncol=2)M3<- matrix( c(1, 3, 1,5, 7,3, 1, 3, 3, 4), nrow=5, ncol=2)g <- list()for (i in 1:ncol(M1)){g[[i]] <- grangertest(M1[ ,i] ~ M3[ ,i])}foo <- function(x){ F <- x$F[2] P <- x$`Pr(>F)`[2] data.frame(F = F, P = P) }do.call(rbind, lapply(g, foo)) F P1 0.3125000 0.67548962 0.1781818 0.7457180 这篇关于R中的列明智Granger因果检验的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-13 07:17