Learn R Programming

ffaframework (version 0.1.0)

eda_white_test: White Test for Heteroskedasticity

Description

Performs the White test for heteroskedasticity by regressing the squared residuals of a linear model on the original regressors and their squared terms. The null hypothesis is homoskedasticity.

Usage

eda_white_test(data, years, alpha = 0.05)

Value

A list containing the results of the White test:

  • data: The data argument.

  • years: The years argument.

  • alpha: The significance level as specified in the alpha argument.

  • null_hypothesis: A string describing the null hypothesis.

  • alternative_hypothesis: A string describing the alternative hypothesis.

  • statistic: White test statistic based on sample size and r_squared.

  • p_value: The p-value derived from a Chi-squared distribution with df = 2.

  • reject: If TRUE, the null hypothesis was rejected at significance alpha.

Arguments

data

Numeric vector of observed annual maximum series values. Must be strictly positive, finite, and not missing.

years

Numeric vector of observation years corresponding to data. Must be the same length as data and strictly increasing.

alpha

Numeric scalar in \([0.01, 0.1]\). The significance level for confidence intervals or hypothesis tests. Default is 0.05.

Details

The White test regresses the squared residuals from a primary linear model lm(data ~ years) against both the original regressor and its square. The test statistic is calculated as \(nR^2\), where \(R^2\) is the coefficient of determination from the auxiliary regression and \(n\) is the number of elements in the time series. Under the null hypothesis, the test statistic has the \(\chi^2\) distribution with 2 degrees of freedom.

References

White, H. (1980). A heteroskedasticity-consistent covariance matrix estimator and a direct test for heteroskedasticity. Econometrica, 48(4), 817–838.

See Also

Examples

Run this code
data <- rnorm(n = 100, mean = 100, sd = 10)
years <- seq(from = 1901, to = 2000)
eda_white_test(data, years)

Run the code above in your browser using DataLab