glance() describes an ipw() result rather than its estimates: one row
naming the estimand and counting the observations and the residual degrees of
freedom of the system the standard errors came from. A fit reporting several
effect measures, or several contrasts of a categorical exposure, still
returns exactly one row.
Under M-estimation that system is the stacked estimating equations, which hold the propensity score model, the outcome model, and the effect measures at once. Its residual degrees of freedom are the observations it was solved on less the parameters it solves for, so a multinomial propensity score model leaves fewer of them than a binary one does on the same data. Linearization stacks nothing and records no parameter count, so the observations are the outcome model's and there is no count to subtract from them.
The columns and their types are the same on every route ipw() takes, so the
rows of several results stack into one table.
Usage
# S3 method for class 'ipw'
glance(x, ...)Arguments
- x
An
ipwobject, as returned byipw().- ...
These dots are for future extensions and must be empty.
Value
A one-row tibble with the columns:
estimandThe estimand the weights target, such as
"ate".nobsThe number of observations the outcome model was fit on, which is also what the stacked estimating equations are solved on under M-estimation. Reported by
stats::nobs().df.residualThe residual degrees of freedom of the stacked estimating equations,
nobsless the number of parameters the system solves for.NAunder linearization, which records no parameter count. Reported bystats::df.residual().
Examples
set.seed(123)
n <- 200
x1 <- rnorm(n)
z <- rbinom(n, 1, plogis(0.5 * x1))
y <- rbinom(n, 1, plogis(-0.5 + 0.8 * z + 0.3 * x1))
dat <- data.frame(x1, z, y)
ps_mod <- glm(z ~ x1, data = dat, family = binomial())
wts <- wt_ate(ps_mod)
#> ℹ Using exposure variable "z" from GLM model
#> ℹ Treating `.exposure` as binary
outcome_mod <- glm(y ~ z, data = dat, family = quasibinomial(), weights = wts)
result <- ipw(ps_mod, outcome_mod)
glance(result)
#> # A tibble: 1 × 3
#> estimand nobs df.residual
#> <chr> <int> <int>
#> 1 ate 200 191
