Hello statalist community
I am trying to run the following regression in stata:
where the excess return (EXRET) is my dependent variable, a proxy for difference of opinion (INCVOL) and a proxy for institutional ownership (INSOWN) are my independent variables, and I am controlling for the size effect (LnMV) and the market to book effect (LnMB).
i identifies the firm (permno) and q identifies the quarter (num_QUARTER).
I am trying to estimate each model by the calendar year-quarter (num_QUARTER) and output the precision-weighted Fama and Macbeth (1973) coefficient estimates, where the weights correspond to the number of observations available in each num_QUARTER.
Here is a sample of my data:
Example generated by -dataex-. For more info, type help dataex
clear
input double permno float(num_QUARTER EXRET ln_MV ln_MB) double INCVOL float INSOWN
10008 11 -3.613648 3.837628 .6660116 . 50.70855
10008 9 2.3320007 3.935141 .8268394 . 29.77759
10008 6 2.867223 3.898507 .8512741 . 34.233788
10008 8 .4817073 3.788159 .7337805 . 36.70713
10008 13 -.9682727 3.7018266 .4458091 . 44.39114
10008 7 5.464943 3.522456 .4682188 . 43.14516
10008 12 5.849236 3.432163 .2463477 . 51.50757
10008 10 -1.7264075 3.788159 .59201974 . 42.59423
10008 14 4.1000843 3.9286 .5639282 . 45.09671
10010 39 3.996558 3.979242 1.7785792 3.243112060436777 20.236296
10010 32 12.792796 4.535048 1.6222625 3.9632545293359813 8.989085
10010 35 .9209003 3.903807 1.8974736 3.730587269986754 10.883036
10010 12 -5.483268 2.555605 .6282953 . .3308768
10010 30 -1.7342974 4.343682 1.4674653 . 7.709942
10010 29 -5.497581 4.4030538 1.4837706 . 10.38042
10010 11 2.9390564 2.385821 .4960281 . 9.4157
10010 16 -2.424029 2.7355816 .6487922 . .7752287
10010 41 5.316243 4.3014655 2.079982 3.143430414516524 12.29525
10010 14 -4.1153455 2.859547 .8459778 . .4511957
10010 21 17.96718 2.906968 .6482305 . 1.549211
10010 25 -5.758246 4.707672 2.1232975 . 28.631784
10010 36 3.8106065 4.067744 2.003289 3.5763718828762605 6.736435
10010 27 4.899927 4.5394745 1.7059673 . 15.765204
10010 17 -3.61082 3.019382 .8926992 . .6788278
10010 28 -.9291086 4.6668105 1.7868258 . 11.099987
10010 33 -7.396168 4.2913423 1.3862462 3.882547117782703 7.857353
10010 38 -.49252 3.9549484 1.831729 3.340686017305362 16.595228
10010 22 -6.025785 4.436899 2.093364 . 12.177193
10010 42 -3.5942485 . . 3.2307917212785124 0
10010 31 11.832273 4.154188 1.278648 4.205261673947921 7.944925
10010 34 -1.1528807 4.011162 1.1025683 3.82539639632745 8.12151
10010 37 3.75514 4.4388576 2.2043371 3.4520890957179944 12.125244
10010 13 -3.490855 2.8352535 .8611723 . .3399007
10010 26 -22.12851 4.855687 2.1711104 . 24.2808
10010 40 -14.593055 3.996084 1.7676836 3.1438398217238763 12.346858
10010 19 3.907184 2.623242 .4089416 . .9546611
10010 20 4.5179973 2.7089984 .4877318 . 1.0325191
10010 23 6.075223 3.926768 1.467436 . 8.285469
10010 18 .3539547 2.9566655 .7894421 . 1.0134529
10010 15 -3.5315084 2.7891355 .7392515 . .47340825
10010 24 -1.8002476 4.501533 1.9816613 . 14.55777
10011 51 -3.56842 4.446916 .5785106 2.334583952508747 14.916426
10011 46 6.99464 4.776778 1.0684394 . 20.15268
10011 37 -2.8352714 3.5961645 1.5601523 . 2.707788
10011 44 3.627314 4.579211 .9194773 . 12.897806
10011 42 -1.09913 4.455161 1.7652068 . 3.182189
10011 38 -3.223763 4.1214304 2.0016873 . 2.7191024
10011 50 -5.325699 4.463703 .6218236 2.4463803968178697 19.195
10011 52 -.11500657 4.491021 .5861638 2.25453858594281 39.19349
10011 47 -7.960851 4.6077433 .8482187 2.717672115669003 17.707294
10011 36 3.944739 3.699705 1.7451184 . 2.3
10011 41 3.076095 4.331108 1.7054982 . 2.8928895
10011 40 -1.430903 4.5160847 1.9600986 . 2.913332
10011 48 .23876584 4.4052424 .6102028 2.67519623302301 25.705116
10011 43 7.620689 4.475688 1.6873487 . 5.335223
10011 35 -13.390417 3.2955816 1.4056373 . 1.879015
10011 49 -3.2104526 4.1643367 .3479661 2.532721266515545 34.033783
10011 39 4.7234454 3.935095 1.64438 . 2.679057
10015 4 -2.116692 3.6982975 1.1322718 . 7.276555
10015 1 .2713797 2.975351 .7527837 . 8.153242
10015 2 -.029075697 3.2543395 .836909 . 3.864492
10015 3 -13.90464 3.461979 .9384125 . 15.327478
10016 22 2.715161 6.139966 .3224233 . 0
10016 31 .3153377 5.626577 -.3344666 .7665897111991958 0
10016 60 2.0315082 5.812871 1.2374282 2.7224301578201575 72.10319
10016 63 10.072694 5.704714 1.0895839 .6080836900541465 78.52301
10016 15 5.258823 6.15718 .25509027 . .
end
[/CODE]
For some quarters, data for INCVOL is missing, whilst for INSOWN, some quarters are missing and some are 0, by design.
I have tried to run the following code, but I do not think it is correct:
Would appreciate any input, thanks in advance.
I am trying to run the following regression in stata:
where the excess return (EXRET) is my dependent variable, a proxy for difference of opinion (INCVOL) and a proxy for institutional ownership (INSOWN) are my independent variables, and I am controlling for the size effect (LnMV) and the market to book effect (LnMB).
i identifies the firm (permno) and q identifies the quarter (num_QUARTER).
I am trying to estimate each model by the calendar year-quarter (num_QUARTER) and output the precision-weighted Fama and Macbeth (1973) coefficient estimates, where the weights correspond to the number of observations available in each num_QUARTER.
Here is a sample of my data:
Example generated by -dataex-. For more info, type help dataex
clear
input double permno float(num_QUARTER EXRET ln_MV ln_MB) double INCVOL float INSOWN
10008 11 -3.613648 3.837628 .6660116 . 50.70855
10008 9 2.3320007 3.935141 .8268394 . 29.77759
10008 6 2.867223 3.898507 .8512741 . 34.233788
10008 8 .4817073 3.788159 .7337805 . 36.70713
10008 13 -.9682727 3.7018266 .4458091 . 44.39114
10008 7 5.464943 3.522456 .4682188 . 43.14516
10008 12 5.849236 3.432163 .2463477 . 51.50757
10008 10 -1.7264075 3.788159 .59201974 . 42.59423
10008 14 4.1000843 3.9286 .5639282 . 45.09671
10010 39 3.996558 3.979242 1.7785792 3.243112060436777 20.236296
10010 32 12.792796 4.535048 1.6222625 3.9632545293359813 8.989085
10010 35 .9209003 3.903807 1.8974736 3.730587269986754 10.883036
10010 12 -5.483268 2.555605 .6282953 . .3308768
10010 30 -1.7342974 4.343682 1.4674653 . 7.709942
10010 29 -5.497581 4.4030538 1.4837706 . 10.38042
10010 11 2.9390564 2.385821 .4960281 . 9.4157
10010 16 -2.424029 2.7355816 .6487922 . .7752287
10010 41 5.316243 4.3014655 2.079982 3.143430414516524 12.29525
10010 14 -4.1153455 2.859547 .8459778 . .4511957
10010 21 17.96718 2.906968 .6482305 . 1.549211
10010 25 -5.758246 4.707672 2.1232975 . 28.631784
10010 36 3.8106065 4.067744 2.003289 3.5763718828762605 6.736435
10010 27 4.899927 4.5394745 1.7059673 . 15.765204
10010 17 -3.61082 3.019382 .8926992 . .6788278
10010 28 -.9291086 4.6668105 1.7868258 . 11.099987
10010 33 -7.396168 4.2913423 1.3862462 3.882547117782703 7.857353
10010 38 -.49252 3.9549484 1.831729 3.340686017305362 16.595228
10010 22 -6.025785 4.436899 2.093364 . 12.177193
10010 42 -3.5942485 . . 3.2307917212785124 0
10010 31 11.832273 4.154188 1.278648 4.205261673947921 7.944925
10010 34 -1.1528807 4.011162 1.1025683 3.82539639632745 8.12151
10010 37 3.75514 4.4388576 2.2043371 3.4520890957179944 12.125244
10010 13 -3.490855 2.8352535 .8611723 . .3399007
10010 26 -22.12851 4.855687 2.1711104 . 24.2808
10010 40 -14.593055 3.996084 1.7676836 3.1438398217238763 12.346858
10010 19 3.907184 2.623242 .4089416 . .9546611
10010 20 4.5179973 2.7089984 .4877318 . 1.0325191
10010 23 6.075223 3.926768 1.467436 . 8.285469
10010 18 .3539547 2.9566655 .7894421 . 1.0134529
10010 15 -3.5315084 2.7891355 .7392515 . .47340825
10010 24 -1.8002476 4.501533 1.9816613 . 14.55777
10011 51 -3.56842 4.446916 .5785106 2.334583952508747 14.916426
10011 46 6.99464 4.776778 1.0684394 . 20.15268
10011 37 -2.8352714 3.5961645 1.5601523 . 2.707788
10011 44 3.627314 4.579211 .9194773 . 12.897806
10011 42 -1.09913 4.455161 1.7652068 . 3.182189
10011 38 -3.223763 4.1214304 2.0016873 . 2.7191024
10011 50 -5.325699 4.463703 .6218236 2.4463803968178697 19.195
10011 52 -.11500657 4.491021 .5861638 2.25453858594281 39.19349
10011 47 -7.960851 4.6077433 .8482187 2.717672115669003 17.707294
10011 36 3.944739 3.699705 1.7451184 . 2.3
10011 41 3.076095 4.331108 1.7054982 . 2.8928895
10011 40 -1.430903 4.5160847 1.9600986 . 2.913332
10011 48 .23876584 4.4052424 .6102028 2.67519623302301 25.705116
10011 43 7.620689 4.475688 1.6873487 . 5.335223
10011 35 -13.390417 3.2955816 1.4056373 . 1.879015
10011 49 -3.2104526 4.1643367 .3479661 2.532721266515545 34.033783
10011 39 4.7234454 3.935095 1.64438 . 2.679057
10015 4 -2.116692 3.6982975 1.1322718 . 7.276555
10015 1 .2713797 2.975351 .7527837 . 8.153242
10015 2 -.029075697 3.2543395 .836909 . 3.864492
10015 3 -13.90464 3.461979 .9384125 . 15.327478
10016 22 2.715161 6.139966 .3224233 . 0
10016 31 .3153377 5.626577 -.3344666 .7665897111991958 0
10016 60 2.0315082 5.812871 1.2374282 2.7224301578201575 72.10319
10016 63 10.072694 5.704714 1.0895839 .6080836900541465 78.52301
10016 15 5.258823 6.15718 .25509027 . .
end
[/CODE]
For some quarters, data for INCVOL is missing, whilst for INSOWN, some quarters are missing and some are 0, by design.
I have tried to run the following code, but I do not think it is correct:
Code:
xtset permno num_QUARTER egen NQTR = count(num_QUARTER) if !mi(EXRET , ln_MV ,ln_MB ,INCVOL ,INSOWN), by(num_QUARTER) foreach var in EXRET ln_MV ln_MB INCVOL INSOWN { g w`var' = `var'*sqrt(NQTR) } byso num_QUARTER: asreg wEXRET wln_MV wln_MB wINCVOL wINSOWN, fmb noconstant
Comment