sreg {sreg} | R Documentation |
Estimate the ATE(s) and the corresponding standard error(s) for a (collection of) treatment(s) relative to a control.
sreg(Y, S = NULL, D, G.id = NULL, Ng = NULL, X = NULL, HC1 = TRUE)
Y |
a numeric |
S |
a numeric |
D |
a numeric |
G.id |
a numeric |
Ng |
a numeric |
X |
a |
HC1 |
a |
An object of class sreg
that is a list containing the following elements:
tau.hat
: a 1 \times |\mathcal A|
vector
of ATE estimates, where |\mathcal A|
represents the number of treatments
se.rob
: a 1 \times |\mathcal A|
vector
of standard errors estimates, where |\mathcal A|
represents the number of treatments
t.stat
: a 1 \times |\mathcal A|
vector
of t
-statistics, where |\mathcal A|
represents the number of treatments
p.value
: a 1 \times |\mathcal A|
vector
of corresponding p
-values, where |\mathcal A|
represents the number of treatments
CI.left
: a 1 \times |\mathcal A|
vector
of the left bounds of the 95% as. confidence interval
CI.right
: a 1 \times |\mathcal A|
vector
of the right bounds of the 95% as. confidence interval
data
: an original data of the form data.frame(Y, S, D, G.id, Ng, X)
lin.adj
: a data.frame
representing the covariates that were used in implementing linear adjustments
Authors:
Juri Trifonov jutrifonov@uchicago.edu
Yuehao Bai yuehao.bai@usc.edu
Azeem Shaikh amshaikh@uchicago.edu
Max Tabord-Meehan maxtm@uchicago.edu
Maintainer:
Juri Trifonov jutrifonov@uchicago.edu
Bugni, F. A., Canay, I. A., and Shaikh, A. M. (2018). Inference Under Covariate-Adaptive Randomization. Journal of the American Statistical Association, 113(524), 1784–1796, doi:10.1080/01621459.2017.1375934.
Bugni, F., Canay, I., Shaikh, A., and Tabord-Meehan, M. (2024+). Inference for Cluster Randomized Experiments with Non-ignorable Cluster Sizes. Forthcoming in the Journal of Political Economy: Microeconomics, doi:10.48550/arXiv.2204.08356.
Jiang, L., Linton, O. B., Tang, H., and Zhang, Y. (2023+). Improving Estimation Efficiency via Regression-Adjustment in Covariate-Adaptive Randomizations with Imperfect Compliance. Forthcoming in Review of Economics and Statistics, doi:10.48550/arXiv.2204.08356.
library("sreg")
library("dplyr")
library("haven")
### Example 1. Simulated Data.
data <- sreg.rgen(n = 1000, tau.vec = c(0), n.strata = 4, cluster = FALSE)
Y <- data$Y
S <- data$S
D <- data$D
X <- data.frame("x_1" = data$x_1, "x_2" = data$x_2)
result <- sreg(Y, S, D, G.id = NULL, Ng = NULL, X)
print(result)
### Example 2. Empirical Data.
?AEJapp
data("AEJapp")
data <- AEJapp
head(data)
Y <- data$gradesq34
D <- data$treatment
S <- data$class_level
data.clean <- data.frame(Y, D, S)
data.clean <- data.clean %>%
mutate(D = ifelse(D == 3, 0, D))
Y <- data.clean$Y
D <- data.clean$D
S <- data.clean$S
table(D = data.clean$D, S = data.clean$S)
result <- sreg(Y, S, D)
print(result)
pills <- data$pills_taken
age <- data$age_months
data.clean <- data.frame(Y, D, S, pills, age)
data.clean <- data.clean %>%
mutate(D = ifelse(D == 3, 0, D))
Y <- data.clean$Y
D <- data.clean$D
S <- data.clean$S
X <- data.frame("pills" = data.clean$pills, "age" = data.clean$age)
result <- sreg(Y, S, D, G.id = NULL, X = X)
print(result)