This function calculates the treatment effect estimate, the difference in the average outcome in the treatment group minus the control group. This function is intended to be used for a fully observed continuous outcome. The user can also request a variance estimate, estimated using perturbating-resampling, and a 95% confidence interval. If a confidence interval is requested two versions are provided: a normal approximation based interval and a quantile based interval, both use perturbation-resampling.
delta.estimate(yone,yzero, var = FALSE, conf.int = FALSE, weight = NULL,
weight.perturb = NULL)
A list is returned:
the estimate, \(\hat{\Delta}\), described above.
the variance estimate of \(\hat{\Delta}\); if var = TRUE or conf.int = TRUE.
a vector of size 2; the 95% confidence interval for \(\hat{\Delta}\) based on a normal approximation; if conf.int = TRUE.
a vector of size 2; the 95% confidence interval for \(\hat{\Delta}\) based on sample quantiles of the perturbed values, described above; if conf.int = TRUE.
numeric vector; primary outcome for treated observations.
numeric vector; primary outcome for control observations.
TRUE or FALSE; indicates whether a variance estimate for delta is requested, default is FALSE.
TRUE or FALSE; indicates whether a 95% confidence interval for delta is requested, default is FALSE.
a n1+n0 by x matrix of weights where n1 = length of yone and n0 = length of yzero, default is null; generally not supplied by use but only used by other functions.
a n1+n0 by x matrix of weights where n1 = length of yone and n0 = length of yzero, default is null; generally used for confidence interval construction and may be supplied by user.
Layla Parast
Let \(Y^{(1)}\) and \(Y^{(0)}\) denote the primary outcome under the treatment and primary outcome under the control,respectively. The treatment effect, \(\Delta\), is the expected difference in \(Y^{(1)}\) compared to \(Y^{(0)}\), \( \Delta=E(Y^{(1)}-Y^{(0)}).\) We estimate \(\Delta\) as $$\hat{\Delta} = n_1^{-1} \sum_{i=1}^{n_1} Y_{1i} - n_0^{-1} \sum_{i=1}^{n_0} Y_{0i}$$ where \(Y_{1i}\) is the observed primary outcome for person \(i\) in the treated group, \(Y_{0i}\) is the observed primary outcome for person \(i\) in the control group, and \(n_1\) and \(n_0\) are the number of individuals in the treatment and control group, respectively. Randomized treatment assignment is assumed throughout this package.
Variance estimation and confidence interval construction are performed using perturbation-resampling. Specifically, let \(\left \{ V^{(b)} = (V_{11}^{(b)}, ...V_{1n_1}^{(b)}, V_{01}^{(b)}, ...V_{0n_0}^{(b)})^T, b=1,....,D \right \}\) be \(n \times D\) independent copies of a positive random variables \(V\) from a known distribution with unit mean and unit variance. Let $$\hat{\Delta}^{(b)} = \frac{ \sum_{i=1}^{n_1} V_{1i}^{(b)} Y_{1i}}{ \sum_{i=1}^{n_1} V_{1i}^{(b)}} - \frac{ \sum_{i=1}^{n_0} V_{0i}^{(b)} Y_{0i}}{ \sum_{i=1}^{n_0} V_{0i}^{(b)}}.$$The variance of \(\hat{\Delta}\) is obtained as the empirical variance of \(\{\hat{\Delta}^{(b)}, b = 1,...,D\}.\) In this package, we use weights generated from an Exponential(1) distribution and use \(D=500\). We construct two versions of the \(95\%\) confidence interval for \(\hat{\Delta}\): one based on a normal approximation confidence interval using the estimated variance and another taking the 2.5th and 97.5th empirical percentiles of \(\hat{\Delta}^{(b)}\).
data(d_example)
names(d_example)
delta.estimate(yone=d_example$y1, yzero=d_example$y0)
Run the code above in your browser using DataLab