Wald_test {clubSandwich}  R Documentation 
Wald_test
reports Waldtype tests of linear contrasts from a fitted
linear regression model, using a sandwich estimator for the
variancecovariance matrix and a small sample correction for the pvalue.
Several different smallsample corrections are available.
Wald_test(obj, constraints, vcov, test = "HTZ", tidy = FALSE, ...)
obj 
Fitted model for which to calculate Wald tests. 
constraints 
List of one or more constraints to test. See details and examples. 
vcov 
Variance covariance matrix estimated using 
test 
Character vector specifying which smallsample correction(s) to
calculate. The following corrections are available: 
tidy 
Logical value controlling whether to tidy the test results. If

... 
Further arguments passed to 
Constraints can be specified directly as q X p matrices or
indirectly through constrain_equal
,
constrain_zero
, or constrain_pairwise
A list of test results.
vcovCR
, constrain_equal
,
constrain_zero
, constrain_pairwise
data(Duncan, package = "carData")
Duncan$cluster < sample(LETTERS[1:8], size = nrow(Duncan), replace = TRUE)
Duncan_fit < lm(prestige ~ 0 + type + income + type:income + type:education, data=Duncan)
# Note that type:income terms are interactions because main effect of income is included
# but type:education terms are separate slopes for each unique level of type
# Test equality of intercepts
Wald_test(Duncan_fit,
constraints = constrain_equal(1:3),
vcov = "CR2", cluster = Duncan$cluster)
# Test equality of typebyeducation slopes
Wald_test(Duncan_fit,
constraints = constrain_equal(":education", reg_ex = TRUE),
vcov = "CR2", cluster = Duncan$cluster)
# Pairwise comparisons of typebyeducation slopes
Wald_test(Duncan_fit,
constraints = constrain_pairwise(":education", reg_ex = TRUE),
vcov = "CR2", cluster = Duncan$cluster)
# Test typebyincome interactions
Wald_test(Duncan_fit,
constraints = constrain_zero(":income", reg_ex = TRUE),
vcov = "CR2", cluster = Duncan$cluster)
# Pairwise comparisons of typebyincome interactions
Wald_test(Duncan_fit,
constraints = constrain_pairwise(":income", reg_ex = TRUE, with_zero = TRUE),
vcov = "CR2", cluster = Duncan$cluster)