Announcement

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

  • Panel Data Regression with Two Dependent Variables

    Hello all,

    I have a quick question about how to analyze a panel data set where I have two dependent variables and two main predictors (all of them are continuous variables). I want to assess the relative impacts of the two main predictors x1 and x2 on the two dependent variables y1 y2 by comparing the coefficients of y1 y2 simultaneously. I am aware that -xtreg- will not be suitable for this analysis because -xtreg- allows only one dependent variable. However, I am not sure what other alternatives I should choose for this multivariate panel data regression. Any help is much appreciated!

    Many thanks,
    David
    Last edited by David Wang; 12 Jun 2019, 12:00.

  • #2
    You could do something like this:

    Code:
    gen long obs_no = _n
    reshape long y, i(obs_no) j(which_dv)
    
    xtreg y i.which_dv##c.(x1 x2) // , fe or re, robust vce, whatever
    The coefficient of 2.which_dv#x1 will estimate the difference between the coefficients for the y1:x1 and y2:x1 regressions. Analogous interpretation applied to the coefficient of 2.which_dv#x2.

    That said, do remember that trying to compare two regression coefficients is a hazardous occupation. Unless y1 and y2 are measured in the same units, on the same scale, and have the same distribution, such comparisons are meaningless.

    Comment


    • #3
      Thanks much, Clyde! I have to say this is a very smart approach! Since my two dependent variables are not measured on the same scale, I first standardized the two dependent variables, and then applied your approach. It worked very well. Again, I really appreciate your help, Clyde!

      Best,
      David

      Comment


      • #4
        Hello, I can not run the code suggested by Clyde. I have a panel data with two continuous DVs and five continuous IVs for six countries and period of 26 years. Any help will be appreciated.

        Comment


        • #5
          Hayuma:
          welcome to this forum.
          Another approach might be:
          Code:
          . use "https://www.stata-press.com/data/r18/nlswork.dta"
          (National Longitudinal Survey of Young Women, 14-24 years old in 1968)
          
          . mvreg ln_wage wks_work= i.idcode i.year c.age##c.age if idcode<=5
          
          Equation             Obs   Parms        RMSE    "R-sq"          F      P>F
          --------------------------------------------------------------------------
          ln_wage               60      21    .2595974    0.6501   3.622568   0.0003
          wks_work              60      21    17.87903    0.7203   5.021056   0.0000
          
          ------------------------------------------------------------------------------
                       | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
          -------------+----------------------------------------------------------------
          ln_wage      |
                idcode |
                    2  |  -.3751495   .1104366    -3.40   0.002    -.5985287   -.1517704
                    3  |   .1603017   1.898535     0.08   0.933    -3.679847     4.00045
                    4  |   .6039827   1.924932     0.31   0.755    -3.289559    4.497524
                    5  |   .4026861   1.911194     0.21   0.834    -3.463069    4.268441
                       |
                  year |
                   69  |   .2081141   .4098055     0.51   0.614    -.6207959    1.037024
                   70  |    .231393   .6704796     0.35   0.732     -1.12478    1.587566
                   71  |   .2591752     .97434     0.27   0.792    -1.711613    2.229964
                   72  |   .4146467   1.285236     0.32   0.749    -2.184989    3.014282
                   73  |   .5367871   1.599101     0.34   0.739    -2.697699    3.771273
                   75  |   .6129151   2.231424     0.27   0.785    -3.900565    5.126395
                   77  |   .8047842   2.870449     0.28   0.781    -5.001247    6.610815
                   78  |   1.085894   3.189191     0.34   0.735    -5.364854    7.536642
                   80  |   1.139914   3.826443     0.30   0.767    -6.599797    8.879625
                   82  |   1.314783   4.472338     0.29   0.770    -7.731375    10.36094
                   83  |   1.567653   4.788419     0.33   0.745    -8.117838    11.25315
                   85  |   2.064355    5.43326     0.38   0.706    -8.925449    13.05416
                   87  |   2.465956   6.086959     0.41   0.688    -9.846081    14.77799
                   88  |   2.824165   6.648009     0.42   0.673     -10.6227    16.27103
                       |
                   age |   .2352784   .3120618     0.75   0.455    -.3959262    .8664831
                       |
           c.age#c.age |  -.0057469   .0010793    -5.32   0.000    -.0079301   -.0035638
                       |
                 _cons |   -1.11577   5.019817    -0.22   0.825    -11.26931    9.037768
          -------------+----------------------------------------------------------------
          wks_work     |
                idcode |
                    2  |  -.3176303   7.606007    -0.04   0.967    -15.70223    15.06697
                    3  |   37.28914   130.7562     0.29   0.777    -227.1902    301.7684
                    4  |   28.61586   132.5742     0.22   0.830    -239.5407    296.7724
                    5  |    33.0437    131.628     0.25   0.803    -233.1991    299.2865
                       |
                  year |
                   69  |   -6.92705   28.22419    -0.25   0.807    -64.01586    50.16176
                   70  |   9.155491   46.17737     0.20   0.844    -84.24706     102.558
                   71  |   3.221527   67.10489     0.05   0.962    -132.5109     138.954
                   72  |   16.51413   88.51697     0.19   0.853    -162.5283    195.5566
                   73  |   1.172813   110.1335     0.01   0.992    -221.5932    223.9388
                   75  |   11.98843   153.6829     0.08   0.938    -298.8646    322.8415
                   77  |   39.23896    197.694     0.20   0.844    -360.6349    439.1128
                   78  |   22.50841   219.6464     0.10   0.919    -421.7685    466.7853
                   80  |   75.03396   263.5353     0.28   0.777    -458.0166    608.0845
                   82  |   100.4684   308.0195     0.33   0.746      -522.56    723.4967
                   83  |   75.70391   329.7887     0.23   0.820    -591.3567    742.7645
                   85  |   129.7519   374.2003     0.35   0.731    -627.1396    886.6434
                   87  |   140.0234    419.222     0.33   0.740    -707.9331    987.9798
                   88  |   130.8923   457.8627     0.29   0.776    -795.2224    1057.007
                       |
                   age |   6.163943   21.49237     0.29   0.776    -37.30848    49.63636
                       |
           c.age#c.age |  -.1830421   .0743361    -2.46   0.018    -.3334009   -.0326832
                       |
                 _cons |   -32.1808   345.7256    -0.09   0.926    -731.4768    667.1152
          ------------------------------------------------------------------------------
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment


          • #6
            Originally posted by Hayuma Ami View Post
            I can not run the code suggested by Clyde. I have a panel data with two continuous DVs and five continuous IVs for six countries and period of 26 years.
            I'm not sure why you cannot, but try something like that shown below, starting at the "Begin here" comment. (The stuff above is just to create a dataset for illustration.) Do-file and log file attached.
            Code:
            version 18.0
            
            clear *
            
            // seedem
            set seed 215682931
            
            // Six countries
            quietly drawnorm lat0 lat1, double corr(1 0.5 \ 0.5 1) n(6)
            generate byte cid = _n
            
            // Period of 26 years
            quietly expand 26
            bysort cid: generate byte yea = _n
            
            // Five continuous predictors
            forvalues iv = 1/5 {
                generate double pre`iv' = runiform()
            }
            
            // Two types of continuous outcome
            forvalues dv = 0/1 {
                generate double out`dv' = rnormal(lat`dv', 1)
            }
            
            *
            * Begin here
            *
            quietly reshape long out, i(cid yea) j(typ)
            mixed out i.typ##c.pre? i.yea || cid: , reml dfmethod(kroger) nolrtest nolog
            
            exit
            Attached Files

            Comment

            Working...
            X