Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Margins interaction variables Beta regression

    Dear Statalisters,

    I am running a regression with proportions as dependent variable. In the beta regression I run interactions between independent variables. The interactions work perfectly in the regression but when trying to find the margins, Stata does not deliver the margin values.

    Some background:
    I am interested to see if the probability of a partner business deal (Dealprob) increase when the CEO has the same nationality as the partner (CEOhomebias). For further insights I use Multinationality as interacting continuous variable, which measures foreign sales/total sales.

    I am using the following regression model:
    Code:
    betareg Dealprob CEOhomebias Multinationality CEOhomebias#c.Multinationality
    Hereafter I use the following commands to find marginal effects:

    Code:
     margins CEOhomebias#c.Multinationality
    only factor variables and their interactions are allowed r(198);
    Code:
     margins CEOhomebias#Multinationality Multinationality 
    factor variables may not contain noninteger values r(452)
    Code:
     margins, dydx(CEOhomebias#c.Multinationality)
    invalid dydx() option; levels of interactions not allowed r(198);
    Code:
     margins, dydx(i.CEOhomebias#c.Multinationality)
    i:  operator invalid
    Code:
     margins, dyex(CEOhomebias#c.Multinationality)
    invalid dyex() option; levels of interactions not allowed
    I hope you guys can help me out, thank you in advance!

  • #2
    Hello,

    Spend about 15-20 minutes to work through the examples featured under -help margins-. To break it down, the errors shown above fell into two types:
    1. Lacking familiarity with the syntax structure of -margins-. In margins, only factor variable(s) are supplied after the margins command. If there are continuous variables, a set of user-specific values need to be supplied to confine the number of estimates returned to you, as there are practically infinite of them.
    2. Try to visualize what this interaction does, it allows Dealprob and Multinationality to have different regression lines for each level in CEOhombias. So, when -dydx- is used without specifying which line, nothing returned.
    Both of which can be readily clarified if you work through all those margins commands in the help manual.

    Comment


    • #3
      I would use the factor-variable notation in your –betareg– command itself and then continue with that same factor-variable notation into your –margins– command. For example, this code
      Code:
      sysuse auto
      reg price i.foreign c.mpg
      margins, dydx(i.foreign c.mpg)
      reg price foreign mpg
      margins, dydx(i.foreign c.mpg)
      gives this result
      Code:
      . reg price i.foreign c.mpg
      
            Source |       SS           df       MS      Number of obs   =        74
      -------------+----------------------------------   F(2, 71)        =     14.07
             Model |   180261702         2  90130850.8   Prob > F        =    0.0000
          Residual |   454803695        71  6405685.84   R-squared       =    0.2838
      -------------+----------------------------------   Adj R-squared   =    0.2637
             Total |   635065396        73  8699525.97   Root MSE        =    2530.9
      
      ------------------------------------------------------------------------------
             price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
           foreign |
          Foreign  |   1767.292    700.158     2.52   0.014     371.2169    3163.368
               mpg |  -294.1955   55.69172    -5.28   0.000    -405.2417   -183.1494
             _cons |   11905.42   1158.634    10.28   0.000     9595.164    14215.67
      ------------------------------------------------------------------------------
      
      . margins, dydx(i.foreign c.mpg)
      
      Average marginal effects                        Number of obs     =         74
      Model VCE    : OLS
      
      Expression   : Linear prediction, predict()
      dy/dx w.r.t. : 1.foreign mpg
      
      ------------------------------------------------------------------------------
                   |            Delta-method
                   |      dy/dx   Std. Err.      t    P>|t|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
           foreign |
          Foreign  |   1767.292    700.158     2.52   0.014     371.2169    3163.368
               mpg |  -294.1955   55.69172    -5.28   0.000    -405.2417   -183.1494
      ------------------------------------------------------------------------------
      Note: dy/dx for factor levels is the discrete change from the base level.
      
      . reg price foreign mpg
      
            Source |       SS           df       MS      Number of obs   =        74
      -------------+----------------------------------   F(2, 71)        =     14.07
             Model |   180261702         2  90130850.8   Prob > F        =    0.0000
          Residual |   454803695        71  6405685.84   R-squared       =    0.2838
      -------------+----------------------------------   Adj R-squared   =    0.2637
             Total |   635065396        73  8699525.97   Root MSE        =    2530.9
      
      ------------------------------------------------------------------------------
             price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
           foreign |   1767.292    700.158     2.52   0.014     371.2169    3163.368
               mpg |  -294.1955   55.69172    -5.28   0.000    -405.2417   -183.1494
             _cons |   11905.42   1158.634    10.28   0.000     9595.164    14215.67
      ------------------------------------------------------------------------------
      
      . margins, dydx(i.foreign c.mpg)
      i:  operator invalid
      r(198);
      
      end of do-file
      
      r(198);

      Comment


      • #4
        Thank you very much guys! This helps a lot!

        Comment

        Working...
        X