Announcement

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

  • Controlling for fixed effects

    Hi guys

    I have another thread active, but i think my explanation was not clear, why i am trying again. I am very new to Stata and fixed effect regression so i apologize if my questions seem stupid.

    In the bottom i have included an example of my data set.

    What i wish to do is a regression where my dependent variable is ReturnMultiple and want to explain this by InvestorOrigin (dummy variable if investor is 1=foreign, 2=local, 3=mixed)
    In my base model i control for Exit type (dummy variable if exit type is 1=IPO, 2=share buyback 3=market sale), Size of transaction at exit and Holding period
    With this my baseline model becomes: reg ReturnMultiple i.InvestorOrigin i.ExitType SizeAtExit HoldingPeriodMonths
    The conclusions from this model is very interesting (as local perform much better)
    I would like to control for fixed effects of the Target industry, Target country and Exit year. to see if this further enhance the conclusions.

    My knowledge of Stata and fixed regressions is not sufficient to do this, so that is why is ask for help..

    Can i achieve this by the following equation?
    reg ReturnMultiple i.InvestorOrigin i.ExitType SizeAtExit HoldingPeriodMonths i.TargetCountry i.TargetIndustry i.ExitYear

    Or do i have to use the xtreg? And if so, do you have ideas of how the code could look like?

    Overall the dataset consists of ~3000 transactions in the period of 2012-2018 (7 years), within ~20 different industries and within 6 different countries.

    I really hope you guys are able to help me with this

    Thank you so much in advance

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    InvestorOrigin ExitType ExitYear SizeAtExitUSD TargetCountry HoldingPeriodMonths TargetIndustry ReturnMultiple
    "Foreign" "Market sale"   2018   3.29 "Vietnam"      46.3 "Transportation/ Distribution" -.63
    "Local"   "Market sale"   2010   2.64 "India"        64.5 "Textiles and clothing"         .12
    "Foreign" "Market sale"   2014    .11 "India"       104.1 "Electronics"                   .18
    "Foreign" "Market sale"   2012   8.37 "China (PRC)"  57.1 "Retail/Wholesale"               .2
    "Foreign" "Market sale"   2013     15 "India"        68.5 "Construction"                   .2
    "Foreign" "Market sale"   2014   4.94 "India"       117.8 "Infrastructure"                .22
    "Foreign" "Market sale"   2014   1.69 "India"        88.6 "Textiles and clothing"         .25
    "Foreign" "Market sale"   2014    .15 "India"        95.3 "Electronics"                   .26
    "Local"   "Market sale"   2011    .14 "China (PRC)"   8.2 "Computer related"              .29
    "Foreign" "Share buyback" 2013    7.7 "India"        71.4 "Travel/Hospitality"             .3
    "Foreign" "Market sale"   2013    9.8 "India"          91 "Transportation/ Distribution"   .3
    "Foreign" "Market sale"   2014   3.21 "India"        83.2 "Textiles and clothing"         .31
    "Foreign" "Market sale"   2012    5.2 "India"        20.6 "Manufacturing - Heavy"          .4
    "Foreign" "Market sale"   2013 305.88 "India"        74.5 "Telecommunications"            .47
    "Foreign" "Market sale"   2009   2.91 "India"        50.9 "Leisure/Entertainment"         .49
    "Foreign" "Market sale"   2012   9.15 "India"        72.4 "Transportation/ Distribution"  .54
    "Local"   "Share buyback" 2012  15.32 "Malaysia"     26.4 "Services - Non-Financial"      .54
    "Foreign" "Market sale"   2013  56.03 "China (PRC)"  31.8 "Utilities"                     .56
    "Foreign" "Market sale"   2014  56.09 "India"        78.6 "Utilities"                     .63
    "Foreign" "Market sale"   2013   12.9 "China (PRC)"  63.6 "Medical"                       .65
    "Foreign" "Share buyback" 2013  54.87 "Malaysia"     73.1 "Mining and metals"             .66
    "Foreign" "Market sale"   2014   1.83 "India"        95.7 "Manufacturing - Heavy"         .68
    end

  • #2
    This does not actually look like a statistical question to me. I think it is a content question. It is not at all obvious what nesting structure, if any, there is in your data. The individual observations are "transactions" that occur in different places at different times and in different industries. The issue becomes whether observations that occur at the same time, or in the same place, or in the same industry, are independent or not. If they are, then you can stick with -regress-. If not, then you need to account for the dependency by using -xtreg-, or perhaps -mixed- if the dependencies extend beyond just two levels. As I have no understanding of the content here, I can't advise more specifically than that.

    As an aside, you must have somehow edited your -dataex- output when you posted it. As a result, it is not usable for importing your example data into Stata. When you use -dataex- never edit it: always post it exactly as it comes out on Stata's Results window. I reconstructed your example data in Stata by other means; below is a correct -dataex- output from it:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str9 InvestorOrigin str15 ExitType int ExitYear float SizeAtExitUSD str13 TargetCountry float HoldingPeriodMonths str30 TargetIndustry float ReturnMultiple
    "Foreign" "Market sale"   2012   8.37 "China (PRC)"  57.1 "Retail/Wholesale"               .2
    "Foreign" "Market sale"   2013   12.9 "China (PRC)"  63.6 "Medical"                       .65
    "Foreign" "Market sale"   2013  56.03 "China (PRC)"  31.8 "Utilities"                     .56
    "Local"   "Market sale"   2011    .14 "China (PRC)"   8.2 "Computer related"              .29
    "Foreign" "Market sale"   2014   3.21 "India"        83.2 "Textiles and clothing"         .31
    "Foreign" "Market sale"   2014   1.69 "India"        88.6 "Textiles and clothing"         .25
    "Foreign" "Market sale"   2012   9.15 "India"        72.4 "Transportation/ Distribution"  .54
    "Foreign" "Market sale"   2013     15 "India"        68.5 "Construction"                   .2
    "Foreign" "Market sale"   2014    .15 "India"        95.3 "Electronics"                   .26
    "Foreign" "Share buyback" 2013    7.7 "India"        71.4 "Travel/Hospitality"             .3
    "Foreign" "Market sale"   2013 305.88 "India"        74.5 "Telecommunications"            .47
    "Foreign" "Market sale"   2014    .11 "India"       104.1 "Electronics"                   .18
    "Foreign" "Market sale"   2014  56.09 "India"        78.6 "Utilities"                     .63
    "Foreign" "Market sale"   2009   2.91 "India"        50.9 "Leisure/Entertainment"         .49
    "Foreign" "Market sale"   2013    9.8 "India"          91 "Transportation/ Distribution"   .3
    "Foreign" "Market sale"   2014   1.83 "India"        95.7 "Manufacturing - Heavy"         .68
    "Foreign" "Market sale"   2012    5.2 "India"        20.6 "Manufacturing - Heavy"          .4
    "Foreign" "Market sale"   2014   4.94 "India"       117.8 "Infrastructure"                .22
    "Local"   "Market sale"   2010   2.64 "India"        64.5 "Textiles and clothing"         .12
    "Foreign" "Share buyback" 2013  54.87 "Malaysia"     73.1 "Mining and metals"             .66
    "Local"   "Share buyback" 2012  15.32 "Malaysia"     26.4 "Services - Non-Financial"      .54
    "Foreign" "Market sale"   2018   3.29 "Vietnam"      46.3 "Transportation/ Distribution" -.63
    end
    If you need to restrict which variables you show in your example, or which observations to show, list the variables you want to show in the varlist part of the -dataex- command, and use -if- or -in- (or both) to select observations.

    If the above paragraph is not understandable to you, then you need to invest some time in the basics of Stata. The PDF Stata documentation that comes with your installation is the most direct way to do that, and it is excellent. See post #5 at https://www.statalist.org/forums/for...uplicate-dates for William Lisowski's outstanding advice about the fundamental reading that all Stata users should do.

    Comment


    • #3
      Dennis:
      I do share Clyde's comments as well as pointing you to William's advice on how to get wisely started with Stata.
      That said, as you can see from the following example that elaborates on your data excerpt and comes with some comments:
      Code:
      . xtset TargetCountry ExitType
      string variables not allowed in varlist;
      TargetCountry is a string variable
      r(109);
      
      *panel identifiers cannot be -string- variables. The same holds for predictors and dependent variable*
      
      encode InvestorOrigin, gen(InvestorOrigin_num)
      encode ExitType, gen(ExitType_num)
      encode TargetCountry, gen(TargetCountry_num)
      encode TargetIndustry, gen(TargetIndustry_num)
      * -string- variables should be -encode-d to become useful for panel data regression*
      . xtset TargetCountry_num ExitType_num
      repeated time values within panel
      r(451);
      *your dataset has repeatedly time values within the same panel. Provided that you do not have genuine duplicates and do not plan to use time-series commands (lags and leads)...*
      
      . xtset TargetCountry_num
             panel variable:  TargetCountry_num (unbalanced)
         
      *...you can -xtset- your dataset via -panelid- only*   
      
      . xtreg ReturnMultiple i.InvestorOrigin_num i.ExitType_num i.TargetCountry_num i.TargetIndustry_num SizeAtExit HoldingPe
      > riodMonths, fe
      note: 2.TargetCountry_num omitted because of collinearity
      note: 3.TargetCountry_num omitted because of collinearity
      note: 4.TargetCountry_num omitted because of collinearity
      note: 10.TargetIndustry_num omitted because of collinearity
      note: 14.TargetIndustry_num omitted because of collinearity
      
      Fixed-effects (within) regression               Number of obs     =         22
      Group variable: TargetCoun~m                    Number of groups  =          4
      
      R-sq:                                           Obs per group:
           within  = 0.9353                                         min =          1
           between = 0.6641                                         avg =        5.5
           overall = 0.0653                                         max =         15
      
                                                      F(16,2)           =       1.81
      corr(u_i, Xb)  = -0.8433                        Prob > F          =     0.4146
      
      -----------------------------------------------------------------------------------------------
                     ReturnMultiple |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      ------------------------------+----------------------------------------------------------------
                 InvestorOrigin_num |
                             Local  |  -.1708747   .1836434    -0.93   0.450    -.9610284     .619279
                                    |
                       ExitType_num |
                     Share buyback  |   .5062534   .7834262     0.65   0.584    -2.864558    3.877064
                                    |
                  TargetCountry_num |
                             India  |          0  (omitted)
                          Malaysia  |          0  (omitted)
                           Vietnam  |          0  (omitted)
                                    |
                 TargetIndustry_num |
                      Construction  |   1.098176   1.441556     0.76   0.526    -5.104339    7.300691
                       Electronics  |  -.2570021   .3206702    -0.80   0.507    -1.636735     1.12273
                    Infrastructure  |   .2260127   .7155502     0.32   0.782    -2.852752    3.304777
             Leisure/Entertainment  |   .2118944   .3652721     0.58   0.620    -1.359745    1.783533
             Manufacturing - Heavy  |   .3293841   .4011998     0.82   0.498    -1.396839    2.055608
                           Medical  |   1.480472   1.400866     1.06   0.401     -4.54697    7.507913
                 Mining and metals  |   3.782363   3.920383     0.96   0.436    -13.08568    20.65041
                  Retail/Wholesale  |   .5898592   .9515933     0.62   0.599    -3.504516    4.684235
          Services - Non-Financial  |          0  (omitted)
                Telecommunications  |   29.10356   29.33839     0.99   0.426    -97.12933    155.3364
             Textiles and clothing  |   .0054531   .3813403     0.01   0.990    -1.635322    1.646228
      Transportation/ Distribution  |   .8094011   .9757013     0.83   0.494    -3.388703    5.007505
                Travel/Hospitality  |          0  (omitted)
                         Utilities  |   5.458636   5.394562     1.01   0.418    -17.75229    28.66956
                                    |
                      SizeAtExitUSD |   -.095322   .0959368    -0.99   0.425    -.5081046    .3174607
                HoldingPeriodMonths |  -.0013545   .0046138    -0.29   0.797    -.0212062    .0184972
                              _cons |   .6202811   .4263767     1.45   0.283     -1.21427    2.454832
      ------------------------------+----------------------------------------------------------------
                            sigma_u |  1.1379329
                            sigma_e |  .13344057
                                rho |  .98643527   (fraction of variance due to u_i)
      -----------------------------------------------------------------------------------------------
      F test that all u_i=0: F(3, 2) = 2.62                        Prob > F = 0.2884
      
      *being the -panelid- -TargetCountry_num- is omitted from the set of predictors*
      *other time-invariant predictors are wiped out by the -fe- machinery*
      *consider how many predictors your full dataset can bera (rule of thumb: 10-20 observations for each predictor)*
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment

      Working...
      X