Quantcast
Channel: Statalist
Viewing all 65109 articles
Browse latest View live

Using marginsplot, category labels and plots overlap.

$
0
0
I use Stata 15.1 SE on Windows 10.
I am calculating predictive margins following an ologit in the svy command context. The factor predictor has 15 categories. When I use marginsplot to create a graph of the predictive margins, the bottom three and top three categories overlap with each other. So in the image, the top line combines the three lowest categories of variable reltrad4 (codes 1100, 1200 and 1300, respectively) and the bottom line combines the three highest categories (coded 100001, 100002, and 100003, respectively).
Array

The marginsplot command I used to generate this is:
marginsplot, horizontal yscale(reverse)
I've tried extending the axis and other things, but can't resolve the problem of separating out these categories.
Thanks in advance for any help!

Matching of Cases to reduce sample size of logit regression

$
0
0
Hi everyone,

I'm working on a study to investigate the impact of firm performance on probability of takeover. I will be using a logit model, with target = 1 or 0 as the dependent variable, and other firm characteristics to obtain results. However, currently my ratio of targets to non-targets is 96 : 1315, which is quite skewed.

Hence, I'm looking to reduce my non-targets sample to a smaller number before running the regression, probably by matching 1-2 non-targets to every target. I plan to match the targets based on the year and reit_id but i'm not quite sure how to do this. Below is my code for a small portion of my data. The column target is the dependent variable, where i hope to reduce the number target = 0.

Thanks for your help in advance.


