View source: R/helper_functions.R
estimate_bias | R Documentation |
Returns the bias based on the different parameters in the bias decomposition
estimate_bias(rho, R2, weights, sigma2)
rho |
Correlation between the error in the weights and outcome |
R2 |
R2 measure for how much variation in the true weights is explained by the error term, must be bound on the range [0,1) |
weights |
Vector of estimated weights |
sigma2 |
Estimated variance of the outcome (i.e., stats::var(Y) for obervational setting; stats::var(tau) for generalization setting) |
Estimated bias from omitting a confounder from weights
set.seed(331)
Y = rnorm(1000)
weights = rlogis(1000)
weights = weights/mean(weights)
estimate_bias(rho = 0.5, R2 = 0.5, weights = weights, sigma2 = var(Y))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.