Monte Carlo based calculation of study power for treatment effect estimation using linear regression on treatment indicator and adjustment covariates.
mlr.power(tr, Z.i = NULL, d, sig.level = 0.05, niter = 1000
, verbose = FALSE, idx = 1:length(tr), rnd = FALSE)
Binary treatment indicator vector (1=treatment, 0=control), whose coefficient in the linear regression model is TE.
Matrix of adjustment covariates included in linear regression. We must have nrow(Z.i) == length(tr)
.
Standardized effect size, equal to treatment effect divided by standard deviation of generative noise.
Significance level for rejecting null hypothesis.
Number of Monte Carlo simulations used for calculating power.
If TRUE
, calculated power is printed.
Subset of observations to use for power calculation.
Boolean flag. If TRUE
, power is also calculated for random subsampling of observations, using same treatment and control group sizes as indicated by idx
.
A numeric vector is returned. If rnd
is FALSE
, meand and standard error of calculated power is returned. If rnd
is TRUE
, mean and standard error of power calculated for random subsampling of observations is returned as well.
In each Monte Carlo iteration, response variable is generated from a normal distribution whose mean is equal to d * tr
(other coefficients are assumed to be zero since their value does not affect power calculation), and whose standard deviation is 1.0
. Then OLS-based regression is performed on data, and p-value for treatment effect is compared to sig.level
, based on which null hypothesis (no effect) is rejected or accepted. The fraction of iterations where null hypothesis is rejected is taken to be power. Standard error is calculated using a binomial-distribution assumption.