Code:
entityname    entityid    target    year    reit_id    roa    spalpha    ebitdamargin    market_ta
Campus Crest Communities, Inc.    4258761    1    2014    Specialty    .579    -0.51    37.455    40.21625
Monogram Residential Trust, Inc.    4190766    1    2016    Multifamily    .179    0.07    47.322    56.40852
Rayonier Inc.    4062541    0    2014    Specialty    1.811    -0.72    34.616    144.3895
CyrusOne Inc.    4332673    0    2014    Specialty    1.657    0.29    46.479    67.78162
American Residential Properties, Inc.    4383076    1    2014    Specialty    -.778    0.07    32.278    41.56983
Quality Care Properties, Inc.    4745972    1    2017    Health Care    2.141    -0.81    90.71    29.4966
New Senior Investment Group Inc.    4544851    0    2016    Health Care    .208    -0.09    41.152    28.49409
Gladstone Land Corporation    4264067    0    2014    Specialty    1.08    -0.92    50.964    54.68895
Independence Realty Trust, Inc.    4235858    0    2016    Multifamily    -.246    0.24    19.267    47.55272
Front Yard Residential Corporation    4345051    0    2015    Specialty    .982    -0.51    19.431    28.1446
Bluerock Residential Growth REIT, Inc.    4214866    0    2017    Multifamily    -1.42    -0.72    13.368    14.52915
New Senior Investment Group Inc.    4544851    0    2017    Health Care    1.07    -0.74    41.344    24.76231
Gladstone Land Corporation    4264067    0    2015    Specialty    1.552    -0.40    64.09    37.79842
Silver Bay Realty Trust Corp.    4335231    1    2016    Specialty    .954    0.07    44.124    49.76474
CatchMark Timber Trust, Inc.    4108902    0    2015    Specialty    -.518    -0.04    32.389    73.57886
Gladstone Commercial Corporation    4088076    0    2014    Diversified    2.586    -0.15    80.214    44.81316
Trade Street Residential, Inc.    4094472    1    2014    Multifamily    .444    0.46    40.342    49.62671
Gladstone Land Corporation    4264067    0    2016    Specialty    1.624    0.46    71.098    33.73792
Associated Estates Realty Corporation    103102    1    2014    Multifamily    1.62    0.61    51.628    91.29086
NexPoint Residential Trust, Inc.    4561930    0    2016    Multifamily    1.362    0.97    43.274    45.40438
NexPoint Residential Trust, Inc.    4561930    0    2017    Multifamily    .795    0.45    43.014    55.72662
UDR, Inc.    103025    0    2014    Multifamily    1.101    0.50    59.705    115.1405
CatchMark Timber Trust, Inc.    4108902    0    2016    Specialty    -.383    -0.09    30.576    61.54402
Gladstone Commercial Corporation    4088076    0    2015    Diversified    2.622    -0.29    82.294    41.37527
American Campus Communities, Inc.    4092925    0    2014    Specialty    1.721    0.41    48.367    76.2162
Mid-America Apartment Communities, Inc.    103123    0    2014    Multifamily    2.192    0.31    54.732    82.39773
Lexington Realty Trust    103128    0    2014    Diversified    2.94    0.06    81.272    68.14964
NorthStar Realty Europe Corp.    4608576    0    2016    Office    -.167    0.00    41.071    37.73274
Camden Property Trust    103094    0    2014    Multifamily    2.653    0.42    56.397    105.8357
Apartment Investment and Management Company    103180    0    2014    Multifamily    2.712    0.60    56.818    89.20546
Gladstone Land Corporation    4264067    0    2017    Specialty    1.822    0.48    73.489    40.06698
Global Net Lease, Inc.    4307540    0    2016    Diversified    1.613    -0.15    76.801    53.82782
Global Net Lease, Inc.    4307540    0    2017    Diversified    1.844    -0.53    78.085    45.57275
American Homes 4 Rent    4392539    0    2015    Specialty    .424    -0.11    43.443    51.29628
Pennsylvania Real Estate Investment Trust    102991    0    2014    Regional Mall    1.859    0.21    50.725    63.55355
One Liberty Properties, Inc.    102988    0    2014    Diversified    3.427    0.21    73.748    63.40358
Home Properties, Inc.    103183    1    2014    Multifamily    2.995    0.31    59.654    84.33441
Apartment Investment and Management Company    103180    0    2012    Multifamily    1.922    0.23    55.875    61.53297
New Senior Investment Group Inc.    4544851    0    2015    Health Care    -.109    -0.92    40.188    27.92127
MGM Growth Properties LLC    4674180    0    2017    Specialty    2.33    0.31    82.439    19.96539
Preferred Apartment Communities, Inc.    4263486    0    2012    Multifamily    1.318    0.52    46.964    33.54093
CatchMark Timber Trust, Inc.    4108902    0    2017    Specialty    -.21    0.18    29.093    77.03358
Rayonier Inc.    4062541    0    2015    Specialty    2.179    -0.38    36.139    117.6844
UDR, Inc.    103025    0    2012    Multifamily    .682    -0.20    59.412    86.96828
Wheeler Real Estate Investment Trust, Inc.    4305469    0    2014    Shopping Center    -1.892    -0.11    24.25    14.47827
Apartment Investment and Management Company    103180    0    2010    Multifamily    .972    1.07    48.615    41.19895
Preferred Apartment Communities, Inc.    4263486    0    2017    Multifamily    1.309    0.44    58.694    24.01128
Lexington Realty Trust    103128    0    2015    Diversified    2.936    -0.55    80.284    49.2753
Rouse Properties, Inc.    4298147    1    2015    Regional Mall    1.486    -0.33    56.213    33.42612
UDR, Inc.    103025    0    2013    Multifamily    .954    -0.47    59.396    86.26359
Colonial Properties Trust    103076    1    2012    Multifamily    1.977    -0.03    55.763    57.36412
QTS Realty Trust, Inc.    4405219    0    2014    Specialty    2.425    0.56    39.725    89.93388
Apartment Investment and Management Company    103180    0    2013    Multifamily    2.503    -0.52    56.902    62.18889
Washington Real Estate Investment Trust    103036    0    2014    Diversified    1.94    0.19    55.25    88.9749
AvalonBay Communities, Inc.    103145    0    2014    Multifamily    2.958    0.58    65.601    133.6737
Healthcare Realty Trust Incorporated    103057    0    2014    Health Care    2.364    0.45    59.304    97.91383
Gladstone Commercial Corporation    4088076    0    2012    Diversified    3.239    -0.06    83.093    35.79676
CoreSite Realty Corporation    4258680    0    2014    Specialty    2.757    0.28    46.367    79.06402
American Campus Communities, Inc.    4092925    0    2015    Specialty    1.654    -0.01    48.54    77.32224
Gladstone Commercial Corporation    4088076    0    2016    Diversified    2.455    0.50    81.015    60.98448
Digital Realty Trust, Inc.    4094311    0    2014    Specialty    2.63    0.52    55.927    94.38674
NorthStar Realty Finance Corp.    4092549    1    2015    Diversified    2.471    -0.93    47.505    20.25767
Apartment Investment and Management Company    103180    0    2015    Multifamily    2.616    0.13    57.883    102.2728
InfraREIT, Inc. (REIT)    4573482    0    2016    Specialty    3.656    -0.05    87.303    41.77341
Cogdell Spencer Inc.    4104525    1    2010    Health Care    1.354    0.08    25.996    46.61516
Camden Property Trust    103094    0    2016    Multifamily    2.639    0.11    56.562    122.0128
American Homes 4 Rent    4392539    0    2014    Specialty    -.017    -0.01    37.351    58.19209
Wheeler Real Estate Investment Trust, Inc.    4305469    0    2015    Shopping Center    -1.149    -1.50    45.911    41.35297
Pennsylvania Real Estate Investment Trust    102991    0    2016    Regional Mall    2.274    -0.41    55.312    50.39394
CIM Commercial Trust Corporation    4543503    0    2017    Office    1.073    0.63    36.596    62.57856
Equity Residential    103054    0    2014    Multifamily    2.515    0.59    64.383    113.581
Investors Real Estate Trust    107231    0    2013    Multifamily    2.9    -0.50    58.091    52.25985
Washington Real Estate Investment Trust    103036    0    2013    Diversified    1.988    -0.80    57.383    78.9179
PS Business Parks, Inc.    102999    0    2014    Diversified    3.514    -0.03    62.349    96.14012
Medical Properties Trust, Inc.    4095909    0    2014    Health Care    2.814    0.17    64.68    63.9744
UDR, Inc.    103025    0    2016    Multifamily    1.466    -0.13    62.788    126.9551
UDR, Inc.    103025    0    2010    Multifamily    .374    0.70    55.599    77.62515
American Assets Trust, Inc.    4270741    0    2014    Diversified    2.771    0.35    57.604    89.59715
Healthcare Trust of America, Inc.    4132396    0    2014    Health Care    1.928    0.53    61.652    111.1654
Wheeler Real Estate Investment Trust, Inc.    4305469    0    2017    Shopping Center    1.265    -0.77    58.985    19.0675
Pennsylvania Real Estate Investment Trust    102991    0    2017    Regional Mall    1.8    -0.98    54.761    32.14258
One Liberty Properties, Inc.    102988    0    2015    Diversified    3.369    -0.15    72.37    54.07995
Farmland Partners Inc.    4426904    0    2015    Specialty    1.424    0.03    50.33    38.09379
Washington Real Estate Investment Trust    103036    0    2015    Diversified    1.83    -0.01    56.267    84.21301
One Liberty Properties, Inc.    102988    0    2012    Diversified    3.33    0.36    75.484    61.89199
CBL & Associates Properties, Inc.    103092    0    2014    Regional Mall    3.824    0.02    65.297    50.10408

