bcalibrate {CopSens}R Documentation

Calibration for Binary Outcomes

Description

Calibrates the naive estimates to account for unobserved confounding when outcome variables are binary. The calibration can be done with user-specific sensitivity parameter or with our pre-provided calibration methods, the worst-case calibration for a single contrast or multivariate calibration for multiple contrasts.

Usage

bcalibrate(
  y,
  tr,
  t,
  gamma,
  R2 = NULL,
  mu_y_t = NULL,
  mu_u_tr = NULL,
  mu_u_t = NULL,
  cov_u_t = NULL,
  nU = NULL,
  nsim = 4000,
  ...
)

Arguments

y

data.frame, matrix or vector. Binary outcome variable.

tr

data.frame. Treatment variables with rows corresponding to observations and columns to variables.

t

data.frame. Treatment arms of interest. May contain a single or multiple treatments in rows.

gamma

a vector specifying the direction of sensitivity parameters.

R2

an optional scalar or vector specifying the proportion of residual variance in outcome given the treatment that can be explained by confounders, which determines the magnitude of sensitivity parameters.

mu_y_t

an optional scalar or vector that contains naive estimates of treatment effects ignoring confounding.

mu_u_tr

an optional matrix of conditional confounder means for all observed treatments with latent variables in columns.

mu_u_t

an optional matrix of conditional confounder means for treatments of interest with latent variables in columns.

cov_u_t

an optional covariance matrix of confounders conditional on treatments.

nU

Number of latent confounders to consider.

nsim

an optional scalar specifying the number of sample draws.

...

further arguments passed to kEstimateor pca.

Value

A data.frame with naive and calibrated estimates of population average outcome receiving treatment t.

Examples


# load the example data #
y <- GaussianT_BinaryY$y
tr <- subset(GaussianT_BinaryY, select = -c(y))
t1 <- tr[1:5,]
t2 <- rep(0, times = ncol(tr))
# calibration #
est_b <- bcalibrate(y = y, tr = tr, t = rbind(t1, t2),
                    nU = 3, gamma = c(1.27, -0.28, 0),
                    R2 = c(0.2, 0.7))
est_b_rr <- list(est_df = est_b$est_df[1:5,] / as.numeric(est_b$est_df[6,]),
                 R2 = c(0.2, 0.7))
plot_estimates(est_b_rr)


[Package CopSens version 0.1.0 Index]