Skip to content

Commit

Permalink
fix readme
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaswiemann committed Nov 28, 2023
1 parent c9dbdc2 commit b53271c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
5 changes: 1 addition & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ devtools::install_github("thomaswiemann/civ", dependencies = TRUE)
To illustrate ``civ`` on a simple example, consider the data generating process from the simulation of Wiemann (2023): For $i = 1, \ldots, n$, the data generating process is given by $$
Y_i = D_i \pi_{0}(X_i) + X_i\beta_0 + U_i,\qquad \text{and} \qquad
D_i= m_0(Z_i) + X_i\gamma_0 + V_i,
$$
where $(U_i, V_i)\sim \mathcal{N}(0, \left[\begin{smallmatrix}
1 & 0.6 \\
0.6 & \sigma_V^2 \end{smallmatrix}\right])$, $D_i$ is a scalar-valued endogenous variable, $X_i\sim\textrm{Bernoulli}(0.5)$ is a binary covariate and $\beta_0 = \gamma_0 = 0$, and $Z_i$ is the categorical instrument taking values in ${1, \ldots, 40\}$ with equal probability. To introduce correlation between $Z_i$ and $X_i$, I further set $\Pr(Z_i \text{ is odd}\vert X_i = 0) = \Pr(Z_i \text{ is even}\vert X_i = 1) = 0$. The optimal instrument $m_0$ is constructed by first partitioning the support of $Z_i$ into two equal subsets and then assigning either $0$ or $C$ as values. I choose the scalars $\sigma_V^2$ and $C$ such that the variance of the first stage variable is fixed to 1 and the concentration parameter for $n=800$ is $\mu^2 = 180$. The data generating process allows for individual treatment effects $\pi_0(X_i)$ to differ with covariates. Here, $\pi_0(X_i) = 1 + 0.5(1 - 2X_i)$ so that the expected treatment effect is simply $E\pi_0(X) = 1.$
$$ where $(U_i, V_i)$ are mean-zero multivariate normal with $\sigma_U^2 = 1$, $\sigma_V^2 =\sqrt{0.81}$, and $\sigma_{UV} = 0.6$. $D_i$ is a scalar-valued endogenous variable, $X_i\sim\textrm{Bernoulli}(0.5)$ is a binary covariate and $\beta_0 = \gamma_0 = 0$, and $Z_i$ is the categorical instrument taking values in $\{1, \ldots, 40\}$ with equal probability. To introduce correlation between $Z_i$ and $X_i$, I further set $\Pr(Z_i \text{ is odd}\vert X_i = 0) = \Pr(Z_i \text{ is even}\vert X_i = 1) = 0$. The optimal instrument $m_0$ is constructed by first partitioning the support of $Z_i$ into two equal subsets and then assigning either $0$ or $C$ as values. The scalars $\sigma_V^2$ and $C$ are chosen such that the variance of the first stage variable is fixed to 1 and the concentration parameter for $n=800$ is $\mu^2 = 180$. The data generating process allows for individual treatment effects $\pi_0(X_i)$ to differ with covariates. Here, $\pi_0(X_i) = 1 + 0.5(1 - 2X_i)$ so that the expected treatment effect is simply $E\pi_0(X) = 1.$

The code snippet below draws $n=800$ observations from this data generating
process.
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ process from the simulation of Wiemann (2023): For $i = 1, \ldots, n$,
the data generating process is given by $$
Y_i = D_i \pi_{0}(X_i) + X_i\beta_0 + U_i,\qquad \text{and} \qquad
D_i= m_0(Z_i) + X_i\gamma_0 + V_i,
$$ where
$(U_i, V_i)\sim \mathcal{N}(0, \left[\begin{smallmatrix} 1 & 0.6 \\ 0.6 & \sigma_V^2 \end{smallmatrix}\right])$,
$$ where $(U_i, V_i)$ are mean-zero multivariate normal with
$\sigma_U^2 = 1$, $\sigma_V^2 =\sqrt{0.81}$, and $\sigma_{UV} = 0.6$.
$D_i$ is a scalar-valued endogenous variable,
$X_i\sim\textrm{Bernoulli}(0.5)$ is a binary covariate and
$\beta_0 = \gamma_0 = 0$, and $Z_i$ is the categorical instrument taking
values in ${1, \ldots, 40\}$ with equal probability. To introduce
values in $\{1, \ldots, 40\}$ with equal probability. To introduce
correlation between $Z_i$ and $X_i$, I further set
$\Pr(Z_i \text{ is odd}\vert X_i = 0) = \Pr(Z_i \text{ is even}\vert X_i = 1) = 0$.
The optimal instrument $m_0$ is constructed by first partitioning the
support of $Z_i$ into two equal subsets and then assigning either $0$ or
$C$ as values. I choose the scalars $\sigma_V^2$ and $C$ such that the
$C$ as values. The scalars $\sigma_V^2$ and $C$ are chosen such that the
variance of the first stage variable is fixed to 1 and the concentration
parameter for $n=800$ is $\mu^2 = 180$. The data generating process
allows for individual treatment effects $\pi_0(X_i)$ to differ with
Expand Down

0 comments on commit b53271c

Please sign in to comment.