Econometrics - Interaction Terms

Поделиться
HTML-код
  • Опубликовано: 28 ноя 2024

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

  • @arifmemovic3383
    @arifmemovic3383 Год назад +2

    You have a gift for teaching econometrics! When I am learning a new concept, or need a refresher, your channel is one of the first supplementary sources I turn to. Thank you so much for providing these lessons free of charge to the public.

  • @cartilo2619
    @cartilo2619 21 день назад

    great lecture, finally pieced together what I was lacking in class lectures

  • @nickvarney8148
    @nickvarney8148 9 месяцев назад

    This is the best explanation for interaction terms I've come across. Thank you again for your consistent clarity!

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

    Hi Nick, Thank you for the wonderful video. I am two continuous variables in my growth model. One important thing with the interaction terms is that we have to calculate substantively meaningful marginal effects and standard errors (Brambor et al. 2005). Could you please show how to do this in STATA?

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

      See my video on "interaction terms in Stata". Then look into the margins command for calculating marginal effects at different values.

  • @sangcheolsong6530
    @sangcheolsong6530 9 месяцев назад

    one question about three-way interaction terms. Let's label each variable A(main variable), B(1st moderator), C (2nd moderator). I'm interested in (hypothesize) the relationships A-B and A-B-C. Should all two-way (AB, AC, BC) and three-way interaction terms (A * B * C) be included in a regression model and result or would be it fine to include some of interest (AB, ABC) only?

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  9 месяцев назад

      Yes, you want to include all the terms. Otherwise you're inducing a kind of omitted variable bias.

  • @takesuretozooneyi4836
    @takesuretozooneyi4836 8 месяцев назад

    Hi Nicky. I have been looking for a video explaining interaction of two dummies for a long long time. Thanks for saving my thesis. I was wondering, in the case of your example, if we can make margin and interaction plots in stata, and how we can explain them. thanks.

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  8 месяцев назад

      Glad you liked the video! I think you do those in Stata with marginsplot although I haven't used Stata really in ages. I'd recommend checking this page, which I believe has Stata implementations of both (which maybe I wrote? I don't remember) lost-stats.github.io/Presentation/Figures/Figures.html

    • @takesuretozooneyi4836
      @takesuretozooneyi4836 8 месяцев назад

      @@NickHuntingtonKlein Thank you. Let me check it out.

  • @victorantunes3357
    @victorantunes3357 8 месяцев назад

    Hello! This is awesome. Two questions, if I may: could I interpret just the way you did it, but with Odds Ratios? And, if I find non-statistically significant interactions, can I still calculate predicted probabilities and present them in my paper?
    Many thanks for this!

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  8 месяцев назад

      Things get a bit more complex when you wander outside of linear regression. If you're getting those ORs from a logit/probit, for example, then you need the full cross product which is a bit more complex, see Ai and Norton (2003). But yes you can still use interaction terms, get predicted probabilities, and present them. www.sciencedirect.com/science/article/pii/S0165176503000326?casa_token=qgjcQx7R5GMAAAAA:A4pBwhzjRjDIT9KNABtTxlJrlBMr4_NPJH-A-GFB7euOlpUMLklRKPpjIArWeP_w6S9LuYY8bw

    • @victorantunes3357
      @victorantunes3357 8 месяцев назад

      @@NickHuntingtonKlein
      Many thanks for your response and time!

    • @victorantunes3357
      @victorantunes3357 8 месяцев назад

      Professor, may I ask you something else?
      As I said I would do, I have calculated predicted probabilities for every combination of categories of my two categorical variables (the ones that were interacted).
      This is the objective of my paper: Previous research has also found that health status is negatively associated with elder mistreatment (Acierno et al. 2017; Koga et al. 2019). However, social support might moderate the relationship between health status and elder mistreatment (Acierno et al. 2017). Hence, our second objective is to investigate the possible mediating effect of social support in Brazil. We hypothesize that social support mitigates the negative relationship between health status and elder mistreatment (Acierno et al. 2017). So, I want to see if support mitigates the negative relationship between health status and elder mistreatment.
      In this sense, my dependent variable is Elder Mistreatment (1 = Yes; 0 = No). My variable of health status is the self-rated health status, which has the following categories: Bad, Regular, and Good. And, my variable of social support is about how many family members the elder can count on, categorized as follows: None, One or Two, and Three or more.
      I then interacted social support with health status, and got the following predicted probabilities:
      * If social support is none and self-rated health is bad: Lower * Interval = 17.89; Probability = 23.68; Upper Interval = 29.47.
      * If social support is none and self-rated health is good: Lower Interval = 9.46; Probability = 12.49; Upper Interval = 15.51.
      * If social support is three or more and self-rated health is bad: Lower Interval = 8.47; Probability = 10.45; Upper Interval = 12.42.
      * If social support is three or more and self-rated health is good: Lower Interval = 4.83; Probability = 5.86; Upper Interval = 6.89.
      Based on this, could I conclude the following?
      There is no crossing of predicted probabilities (and their respective confidence intervals) between the levels of bad and good health, regardless of the level of social support (none vs. three or more). That is, there is at least one statistically significant negative association between health status and elder mistreatment for each of the levels of social support. Additionally, as social support increases, the negative association found occurs at lower predicted probabilities. Therefore, we have evidence that greater social support mitigates the negative association between health status and elder mistreatment, which supports our hypothesis.
      I'm confused if I can conclude such a thing. That is, if I am interpreting my results correctly.
      Many many thanks for this!

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  8 месяцев назад

      Ignoring statistical significance for a moment, your predicted probabilities are showing a smaller percentage-point gap between good and bad health at high levels of social support (10.45-5.86=4.59) than at low levels of social support (23.67-12.49=11.18). In percentage-point terms, that does mean that social support moderates teh effect of health (since health has a smaller percentage-point effect at higher levels of social support than at lower levels). However, that's in percentage-point terms. I don't know whether that gap is still changing if you're looking at odds-ratio terms.
      Now bringing back in statistical significance, unfortuntately, "these two confidence intervals do/do not overlap" does not perfectly correspond to "the difference between these two things is not/is significant." Related ideas but not the same thing. If you want to check if the interaction (or any of the other differences) are significant, you're better off using a method that lets you actually test the significance of the difference of these methods. In the case of the interaction I recommend the Ai and Norton paper I mentioned earlier. In general, the marginaleffects package in R, or the margins function in Stata, are helpful for doing significance calculations on things like this.@@victorantunes3357

    • @victorantunes3357
      @victorantunes3357 8 месяцев назад

      @@NickHuntingtonKlein This is great! Many thanks again! Best regards!

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

    Hi, Nick, great explanation! May I ask a question? Is the interaction effect always smaller than the main effects? Can you explain a little why that is?

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

      It doesn't have to be but we'd expect that to be the case most of the time. Interaction effects represent a difference in effect. If we're talking about an interaction with a binary variable, there just aren't that many effects that are more than twice as large for one group than for another, in real terms.

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

    Hi Nick, This is very helpful. May I ask a question? In the example, the coefficient on the interaction term (marriage * collage) is actually insignificant. Do we still need to add that coefficient when we interpreting the regression?

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

      Yes. If it's in the model you need to account for it in interpretation.

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

      @@NickHuntingtonKlein Thank you!

  • @EmiliaSesmapriester
    @EmiliaSesmapriester 10 месяцев назад

    Hey Nick. Thank you for your videos they do really help. I am writing my thesis and I just want to make sure whether I can have the regression analysis done this way: my dependent variable is measured with a likert scale. And I wanted to make sure if I can have my independent variable and my moderator done with a binary variable (with yes and no). Thank you so much!

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  10 месяцев назад

      Yep, no problem mixing an ordinal outcome with binary predictors. Formally, an ordered logit model would be better for likert scale data than ols, but in my opinion ols *usually* works fine anyway, and for an undergrad thesis I wouldn't bother with ordered logit.

    • @EmiliaSesmapriester
      @EmiliaSesmapriester 10 месяцев назад

      Thank you for your fast response! I don’t know if you’ll be able to answer but I have a follow up question: My research proposal has as an dependent variable is Customer Perception. However I am looking at the regression analysis for the sub hypothesis which are related to Quality and Purchase intention (so they fall inside customer perception). I am then the regression analysis mentioned before for Purchase intention, and the same one for Quality. I would appreciate if you have some insight in whether this analysis is sufficient in order to determine the customer perception, or if a joint mean of both regressions would be necessary instead.@@NickHuntingtonKlein

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  10 месяцев назад

      @@EmiliaSesmapriester from what I understand from your description that sounds fine

    • @EmiliaSesmapriester
      @EmiliaSesmapriester 10 месяцев назад

      Sorry for this message I just to double check that you then mean that with the two regressions should be enough? @@NickHuntingtonKlein

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

    Super comprehensive, thank you very much!

  • @jayp5898
    @jayp5898 7 месяцев назад

    Hello Nick, thank you for the detailed explanation. How would you do this (code in python) when you have 20 independent variables of which is a treatment variable which is binary?

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  7 месяцев назад

      In statsmodels? See this section of my book www.theeffectbook.net/ch-StatisticalAdjustment.html#coding-up-polynomials-and-interactions

    • @jayp5898
      @jayp5898 7 месяцев назад

      @@NickHuntingtonKlein thank you for the quick response.
      formula = "'inspection_score ~ NumberofLocations*Weekend + Year"' - this assumes that there is interaction only between NumberofLocations and Weekend. What if I have x1, x2 ..x20 variables and x21 as treatment variable? can I write something like: formula = "'y ~ x21*(x1 + x2 + x3 + ... + x19 + x20 )"' ?

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  7 месяцев назад

      @@jayp5898 that would work in R but I'm not sure about the statsmodels implementation of patsy. Try it and see! Otherwise you might have to do them one at a time (but you can build the model string procedurally using regular ol string manipulation if that's the case)

    • @jayp5898
      @jayp5898 7 месяцев назад

      @@NickHuntingtonKlein Hi Nick, I was able to fit a logistic regression in python including all variables and their product with treatment variable. However, this model ROC is much lower (0.53) than model with just the variables (main effect). Also, this model only contains interaction effect and none of the main variables. What am I doing wrong?

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  7 месяцев назад

      @@jayp5898 you definitely do want to include the variables by themselves, not just the interactions. So that's likely to be your issue.
      In addition, do you mean auc instead of roc? I wouldn't be too worried about your roc at any given cutoff (and I'd only worry about auc if your goal is classification as opposed to inference).

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

    Hey Nick, it's me again. (Pandemic has made it difficult to discuss with people, and these videos have been a god-sent)
    I am running a fixed-effects model which controls for individual fixed effects and time fixed effects (years). The way my data was generated, age is kept as an individual fixed effect. This is, if a person was 17 in 2015, they will show as the nearest multiple of 10, so 20 years old in this case, in the entire panel. However, I want to control for age. So I plan on interacting it with year. At first, it made sense to just scale the age by adding increments of 1 depending on how far it was from 2015. In plm, the model ran fine. In lfe, the effect of Age was absorbed by the fixed effects.
    Now I am running the model by multiplying the age of an individual by the current year and the model is running fine. My question is: do you know why addition as an interaction was absorbed by the fixed-effects model? And if there is any specific side effect of interacting variables with the fixed effects. I went all over the internet looking for an answer, and all I got was an article saying I should use a “double-demeaned” estimator. That sounds too complex to me though.
    Thank you so much for all the help you provide with your videos! Even after going through Pischke and Woolridge, it's your videos that end up answering my questions.

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

      Age is already controlled for by the two way fixed effects, at least in a balanced panel and nearly so in an unbalanced one. Age is Year - Birth Year. Birth year is fixed within individual, so the individual FE controls for that, and year is fixed within year, so the year FE controls for that. That's why it drops out.
      What you're describing with the interaction is probably something like letting the linear effect of year on the outcome be different for each birth year. This might make sense with, say, income as the dependent variable since you could mimic age profiles this way. The key here is that doing age x fixed effects for year collapses back to the fixed effects you have. Add up all the FEs and you're back to just age, which the individual FE controls for.
      So you'd need to be sure to impose a functional form here,otherwise you're adding no new information and it will get dropped. Ie you have to be claiming something like "the outcome-age profile is linear" or it doesn't have any new information to add to the estimation. You should be able to do this by, for example, interacting fixed effects for birth year with a *linear* (or polynomial) term for year. But think carefully about what claim you're trying to make / what it is you're actually trying to control for.
      Glad you like the videos!

  • @zeinabchalhoub2463
    @zeinabchalhoub2463 10 месяцев назад

    hello thank you very much for this video it was so clear and you have explained in very great way and easy to understand, thank you for your effort
    🌸

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

    Thanks for the video. Let's assume the interaction term has a significant p-value and whereas both predictors have an insignificant one. Would this mean the interaction term is useless for interpretation regarding the dependent variable, because the effect gets lost in the insignificant predictors?

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

      Nope. When you have the same variable appearing multiple times in the model, the significance of any one of the coefficients doesn't tell you about the overall effect. You'd want to get the significance of the overall interacted effect at a given value of the variable it's being interacted with.

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

      ​@@NickHuntingtonKlein Thanks for the rapid answer! My behavioral finance prof wants to show us how easy it is to find significant effects by running regressions on random data.
      "Run OLS regressions of the firm return in t = 1 on all the firm characteristics, ..... Next, create interactions between all pairs of firm characteristics..... From your regressions, find the three most statistically significant “predictors” of returns (with the smallest p-value). For each of these three “predictors,” come up with a story that explains intuitively (as you would read in a newspaper article), why that factor predicts firm returns well."
      When I look at summary in R i do have significant interaction effects but the main effects are not significant. So for this task the significant interaction effects are useless?
      It is my first time encountering interaction terms...
      Best regards, Jonathan

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

      @@dronefootage5438 insignificant doesn't mean useless - that's not a great way to use significance. See my textbook section on significance www.theeffectbook.net/ch-StatisticalAdjustment.html#hypothesis-testing-in-ols
      As for the insignificant main effects and significant interaction, same answer as my previous post. The significance of the main effects is irrelevant when the variable is also included in an interaction. You cna only interpret the main effect jointly with its interaction. The main effect alone only represents the effect of the variable *when the variable it's being interacted with is 0*. If that's not your case of interest then that's not a test you should care about

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

      @@NickHuntingtonKlein
      Your textbook is great! Thats what I needed. thanks :)

  • @anthonymenor1152
    @anthonymenor1152 7 месяцев назад

    could you ever do an interaction term between just 1 level of categorical variable and another variable?

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  7 месяцев назад +1

      I suppose you could but it would make the interpretation pretty difficult. The coefficient on the other variable would be a weighted average of the effects for the other levels of the category, and the coefficient on the interaction would be the difference between the effect for that group and that weird weighted average.

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

    Hi Nick, does your example also mean that a married person who has not gone to colllege would increase their log earnings by 0.24? At 6:55 you say that the effect is .85 + (-.25)*1=.6 for married people. But if you set married to 1 wouldn't the beta 1 coefficient of the estimated .24 also "activate"? By that I mean would the overall effect not be .84 then?

    • @ismaildemir773
      @ismaildemir773 2 года назад +1

      You are right about the overall effect, but I think Nick in this context was talking about solely the effect of going to college, so disregarding the first married variable.

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

      @@ismaildemir773 correct. Someone who is married and non-BA gets a .24 bump relative to not being married and non-BA, but that's not related to the *effect of betting a BA* which is what that section is about

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

    Does the interpretation of the married main effect "marriedTRUE" change when including the interaction term? Please help

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

      Yes, it's the exact same deal as interpreting the college coefficient. With the interaction term it's the difference between married and non married people *among those with no college*

  • @ariana.acostag
    @ariana.acostag 2 года назад +1

    Hey Nick! Do you have a video like this one but interpreting interaction terms in probit models? I'm stuck with my bachelor thesis and would really appreciate the help :) Thanks!

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

      I don't have a video on it but there's this classic paper! doi.org/10.1016/S0165-1765(03)00032-6

    • @ariana.acostag
      @ariana.acostag 2 года назад

      @@NickHuntingtonKlein Thanks for answering! Your videos are awesome

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

    Thanks a lot for the video! It is amazing!! I have one question tough: How the interpretation changes if we add in the same model another variable and we interact with MarriedTRUE? Let's say for example, that in the model we have: x1=MarriedTRUE; x2=CollegeTRUE; x3= MArriedTRUE x College TRUE, x4 = White; x5= MarriedTRUE x White. Do you have any video for that? Or any esy explanation? Thanks a lot in advance!!!

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

      Same thing works, just take the derivative. Derivative works in all cases. The effect of married here is b1 + b3*College + b5*White.

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

      @@NickHuntingtonKlein Great!! Thanks a lot!!!

  • @DiegoMartinez-mt2zg
    @DiegoMartinez-mt2zg 3 года назад

    Hi Nick, this is very helpful. May I ask a question? How would you interpret the interaction effect if it is so strong that it changes the sign, e.g. 0.85 + (-1.05)*1= -0.2? Is there a substitution effect behind? How do I interpret it? Thank you very much

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

      That would depend entirely on context, I don't know how to interpret that on its own.
      Also whether it even changes sign depends on context. The coefficient on the non-interaction term .85 is only the relevant effect when the other variable is 0. Is 0 a plausible value? It may be that for the range of in-sample values the effect is always positive/negative

    • @DiegoMartinez-mt2zg
      @DiegoMartinez-mt2zg 3 года назад

      @@NickHuntingtonKlein Thank you very much for your suggestion. In my case, the change is supported by the theory, so great.

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

    Great video!

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

    Hi! I am attempting to plot the marginal effects/confidence intervals of an interaction in a panel data model (plm) and have had no luck whatsoever finding a package that supports plm objects! Would you happen to have any suggestions on packages or code to use for this? I’m going absolutely crazy! Thanks so much!

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

    **I am interacting two continuous variables.

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

    This channel is very soon gonna become the Lady Gaga of Econometrics

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

    Great video. Helped me a lot! :D

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

    thank you! great video.

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

    You are a legend!

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

    thank you, very insightful

  • @hamzabouss
    @hamzabouss 7 месяцев назад

    Thank you ☺☺

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

    Thank you!