Skip to content

Commit

Permalink
Clarify covariate adjustment in vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
kolesarm committed Mar 19, 2024
1 parent 82e3fd1 commit d5e66fb
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 25 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: RDHonest
Title: Honest Inference in Regression Discontinuity Designs
Version: 0.9.0
Version: 1.0.0
Authors@R:
c(person(given = "Michal",
family = "Kolesár",
Expand Down
3 changes: 2 additions & 1 deletion R/Cbound.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
#' }
#' @examples
#' ## Subset data to increase speed
#' r <- RDHonest(log(earnings)~yearat14, data=cghs, subset=abs(yearat14-1947)<10,
#' r <- RDHonest(log(earnings)~yearat14, data=cghs,
#' subset=abs(yearat14-1947)<10,
#' cutoff=1947, M=0.04, h=3)
#' RDSmoothnessBound(r, s=2)
#' @export
Expand Down
4 changes: 2 additions & 2 deletions R/RDHonest.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
#' computed according to criterion given by \code{opt.criterion}.
#' @param weights Optional vector of weights to weight the observations (useful
#' for aggregated data). The weights are interpreted as the number of
#' observations that each aggregated data point averages over. Disregarded if
#' optimal kernel is used.
#' observations that each aggregated data point averages over. Disregarded
#' if optimal kernel is used.
#' @param point.inference Do inference at a point determined by \code{cutoff}
#' instead of RD.
#' @param T0 Initial estimate of the treatment effect for calculating the
Expand Down
22 changes: 13 additions & 9 deletions doc/RDHonest.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ unadjusted estimate that replaces the original outcome $Y_{i}$ with the
covariate-adjusted outcome $Y_{i}-W_{i}'\tilde{\gamma}_{Y, h}$. The second
equality uses the decomposition
$Y_{i}-W_{i}'\tilde{\gamma}_{Y, h}=\tilde{Y}_{i}-W_{i}'
(\tilde{\gamma}_{Y h}-\gamma_{Y})$
(\tilde{\gamma}_{Y, h}-\gamma_{Y})$
to write the estimator as a sum of the infeasible estimator and a linear
combination of "placebo RD estimators" $\hat{\tau}_{W_{k}, h}$, that
replace $Y_{i}$ in the outcome equation with the $k$th element of $W_{i}$,
Expand Down Expand Up @@ -673,14 +673,18 @@ of the covariate-adjusted outcome. In our implementation, we first estimate the
model without covariates (using a rule of thumb to calibrate $M$, the bound on
the second derivative of $f_{Y}$), and compute the bandwidth $\check{h}$ that's
MSE optimal without covariates. Based on this bandwidth, we compute a
preliminary estimate $\check{\gamma}_{Y, \check{h}}$ of $\gamma_{Y}$, and use
this preliminary estimate to compute the covariate-adjusted outcome
$Y_{i}-W_{i}'\check{\gamma}_{Y, \check{h}}$. If $\tilde{M}$ is not supplied, we
calibrate $\tilde{M}$ using the rule of thumb, using this covariate-adjusted
outcome as the outcome. Similarly, we use this covariate-adjusted outcome as the
outcome to compute a preliminary estimator of the conditional variance
$\sigma^{2}_{\tilde{Y}}(x_{i})$, for optimal bandwidth calculations, as in the
case without covariates.
preliminary estimate $\tilde{\gamma}_{Y, \check{h}}$ of $\gamma_{Y}$, and use
this preliminary estimate to compute a preliminary covariate-adjusted outcome
$Y_{i}-W_{i}'\tilde{\gamma}_{Y, \check{h}}$. If $\tilde{M}$ is not supplied, we
calibrate $\tilde{M}$ using the rule of thumb, using this preliminary
covariate-adjusted outcome as the outcome. Similarly, we use this preliminary
covariate-adjusted outcome as the outcome to compute a preliminary estimator of
the conditional variance $\sigma^{2}_{\tilde{Y}}(x_{i})$, for optimal bandwidth
calculations, as in the case without covariates. With this choice of bandwidth
$h$, in the second step, we estimate $\tau_Y$ using the estimator
$\tilde{\tau}_{Y, h}$ defined above.



A demonstration using the `headst` data:
```{r}
Expand Down
Binary file modified doc/RDHonest.pdf
Binary file not shown.
Binary file modified doc/manual.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions man/RDHonest.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/RDSmoothnessBound.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 13 additions & 9 deletions vignettes/RDHonest.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ unadjusted estimate that replaces the original outcome $Y_{i}$ with the
covariate-adjusted outcome $Y_{i}-W_{i}'\tilde{\gamma}_{Y, h}$. The second
equality uses the decomposition
$Y_{i}-W_{i}'\tilde{\gamma}_{Y, h}=\tilde{Y}_{i}-W_{i}'
(\tilde{\gamma}_{Y h}-\gamma_{Y})$
(\tilde{\gamma}_{Y, h}-\gamma_{Y})$
to write the estimator as a sum of the infeasible estimator and a linear
combination of "placebo RD estimators" $\hat{\tau}_{W_{k}, h}$, that
replace $Y_{i}$ in the outcome equation with the $k$th element of $W_{i}$,
Expand Down Expand Up @@ -673,14 +673,18 @@ of the covariate-adjusted outcome. In our implementation, we first estimate the
model without covariates (using a rule of thumb to calibrate $M$, the bound on
the second derivative of $f_{Y}$), and compute the bandwidth $\check{h}$ that's
MSE optimal without covariates. Based on this bandwidth, we compute a
preliminary estimate $\check{\gamma}_{Y, \check{h}}$ of $\gamma_{Y}$, and use
this preliminary estimate to compute the covariate-adjusted outcome
$Y_{i}-W_{i}'\check{\gamma}_{Y, \check{h}}$. If $\tilde{M}$ is not supplied, we
calibrate $\tilde{M}$ using the rule of thumb, using this covariate-adjusted
outcome as the outcome. Similarly, we use this covariate-adjusted outcome as the
outcome to compute a preliminary estimator of the conditional variance
$\sigma^{2}_{\tilde{Y}}(x_{i})$, for optimal bandwidth calculations, as in the
case without covariates.
preliminary estimate $\tilde{\gamma}_{Y, \check{h}}$ of $\gamma_{Y}$, and use
this preliminary estimate to compute a preliminary covariate-adjusted outcome
$Y_{i}-W_{i}'\tilde{\gamma}_{Y, \check{h}}$. If $\tilde{M}$ is not supplied, we
calibrate $\tilde{M}$ using the rule of thumb, using this preliminary
covariate-adjusted outcome as the outcome. Similarly, we use this preliminary
covariate-adjusted outcome as the outcome to compute a preliminary estimator of
the conditional variance $\sigma^{2}_{\tilde{Y}}(x_{i})$, for optimal bandwidth
calculations, as in the case without covariates. With this choice of bandwidth
$h$, in the second step, we estimate $\tau_Y$ using the estimator
$\tilde{\tau}_{Y, h}$ defined above.



A demonstration using the `headst` data:
```{r}
Expand Down

0 comments on commit d5e66fb

Please sign in to comment.