ljungbox_test: Ljung-Box Test

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/ares.r

Description

Run the Ljung-Box test

Usage

1
ljungbox_test(x, k = 25, ...)

Arguments

x

a vector, usually of residuals

k

an integer indicating the number of lags to compute the autocorrelation coefficients

...

further options for acf

Details

This function implements the the Ljung-Box test for autocorrelation coefficients. The null hypothesis of the test is H_{0}: ρ(1)=ρ(2)=\cdots=ρ(k) for k<≤ft(n-1\right). The test statistic depends on k.

Value

A list containing the following objects

statistic

the test statistic

p.value

the p-value

df

the degrees of freedom of the chi-squared distribution of the test statistic

n.used

the number of observations used for autocorrelations computation

data.name

the name of the input variable

Author(s)

Washington Junger wjunger@ims.uerj.br and Antonio Ponce de Leon ponce@ims.uerj.br

References

Schwartz, J., Spix, C., Touloumi, G. et al. (1996) Methodological issues in studies of air pollution and daily counts of deaths or hospital admissions. J Epidemiol. Community Health 50 (suppl 1), S12–S18.

Spanos, A. (1999) Probability Theory and Statistical Inference. Cambridge.

See Also

get_residuals,acf

Examples

1
2
3
4
5
6
data(admrio)
setup(admrio,"date")
f <- resp5~s(time)+weekdays+s(tmpmax)
m <- fit_core(f)
r <- get_residuals(m)
ljungbox_test(r,25)

wjunger/ares documentation built on Dec. 23, 2021, 5:17 p.m.