car (version 3.0-3)

S: Modified Functions for Summarizing Linear, Generalized Linear, and Some Other Models

Description

car package replacements for the summary (S) and confint (Confint) functions for lm, glm, multinom, and polr objects, with additional arguments but the same defaults as the original functions. The Confint method for "polr" objects profiles the likelihood to get confidence intervals for the regression parameters but uses Wald intervals for the thresholds. Default methods that call the standard R summary and confint functions are provided for the S and Confint generics, so the car functions should be safe to use in general. The default method for Confint also assumes that there is an appropriate coef method. For briefer model summaries, see brief.

Usage

S(object, brief, ...)

# S3 method for lm S(object, brief=FALSE, correlation = FALSE, symbolic.cor = FALSE, vcov. = vcov(object, complete=FALSE), header = TRUE, resid.summary = FALSE, adj.r2 = FALSE, ...)

# S3 method for glm S(object, brief=FALSE, exponentiate, dispersion, correlation = FALSE, symbolic.cor = FALSE, vcov. = vcov(object, complete=FALSE), header = TRUE, resid.summary = FALSE, ...)

# S3 method for multinom S(object, brief=FALSE, exponentiate=FALSE, ...)

# S3 method for polr S(object, brief=FALSE, exponentiate=FALSE, ...)

# S3 method for lme S(object, brief=FALSE, correlation=FALSE, ...)

# S3 method for lmerMod S(object, brief=FALSE, KR=FALSE, correlation=FALSE, ...)

# S3 method for glmerMod S(object, brief=FALSE, correlation=FALSE, exponentiate, ...)

# S3 method for default S(object, brief, ...)

# S3 method for S.lm print(x, digits = max(3, getOption("digits") - 3), symbolic.cor = x$symbolic.cor, signif.stars = getOption("show.signif.stars"), ...)

# S3 method for S.glm print(x, digits = max(3L, getOption("digits") - 3L), symbolic.cor = x$symbolic.cor, signif.stars = getOption("show.signif.stars"), ...)

# S3 method for S.multinom print(x, digits = max(3, getOption("digits") - 3), signif.stars = getOption("show.signif.stars"), ...)

# S3 method for S.polr print(x, digits = max(3, getOption("digits") - 3), signif.stars = getOption("show.signif.stars"), ...)

# S3 method for S.lme print(x, digits=max(3, getOption("digits") - 3), signif.stars = getOption("show.signif.stars"), ...)

# S3 method for S.lmerMod print(x, digits=max(3, getOption("digits") - 3), signif.stars = getOption("show.signif.stars"), ...)

# S3 method for S.glmerMod print(x, digits=max(3, getOption("digits") - 3), signif.stars = getOption("show.signif.stars"), ...)

Confint(object, ...)

# S3 method for lm Confint(object, estimate=TRUE, parm, level=0.95, vcov.=vcov(object, complete=FALSE), ...)

# S3 method for glm Confint(object, estimate=TRUE, exponentiate=FALSE, vcov., dispersion, type=c("LR", "Wald"), ...)

# S3 method for polr Confint(object, estimate=TRUE, exponentiate=FALSE, thresholds=!exponentiate, ...)

# S3 method for multinom Confint(object, estimate=TRUE, exponentiate=FALSE, ...)

# S3 method for lme Confint(object, estimate=TRUE, level=0.95, ...)

# S3 method for lmerMod Confint(object, estimate=TRUE, level=0.95, ...)

# S3 method for glmerMod Confint(object, estimate=TRUE, level=0.95, exponentiate=FALSE, ...)

# S3 method for default Confint(object, estimate=TRUE, level=0.95, vcov., ...)

Arguments

object

a model object, e.g., of class "lm" as produced by a call to lm.

exponentiate

for a "glm" or "glmerMod" model using the log or logit link, or a "polr" or "multinom" model, show exponentiated coefficient estimates and confidence bounds.

correlation, symbolic.cor
x, digits, signif.stars
dispersion
vcov.

either a matrix giving the estimated covariance matrix of the estimates, or a function that when called with object as an argument returns an estimated covariance matrix of the estimates. The default of vcov. = vcov uses the usual estimated covariance matrix. Other choices include the functions documented at hccm. See example below for using a bootstrap to estimate the covariance matrix. For the glm methods of Confint and S, if the vcov. or dispersion argument is specified, then Wald-based confidence limits are computed; otherwise the reported confidence limits are computed by profiling the likelihood. NOTE: The dispersion and vcov. arguments may not both be specified.