Droping "NA"s

$
0
0
Hi Stata users.

I have 26 variables that contain some observations as NA. Is there a way (
olther than "
drop if var==NA" for each variable)
to drop all observations that contain "NA"s for any variable?

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input double id str17 mtb0 str9(ebv0 debt0 ebit0 ta1 ni1) str8 cfo1
302319 "NA"       "-1364"    "376"     "-1055"   "117"      "-476"    "-278"  
303063 ".83"      "-544"     "952"     "-2402"   "1486"     "-667"    "-1365" 
282874 "238.15"   "200229"   "32358"   "35823"   "260814"   "30219"   "1883"  
214440 "261.88"   "164534"   "0"       "6766"    "166933"   "6752"    "-3199" 
378443 "1394.28"  "2887794"  "0"       "-760338" "11451238" "-391191" "350907"
301631 "81305.81" "16763000" "7864000" "7905000" "35994000" "5142000" "6999000"
283489 "6.9"      "NA"       "NA"      "NA"      "9699"     "-21888"  "-9224" 
end
Thanks in advance.

Presenting Information Criteria in Latex form from Stata

$
0
0
Hi guys,

I would like to display my information criteria in choosing the lag length for the estimation of the VAR model but I don't know the command that is required to export the table into Latex form (if it's possible that is). T

My code is
varsoc lop lrgdp inf lexc
and my variables are

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(lop lrgdp) double inf float(lexc quarter)
 3.571784 12.733817  7.74278215223094  1.598734  80
 3.568123 12.690648  10.2464332036316 1.5978713  81
 3.487579 12.661692   12.291933418694 1.5771695  82
3.6658666 12.745687  13.1147540983606  1.614704  83
3.6188145 12.734313  14.7381242387332 1.6771152  84
 3.512739   12.7117                14 1.7375907  85
3.4593616 12.695962  13.5689851767389  1.805854  86
3.5122416 12.754564  12.3745819397994 1.7645824  87
 3.423394 12.734605  11.8895966029724 1.7836152  88
 3.469064  12.70936  11.0423116615067 1.8045276  89
 3.459676 12.699594  10.8433734939759  1.893353  90
3.4528406 12.762194  11.6071428571428 1.9665668  91
 3.372798 12.752794  9.77229601518024  1.961493  92
 3.383712 12.759803   9.1078066914498 1.9698684  93
 3.411038  12.74189  7.78985507246374 2.0019078  94
 3.365225 12.807036  7.28888888888891  2.015254  95
  3.37531  12.81646  6.30942091616251 2.0397863  96
3.3780425 12.796157  6.47359454855195 2.0465481  97
 3.337429 12.817017  6.13445378151261 2.1241918  98
 3.313822 12.866818  5.96520298260146 2.1803722  99
 3.309326 12.878362  5.69105691056911  2.237168 100
 3.293983  12.84228  5.75999999999999 2.1853395 101
 3.299288 12.861259  5.77988915281077  2.121343 102
  3.33482 12.929962  5.62939796716187 2.0523486 103
 2.842581 12.903667  5.76923076923076 1.9905694 104
 2.521185 12.897962  6.05143721633889  2.001881 105
 2.521185  12.89723  8.00898203592812 1.9996946 106
2.6837575 12.971673  8.80829015544041  2.010828 107
 2.873941  12.92926  9.96363636363637  1.950964 108
 2.911807 12.932686  9.70042796005709 1.9037777 109
 2.941276 12.893644  7.90020790020794  1.906605 110
 2.876761 12.984353  7.41496598639454 1.8676294 111
 2.757052 12.946301  7.07671957671957 1.8508142 112
 2.778198 12.911412  7.02210663198959  1.833541 113
2.6452286  12.90235  6.61528580603723  1.922188 114
 2.576168 12.970265  6.01646611779607   1.88874 115
 2.834585 12.919985  4.69425571340333 1.9055742 116
 2.916148  12.94254  4.67800729040098  1.947119 117
 2.857045 12.918333  4.51807228915663  1.951395 118
2.9295924  12.99056  4.30107526881723 1.9239225 119
 2.968532 12.966217  4.36578171091446  1.876953 120
 2.761275 12.940326  3.83052814857803 1.8701546 121
