wald_test {probstats4econ}R Documentation

Wald test statistic and p-value

Description

Given the parameter estimates and their variance-covariance matrix, wald_test calculates the Wald test statistic and p-value for a set of linear constraints on the parameters.

Usage

wald_test(
  gamma_hat,
  var_gamma_hat,
  R = diag(length(gamma_hat)),
  r = default_test(R)
)

Arguments

gamma_hat

L x 1 vector of parameter estimates

var_gamma_hat

L x L variance-covariance matrix of parameter estimates

R

Q x L matrix of linear constraints to be tested. Defaults to identity matrix of size L

r

Q x 1 vector of test values for the linear constraints. Defaults to a vector of zeros of length Q to test that all the contrasts are equal to zero.

Value

A list with the following elements:

Examples

# test that union workers earn the same as non-union workers
cps$union <- as.numeric(cps$unionstatus == "Union")
model <- lm(earnwk ~ union, data = cps)
gamma_hat <- coef(model)
var_gamma_hat <- vcov(model)
wald_test(gamma_hat, var_gamma_hat, R = c(0, 1))

# test that non-union workers make 900/week
# *and* union workers make 1000/week
wald_test(
  gamma_hat,
  var_gamma_hat,
  R = matrix(c(0, 1, 1, 1), nrow = 2),
  r = c(900, 1000)
)


[Package probstats4econ version 0.2.0 Index]