glm_weightit-methods | R Documentation |
glm_weightit()
objectsThis 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()
.
## S3 method for class 'glm_weightit'
summary(object, ci = FALSE, level = 0.95, transform = NULL, ...)
## S3 method for class 'multinom_weightit'
summary(object, ci = FALSE, level = 0.95, transform = NULL, ...)
## S3 method for class 'ordinal_weightit'
summary(
object,
ci = FALSE,
level = 0.95,
transform = NULL,
thresholds = TRUE,
...
)
## S3 method for class 'coxph_weightit'
summary(object, ci = FALSE, level = 0.95, transform = 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, ...)
## S3 method for class 'glm_weightit'
anova(object, object2, test = "Chisq", method = "Wald", tolerance = 1e-07, ...)
object , object2 , x |
an output from one of the above modeling functions. For |
ci |
|
level |
when |
transform |
the function used to transform the coefficients, e.g., |
... |
ignored. |
thresholds |
|
digits |
the number of significant digits to be
passed to |
complete |
|
test |
the type of test statistic used to compare models. Currently only |
method |
the kind of test used to compare models. Currently only |
tolerance |
for the Wald test, the tolerance used to determine if models are symbolically nested. |
vcov()
(which is called by summary()
) simply extracts the covariance matrix already computed by the fitting function. confint()
computes Wald confidence intervals (internally calling confint.lm()
). 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.
anova()
performs a Wald test to compare two fitted models. The models must be nested, but they don't have to be nested symbolically (i.e., the names of the coefficients of the smaller model do not have to be a subset of the names of the coefficients of the larger model). The larger model must be supplied to object
and the smaller to object2
. Both models must contain the same units, weights (if any), and outcomes. The variance-covariance matrix of the coefficients of the smaller model is not used, so it can be specified as "none"
in the original model call. Otherwise, a warning be thrown if the covariances were computed using different methods.
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 then for coxph
objects.
Otherwise, all methods return the same type of object as their generics.
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.
## See more examples at ?glm_weightit
data("lalonde", package = "cobalt")
# Model comparison for any relationship between `treat`
# and `re78` (not the same as testing for the ATE)
fit1 <- glm_weightit(
re78 ~ treat * (age + educ + race + married + nodegree +
re74 + re75), data = lalonde
)
fit2 <- glm_weightit(
re78 ~ age + educ + race + married + nodegree +
re74 + re75, data = lalonde
)
anova(fit1, fit2)
# Model comparison between spline model and linear
# model; note they are nested but not symbolically
# nested
fit_s <- glm_weightit(
re78 ~ splines::ns(age, df = 4), data = lalonde
)
fit_l <- glm_weightit(
re78 ~ age, data = lalonde
)
anova(fit_s, fit_l)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.