<p>In real life you do not simply construct instrument, that is a language you might see in some econometrics textbooks when they discus the model theoretically, e.g. &quot;to get rid of simultaneity we construct instrument that has this or that property&quot;, but in real life you don't actually construct the series.</p>
<p>In real life you record data for some variable you believe will be good instrument. A good instrument should satisfy the properties you mention. There are no hard rules here, you need to think about it hard. Good examples are things like using draft lottery when estimating returns to education such as done by Angrist and Kruger. Draft clearly affects education, and since people were drafted by lottery its guaranteed its exogenous and <span class="math-container">$Cov(Z_i,ϵ_i)=0$</span>.</p>
<p>A one way how you implement this, in lets say <code>R</code>   is as follows:</p>
<p>You can use package ivreg:</p>
<pre><code>install.packages(&quot;ivreg&quot;)
library(&quot;ivreg&quot;)
</code></pre>
<p>Get yourself data, for the purpose of demonstration I will use:</p>
<pre><code>data(&quot;SchoolingReturns&quot;, package = &quot;ivreg&quot;)
</code></pre>
<p>Next since we already have all the data we can run a model. We can do simple Mincer equation</p>
<pre><code>my_iv &lt;- ivreg(log(wage) ~ education + poly(experience, 2h) |
  nearcollege + poly(age, 2),
  data = SchoolingReturns)
</code></pre>
<p>Where the first set of variables are the variables in second stage and after <code>| </code>there is a set of instruments. We use proximity to college as an instrument for education (since being closer to university makes you more likely to attend one, but arguably your location is exogenous), and age for experience.</p>
<p>As you see you do not create the instrument in some computational way inside your PC. You go out and find data on variable that you can defend being a good instrument. You can use Hausman test or F-test to see whether the regression is consistent or whether first stage is strong to support the use of instrument. You can also run auxiliary first stage to examine whether the instrument is significant when regressed on endogenous regressor. For that you would just run regular regression where dependent variable is the a dependent variable and instrument will be  independent variable.</p>

CC BY-SA 4.0
2023-02-07T02:06:11.493Z
Thanks for the answer! It is much more clear to me how it actually works in practice. What do you mean by draft? I just searched Angrist and Kruger, and from my understanding, they use the quarter of the year people are born in as an instrument, due to compulsory schooling regulations by age.
Nicolas Torres
CC BY-SA 4.0
2023-02-07T15:02:04.670Z
@NicolasTorres I know the paper you are referring to but they also have different paper where they use US draft lottery, here is the paper if interested https://www.nber.org/papers/w4067.
1muflon1
CC BY-SA 4.0
2023-02-06T22:16:25.157Z
2023-02-06T22:16:25.157Z
1muflon1
<p>I was taught in my first econometrics course that if I have a model</p>
<p><span class="math-container">$y_i = \beta_0 + \beta_1 X_i + \epsilon_i$</span>,</p>
<p>but it had an endogeneity problem, i.e. <span class="math-container">$E(\epsilon_i | X_i) \neq 0$</span>, I could solve it by creating some instrument variable <span class="math-container">$Z_i$</span> with the following properties:</p>
<ul>
<li><span class="math-container">$Cov(Z_i, \epsilon_i) = 0$</span></li>
<li><span class="math-container">$Cov(Z_i, X_i) \neq 0$</span>.</li>
</ul>
<p>The properties make sense to me: I want a new variable that is still related to the independent variable we are studying <span class="math-container">$X_i$</span>, but kind of independent with the error term to solve the problem we had in the first place.</p>
<p>But I never knew how to actually come up with or construct an explicit instrument to be able to actually use instrumental variables in a practical situation.</p>
<p>I would appreciate some sort of explanation or example.</p>

