| 42333 |
ripley |
1 |
% File src/library/stats/man/box.test.Rd
|
| 68948 |
ripley |
2 |
% Part of the R package, https://www.R-project.org
|
| 74265 |
hornik |
3 |
% Copyright 1995-2018 R Core Team
|
| 42333 |
ripley |
4 |
% Distributed under GPL 2 or later
|
|
|
5 |
|
| 27497 |
ripley |
6 |
\name{Box.test}
|
| 56186 |
murdoch |
7 |
\alias{Box.test}
|
| 46873 |
ripley |
8 |
\concept{portmanteau}
|
| 27497 |
ripley |
9 |
\title{Box-Pierce and Ljung-Box Tests}
|
|
|
10 |
\description{
|
|
|
11 |
Compute the Box--Pierce or Ljung--Box test statistic for examining the
|
| 46867 |
ripley |
12 |
null hypothesis of independence in a given time series. These are
|
|
|
13 |
sometimes known as \sQuote{portmanteau} tests.
|
| 27497 |
ripley |
14 |
}
|
|
|
15 |
\usage{
|
| 45713 |
ripley |
16 |
Box.test(x, lag = 1, type = c("Box-Pierce", "Ljung-Box"), fitdf = 0)
|
| 27497 |
ripley |
17 |
}
|
|
|
18 |
\arguments{
|
|
|
19 |
\item{x}{a numeric vector or univariate time series.}
|
|
|
20 |
\item{lag}{the statistic will be based on \code{lag} autocorrelation
|
|
|
21 |
coefficients.}
|
|
|
22 |
\item{type}{test to be performed: partial matching is used.}
|
| 45713 |
ripley |
23 |
\item{fitdf}{number of degrees of freedom to be subtracted if \code{x}
|
|
|
24 |
is a series of residuals.}
|
| 27497 |
ripley |
25 |
}
|
| 45713 |
ripley |
26 |
\details{
|
|
|
27 |
These tests are sometimes applied to the residuals from an
|
|
|
28 |
\code{ARMA(p, q)} fit, in which case the references suggest a better
|
|
|
29 |
approximation to the null-hypothesis distribution is obtained by
|
|
|
30 |
setting \code{fitdf = p+q}, provided of course that \code{lag > fitdf}.
|
|
|
31 |
}
|
| 27497 |
ripley |
32 |
\note{
|
|
|
33 |
Missing values are not handled.
|
|
|
34 |
}
|
|
|
35 |
\value{
|
|
|
36 |
A list with class \code{"htest"} containing the following components:
|
|
|
37 |
\item{statistic}{the value of the test statistic.}
|
|
|
38 |
\item{parameter}{the degrees of freedom of the approximate chi-squared
|
| 74363 |
maechler |
39 |
distribution of the test statistic (taking \code{fitdf} into account).}
|
| 27497 |
ripley |
40 |
\item{p.value}{the p-value of the test.}
|
|
|
41 |
\item{method}{a character string indicating which type of test was
|
|
|
42 |
performed.}
|
|
|
43 |
\item{data.name}{a character string giving the name of the data.}
|
|
|
44 |
}
|
|
|
45 |
\references{
|
|
|
46 |
Box, G. E. P. and Pierce, D. A. (1970),
|
|
|
47 |
Distribution of residual correlations in autoregressive-integrated
|
|
|
48 |
moving average time series models.
|
|
|
49 |
\emph{Journal of the American Statistical Association}, \bold{65},
|
|
|
50 |
1509--1526.
|
| 74265 |
hornik |
51 |
\doi{10.2307/2284333}.
|
| 45713 |
ripley |
52 |
|
| 27497 |
ripley |
53 |
Ljung, G. M. and Box, G. E. P. (1978),
|
|
|
54 |
On a measure of lack of fit in time series models.
|
| 74265 |
hornik |
55 |
\emph{Biometrika}, \bold{65}, 297--303.
|
|
|
56 |
\doi{10.2307/2335207}.
|
| 45713 |
ripley |
57 |
|
| 27497 |
ripley |
58 |
Harvey, A. C. (1993)
|
|
|
59 |
\emph{Time Series Models}.
|
| 65208 |
hornik |
60 |
2nd Edition, Harvester Wheatsheaf, NY, pp.\sspace{}44, 45.
|
| 27497 |
ripley |
61 |
}
|
|
|
62 |
\author{A. Trapletti}
|
|
|
63 |
\examples{
|
|
|
64 |
x <- rnorm (100)
|
|
|
65 |
Box.test (x, lag = 1)
|
| 61160 |
ripley |
66 |
Box.test (x, lag = 1, type = "Ljung")
|
| 27497 |
ripley |
67 |
}
|
|
|
68 |
\keyword{ts}
|