Announcement

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

  • Mean ratio for linear regression

    Hi all,
    I have a survey data with y is continuous variable, x1: binary variable, x2...x5 are either continuous or categorical variables. I used linear regression with the following code:
    svy: regress y x1 x2 x3 x4 x5
    I have a result with coefficient for each independent variable. For the main binary independent variable x1, the coefficient shows the mean difference between 2 groups. However, my advisor wants to report mean ratio instead of mean difference but I don't know how. Could you please help me?
    Thanks.

  • #2
    Ly:
    you may want to consider -nlcom-:
    Code:
    . use "C:\Program Files\Stata16\ado\base\a\auto.dta"
    (1978 Automobile Data)
    
    . regress price i.foreign
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(1, 72)        =      0.17
           Model |  1507382.66         1  1507382.66   Prob > F        =    0.6802
        Residual |   633558013        72  8799416.85   R-squared       =    0.0024
    -------------+----------------------------------   Adj R-squared   =   -0.0115
           Total |   635065396        73  8699525.97   Root MSE        =    2966.4
    
    ------------------------------------------------------------------------------
           price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         foreign |
        Foreign  |   312.2587   754.4488     0.41   0.680    -1191.708    1816.225
           _cons |   6072.423    411.363    14.76   0.000     5252.386     6892.46
    ------------------------------------------------------------------------------
    
    . nlcom (_cons+_b[1.foreign]/_cons), post
    
           _nl_1:  _cons+_b[1.foreign]/_cons
    
    ------------------------------------------------------------------------------
           price |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
           _nl_1 |   313.2587   754.4488     0.42   0.678    -1165.434    1791.951
    ------------------------------------------------------------------------------
    
    . testnl ( _cons+_b[1.foreign]/_cons)=0
    
      (1)  ( _cons+_b[1.foreign]/_cons) = 0
    
                   chi2(1) =        0.17
               Prob > chi2 =        0.6780
    
    .
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thanks Carlo. May I ask how I interpret the coef. in the nlcom: 313.26. Is it a mean ratio between foreign group (1 vs. 0)?

      Comment


      • #4
        Ly:
        -nlcom- replace _cons with 1 (313.2587 vs 312.2587); hence, this may not be what your supervisor wants you to do.
        -nlcom- confirms (as expected) that the difference between the mean (conditional) price for domestic and foreign does not differ (or, better, that we cannot rule out that the difference is not 0).
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Thanks Carlo. So, can I use the following code to get mean ratio between groups?
          nlcom ((_b[_cons]+_b[1.foreign])/_b[_cons]).

          Comment


          • #6
            Ly:
            the formula you copied and pasted in #5 replaces _cons with 1 (313.2587 vs 312.2587); hence, this may not be what your supervisor wants you to do.
            I do hope that what follows can give you some indications:
            Code:
            . use "C:\Program Files\Stata16\ado\base\a\auto.dta"
            (1978 Automobile Data)
            
            . regress price i.foreign
            
                  Source |       SS           df       MS      Number of obs   =        74
            -------------+----------------------------------   F(1, 72)        =      0.17
                   Model |  1507382.66         1  1507382.66   Prob > F        =    0.6802
                Residual |   633558013        72  8799416.85   R-squared       =    0.0024
            -------------+----------------------------------   Adj R-squared   =   -0.0115
                   Total |   635065396        73  8699525.97   Root MSE        =    2966.4
            
            ------------------------------------------------------------------------------
                   price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
                 foreign |
                Foreign  |   312.2587   754.4488     0.41   0.680    -1191.708    1816.225
                   _cons |   6072.423    411.363    14.76   0.000     5252.386     6892.46
            ------------------------------------------------------------------------------
            
            . predict fitted, xb
            
            . egen mean_domestic=mean(fitted) if foreign==0
            (22 missing values generated)
            
            . egen mean_foreign=mean(fitted) if foreign==1
            (52 missing values generated)
            
            
            
            
            . sum mean_domestic mean_foreign
            
                Variable |        Obs        Mean    Std. Dev.       Min        Max
            -------------+---------------------------------------------------------
            mean_domes~c |         52    6072.423           0   6072.423   6072.423
            mean_foreign |         22    6384.682           0   6384.682   6384.682
            
            
            . sum mean_domestic
            
                Variable |        Obs        Mean    Std. Dev.       Min        Max
            -------------+---------------------------------------------------------
            mean_domes~c |         52    6072.423           0   6072.423   6072.423
            
            
            . scalar m1=r(mean)
            
            . sum mean_foreign
            
                Variable |        Obs        Mean    Std. Dev.       Min        Max
            -------------+---------------------------------------------------------
            mean_foreign |         22    6384.682           0   6384.682   6384.682
            
            . scalar m2=r(mean)
            
            . di scalar(m1)/scalar(m2)
            .9510925
            
            .
            That said, I still fail to get what your supervisor is aiming at via mean ratios.
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #7
              Hi,
              My question doesn't relate to mean ratio for linear regression but towards nlcom

              I am trying to estimate the Intergenerational Correlation (IGC) in education using nlcom but cannot figure out how to

              \[ IGC : \rho_{IG}= \beta1 * \frac{\sigma_{parent}}{\sigma_{child}} \]

              Where PIG = Intergenerational Correlation (IGC),

              Beta1 = intergenerational regression coefficient (IGRC) coming from estimating

              \[ Edu_{i,g} = \beta_{0}+ \beta_{1}Edu_{i,parent}+\beta_{2}Edu_{i,grandparen t} + \epsilon_{ig} \]

              and Sigma= standard deviation of the parent/child

              Comment

              Working...
              X