3.2448034 12.928958  3.80403458213255 1.8171023 122
 3.433987  13.01213    4.524627720504  1.768508 123
 2.988204 12.980206  3.90050876201245 1.7871656 124
 2.908539 12.994061  3.80100614868644  1.910165 125
 2.966475 12.965244  3.49805663520268 1.9188864 126
 2.989043  13.03053  2.57534246575342 1.8550003 127
 2.862582  13.03316  2.33949945593033 1.8492314 128
 2.979772 13.002828   2.4232633279483 1.8425794 129
 2.995566 13.011215  2.30686695278971 1.7568114 130
2.9421556 13.063393  2.24358974358973 1.8557254 131
 2.889816  13.03319  2.60499734183944 1.9392883 132
 2.890001 13.020434  2.41850683491062 1.9237765 133
 2.785011 13.036485  2.14997378080752  1.981176 134
 2.705603 13.129934  1.98537095088822   1.99125 135
 2.629728 13.086267   1.2435233160622 2.0071983 136
 2.789323 13.094742  .975359342915802   1.97535 137
  2.83615 13.069872  1.54004106776183   1.92342 138
2.8096035 13.167482  1.74180327868853  1.907233 139
 2.846265 13.138304  2.66120777891503 1.8751172 140
2.9001386 13.106668  2.69445856634468 1.8304694 141
2.7997174  13.13269   2.3255813953488 1.8410743 142
  2.83184 13.203746  2.16515609264855 1.8371985 143
2.9076295 13.192417  .897308075772663 1.8587487 144
2.9697304 13.162365  .990099009900991 1.8772483 145
 3.026746 13.191945  1.38339920948619 1.8584784 146
 3.138244 13.232254  1.77427304090683 1.8616062 147
 3.048483 13.214523  3.06324110671939 1.8915474 148
  2.91723 13.248065  2.69607843137256 1.9568384 149
2.9262035 13.222542  2.29044834307992 2.0096192 150
 2.935982  13.29889  2.22760290556901  1.963833 151
2.6506565 13.286092  2.15723873441995 2.0201964 152
 2.586259 13.259114   2.2434367541766 2.0167592 153
 2.565206  13.23906  2.28680323963794 2.0330641 154
 2.472328  13.30432  2.32117479867363 2.0134616 155
 2.454734 13.283984  2.25246363209761 2.0364158 156
 2.774462  13.26049  2.47432306255837 2.0538929 157
 3.017657 13.274122  2.04937121564973 2.0596468 158
 3.169966  13.34865  2.68518518518515  2.065874 159
3.2815375 13.348047  2.89123451124368 2.1065755 160
 3.287157 13.287727  2.91571753986331 2.1722455 161
 3.397301 13.296283  3.42309447740759 2.1921618 162
3.3901365 13.361666  3.11091073038775 2.2251422 163
 3.260785  13.35588  3.52363960749332 2.1848927 164
 3.285662 13.310266  3.93979637007527  2.216909 165
 3.227373 13.320636   2.5595763459841   2.19689 166
2.9607956  13.38958   2.0113686051596 2.1861658 167
 3.040865  13.34324   1.0340370529944 2.1871219 168
 3.226976 13.364398  .468483816013621 2.1021235 169
3.2934885 13.324635  1.41996557659209 2.0180607 170
 3.286036  13.40151  2.22888984140592 1.9903824 171
 3.444789 13.380116  4.60554371002131 1.9540068 172
3.2766414  13.33437  2.24671470962272 1.9471028 173
 3.345802  13.34543  1.90920661858297 1.9928846 174
 3.379633 13.410333  1.21593291404613 1.9342626 175
  3.46979 13.425058 -1.42682429677945  1.932487 176
3.5730944 13.385754  .829187396351576 1.9257075 177
 3.702618 13.367247  1.20732722731057 1.9261932 178
 3.754901 13.447302  1.24275062137531 1.8458267 179
end
format %tq quarter
Could someone please help me out with the code?

Threshold regression

$
0
0
I need your help.
My model is Yit=a1(1-I*)(D-D*)+a2xI*(D-D*)+bxXit+eit while I*=1 if D>D* and I*=0 if D<D*
I use xthreg command but I dont know what is in rx() and qx() with my model because I have dummy variable. It is quite different with Hansen because he uses cf1 as the regime-dependent variable so I'm confused about my case.
Many thanks

Static (not dynamic) panel data using xtabond2.

$
0
0
Dear All, This is a question more about econometric concept rather than Stata code. While (ssc install) xtabond2 was designed to estimate dynamic panel models (difference/system GMM), I wonder if (I think) it can be applied to estimate static panel data models. Are there any references/applications? Thanks.

xtabond2 Hansen test

$
0
0
Hello I'm using system GMM to estimate TFP growth (gtfp_100) at regional level .
I've a problem with the Hansen test, which is clearly too high (1.000), I guess.
I suspect this is due to instrument proliferation. So I tried to limit the instruments using collapse. Also I get the same results when using only (1 2) lags for the equation in difference. Any suggestions, please.
Code:
xtabond2 gtfp_100  l(1).ltfp_rel_lev95 ///
l(1).(   S dettotoccrfl  netai psii  netae     psie   ///
   branchps  rspri_stock_va  totroadskms   cs_14pesos) ///
