Skip to contents

Methods mostly to extract information from model fit and inference. See details for more information on each method.

Usage

estimand(object)

# S3 method for class 'rctglm'
estimand(object)

est(object)

# S3 method for class 'rctglm'
coef(object, ...)

# S3 method for class 'rctglm'
predict(object, ...)

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

Arguments

object

an object of class rctglm

...

additional arguments passed to methods

x

an object of class rctglm

digits

a numeric with the number of digits to display when printing

Value

estimand/est returns a data.frame with columns Estimate and Std. Error with the estimate and standard error of the estimand.

See coef() and predict.glm() for details on what is returned by the corresponding methods.

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 class rctglm, which extracts coefficient information from the underlying glm fit in the procedure. The same is true for the method defined for the predict() generic. The method for an rctglm class object calls predict.glm() on the glm fit contained within an rctglm object.

See also

The generic rctglm() which produces rctglm class objects.

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.6275
#> Counterfactual active mean (psi_1=E[Y|X, A=1]) estimate: 0.8418
#> Estimand function r: psi1 - psi0
#> Estimand (r(psi_1, psi_0)) estimate (SE): 0.2143 (0.07495)
estimand(ate)
#>    Estimate Std. Error
#> 1 0.2143439 0.07495377
coef(ate)
#> (Intercept)          X1           A 
#>   0.6253111   1.4850566   1.5630501