Stata - How to estimate (average) marginal effects

Поділитися
Вставка
  • Опубліковано 23 жов 2024

КОМЕНТАРІ • 30

  • @moha8719
    @moha8719 3 роки тому +4

    Thank you so much! I've watched many longer videos about this topic. But yours was shorter and more useful. It gave me exactly what I was looking for and saved my time!

  • @karuhangakennedy6523
    @karuhangakennedy6523 3 роки тому

    This video was so helpful. Thank you so much all the others couldn't provide

  • @yah8619
    @yah8619 Рік тому +1

    Hi! Which p- value should I use, p value after marginal effects or before ( logistics regression/ coefficient) thank you

  • @melikekussan
    @melikekussan 2 роки тому +1

    Hi Steffan, your videos are always simple to understand, thankyou
    I have a question,
    Calculate the marginal effect of distance on exports.
    My regression is as follows:
    Dependent variable: exports
    Independent variable: distance
    Both are logarithmic variables.
    Would I need to take the square of distance in my regression or not?

    • @SteffensClassroom
      @SteffensClassroom  2 роки тому

      Dear Melike. Thank you for your comments. Using sqr distance in your model depends on if you think that there is an increase/decrease effect of distance on exports. I don't know your exact research question, but in any case, I believe you can simply use the margins command as presented in the video. That is, logit y x followed by the margins command.
      Feel free to mail me if you wish to discuss this further.

    • @melikekussan
      @melikekussan 2 роки тому

      @@SteffensClassroom Thankyou for replying Steffan, I appreciate your help. Yes my regression coefficient shows that exports decrease as distance increases.

  • @gresalatifi3338
    @gresalatifi3338 3 роки тому

    Hi Steffen! Thanks for the insightful explanation of the marginal effects. How about when having a Heckman 2 step selection model? If I would follow what you mentioned, I am observing the post estimation ran on the selection dependent variable only...any hints?

    • @SteffensClassroom
      @SteffensClassroom  3 роки тому

      Hi Gresa!
      I am not 100p sure what you are looking for. Are you interested in getting the marginal effects after the 1 step in the Heckman model (i.e. the probit?), or what are you going at?
      Feel free to mail me with the question :)

  • @vidyaranik3862
    @vidyaranik3862 2 роки тому +2

    hello sir, i want to know how to export this results which includes coefficient with standard error and average marginal effects with standard error to word using outreg2 command?

    • @SteffensClassroom
      @SteffensClassroom  2 роки тому

      Hello!
      You need to do this in two separate columns. First export the regular results after your regression using the standard syntax. For the marginal effects, you have to first store the estimates after you have calculated the marginal effects; est store modelname
      Then you run your outreg2 command.
      Don't forget to add option replace the first time you run outreg2, and append to add the next column to the same table.

  • @lenousemensah2474
    @lenousemensah2474 3 роки тому +1

    Hi Steffen, how do I run the command for marginal effect in multivariate probit regression.

    • @SteffensClassroom
      @SteffensClassroom  3 роки тому

      Hi Lenouse. Thank you for the question. Must admit I never tried it, but intuition tells me it would be something like:
      biprobit (y1 x1 x2) (y2 x1 x2)
      margins, dydx(*) predict(xb1) predict(xb2)
      Let me know if this works out for you!

  • @dataman6744
    @dataman6744 2 роки тому

    Great explanation thanks

  • @beigestallion2929
    @beigestallion2929 2 роки тому +1

    Hey Steffen ! I'm currently trying to this for a tobit panel model. However my marginal effects are exactly the same as coefficients...
    What should I do ?
    tobit CRASH ESG EPS SIZE MB SD AVG LEV ROA NCSKEW i.IND i.COUNTRY i.Year, ll(0)
    margins, dydx(ESG)
    It also says in my margins output that my "expression" is "Linear prediction, predict()" as opposed to your "Pr(Low), predict()"
    Any help would be immensely appreciated

    • @SteffensClassroom
      @SteffensClassroom  2 роки тому

      Hello!
      Hard to say what is going on exactly when I don't know the data, but I have a decent guess why you get the same for the regular coefficients as for marginal effects. If you used -margins, dydx()- and no other options, the default prediction in -margins- after -tobit- is xb. You are therefore only getting the marginal effect on the linear predictor which, of course, is just the coefficient.
      You would have to add another option in this case, and I think:
      margins, dydx(*) predict (ystar(0,.))
      should do it. You have to tell Stata that there is censoring going on, as you are running a censoring model.
      I hope this helps,

  • @SaraAhmed-oq3qt
    @SaraAhmed-oq3qt 3 роки тому

    Hi Steffen, Thank you for sharing,
    I am still confused in terms of marginal effect and need your help, please
    I am working on a Panel data model. I want to measure the marginal effect of the interaction terms FDX * INF, FDX * INFVOL , FDX2 * INF and FDX2 * INFVOL on GDP
    My model is the multiplicative interaction model.
    GDP = β1 FDX + β2 FDX2+ β3 INF + β4 INFVOL+ β5 FDX * INF + β6 FDX * INFVOL + β7 FDX2 * INF + β8 FDX2 * INFVOL + β9 INIGDPPC + β10 GOV + β11 GFCF + β12 TRD + β13 LBOR
    by examining the partial derivative of GDP, as follows:
    ∂GDP/∂FDX = β1 + 2 β2 FDX + β5 INF + β6 INFVOL + 2 β7 FDX * INF + 2 β8 FDX * INFVOL
    I performed GMM command
    xtabond2 rgdpg ihs_inigdppc_lag1 fdxs2 fdxsquar2 ihs_inf c.fdxs2#c.ihs_inf c.fdxsquar2#c.ihs_inf ihs_gfcf ihs_gov ihs_trd ihs_lbor, gmm(rgdpg ihs_inigdppc fdxs2 fdxsquar2 c.fdxs2#c.ihs_inf c.fdxsquar2#c.ihs_inf , lag(2 2) collapse eq(diff)) iv(ihs_inf ihs_gfcf ihs_gov ihs_trd ihs_lbor, eq(diff)) gmm(rgdpg ihs_inigdppc fdxs2 fdxsquar2 c.fdxs2#c.ihs_inf c.fdxsquar2#c.ihs_inf, lag(2 .) collapse eq(level)) twostep robust
    I am trying to compute the standard error Using the covariance matrix, the variance
    σ^2(dy/dx) = Var ( β1) + 4 FDX2 var( β2) + INF2 var (β5) + INFVOL2 var (β6) +4 FDX2 * INF2 var( β7) + 4 FDX2 * INFVOL2 var (β8) + 4 FDX cov( β1β2) + 2INF cov(β1β5) + 2INFVOL cov(β1β6) + 4 FDX * INF cov(β2 β5) + 4 FDX * INFVOL cov(β2 β6) + 4 FDX * INF cov( β1β7) + 8 FDX2 * INF cov( β2 β7) + 4 FDX * INFVOL cov( β1β8) + 8 FDX2 * INFVOL cov( β2 β8) +4 FDX * INF2 cov (β5β7) +4 FDX * INFVOL2 cov (β6β8)
    1- Can I run this equation using the marginal command, if yes, what is the command, please?
    2- What the marginal command for interaction term say FDX * INF at Mean, Minimum and Maximum?
    Thank you

    • @SteffensClassroom
      @SteffensClassroom  3 роки тому

      Hi Sara
      I would very much like to help you, but this one is a little more complicated, and I would therefore suggest you send me a mail regarding this issue. See my contact mail on the channel.

  • @brn2763
    @brn2763 7 місяців тому

    Hey Steffen, I am doing a beta regression and want to calculate the margins. My dependent variable is given as a share (between 0-1) and my main independent variable as a count variable. How do i interpret the margin effect on my dependent variable, in case of a one unit increase in my independet variable?

    • @SteffensClassroom
      @SteffensClassroom  7 місяців тому

      Hi!
      I'll ask you to refer to your Econometrics textbook for this one :)

  • @jadejoseph7328
    @jadejoseph7328 2 роки тому +1

    What is the estimated effect of a one standard deviation increase.. can you please explain how to do it

    • @SteffensClassroom
      @SteffensClassroom  2 роки тому

      Hi!
      On top my head, it sounds like first standardize all your observations, and then run the model. That is, you subtract the mean and divide by the sd for each variable in your model.
      You can read more about it here: stats.idre.ucla.edu/stata/faq/how-do-i-standardize-variables-in-stata/#:~:text=A%20standardized%20variable%20(sometimes%20called,a%20standard%20deviation%20of%20one.
      It is also on my list for a future video :)

    • @jadejoseph7328
      @jadejoseph7328 2 роки тому +1

      @@SteffensClassroom thank you so much!

    • @SteffensClassroom
      @SteffensClassroom  2 роки тому

      No thank you for asking! Gave me a good idea for a new Stata video :)

  • @filil9588
    @filil9588 Рік тому

    where helpful, thanks!

  • @catalinserra5132
    @catalinserra5132 2 роки тому

    Hi Steffen, Can you explain how to tabulate the margins in word ? My Code is: eststo: probit Y X1 X2 X3 etc. Than margins, dydx(*). I can tabulate my probit Values With esttab but habe no Clue how to tabulate the marings. Would be so helpfull! P.S. I‘ve already checkend the stata help page and every google hit I could find

    • @SteffensClassroom
      @SteffensClassroom  2 роки тому

      I use the outreg2 command, and apply the option word when I want to tabulate the margins in word. Never used eststo. :)

    • @catalinserra5132
      @catalinserra5132 2 роки тому

      @@SteffensClassroom is there any way to also tabulate the margins with esttab in stat? :)

    • @SteffensClassroom
      @SteffensClassroom  2 роки тому

      No idea. I never tried :)

  • @rex5555555555
    @rex5555555555 2 роки тому

    elon is that you?