HypothesisTests.DurbinWatsonTest —TypeDurbinWatsonTest(X::AbstractArray, e::AbstractVector; p_compute::Symbol = :ndep)Compute the Durbin-Watson test for serial correlation in the residuals of a regression model.
X is the matrix of regressors from the original regression model ande the vector of residuals. Note that the Durbin-Watson test is not valid ifX includes a lagged dependent variable. The test statistic is computed as
\[DW = \frac{\sum_{t=2}^n (e_t - e_{t-1})^2}{\sum_{t=1}^n e_t^2}\]
wheren is the number of observations.
By default, the choice of approach to compute p-values depends on the sample size (p_compute=:ndep). For small samples (n<100), Pan's algorithm (Farebrother, 1980) is employed. For larger samples, a normal approximation is used (Durbin and Watson, 1950). To always use Pan's algorithm, setp_compute=:exact.p_compute=:approx will always use the normal approximation.
Default is a two-sided p-value for the alternative hypothesis of positive or negative serial correlation. One-sided p-values can be requested by callingpvalue(x::DurbinWatsonTest; tail=) with the options:left (negative serial correlation) and:right (positive serial correlation).
References
External links
HypothesisTests.BoxPierceTest —TypeBoxPierceTest(y, lag, dof=0)Compute the Box-PierceQ statistic to test the null hypothesis of independence in a time seriesy.
lag specifies the number of lags used in the construction ofQ. When testing the residuals of an estimated model,dof has to be set to the number of estimated parameters. E.g., when testing the residuals of an ARIMA(p,0,q) model, setdof=p+q.
External links
HypothesisTests.LjungBoxTest —TypeLjungBoxTest(y, lag, dof=0)Compute the Ljung-BoxQ statistic to test the null hypothesis of independence in a time seriesy.
lag specifies the number of lags used in the construction ofQ. When testing the residuals of an estimated model,dof has to be set to the number of estimated parameters. E.g., when testing the residuals of an ARIMA(p,0,q) model, setdof=p+q.
External links
HypothesisTests.BreuschGodfreyTest —TypeBreuschGodfreyTest(X, e, lag, start0 = true)Compute the Breusch-Godfrey test for serial correlation in the residuals of a regression model.
X is the matrix of regressors from the original model ande the vector of residuals.lag determines the number of lagged residuals included in the auxiliary regression. Setstart0 to specify how the starting values for the lagged residuals are handled.start0 = true (default) sets them to zero (as in Godfrey, 1978);start0 = false uses the firstlag residuals as starting values, i.e. shortening the sample bylag.
External links
HypothesisTests.JarqueBeraTest —TypeJarqueBeraTest(y::AbstractVector; adjusted::Bool=false)Whenadjusted isfalse, compute the Jarque-Bera statistic to test the null hypothesis that a real-valued vectory is normally distributed.
Note that the approximation by the Chi-squared distribution does not work well and the speed of convergence is slow. In small samples, the test tends to be over-sized for nominal levels up to about 3% and under-sized for larger nominal levels (Mantalos, 2010).
Whenadjusted istrue, compute the Adjusted Lagrangian Multiplier statistic to test the null hypothesis that a real-valued vectory is normally distributed.
Note that the use of Adjusted Lagrangian Multiplier is preferred over Jarque-Bera for small and medium sample sizes and it is a modification to the Jarque-Bera test (Urzua, 1996).
References
External links
HypothesisTests.ADFTest —TypeADFTest(y::AbstractVector{T}, deterministic::Symbol, lag::Int) where T<:RealCompute the augmented Dickey-Fuller unit root test.
y is the time series to be tested,deterministic determines the deterministic terms (options::none,:constant,:trend,:squared_trend) andlag the number of lagged first-differences included in the test regression, respectively.
Critical values and asymptotic p-values are computed based on response surface regressions following MacKinnon (2010) and MacKinnon (1994), respectively. These may differ slightly from those reported in other regression packages as different algorithms might be used.
References
External links
HypothesisTests.ClarkWestTest —TypeClarkWestTest(e1::AbstractVector{<:Real}, e2::AbstractVector{<:Real}, lookahead::Integer=1)Perform the Clark-West test of equal performance of two nested prediction models, in terms of the out-of-sample mean squared prediction errors.
e1 is a vector of forecasts from the smaller (nested) model,e2 is a vector of forecast errors from the larger model, andlookahead is the number of steps ahead of the forecast. Typically, the null hypothesis is that the two models perform equally well (a two-sided test), but sometimes we test whether the larger model performs better, which is indicated by a positive test statistic, for instance, above 1.645 for the 5% significance level (right tail test).
Implements:pvalue
References
HypothesisTests.DieboldMarianoTest —TypeDieboldMarianoTest(e1::AbstractVector{<:Real}, e2::AbstractVector{<:Real}; loss=abs2, lookahead=1)Perform the modified Diebold-Mariano test proposed by Harvey, Leybourne and Newbold of the null hypothesis that the two methods have the same forecast accuracy.loss is the loss function described in Diebold, F.X. and Mariano, R.S. (1995) Comparing predictive accuracy. Journal of Business and Economic Statistics, 13, 253-263. andlookahead is the number of steps ahead of the forecast.
References
HypothesisTests.WhiteTest —TypeWhiteTest(X, e; type = :White)Compute White's (or Breusch-Pagan's) test for heteroskedasticity.
X is a matrix of regressors ande is the vector of residuals from the original model. The keyword argumenttype is either:linear for the Breusch-Pagan/Koenker test,:linear_and_squares for White's test with linear and squared terms only (no cross-products), or:White (the default) for the full White's test (linear, squared and cross-product terms).X should include a constant and at least one more regressor, with observations in rows and regressors in columns. In some applications,X is a subset of the regressors in the original model, or just the fitted values. This saves degrees of freedom and may give a more powerful test. Thelm (Lagrange multiplier) test statistic is T*R2 where R2 is from the regression ofe^2 on the terms mentioned above. Under the null hypothesis it is distributed asChisq(dof) wheredof is the number of independent terms (not counting the constant), so the null is rejected when the test statistic is large enough.
Implements:pvalue
References
External links
HypothesisTests.BreuschPaganTest —FunctionBreuschPaganTest(X, e)Compute Breusch-Pagan's test for heteroskedasticity.
X is a matrix of regressors from the original model ande the vector of residuals. This is equivalent toWhiteTest(X, e, type = :linear). SeeWhiteTest for further details.
Settings
This document was generated withDocumenter.jl version 1.16.1 onMonday 24 November 2025. Using Julia version 1.12.1.