Methods mostly to extract information from model fit and inference. See details for more information on each method.
Value
estimand
/est
returns a data.frame
with columns Estimate
and
Std. Error
with the estimate and standard error of the estimand.
coef
returns a named numeric
, being the result of the glm
method of
coef
on the glm
object contained within an rctglm object.
Details
The function estimand (or short-hand version est) can be used to extract
a data.frame
with an estimated value and standard error of the estimand.
A method for the generic coef has been added for rctglm
(i.e., coef.rctglm), which uses the method coef.glm
to extract coefficient
information from the underlying glm
fit in the procedure.
See also
The generic rctglm()
which these are methods for.
Examples
# Generate some data to showcase example
n <- 100
exposure_prob <- .5
dat_binom <- glm_data(
Y ~ 1+1.5*X1+2*A,
X1 = rnorm(n),
A = rbinom(n, 1, exposure_prob),
family = binomial()
)
# Fit the model
ate <- rctglm(formula = Y ~ .,
exposure_indicator = A,
exposure_prob = exposure_prob,
data = dat_binom,
family = binomial,
estimand_fun = "ate")
#>
#> ── Symbolic differentiation of estimand function ──
#>
#> ℹ Symbolically deriving partial derivative of the function 'psi1 - psi0' with respect to 'psi0' as: '-1'.
#> • Alternatively, specify the derivative through the argument
#> `estimand_fun_deriv0`
#> ℹ Symbolically deriving partial derivative of the function 'psi1 - psi0' with respect to 'psi1' as: '1'.
#> • Alternatively, specify the derivative through the argument
#> `estimand_fun_deriv1`
print(ate)
#>
#> Object of class rctglm
#>
#> Call: rctglm(formula = Y ~ ., exposure_indicator = A, exposure_prob = exposure_prob,
#> data = dat_binom, family = binomial, estimand_fun = "ate")
#>
#> Counterfactual control mean (psi_0=E[Y|X, A=0]) estimate: 0.7789
#> Counterfactual control mean (psi_1=E[Y|X, A=1]) estimate: 0.8888
#> Estimand function r: psi1 - psi0
#> Estimand (r(psi_1, psi_0)) estimate (SE): 0.1099 (0.06788)
estimand(ate)
#> Estimate Std. Error
#> 1 0.1098769 0.06788006
coef(ate)
#> (Intercept) X1 A
#> 1.3909470 1.0711635 0.9680493