diff --git a/R/MTS.R b/R/MTS.R index 4f7f9b1..7f581d9 100644 --- a/R/MTS.R +++ b/R/MTS.R @@ -1164,7 +1164,7 @@ VARirf <- list(irf=Si,orthirf=orSi) } -"mq" <- function(x,lag=24,adj=0){ +"mq" <- function(x,lag=24,adj=0,return.only=FALSE){ # Compute multivariate Ljung-Box test statistics # # adj: adjustment for the degrees of freedomm in the chi-square distribution. @@ -1194,13 +1194,18 @@ } pvs=QM[,4] dimnames(QM) = list(names(pvs),c(" m "," Q(m) "," df "," p-value")) - cat("Ljung-Box Statistics: ","\n") - printCoefmat(QM,digits = 3) - # - par(mfcol=c(1,1)) - plot(pvs,ylim=c(0,1),xlab="m",ylab="prob",main="p-values of Ljung-Box statistics") - abline(h=c(0)) - lines(rep(0.05,lag),lty=2,col='blue') + if(!return.only){ + cat("Ljung-Box Statistics: ","\n") + printCoefmat(QM,digits = 3) + # + par(mfcol=c(1,1)) + plot(pvs,ylim=c(0,1),xlab="m",ylab="prob",main="p-values of Ljung-Box statistics") + abline(h=c(0)) + lines(rep(0.05,lag),lty=2,col='blue') + } + else{ + return(QM) + } } ### diff --git a/man/mq.Rd b/man/mq.Rd index 75f4859..73f60c5 100644 --- a/man/mq.Rd +++ b/man/mq.Rd @@ -6,7 +6,7 @@ cross-correlation matrices } \usage{ -mq(x, lag = 24, adj = 0) +mq(x, lag = 24, adj = 0, return.only=FALSE) } \arguments{ \item{x}{The data matrix of a vector time series or residual series of a @@ -16,6 +16,9 @@ fitted multivariate model. } \item{adj}{Adjustment for the degrees of freedom for the Ljung-Box statistics. This is used for residual series. Default is zero. +} + \item{return.only}{If TRUE, the results are returned, but not printed or +plotted. Default is FALSE. } } \details{Computes the multivariate Ljung-Box statistics and their