Test Linear Hypothesis
Generic function for testing a linear hypothesis, and methods for fitted linear or generalized linear models.
linear.hypothesis(model, ...) lht(...) ## S3 method for class 'lm': linear.hypothesis(model, hypothesis.matrix, rhs=0, summary.model=summary(model, corr = FALSE), test=c("F", "Chisq"), vcov=NULL, white.adjust=FALSE, error.SS, error.df, ...) ## S3 method for class 'glm': linear.hypothesis(model, hypothesis.matrix, rhs=0, summary.model=summary(model, corr = FALSE), test=c("Chisq", "F"), vcov=NULL, error.df, ...)
- model object produced by
- matrix (or vector) giving linear combinations of coefficients by rows.
- right-hand-side vector for hypothesis, with as many entries as
summaryobject for the model; usually specified only when
linear.hypothesisis called from another function that has already computed the summary.
- character specifying wether to compute the finite sample F statistic (with approximate F distribution) or the large sample Chi-squared statistic (with asymptotic Chi-squared distribution).
- a function for estimating the covariance matrix of the regression
hccmor an estimated covariance matrix for
model. See also
- logical or character. Convenience interface to
hccm(instead of using the argument
vcov). Can be set either to a character specifying the
- error sum of squares for the hypothesis; if not specified, will be
- error degrees of freedom for the hypothesis; if not specified,
will be taken from
- aruments to pass down.
Computes either a finite sample F statistic (default for
or asymptotic Chi-squared statistic (default for
"glm" objects) for
carrying out a Wald-test-based comparison between a model and a linearly
- An object of class
"anova"which contains the residual degrees of freedom in the model, the difference in degrees of freedom, Wald statistic (either
"Chisq") and corresponding p value.
Fox, J. (1997) Applied Regression, Linear Models, and Related Methods. Sage.
data(Davis) mod<-lm(weight~repwt, data=Davis) linear.hypothesis(mod, diag(2), c(0,1)) ## use asymptotic Chi-squared statistic linear.hypothesis(mod, diag(2), c(0,1), test = "Chisq") ## use HC3 standard errors via ## white.adjust option linear.hypothesis(mod, diag(2), c(0,1), white.adjust = TRUE) ## covariance matrix *function* linear.hypothesis(mod, diag(2), c(0,1), vcov = hccm) ## covariance matrix *estimate* linear.hypothesis(mod, diag(2), c(0,1), vcov = hccm(mod, type = "hc3"))