I am trying to run a loop of regressions by an index called funddateid and then storing the betas from each regression as a matrix or as new variables. I want to run a cross-sectional regression of fund trades on past institutional trades for each fund(j) and quarter(t) so I created a variable called funddateid which is unique for each fund-quarter. The regression is specified below along with the code used.
Delta=IO(Institutional ownership)+logMC(Market cap)+logBM(Book-to-market)+Returns(Momentum)
The following code is used:
Code:
forvalues funddateid = 1(1)4788 { xtreg std_delta_W l.std_LogMc l.std_logBm l.std_IO_98 l.std_Returns_W matrix betas=nullmat(beta) }
The dependent variable(delta) is the percentage change in the number of shares of sock(i) in the portfolio of fund(j) during quarter(t). In some quarters, there is no change which gives delta the value of "0" and in some cases there are no observations of said stock at all since it may not be included in the fund in that particular quarter which will give delta a "." (Missing value). I suspect this is the reason for the "insufficient data" error since there are quite a lot of "missing" observations for delta but I do not know how to get around the problem. If the stock is not present in the particular quarter, I cant assign a 0 to it either. Can anyone provide any advice on how to solve this issue?
See first 100 observations below:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(std_delta_W std_LogMc std_logBm std_IO_98 std_Returns_W) -.08436412 -.019862974 -.3200253 1.2639892 .20019694 .05064744 .010193878 -.15792634 -.025369117 .52692515 -.2992237 -.1692743 .0920907 1.371598 .48546 -.16985036 .06018072 -.6145061 -.14668785 .800246 .2162701 .02847719 -.22756325 .00375406 -.6904961 4.4661713 .2355457 -.6178749 -.22152378 1.3600446 -.10972418 .24799494 -.6843112 -.2404587 .48781285 -.3217568 .13032532 -.4930049 -.19861546 -.6543404 -.24006122 .14044602 -.5806749 -.19565043 .5423205 . -.08693593 -.13920262 1.933017 1.4659822 -.014236635 -.22284804 .18511248 2.084619 -1.6137875 -.24924693 .1081663 -.4439734 -.19012913 -.06332681 -.2021701 .02651491 -.46270245 -.2168303 .8460811 -.033579994 .05745066 -.3176963 -.1329641 -.8327176 -.26426965 -.1790977 .08318415 1.5960423 .6210191 -.1767197 -.13142912 .03676183 .7688901 .4243053 -.26486173 .05073912 -.20902926 -.1765488 .6561047 -.1698344 .002055234 -.3967392 -.23017097 .7369264 .02158031 -.09981994 -.06231921 .3500392 -.59018606 -.12089711 .04993459 -.3253091 -.06297561 .3225815 -.9026852 .159684 -.5303013 -.240055 -.8998079 -.35788155 .0478515 -.55603486 -.11851433 -.0798317 .11438504 -.19279864 .1625038 1.7851228 -.407834 -.2180872 .03732831 -.17707463 .02233156 .53683823 -.22502415 .1183198 -.50608253 .03982426 1.5177295 -.489066 .06251259 -.48739755 -.068284184 .3715165 .2080083 -.21688573 .12193358 2.3437867 .13317217 .07772464 -.005657548 -.2212266 -.025047496 -1.423227 -.03770588 .11380477 -.3589811 -.1708785 1.2609015 -1.0987867 .12406065 -.4313966 -.09260344 .682752 -.21748057 .04514672 -.31970325 .014481218 -.1376224 .3456481 -.015334507 -.30398515 .3943915 1.8803595 -.12660344 .029301 -.3981392 -.14224868 .6349776 -.3948699 .17039265 -.5011021 -.02285117 .6209945 -.14395085 -.06478409 -.1628543 .6400483 1.277161 .02772213 .04336702 -.4834564 -.26528367 -.19495553 . .04514672 -.31970325 .014481218 -.1376224 . .010193878 -.15792634 -.025369117 .52692515 . .1183198 -.50608253 .03982426 1.5177295 . -.13142912 .03676183 .7688901 .4243053 . -.19279864 .1625038 1.7851228 -.407834 . -.09981994 -.06231921 .3500392 -.59018606 . -.1692743 .0920907 1.371598 .48546 . -.08693593 -.13920262 1.933017 1.4659822 . .029301 -.3981392 -.14224868 .6349776 . .05073912 -.20902926 -.1765488 .6561047 . .06251259 -.48739755 -.068284184 .3715165 . .04993459 -.3253091 -.06297561 .3225815 . .1081663 -.4439734 -.19012913 -.06332681 . .159684 -.5303013 -.240055 -.8998079 . .04336702 -.4834564 -.26528367 -.19495553 . .13032532 -.4930049 -.19861546 -.6543404 . .12406065 -.4313966 -.09260344 .682752 . .05745066 -.3176963 -.1329641 -.8327176 . -.1790977 .08318415 1.5960423 .6210191 . -.22284804 .18511248 2.084619 -1.6137875 . -.21688573 .12193358 2.3437867 .13317217 . .11380477 -.3589811 -.1708785 1.2609015 . -.019862974 -.3200253 1.2639892 .20019694 . .0478515 -.55603486 -.11851433 -.0798317 . .2355457 -.6178749 -.22152378 1.3600446 . .002055234 -.3967392 -.23017097 .7369264 . .03732831 -.17707463 .02233156 .53683823 . -.015334507 -.30398515 .3943915 1.8803595 . .17039265 -.5011021 -.02285117 .6209945 . .02847719 -.22756325 .00375406 -.6904961 . -.005657548 -.2212266 -.025047496 -1.423227 . .02651491 -.46270245 -.2168303 .8460811 . -.06478409 -.1628543 .6400483 1.277161 . .06018072 -.6145061 -.14668785 .800246 . .14044602 -.5806749 -.19565043 .5423205 . .24799494 -.6843112 -.2404587 .48781285 . .3013069 -.3031426 -.2458811 -.8189632 -.489066 .5810111 -.1287914 -.3424408 -1.258042 . .4155392 -.52037567 -.2392435 -1.071275 . .7624493 -.3850458 -.51717556 .4311027 . .7474274 -.28644872 -.60361 -.5910043 .05978851 .6582577 -.2454224 -.11071718 -.44066915 3.85713 .6929567 -.3066609 -.3323993 .4323719 . .4163122 -.37317845 -.25870988 -.0045675314 . .3633049 -.3181784 -.1799226 -.3974456 . .7769827 -.27940208 -.2170247 -.9487463 2.274123 .6646247 -.2282051 -.21360686 -.27441826 . .7943527 -.4606717 -.3241475 -.5874089 . .3983752 -.33996755 -.2039016 .6178427 . .4474668 -.09500497 -.24924213 -.9529543 . .7565222 -.28874764 -.4936907 -.7651106 . .3861609 -.4258011 -.24233766 .3661532 . .3667498 -.3582995 -.23735544 -.4927481 . .447699 -.15295595 -.1738346 -.1703405 -.3189141 .6871001 -.3871126 .04885774 .6935948 . .6362026 -.16335775 -.4189915 -.9413581 -.05638577 .6505797 -.20176312 -.3700999 -.7329817 . .8346604 -.4224465 -.3545304 .036658492 . .36996385 -.091672 -.20807937 .7178988 .6130913 .3816887 -.00013731657 -.11239394 -.9962961 . .4151791 -.3586984 -.1680542 .7389817 . .8554429 -.4164061 -.4324653 .57129574 -3.476443 .5704425 -.21022104 -.3436584 .8901415 . .8841048 -.51752275 -.37833935 .2154532 end
Birger
0 Response to Insufficient data when trying looped regressions and storing betas
Post a Comment