header

if TRUE, print the header for the summary output, default is TRUE

resid.summary

if TRUE, print the five-number summary of the residuals in the summary, defaults to FALSE

adj.r2

if TRUE, print the adjusted r-squared in the summary, default is FALSE

brief

if TRUE, set header, resid.summary and adj.r.squared to FALSE, and suppress exponeniated coefficients for GLMs with log or logit link.

KR

if TRUE (default is FALSE), compute Kenward-Roger standard errors and Satterthwaite degrees of freedom for t-tests. Warning: This computation can be very time-consuming.

parm, level
estimate

show the estimated coefficients in the confidence-interval table; default is TRUE.

thresholds

show confidence intervals for the estimated thresholds in the "polr" model.

type

if "LR" (the default) compute confidence intervals based on the LR statistics by profiling the likelihood; if "Wald" base confidence intervals on the Wald statistic using the coefficient standard error and the normal distribution.

additional arguments to be passed down, for consistency with summary and confint methods

Value

The S.lm and S.glm functions return a list with all the elements shown at summary.lm and summary.glm. The S.multinom and S.polr functions return a list with all the elements shown at summary.multinom and summary.polr plus potentially a table of exponentiated coefficients and confidence bounds.

The Confint.lm function returns either the output from confint.lm if vcov. = vcov or Wald-type confidence intervals using the supplied covariance matrix for any other choice of vcov..

Finally, Confint applied to any object that does not inherit from "lm", "multinom", or "polr" simply calls confint, along with, by default, using coef to add a column of estimates to the confidence limits.

Details

All these functions mimic functions in the stats and other standard R packages for summarizing aspects of linear, generalized linear, and some other statistical models.

The S and Confint functions add support for the vcov. argument for linear models, which allows specifying a covariance matrix for the regression coefficients other than the usual covariance matrix returned by the function vcov. This argument may be either the name of a function, so that the call to vcov.(object) returns a covariance matrix, or else vcov. is set equal to a covariance matrix. For example, setting vcov.=hccm uses 'proposal 3' described by Long and Ervin (2000) for a sandwich coefficient-variance estimator that may be robust against nonconstant variance (see hccm). Setting vcov. = hccm(object, type = "hc2") would use the matrix returned by the hccm function using proposal 2. For use with a bootstrap, see the examples below. The overall F-test in the S.lm output uses the supplied covariance matrix in a call to the linearHypothesis function.

The supplied print method for S.lm (and for other S methods) has additional arguments to customize the standard summary.lm output. Standard output is obtained by setting resid.summary=TRUE, adj.r2=TRUE.

Using a heterscedasticy-corrected covariance matrix computed using hccm with GLMs other than Gaussian is not justified; see the article by Freedman (2006).

The Summary.glm method for models fit with the log or logit link by default prints a table of exponentiated coefficients and their confidence limits; Summary.multinom and Summary.polr optionally print tables of exponentiated coefficients.

References

Freedman, David A. (2006). On the so-called Huber sandwich estimator and robust standard errors. The American Statistician, 60, 299-302.

Long, J. S. and Ervin, L. H. (2000) Using heteroscedasity consistent standard errors in the linear regression model. The American Statistician 54, 217--224.

White, H. (1980) A heteroskedastic consistent covariance matrix estimator and a direct test of heteroskedasticity. Econometrica 48, 817--838.

See Also

brief, summary, confint, coef, summary.lm, confint, vcov.lm, hccm, Boot, linearHypothesis

Examples

Run this code
# NOT RUN {
mod.prestige <- lm(prestige ~ education + income + type, Prestige)
S(mod.prestige, vcov.=hccm)
S(mod.prestige, brief=TRUE)
Confint(mod.prestige, vcov.=hccm)

# A logit model
mod.mroz <- glm(lfp ~ ., data=Mroz, family=binomial)
S(mod.mroz)

# }
# NOT RUN {
# Using the bootstrap for standard errors
b1 <- Boot(mod.prestige)
S(mod.prestige, vcov.= vcov(b1))
Confint(b1) # run with the boot object to get corrected confidence intervals
# }

Run the code above in your browser using DataCamp Workspace