tau1995-tau2012   ///
if cod_reg<21   , ///
iv(l(1).(   S dettotoccrfl  netai psii  netae     psie  ///
   branchps  rspri_stock_va  totroadskms   cs_14pesos) ///
tau1995-tau2012  , eq(diff)) ///
iv(l(1).(   S dettotoccrfl  netai psii  netae     psie   ///
   branchps  rspri_stock_va  totroadskms   cs_14pesos) ///
tau1995-tau2012  , eq(lev)) ///
gmm(l(1).ltfp_rel_lev95 , laglimits(1 .) collapse  eq(diff) )   ///
gmm(l(1).ltfp_rel_lev95 , laglimits(0 1) collapse  eq(lev) )   ///
h(3) rob   ar(3)

Code:
Dynamic panel-data estimation, one-step system GMM
------------------------------------------------------------------------------
Group variable: cod_reg                         Number of obs      =       320
Time variable : anno                            Number of groups   =        20
Number of instruments = 54                      Obs per group: min =        16
Wald chi2(26) =   1839.21                                      avg =     16.00
Prob > chi2   =     0.000                                      max =        16
--------------------------------------------------------------------------------
               |               Robust
      gtfp_100 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
ltfp_rel_lev95 |
           L1. |  -.2348444   .0606115    -3.87   0.000    -.3536407   -.1160481
               |
             S |
           L1. |    .019605   .0120456     1.63   0.104    -.0040039    .0432139
               |
  dettotoccrfl |
           L1. |  -.2225202   .1280743    -1.74   0.082    -.4735413    .0285009
               |
         netai |
           L1. |  -.0201765   .0176353    -1.14   0.253    -.0547411    .0143881
               |
          psii |
           L1. |   .0576091   .0654523     0.88   0.379    -.0706749    .1858932
               |
         netae |
           L1. |  -.0480485   .0209141    -2.30   0.022    -.0890394   -.0070575
               |
          psie |
           L1. |   -.170621   .1062258    -1.61   0.108    -.3788197    .0375778
               |
      branchps |
           L1. |   .0445189   .0261953     1.70   0.089     -.006823    .0958607
               |
rspri_stock_va |
           L1. |   .0015889   .0008631     1.84   0.066    -.0001028    .0032806
               |
   totroadskms |
           L1. |   .0095032   .0181984     0.52   0.602    -.0261651    .0451714
               |
    cs_14pesos |
           L1. |   -.140023   .0930925    -1.50   0.133     -.322481    .0424351
               |
       tau1997 |    .081572   .0248708     3.28   0.001      .032826    .1303179
       tau1998 |   .0765403   .0236921     3.23   0.001     .0301045     .122976
       tau1999 |   .0820527    .023021     3.56   0.000     .0369324     .127173
       tau2000 |   .0906023   .0229646     3.95   0.000     .0455925     .135612
       tau2001 |   .0773837   .0238363     3.25   0.001     .0306653     .124102
       tau2002 |   .0514515   .0216221     2.38   0.017     .0090731      .09383
       tau2003 |    .047534   .0194083     2.45   0.014     .0094945    .0855735
       tau2004 |   .0584287   .0162254     3.60   0.000     .0266274      .09023
       tau2005 |   .0508587   .0146411     3.47   0.001     .0221627    .0795548
       tau2006 |   .0504148   .0134201     3.76   0.000     .0241118    .0767178
       tau2007 |   .0464896   .0121259     3.83   0.000     .0227233    .0702559
       tau2008 |   .0233039    .010413     2.24   0.025     .0028949     .043713
       tau2009 |  -.0103899   .0071914    -1.44   0.149    -.0244849    .0037051
       tau2010 |   .0320077   .0055658     5.75   0.000      .021099    .0429164
       tau2011 |   .0195995   .0040825     4.80   0.000      .011598     .027601
         _cons |  -.1010425   .1680118    -0.60   0.548    -.4303397    .2282547
--------------------------------------------------------------------------------
Instruments for first differences equation
  Standard
    D.(L.S L.dettotoccrfl L.netai L.psii L.netae L.psie L.branchps
    L.rspri_stock_va L.totroadskms L.cs_14pesos tau1995 tau1996 tau1997
    tau1998 tau1999 tau2000 tau2001 tau2002 tau2003 tau2004 tau2005 tau2006
    tau2007 tau2008 tau2009 tau2010 tau2011 tau2012)
  GMM-type (missing=0, separate instruments for each period unless collapsed)
    L(1/17).L.ltfp_rel_lev95 collapsed
Instruments for levels equation
  Standard
    L.S L.dettotoccrfl L.netai L.psii L.netae L.psie L.branchps
    L.rspri_stock_va L.totroadskms L.cs_14pesos tau1995 tau1996 tau1997
    tau1998 tau1999 tau2000 tau2001 tau2002 tau2003 tau2004 tau2005 tau2006
    tau2007 tau2008 tau2009 tau2010 tau2011 tau2012
    _cons
  GMM-type (missing=0, separate instruments for each period unless collapsed)
    DL(0/1).L.ltfp_rel_lev95 collapsed
------------------------------------------------------------------------------
Arellano-Bond test for AR(1) in first differences: z =  -3.21  Pr > z =  0.001
Arellano-Bond test for AR(2) in first differences: z =  -0.09  Pr > z =  0.927
Arellano-Bond test for AR(3) in first differences: z =   0.27  Pr > z =  0.785
------------------------------------------------------------------------------
Sargan test of overid. restrictions: chi2(27)   =  95.16  Prob > chi2 =  0.000
  (Not robust, but not weakened by many instruments.)