CC BY-SA 4.0
2023-02-06T16:06:49.997Z
what exactly you mean by construct here? Like you want to know the math behind it?  Or just some example someone running 2SLS in R by manually doing first stage? Instrument is a variable by the way, you do not really construct it, you typically find some variable that can serve as an instrument
1muflon1
CC BY-SA 4.0
2023-02-06T20:56:26.247Z
@1muflon1 I would like to see it implemented on R as you suggest it. The theory behind it seemed like just confusing to me.
Nicolas Torres
CC BY-SA 4.0
2023-02-06T21:56:56.233Z
please dont swear, this site is moderated you are not supposed to use pejoratives and it wastes our mod time to edit/delete such comments
1muflon1
<econometrics>
How to construct an actual instrument?
Nicolas Torres
# How to construct an actual instrument?

(Asked by: username_0 on 2023-02-06)

I was taught in my first econometrics course that if I have a model

$y\_i = \beta\_0 + \beta\_1 X\_i + \epsilon\_i$,

but it had an endogeneity problem, i.e. $E(\epsilon\_i | X\_i) \neq 0$, I could solve it by creating some instrument variable $Z\_i$ with the following properties:

* $Cov(Z\_i, \epsilon\_i) = 0$
* $Cov(Z\_i, X\_i) \neq 0$.

The properties make sense to me: I want a new variable that is still related to the independent variable we are studying $X\_i$, but kind of independent with the error term to solve the problem we had in the first place.

But I never knew how to actually come up with or construct an explicit instrument to be able to actually use instrumental variables in a practical situation.

I would appreciate some sort of explanation or example.

**Tags:** econometrics

> **Comments:**
> **username_1**: what exactly you mean by construct here? Like you want to know the math behind it?  Or just some example someone running 2SLS in R by manually doing first stage? Instrument is a variable by the way, you do not really construct it, you typically find some variable that can serve as an instrument  
> **username_0**: @username_1 I would like to see it implemented on R as you suggest it. The theory behind it seemed like just confusing to me.  
> **username_1**: please dont swear, this site is moderated you are not supposed to use pejoratives and it wastes our mod time to edit/delete such comments  

---

## 1 answers

### Answer by username_1 on 2023-02-06. Score: 2 | Accepted answer

In real life you do not simply construct instrument, that is a language you might see in some econometrics textbooks when they discus the model theoretically, e.g. "to get rid of simultaneity we construct instrument that has this or that property", but in real life you don't actually construct the series.
In real life you record data for some variable you believe will be good instrument. A good instrument should satisfy the properties you mention. There are no hard rules here, you need to think about it hard. Good examples are things like using draft lottery when estimating returns to education such as done by Angrist and Kruger. Draft clearly affects education, and since people were drafted by lottery its guaranteed its exogenous and $Cov(Z_i,ϵ_i)=0$.
A one way how you implement this, in lets say R   is as follows:
You can use package ivreg:
install.packages("ivreg")
library("ivreg")

Get yourself data, for the purpose of demonstration I will use:
data("SchoolingReturns", package = "ivreg")

Next since we already have all the data we can run a model. We can do simple Mincer equation
my_iv <- ivreg(log(wage) ~ education + poly(experience, 2h) |
  nearcollege + poly(age, 2),
  data = SchoolingReturns)

Where the first set of variables are the variables in second stage and after | there is a set of instruments. We use proximity to college as an instrument for education (since being closer to university makes you more likely to attend one, but arguably your location is exogenous), and age for experience.
As you see you do not create the instrument in some computational way inside your PC. You go out and find data on variable that you can defend being a good instrument. You can use Hausman test or F-test to see whether the regression is consistent or whether first stage is strong to support the use of instrument. You can also run auxiliary first stage to examine whether the instrument is significant when regressed on endogenous regressor. For that you would just run regular regression where dependent variable is the a dependent variable and instrument will be  independent variable.

> **Comments:**
> **username_0**: Thanks for the answer! It is much more clear to me how it actually works in practice. What do you mean by draft? I just searched Angrist and Kruger, and from my understanding, they use the quarter of the year people are born in as an instrument, due to compulsory schooling regulations by age.  
> **username_1**: @NicolasTorres I know the paper you are referring to but they also have different paper where they use US draft lottery, here is the paper if interested https://www.nber.org/papers/w4067.  

---

