Instrumental Variables Regression (IV Regression) - R for Economists Moderate 4

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024
  • This series of videos will serve as an introduction to the R statistics language, targeted at economists.
    In this video we cover how to perform an instrumental variables regression using ivreg() from the AER package. We also cover how to estimate the first stage separately, and run an F-test on the instruments using linearHypothesis().
    Also, oops, I totally goofed on the source of the AER package. It is indeed from Applied Econometrics with R, but that is an entirely separate book from Florian Heiss' Using R for Introductory Econometrics! Heiss' book can be found in free ebook form here: urfie.net/read/...
    Download the code from all my R videos at once at nickchk.com/R%...
    You can find links to every video in the series here: nickchk.com/vid...
    There are videos on: [BASIC] Getting Started, Getting Help, Objectives and Variables, Vectors and Matrices, Data Frames, Packages, Summary Statistics (of One and Two Variables), Plots and Graphs, and Linear Regression (OLS), [MODERATE] Regression Formulas, Robust or Clustered Standard Errors and Post-Regression Stats, Regression Plots, Instrumental Variables (IV Regression), Time Series, ARIMA and ARMA, Probit and Logit, Tobit and Heckman, Panel Data, and Missing Data, and [ADVANCED] Simulations, The Tidyverse, Reshape and Join/Merge, dplyr (Introduction, Piping, and Grouping), ggplot (Introduction, Geometries, Overlaid and Grouped Plots, and Titles and Labels), and vtable

Комментарии • 31

  • @bruhigo
    @bruhigo 3 года назад +1

    Thank you for you contribution to R knowledge, Mr. Huntington-Klein. Haven't found an article on the Internet, on how to calculate first-stage reg in R. Your video helped a lot actually and saved hours of search.

  • @luisdavidsosarodriguez9771
    @luisdavidsosarodriguez9771 3 года назад

    I've followed you on Twitter for so long and I didn't know you have a RUclips channel!. I'm so happy because now I know how I'm gonna spend my vacations (I really need to improve in R).
    Thank you for all your contributions for students around the world :)

  • @alessandropaul9808
    @alessandropaul9808 4 года назад +1

    Thanks a lot! Among all my search results you were the one who helped me complete my homework :)
    Edit: And more importantly, understand the concept.

  • @madanydiallo7573
    @madanydiallo7573 2 года назад

    Dude, it's really amazing how easy you are to explain things, thank you! 😁

  • @javierbeltran7623
    @javierbeltran7623 5 лет назад +1

    This is a great job mate!...I only wanted to say thank you for your effort and dedication (and I am waiting for the Panel Data Session!!!)...Thanks again!!!

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  5 лет назад

      Thank you! Panel data is coming in the next batch of videos, probably filming this weekend and posting next week.

    • @javierbeltran7623
      @javierbeltran7623 5 лет назад

      Amazing!!...I am doing my PhD in Australia and I have built a Panel, but I do not feel really confident with the "empirical strategy" to follow to analyze my data with the plm and the splm packages. Running the commands is the easy part, but interpreting and deciding which is the "better model" can be hard...Thanks again...

  • @lixunsu1172
    @lixunsu1172 4 года назад

    Great job. I just wanted to say thank you.

  • @klopplegend4520
    @klopplegend4520 Год назад

    Also another Q, im assuming the same method can be used for panel data? Thanks in advance !

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Год назад +1

      Yep.

    • @klopplegend4520
      @klopplegend4520 Год назад

      @@NickHuntingtonKlein thanks! Was wondering if i need to use fixed effects but guess the instrument already gives as good as random variation

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Год назад

      @@klopplegend4520 You might - FE might improve precision or be necessary to support your validity assumption. But it's not by default necessary.

    • @klopplegend4520
      @klopplegend4520 Год назад

      @@NickHuntingtonKlein you're a legend! Thanks

  • @BrayneStatic
    @BrayneStatic 5 лет назад

    I'm probably still going to be coming back to these videos years after I graduate :)

  • @oussamazennati2084
    @oussamazennati2084 5 лет назад

    Thank you for this useful video.
    However, i have one question:
    Is this function (ivreg) is usable with binomial variables?
    By advance thanks

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  5 лет назад +1

      In the dependent variable? You're probably fine although you might consider use of the ivpoisson package. If you mean binary instead of binomial, then don't use ivreg, use the ivprobit package instead.

  • @patrickstender6949
    @patrickstender6949 4 года назад

    Hello Nick, is there a way to use the ivreg() command together with a fixed effects model?
    Thank you!

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  4 года назад +1

      The felm command in the lfe package, or the iv_robust command in the estimatr package can both do this. Former is more powerful, latter easier to use.

    • @patrickstender6949
      @patrickstender6949 4 года назад

      @@NickHuntingtonKlein thanks for your support! i used the iv_robust() command and included company and year fixed effects. for testing if my instrument is weak/strong, I tried the linearHypothesis() command which you used in your iv_reg() tutorial based on a firststage regression for which I used the lm_robust() command and same fixed effects.
      However, the linearHypothesis() command does not return a F-value for my instrument. Do you have any idea how the test for weak/strong instrument can work with iv_robust() ???
      Again big thank you! :) your videos are really helpful!

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  4 года назад +1

      @@patrickstender6949 set the diagnostics option to TRUE and it will do it automatically

  • @YassineYassine-xw8ty
    @YassineYassine-xw8ty 3 года назад

    is it possible to use a binary variable as an instrument ?

  • @swatisingh6845
    @swatisingh6845 4 года назад

    Thanks for the video. How can we use the method in panel data?

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  4 года назад

      The plm or lfe packages are both capable of this, see for example stats.stackexchange.com/questions/243438/test-excluded-instrument-in-r-plm-package

  • @klopplegend4520
    @klopplegend4520 Год назад

    my f statistic is over 200. is this a problem?

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Год назад

      Not necessarily a problem but worth checking - if you look at your first stage do you get something that looks like near-perfect multicollinearity (e.g. an R^2 very near 1?) if so there may be something degenerate about your model where you're basically using the endogenous variable to predict itself in some way. But if that's not the case, then you've just got a super good instrument and thumbs up to that.

    • @klopplegend4520
      @klopplegend4520 Год назад

      @@NickHuntingtonKlein thank you for your prompt response. My r square is actually not close to one for the first stage. More like 0.75. so i guess I'm fine! Thanks for your response :) and your videos are super helpful.