Box.Ljung.Test: Ljung-Box Test Plot

Description Usage Arguments Details Author(s) References Examples

View source: R/Box.Ljung.Test.R

Description

Returns plot of the p-values Ljung-Box test.

Usage

1
Box.Ljung.Test(z, lag = NULL, main = NULL)

Arguments

z

numeric vector or univariate time series.

lag

lag or lag.max used in the acf of the time serie. If lag=NULL then the function will use lag=10.

main

an overall title for the plot. Optional argument, by default will print p values for Ljung-Box statistic.

Details

The Ljung-Box test is used to check if exists autocorrelation in a time series. The statistic is

Q = n(n+2)\cdot∑_{j=1}^h \hat{ρ}(j)^2/(n-j)

with n the number of observations and \hat{ρ}(j) the autocorrelation coefficient in the sample when the lag is j. Box.Ljung.Test computes Q and returns the p-values graph with lag j.

Author(s)

Ricardo Olea <[email protected]>

References

Brockwell, Peter J., and Richard A. Davis. Introduction to time series and forecasting. 2002. ISBN-13: 978-0387953519.

Ljung, G.M. and Box, G.E.P. (1978), On a measure of lack of fit in time series models, Biometrika, 65, 297-303.

Examples

1
2
3
z = rnorm(500)
Box.Ljung.Test(z, lag=15)
ts.diag(z)

Example output



LSTS documentation built on May 29, 2017, 6:36 p.m.