Hansen test of overid. restrictions: chi2(27)   =   0.00  Prob > chi2 =  1.000
  (Robust, but weakened by many instruments.)

Difference-in-Hansen tests of exogeneity of instrument subsets:
  GMM instruments for levels
    Hansen test excluding group:     chi2(25)   =   0.00  Prob > chi2 =  1.000
    Difference (null H = exogenous): chi2(2)    =   0.00  Prob > chi2 =  1.000
  gmm(L.ltfp_rel_lev95, collapse eq(diff) lag(1 .))
    Hansen test excluding group:     chi2(11)   =   0.00  Prob > chi2 =  1.000
    Difference (null H = exogenous): chi2(16)   =   0.00  Prob > chi2 =  1.000
  gmm(L.ltfp_rel_lev95, collapse eq(level) lag(0 1))
    Hansen test excluding group:     chi2(25)   =   0.00  Prob > chi2 =  1.000
    Difference (null H = exogenous): chi2(2)    =   0.00  Prob > chi2 =  1.000
  iv(L.S L.dettotoccrfl L.netai L.psii L.netae L.psie L.branchps L.rspri_stock_va L.totroadskms L.cs_14pesos tau1995 tau1996 tau1997 tau1998 tau19
> 99 tau2000 tau2001 tau2002 tau2003 tau2004 tau2005 tau2006 tau2007 tau2008 tau2009 tau2010 tau2011 tau2012, eq(diff))
    Hansen test excluding group:     chi2(6)    =   0.00  Prob > chi2 =  1.000
    Difference (null H = exogenous): chi2(21)   =  -0.00  Prob > chi2 =  1.000
  iv(L.S L.dettotoccrfl L.netai L.psii L.netae L.psie L.branchps L.rspri_stock_va L.totroadskms L.cs_14pesos tau1995 tau1996 tau1997 tau1998 tau19
> 99 tau2000 tau2001 tau2002 tau2003 tau2004 tau2005 tau2006 tau2007 tau2008 tau2009 tau2010 tau2011 tau2012, eq(level))
    Hansen test excluding group:     chi2(13)   =   0.00  Prob > chi2 =  1.000
    Difference (null H = exogenous): chi2(14)   =   0.00  Prob > chi2 =  1.000

Synth_runner: Interpret the statistical outcome and general questions [Stata]

$
0
0
Hello together,
I am started to work with stata and synth_runner package. I try to figure out difference in mergers and acquisitions (= synthetic control for the counterfactual scenario). I applied the synth_runner already for multiple treaded units (and different times). Hence, I have a data set with treated and non-treated units. I got the following outcome:

| estimates pvals pvals_std
-------------+---------------------------------
c1 | .0156738 .0049 .7054
c2 | .0074967 .3611 .8254

Now, I have some questions (and hope you can help me with that):
  1. What is the differences between c1/c2 and why do I have 2 P-values?
  2. What would be the easiest way to become a better model fit in the “training” phase?
  3. You have any ideas (methods e.g. DiD) that I could also use to figure out the effects of an event with multiple treated units and different times?
Sorry for the newbie-Questions :-)
Thank you!

Subsetting data using labels

$
0
0
Hi,

I have 15 big data sets where I want to keep only a few variables and I want to do the same to my other datasets.
The problem is that the variable names differ in those data sets and same variables have only the same labels.
(e.g. variable "aaqhi" in data set 1 and "aaghx" in data set 2 both have the same label as "Date of Birth")
So I'm looking for a way to keep variables using their labels, in all those data sets, save them on the existing data sets and then merge all the data sets.


The thing is I do not know how to use variable labels in functions instead of names and I have already searched the forum but did not find anything.

many thanks,
Arman.

ring setting of legend option and scheme modified

$
0
0
Dear Stata users,

I like placing the legend inside the plot, so I modify scheme s2color as follows:
Code:
gridringstyle legend_ring     0 // the default is 3, I change the value to 0
The modified scheme performs well, however, it failed when I place the legend outside the plot region by setting ring(1). I want to know if there's another flexible way to change default ring setting. Thank you.
Code:
sysuse auto, clear
twoway line length weight price, sort
twoway line length weight price, sort legend(ring(1)) // the command failed

Error installing markstat

$
0
0
I am consistently receiving the following error when I attempt to install markstat. I already installed whereis and pandoc but cannot install markstat.

. ssc inst markstat
checking markstat consistency and verifying not already installed...
file http://fmwww.bc.edu/repec/bocode/m/markstats5.zip not found
server says file temporarily redirected to http://41.77.4.165:80/fmwww.bc.edu/r...markstats5.zip
could not copy http://fmwww.bc.edu/repec/bocode/m/markstats5.zip
(no action taken)

ssc install: apparent error in package file for markstat; please notify repec@repec.org, providing package
name
r(601);

Question about Survival Analysis (Discrete hazard proportional odd)

$
0
0
Dear statalist,
First of all, I would like to thank you all for the valuable information you are providing, and which is actually contributing to our knowledge.
I have 3 questions please and I hope that it will be answered.

