stable <-
function(coef, nvar, nlag, ndet, allow_ur=FALSE) {
if(ndet > 0) { m1 <- array(t(coef[-(1:ndet),]), dim = c(nvar, nvar, nlag))
} else { m1 <- array(t(coef), dim = c(nvar, nvar, nlag)) }
m2 <- NULL
for(i in 1:nlag) m2 <- cbind(m2, m1[,,i])
m3 <- rbind(m2,cbind(diag(nvar*(nlag-1)), matrix(0,nvar*(nlag-1),nvar)) )
if(allow_ur) { out <- max(abs(eigen(m3)$values)) <= 1
} else { out <- max(abs(eigen(m3)$values)) = 1 }
out
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.