HARE.jl

Heteroskedasticity and Autocorrelation Estimators – feasible GLS corrections for linear regression models.

HARE.jl provides classical estimators and tests covering heteroskedasticity, AR(1) autocorrelation, and their combination:

Error structureEstimators / Tests
None (benchmark)ols
Exponential variance (Harvey)exponential_fwls, exponential_mle, harvey_test
Power variancepower_fwls, power_mle
Quadratic variance (Glejser)quadratic_fwls, quadratic_mle, glejser_test
Linear variancelinear_fwls, linear_mle
Groupwise heteroscedasticitytwo_step_groupwise, iterated_groupwise, groupwise_mle
AR(1) autocorrelationtwo_step_prais_winsten, iterated_prais_winsten, two_step_cochrane_orcutt, iterated_cochrane_orcutt, hildreth_lu
AR(1) + heteroskedasticitytwo_step_sequential, iterated_sequential, two_step_joint, iterated_joint
AR(1) exact MLEbeach_mackinnon

All estimators return typed result structs that implement the StatsBase interface: coef, stderror, vcov, residuals, fitted, predict.

Installation

using Pkg
Pkg.add(url = "https://github.com/Trumpingtons/HARE.jl")

Quick Start

Pass regressors without a constant column – the intercept is added automatically:

using HARE, Random

Random.seed!(1234)
n   = 500
x1  = randn(n); x2 = randn(n)
X = hcat(x1, x2)
y   = hcat(ones(n), X) * [1.0, 2.0, -1.0] .+ exp.(0.5 .* x1) .* randn(n)

m = exponential_ifwls(X, y)
coef(m)      # coefficient vector
stderror(m)  # standard errors
vcov(m)      # full covariance matrix
residuals(m) # in-sample residuals

The @formula interface mirrors GLM.jl:

using HARE
data = (y = y, x1 = x1, x2 = x2)
m = exponential_ifwls(@formula(y ~ x1 + x2), data)

Contents