I am using unbalanced panel data for a set of companies, and I want to apply the (Discrete hazard proportional odds model).
In 2005 set of standards have been issued and therefore companies were becoming under risk, since 2005, to adopt these standards as the adoption is voluntary. However, due to the lack of financial reports of many companies in 2005, and most of the annual reports appeared in 2006, I decided that the period of the study will be from 2006 to 2015. If I started since 2005 then all companies that established in 2006 will be considered as a (left-truncated) (i.e. any newly established company after 2005 will be under risk to adopt “the subjects have been at risk before entering the study”). And I want to minimize the left-truncated observation as much as possible because they should be excluded when conducting the unobserved heterogeneity “Frailty”. However, they will not be excluded from the sample when conducting the discrete hazard model without Frailty. Therefore, the study period will be from 2006-2015.
My Questions:
  1. Based on the above case, does my understanding of the meaning of left-truncated observation is correct?
  2. Regarding the calendar time, companies calendar time’s will be coded (1) since 2006 and (2) in 2007 and (3) in 2008, and (4) in 2009 and so on until they experience the event. However, for left-truncated companies, they will be coded based on the year they issued. For instance, if a company issued in 2008 then the code for the calendar time for this company this year will be started from (3) not (1). Am I, right?
  3. I have deleted all the left-truncated observation to conduct the “Frailty” and the results showed me that the probability of the likelihood is not significant. However, I did run the analysis with them and the results showed me that the probability of the likelihood is not significant as well. So, that means the unobserved heterogeneity is negligible in my case??
I am very, very sorry for the length of the questions, but I hope that it will be answered, and I will be very grateful for you.
Million thanks in advance.

Extracting commas between specific characters

$
0
0
Goog Afternoon Statalist users,

I have a database that looks like the following:

Code:
Example generated by -dataex-. To install: ssc install dataex
clear
input str100 Politician
"Arthur Alexander (Wilson Center), Hugh Patrick (Wilson Center)"
"Milt Drucker (Director Summit of the Americas, U.S. Department of State)"
"John Sequeira (State Department, Office of Southern Africa Affairs), Ltc Greg Saunders (DOD, Office "
"Mr. Nakamura (president, Kawasaki Steel America)"
"Steven A. Thompson (Professional Staff Member), Roger Smith (House National Security Committee (HNSC"
"S. Chami of Kenya (Ambassador ), Mr. W. Imakando (Embassy of Zambia), Mr. S. Dlamini (Embassy of Swa"
"Randi Sutton,Texas Governor George Bush, Cheryl Parker Rose, Florida
Governor Lawton Chiles (D)."
"Matt Mcmanus (Acting Division Chief, Energy-Producer Country Affairs, U.S. Department of State)"
end
I need to separate the names on each string. My first thought was to separate them by commas, but as you can see there are some commas between parenthesis that would separate things different of names so I need to replace the commas that are between parenthesis to other character and then split the string.

Does anyone nows how to make this replace with the commas only if they are found inside parenthesis?

I've tried this but didn't work:

gen var2 = trim(regexr(Politician," \( (,)+\) *",""))



Thank you very much.


Fixed effects regression with or without year dummies?

$
0
0
Hi all,

I am working with balanced panel data covering the period of 32 consequent years. I am analyzing the effect of marital status on the life satisfaction. I am treating the variables as cardinal since reg and ologit provide more or less the same results, also Hausman points towards FE rather than RE.

However, I am not sure if I need to include year effects (i.year) in my regression. Currently I am running the conditional fixed effect model (xtlogit) with year dummies and it takes significant time and seems to never provide results. I didn't have this problem before adding the year dummies and I wonder now if that might be the trigger or the big massive of data.

In general answering the question of life satisfaction would require or not controlling for the year effects ?

Thank you!

Kind regards,
Gabriela

DCC Garch 2 staged estimation? (R. Engle 2002)

$
0
0
Hello together,

I am trying to estimate pairwise dynamic correlations between country stock index returns via the ddc mgarch model.

According to Stata manual on DCC Garch, the software uses the approach developed by R. Engle (2002), who suggests:
".... a two-stage procedure with each variable first being modelled separately as a univariate GARCH process. A joint log-likelihood function would then simply be the sum of the two log-likelihoods for the individual GARCH models. In the second stage, the conditional likelihood is maximized with respect to any unknown parameters in the correlation matrix."

Question 1:
In a first step I fitted univariate ARIMA-GARCH processes for each country index return series. Is there any chance to include those specifications in the dcc function?
E.g. an ARIMA(1,0,1)GARCH(1,1) process for series A and an ARIMA(1,0,0)Garch(1,1) process for series B?

Question 2:
If i ignore the univariate specifications and run the following code:

mgarch dcc (fra uk =), arch(1/1) garch(1/1) nolog
predict corr*, corr

and then plot the predicted "corr_fra_uk" variable (see attachement) , obviously there is something wrong in the first few periods. I think it has to do with a misspecification of the initial value. Since Garch always includes past periods variances i am wondering how the values for t=1 are calculated when there is no data available before that.

Array

Thanks in advance!
Jano

Testing coefficient difference in 2 probit models

$
0
0
I would like to test the significance of difference between the coefficients in 2 probit models. I follow the code in Stata Manual:
. logit y1 x1
. estimates store M1
. logit y2 x2
. estimates store M2
. suest M1 M2
. test [M1]x1=[M2]x2

