Skip to contents

Test whether the residuals of an estimated model are serially correlated. The test statistic is $$Q = N^2\sum_{k=1}^{K} (N-k)^{-1}\mbox{tr} (G_k G_0^{-1} G_k' G_0^{-1})$$ where \(G_k\) are the sample covariances of the residuals. Under the Null of a correctly specified and estimated model the test statistic is asmyptotically Chi-squared distributed with \(Km^2-\kappa\) degrees of freedom, where \(\kappa\) is the number of (free) parameters of the model (class).

Usage

pm_test(u, lag.max, n.par)

Arguments

u

(N-by-m) matrix of residuals (or an object which may be coerced to a matrix with as.matrix(u)).

lag.max

(integer) maximum number of lags.

n.par

(integer) number of parameters of the estimated model.

Value

Matrix with four columns ("lags" number of lags, "df" degrees of freedom, "Q" test statistics and "p" p values).

Examples

u = matrix(rnorm(100*3), nrow = 100, ncol = 3)
pm_test(u, 4, 0)
#>      lags         Q df         p
#> [1,]    1  7.796479  9 0.5547794
#> [2,]    2 14.118100 18 0.7213606
#> [3,]    3 26.329059 27 0.5004011
#> [4,]    4 33.370774 36 0.5942857