glm_weightit-methods: Methods for 'glm_weightit()' objects

glm_weightit-methodsR Documentation

Methods for glm_weightit() objects

Description

This page documents methods for objects returned by glm_weightit(), lm_weightit(), ordinal_weightit(), multinom_weightit(), and coxph_weightit(). predict() methods are described at predict.glm_weightit() and anova() methods are described at anova.glm_weightit().

Usage

## S3 method for class 'glm_weightit'
summary(object, ci = FALSE, level = 0.95, transform = NULL, vcov = NULL, ...)

## S3 method for class 'multinom_weightit'
summary(object, ci = FALSE, level = 0.95, transform = NULL, vcov = NULL, ...)

## S3 method for class 'ordinal_weightit'
summary(
  object,
  ci = FALSE,
  level = 0.95,
  transform = NULL,
  thresholds = TRUE,
  vcov = NULL,
  ...
)

## S3 method for class 'coxph_weightit'
summary(object, ci = FALSE, level = 0.95, transform = NULL, vcov = NULL, ...)

## S3 method for class 'glm_weightit'
print(x, digits = max(3L, getOption("digits") - 3L), ...)

## S3 method for class 'glm_weightit'
vcov(object, complete = TRUE, vcov = NULL, ...)

## S3 method for class 'glm_weightit'
update(object, formula. = NULL, ..., evaluate = TRUE)

Arguments

object, x

an output from one of the above modeling functions.

ci

logical; whether to display Wald confidence intervals for estimated coefficients. Default is FALSE. (Note: this argument can also be supplied as conf.int.)

level

when ci = TRUE, the desired confidence level.

transform

the function used to transform the coefficients, e.g., exp (which can also be supplied as a string, e.g., "exp"); passed to match.fun() before being used on the coefficients. When ci = TRUE, this is also applied to the confidence interval bounds. If specified, the standard error will be omitted from the output. Default is no transformation.

vcov

either a string indicating the method used to compute the variance of the estimated parameters for object, a function used to extract the variance, or the variance matrix itself. Default is to use the variance matrix already present in object. If a string or function, arguments passed to ... are supplied to the method or function. (Note: for vcov(), can also be supplied as type.)

...

for vcov() or summary() or confint() with vcov supplied, other arguments used to compute the variance matrix depending on the method supplied to vcov, e.g., cluster, R, or fwb.args. For update(), additional arguments to the call or arguments with changed values. See glm_weightit() for details.

thresholds

logical; whether to include thresholds in the summary() output for ordinal_weightit objects. Default is TRUE.

digits

the number of significant digits to be passed to format(coef(x), .) when print()ing.

complete

logical; whether the full variance-covariance matrix should be returned also in case of an over-determined system where some coefficients are undefined and coef(.) contains NAs correspondingly. When complete = TRUE, vcov() is compatible with coef() also in this singular case.

formula.

changes to the model formula, passed to the new argument of update.formula().

evaluate

whether to evaluate the call (TRUE, the default) or just return it.

Details

vcov() by default extracts the parameter covariance matrix already computed by the fitting function, and summary() and confint() uses this covariance matrix to compute standard errors and Wald confidence intervals (internally calling confint.lm()), respectively. Supplying arguments to vcov or ... will compute a new covariance matrix. If cluster was supplied to the original fitting function, it will be incorporated into any newly computed covariance matrix unless cluster = NULL is specified in vcov(), summary(), or confint(). For other arguments (e.g., R and fwb.args), the defaults are those used by glm_weightit(). Note that for vcov = "BS" and vcov = "FWB" (and vcov = "const" for multinom_weightit or ordinal_weightit objects), the environment for the fitting function is used, so any changes to that environment may affect calculation. It is always safer to simply recompute the fitted object with a new covariance matrix than to modify it with the vcov argument, but it can be quicker to just request a new covariance matrix when refitting the model is slow.

update() updates a fitted model object with new arguments, e.g., a new model formula, dataset, or variance matrix. When only arguments that control the computation of the variance are supplied, only the variance will be recalculated (i.e., the parameters will not be re-estimated). When data is supplied, weightit is not supplied, and a weightit object was originally passed to the model fitting function, the weightit object will be re-fit with the new dataset before the model is refit using the new weights and new data. That is, calling update(obj, data = d) is equivalent to calling update(obj, data = d, weightit = update(obj$weightit, data = d)) when a weightit object was supplied to the model fitting function.

The estfun() method for multinom_weightit and ordinal_weightit objects (which is used by function in the sandwich package to compute coefficient covariance matrices) simply extracts the gradient component of the object. For glm_weightit and coxph_weightit objects, the glm and coxph methods are dispatched instead.

Value

summary() returns a summary.glm_weightit() object, which has its own print() method. For coxph_weightit() objects, the print() and summary() methods are more like those for glm objects than for coxph objects.

Otherwise, all methods return the same type of object as their generics.

See Also

glm_weightit() for the page documenting glm_weightit(), lm_weightit(), ordinal_weightit(), multinom_weightit(), and coxph_weightit(). summary.glm(), vcov(), confint() for the relevant methods pages. predict.glm_weightit() for computing predictions from the models. anova.glm_weightit() for comparing models using a Wald test.

Examples

## See more examples at ?glm_weightit

WeightIt documentation built on Oct. 4, 2024, 9:07 a.m.