In my case, I re-phrased the above code:
. probit y1 x1 if group==0
. estimates store M1
. probit y1 x1 if group==1
. estimates store M2
. suest M1 M2
. test [M1]x1=[M2]x1

But I was only told by Stata that "equation M1 not found" so that I have to use "reg" model instead of "probit" to test the coefficient difference.
I am really thankful if anyone could kindly provide suggestions on the proper stata code. Thank you very much!

strpos function not found

$
0
0
when I even I put this command I get this result

. gen has_x= strpos (ICD , "X") >0
strpos not found
r(111);



Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input int(DOB Dateofstudy) str4 GENDER byte AGE str4 ICD
-3538 19715 "Male" 63 "10X" 
-5492 19711 "Male" 69 "13X" 
-2395 19722 "Male" 60 "53N" 
-4061 19712 "Male" 65 "33NX"
-3676 19719 "Male" 64 "22G" 
-3408 19719 "Male" 63 "27J" 
-4884 19712 "Male" 67 "114s"
-5500 19719 "Male" 69 "221" 
-3542 19718 "Male" 63 "21x" 
-3748 19722 "Male" 64 "225x"
end
format %tdnn/dd/CCYY DOB
format %tdnn/dd/CCYY Dateofstudy
any help or advice? thank you

Creating a variable that identifies and calculates overlapping time periods

$
0
0
Hi everyone,

I am currently working on data that shows if respondents of a survey worked part time while they were in school between the age of 15 and 19 years. With some help I was able to create the variable that shows if a person did both part time and school work which is called overlap:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input int ID str10 occupation byte(agebegin ageend overlap)
1546 "school"     16 19 1
1546 "part time " 16 16 0
1546 "part time " 18 18 0
1672 "school "    15 19 1
1672 "part time " 19 19 0
1733 "school"     16 19 1
1733 "part time " 16 16 0
1733 "part time " 18 19 0
1989 "school"     15 17 1
1989 "school"     19 19 1
1989 "part time " 17 17 0
1989 "part time " 19 19 0
1368 "school"     15 19 1
1368 "part time " 16 16 0
1368 "part time " 18 19 0
1121 "school"     15 16 1
1121 "school"     18 18 1
1121 "part time " 16 18 0
end
This is just an extract of many cases. You can see that overlap==1 if there is an overlap of the period in which a person did work part time while schooling. Now I want to create a variable, that can calculate the overlapping period in years. 90% of my data consists of cases like ID no 1672 where people answered that they worked once next to schooling - so the new variable "overlapy" should show the number 1 here. In the case of ID no 1733, the person worked at the age of 16,18 and 19 while in school. So "overlapy" should show the number 3. These two examples together with ID 1546 and 1368 represent nearly all of my data. Case 1121 and 1989 are exceptions and only exist once.

Is it somehow possible to create overlapy which should only appear if overlap==1. Later I would like to have one line per ID only if overlap ==1 and therefore overlapy >=1 shows how many years of part time work a person did at schooling age.

Any idea how to approach this?

Thanks a lot!




Kaplan Meier risk table problem

$
0
0
Dear Statalist,

I am using Stata 14.2 on Mac. I have created a propensity score IPT weighted sample of breast cancer patients and am comparing survival (months) between those who did and did not receive radiotherapy.

The sample size is 7,708, 6,908 of which received radiotherapy while the remaining 802 did not.

A Kaplan Meier curve has been creating using the risktable option.

I am confused because the numbers at risk at time 0 are not the same as stated above, there now seems to more patients than exist in my sample (ie 6,918 in the radiotherapy group, 824 in the no radiotherapy group). Is this something to do with the p weighting?

Your insights would be greatly appreciated.

Code:
logistic radiotherapy covariate1 covariate2 covariate3          /* Propensity score model */
predict ps                                                                               /* Predict propensity scores */
propwt radiotherapy ps, ipt                                                    /* Calculate IPT weights */

stset death_censor_date [pweight=ipt_wt], failure(death==0) origin(diagnosis_date) scale(30.4)
sts graph, by(radiotherapy) risktable
Array

Using a loop to compare observations of a variable

$
0
0
Hi All,
I have a dataset which looks something like below:
ID Amount month max_amount max_month N
1 10 1 20 . 2
1 20 2 20 2 2
2 10 1 10 1 3
2 10 2 10 2 3
2 5 3 10 . 3
3 20 2 20 2 1
4 30 4 30 4 1
Note that I have calculated the max_amount, max_month columns and N using code as below:

egen max_amount =max(Amount), by(ID)
bysort ID: gen max_month = month if Amount>= max_amount
bysort ID: gen N=_N

My problem is with the variable max_month. For my analysis I need one unique value for each ID. Notice that for the ID 2, there are 3 observations. Two of these observations have same value for "amount", i.e. 10. So my maximum amount is 10 but the months corresponding to these 2 "maximums" are different. Now for practical purposes, I am willing to consider only the earliest month among the duplicate "maximums", i.e. I want to retain only the earliest month with a maximum amount for each ID . I tried several ways to do this. Following is a failed attempt at a loop :

foreach num i=1/N {
replace max_month[`i'] = max_month[`i'-1] if max_month[`i']>max_month[`i'-1]
}

I am also wondering if I am not searching for the correct "keywords" on Google to look for an answer to this. Any help would be appreciated.

Thank you!
Viewing all 65109 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>