Tuesday, March 8, 2011

Video Tutorial on Instrumental Variables in R

Update: I have replaced this video tutorial with a video tutorial on a newer, easier to use IV regression command. Check out that command here.

In this video, I show how to use my instrumental variables function in R, ivreg(), along with its companion summary command, sum.iv().

Here is a link to the synthetic "market share" data I used in the video.


  1. Was there a problem in the IV functions in the AER, systemfit, or sem packages that led you to write your own IV estimation function?

  2. Good question. When I wrote the first function (my ivreg()), I was only aware of the tsls() command. I thought the syntax was awkward and I found the command to be hard to use, so I thought it would be a good exercise for myself to write my own function. At the time, I thought that if others find my function useful, great.

    Recently (a few months ago), I came across the aer library implementation, which has better syntax (but I still didn't like how the formula statement works), so I rewrote the function to work with a better (more like lm()) formula statement (my ivregress() command; see my newer post than this). I plan to post a video tutorial on how to use this newer command (but also how to use the more standard ones in aer). I will post that in a couple of weeks at the latest.