I am currently running regressions by group and saving coefficients using "statsby". It turns out that I need to loop over it many times and it takes way to long.
1) I have seen that there exist an alternative: "statsbyfast" but I could not get it to work " (I am using Stata 16, curious if it works at all?)
Code:
. statsbyfast _se, by(date) saving(beta_model`t', replace): regress F1_exret `model`t'' _se command not found
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float date double stock float(F1_exret LogSize LogBM MOM12) 420 1 1.927711 -.5852472 .11499815 0 421 1 2.651725 -.6215999 .16694237 0 422 1 8.454855 -.6135978 .1723073 0 423 1 2.894461 -.5747078 .06242105 0 424 1 -5.920187 -.5773819 .0719837 0 425 1 -.0375 -.6260327 .22071365 0 426 1 -4.4817386 -.6695028 .28219923 0 427 1 3.252563 -.7185428 .3852584 0 428 1 -3.22287 -.7098303 .3655157 0 429 1 7.776516 -.7125176 .3677585 0 430 1 1.1862323 -.6888025 .34420845 0 431 1 2.388549 -.6969711 .3597388 0 432 1 7.000864 -.6892462 .3669921 0 433 1 1.0732287 -.6497501 .28905886 -.59001756 434 1 .5136925 -.6521176 .29533115 -.34324735 435 1 5.910722 -.680016 .3228189 -.33748865 436 1 .484852 -.6565322 .2706667 -.52697074 437 1 -6.739183 -.6319041 .24997833 -.3791255 438 1 -2.2547672 -.6268925 .23821585 -.13331884 439 1 -2.883452 -.6760791 .3425798 .00319561 440 1 11.08221 -.7308719 .4584391 -.014854454 441 1 -.57737654 -.6569486 .2996624 -.2899106 442 1 -1.1008954 -.6990199 .4086685 .07938184 443 1 14.4762 -.7098561 .4065881 -.2690085 444 1 -.53210557 -.6391733 .3055489 -.2858834 445 1 -2.40546 -.644307 .3291195 .06347923 446 1 5.783891 -.6296629 .2995791 -.1533446 447 1 5.910736 -.58641416 .24357404 -.09942824 448 1 12.571774 -.597588 .27519906 .09329037 449 1 6.725173 -.5423116 .17339425 -.09669264 450 1 1.3984214 -.5455991 .1990709 .14503703 451 1 3.005836 -.543 .1645017 .1002197 452 1 -3.1606004 -.571285 .2072771 .4447244 453 1 -.4027479 -.5637179 .1794863 .6573465 454 1 5.554266 -.5739741 .2261642 .3271194 455 1 3.898304 -.54304373 .1708042 .5298603 456 1 .4512345 -.5130402 .20538726 .7006333 457 1 13.428807 -.5485587 .29233277 .4738248 458 1 8.651517 -.5060327 .18044583 .15185186 459 1 -1.7802713 -.4690668 .0826417 .3331818 460 1 -2.2094834 -.4564817 .062599584 .51906013 461 1 9.96819 -.4611211 .11156975 .5783971 462 1 -13.923313 -.3763591 -.10043382 .15692236 463 1 1.5749156 -.3523002 -.1325143 .40620375 464 1 13.581646 -.39034 -.05852994 .4733673 465 1 -.9079541 -.3641424 -.11021375 .4876685 466 1 28.189796 -.4037958 -.025893386 .7512823 467 1 -14.805963 -.28380394 -.2747483 .6154183 468 1 -2.969713 -.377814 .005564627 1.0093682 469 1 11.17293 -.3710982 -.008095614 .2032261 470 1 8.292903 -.3246959 -.09919195 .4272633 471 1 -1.7403984 -.3214875 -.12235998 .3403799 472 1 -2.7151685 -.3393546 -.12690166 .17146797 473 1 -7.766134 -.3716588 -.02381942 .15479617 474 1 -15.99229 -.40318274 .032537498 .09050763 475 1 -12.498517 -.4943248 .22291256 -.20170324 476 1 -2.534053 -.55512065 .3356217 -.3868619 477 1 -2.259816 -.5680073 .3793441 -.4242548 478 1 8.037499 -.6040637 .4178481 -.5078657 479 1 2.4049914 -.5842053 .3603639 -.4787201 480 1 -15.215885 -.5496637 .2613597 -.52056396 481 1 33.767292 -.6454348 .4032734 -.4723427 482 1 11.540565 -.5160571 .1818769 -.4544776 483 1 -7.46128 -.4515151 .0549905 -.4670102 484 1 -17.403605 -.5020388 .16492245 -.4069193 485 1 4.2902956 -.6083258 .3649641 -.4951222 486 1 -4.89105 -.5918792 .3482355 -.5645494 487 1 -4.3433957 -.6647894 .469943 -.54739916 488 1 .26728684 -.6823717 .5128142 -.49472445 489 1 2.872766 -.6869114 .5169506 -.4356141 490 1 7.375127 -.6433847 .45524135 -.4245361 491 1 .12276764 -.6433478 .4670534 -.3215246 492 1 8.740447 -.6436945 .5953303 -.3798505 493 1 -7.108429 -.58352727 .4839517 -.5499729 494 1 7.625951 -.58401996 .4908611 .002041269 495 1 7.67378 -.605188 .50103056 -.4688245 496 1 .2178242 -.5843823 .4542759 -.6478162 497 1 -10.95345 -.5801749 .4198487 -.385942 498 1 -10.099359 -.6432791 .5603625 -.016407905 499 1 -1.0133773 -.6964951 .6791326 -.3039938 500 1 2.0545838 -.6054888 .5074692 -.23619685 501 1 6.788255 -.64476 .5387905 .07837227 502 1 9.634001 -.6598168 .5455746 .04100154 503 1 -12.522242 -.6306199 .4771652 -.08651516 504 1 2.734117 -.7173976 .6910625 -.009167857 505 1 1.1132321 -.6889408 .650866 -.24872683 506 1 -7.731453 -.728283 .7263799 -.4354232 507 1 3.013713 -.7662435 .7858039 -.5364927 508 1 -2.5123286 -.7174132 .710502 -.6678619 509 1 -1.7303873 -.6940764 .6530726 -.6644319 510 1 -4.0352745 -.6226304 .49954605 -.6289694 511 1 -11.12212 -.6619639 .57828003 -.12466832 512 1 -14.533053 -.6750892 .5982243 -.016238984 513 1 13.764318 -.8019307 .850649 -.3836236 514 1 -2.738305 -.7958064 .8558486 -.7865438 515 1 -4.768898 -.7803991 .804569 -.7178196 516 1 -5.050323 -.7936473 .7874112 -.7926201 517 1 .1005229 -.8161545 .8274837 -.50812155 518 1 7.090696 -.8396168 .8552675 -.6607589 519 1 16.29535 -.8485509 .879484 -.5640138 end format %tm date label values stock unit_id label def unit_id 1 "130062", modify
Code:
statsby _b _se, by(date) saving(beta_model1, replace): regress F1_exret LogSize LogBM MOM12
0 Response to Replace "statsby" by "runby" to save time
Post a Comment