I am trying to calculate herding of Robinhood investors by using the Lakonishok et al. (1992) measure, there is an adjustment factor (AF) which I need to calculated based upon this formula
Array
Now I am no expert at writing codes and I keep getting "." values when I try to run the code, so I was hoping anyone would be so helpful and tell me how it can be done.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input double date long(tic gics) double(outstanding vol close_price) float(market_cap small_cap mid_cap large_cap lprice) double spreturn float(stock_return top_mover market_mover users diff_users B S sum_BS active_trader p actual_value) 21930 2174 100 68750000 325155 49.47 3401062400 0 1 0 3.9013665 .008366548 .02102284 0 0 16 1 1 0 1 1240522 8.061123e-07 .9999992 21930 7001 11 47595000 514359 1.16 55210200 1 0 0 .14842 .008366548 .24353448 0 0 63 1 1 0 1 1240522 8.061123e-07 .9999992 21930 6261 15 3173000 1116 14 44422000 1 0 0 2.6390574 .008366548 .006071429 0 0 10 1 1 0 1 1240522 8.061123e-07 .9999992 21930 2934 100 1000000 17436 25.8459 25845900 1 0 0 3.252152 .008366548 -.007900673 0 0 4 1 1 0 1 1240522 8.061123e-07 .9999992 21930 1356 14 119656000 454943 2.75 329054016 1 0 0 1.011601 .008366548 -.2581818 0 0 96 1 1 0 1 1240522 8.061123e-07 .9999992 21930 1257 100 18692000 47229 35.2 657958400 1 0 0 3.561046 .008366548 -.002840909 0 0 17 1 1 0 1 1240522 8.061123e-07 .9999992 21930 3310 11 36090000 354276 64.58 2330692096 0 1 0 4.167905 .008366548 .06286776 0 0 9 1 1 0 1 1240522 8.061123e-07 .9999992 21930 4226 1 76319000 59403 .8607 65687764 1 0 0 -.15000927 .008366548 -.2315557 0 0 49 1 1 0 1 1240522 8.061123e-07 .9999992 21930 1782 13 17340000 107952 1.06 18380400 1 0 0 .05826891 .008366548 .14056604 0 0 10 1 1 0 1 1240522 8.061123e-07 .9999992 21930 4810 21 2355374000 0 14.773 34795941888 0 0 1 2.692801 .008366548 -.013335139 0 0 75 1 1 0 1 1240522 8.061123e-07 .9999992 21930 7448 100 450000 5423 22.1234 9955530 1 0 0 3.096636 .008366548 .020946147 0 0 8 1 1 0 1 1240522 8.061123e-07 .9999992 21930 6490 100 6900000 10611 21.3663 147427472 1 0 0 3.061815 .008366548 .01820156 0 0 146 1 1 0 1 1240522 8.061123e-07 .9999992 21930 3427 100 50000 31 70.83 3541500 1 0 0 4.2602825 .008366548 .011153466 0 0 379 1 1 0 1 1240522 8.061123e-07 .9999992 21930 2205 9 566000 0 75 42450000 1 0 0 4.317488 .008366548 .024266666 0 0 28 1 1 0 1 1240522 8.061123e-07 .9999992 21930 5224 9 1950060000 0 4.811 9381738496 0 1 0 1.570905 .008366548 -.16586988 0 0 53 1 1 0 1 1240522 8.061123e-07 .9999992 21930 7501 21 16329158000 0 24.729 4.038037e+11 0 0 1 3.2079766 .008366548 -.0039629587 0 0 11 1 1 0 1 1240522 8.061123e-07 .9999992 21930 4204 18 885637000 4319848 137.98 1.222002e+11 0 0 1 4.927109 .008366548 .028120017 0 0 7 1 1 0 1 1240522 8.061123e-07 .9999992 21930 6528 24 9127000 26875 19.23 175512208 1 0 0 2.9564714 .008366548 .017160686 0 0 12 1 1 0 1 1240522 8.061123e-07 .9999992 21930 6240 100 2000000 7264 27.6162 55232400 1 0 0 3.3184025 .008366548 .020965954 0 0 56 1 1 0 1 1240522 8.061123e-07 .9999992 21930 812 100 1450000 3101 25.51 36989500 1 0 0 3.2390704 .008366548 .0003920031 0 0 288 1 1 0 1 1240522 8.061123e-07 .9999992 21930 2533 100 23612000 59252 9.59 226439072 1 0 0 2.260721 .008366548 .0177268 0 0 2 1 1 0 1 1240522 8.061123e-07 .9999992 21930 7280 5 1100442000 566727 93.09 102440148992 0 0 1 4.533567 .008366548 .067031905 0 0 15 1 1 0 1 1240522 8.061123e-07 .9999992 21930 7301 100 1500000 3995 121.494 182240992 1 0 0 4.799865 .008366548 .02374027 0 0 48 1 1 0 1 1240522 8.061123e-07 .9999992 21930 6153 9 63662000 1440589 54.64 3478491648 0 1 0 4.0007663 .008366548 -.12573206 0 0 73 1 1 0 1 1240522 8.061123e-07 .9999992 21930 675 3 48498000 386868 102.5 4971044864 0 1 0 4.629863 .008366548 .0662439 0 0 73 1 1 0 1 1240522 8.061123e-07 .9999992 21930 2789 1 29306000 195427 5.56 162941360 1 0 0 1.715598 .008366548 -.18884893 0 0 2 1 1 0 1 1240522 8.061123e-07 .9999992 21930 7073 100 10482000 29701 11.87 124421336 1 0 0 2.474014 .008366548 .01432182 0 0 21 1 1 0 1 1240522 8.061123e-07 .9999992 21930 7222 100 3195000 222763 5.79 18499050 1 0 0 1.7561322 .008366548 -.10708117 0 0 59 1 1 0 1 1240522 8.061123e-07 .9999992 21930 7718 5 94088000 517904 23.77 2236471808 0 1 0 3.1684244 .008366548 .06520825 0 0 7 1 1 0 1 1240522 8.061123e-07 .9999992 21930 4715 100 13249000 1959158 74.71 989832768 1 0 0 4.313614 .008366548 -.09262481 0 0 61 1 1 0 1 1240522 8.061123e-07 .9999992 21930 5319 2 65630000 330052 12.78 838751424 1 0 0 2.5478814 .008366548 .08685446 0 0 57 1 1 0 1 1240522 8.061123e-07 .9999992 21930 6292 14 21363000 102941 24.74 528520608 1 0 0 3.2084215 .008366548 -.0966047 0 0 45 1 1 0 1 1240522 8.061123e-07 .9999992 21930 6428 100 950000 5118 45.5698 43291312 1 0 0 3.819245 .008366548 .015264495 0 0 70 1 1 0 1 1240522 8.061123e-07 .9999992 21930 2354 9 26080000 149820 1.57 40945600 1 0 0 .4510756 .008366548 .08280255 0 0 22 1 1 0 1 1240522 8.061123e-07 .9999992 21930 2535 100 175000 403 43.3899 7593233 1 0 0 3.770227 .008366548 .014524117 0 0 7 1 1 0 1 1240522 8.061123e-07 .9999992 21930 4113 14 7833000 7834 6.06 47467980 1 0 0 1.8017098 .008366548 .0379703 0 0 5 1 1 0 1 1240522 8.061123e-07 .9999992 21930 4044 14 10119000 33708 5.155 52163444 1 0 0 1.639967 .008366548 -.13676043 0 0 4 1 1 0 1 1240522 8.061123e-07 .9999992 21930 2918 1 33496000 267164 6.51 218058960 1 0 0 1.8733394 .008366548 -.2749616 0 0 6 1 1 0 1 1240522 8.061123e-07 .9999992 21930 223 24 5400000 32870 22.04 119016000 1 0 0 3.092859 .008366548 .010703267 0 0 65 1 1 0 1 1240522 8.061123e-07 .9999992 21930 1494 19 2111000 79032 1.02 2153220 1 0 0 .01980263 .008366548 .2655039 0 0 34 1 1 0 1 1240522 8.061123e-07 .9999992 21930 7976 13 30745000 49796 1.26 38738700 1 0 0 .2311117 .008366548 -.015873017 0 0 50 1 1 0 1 1240522 8.061123e-07 .9999992 21930 2667 100 950000 1483 25.02 23769000 1 0 0 3.2196755 .008366548 -.01558753 0 0 2 1 1 0 1 1240522 8.061123e-07 .9999992 21930 1217 13 21941000 76954 5.43 119139632 1 0 0 1.691939 .008366548 -.12707183 0 0 7 1 1 0 1 1240522 8.061123e-07 .9999992 21930 5786 16 19816000 136144 21.78 431592480 1 0 0 3.080992 .008366548 -.05096419 0 0 2 1 1 0 1 1240522 8.061123e-07 .9999992 21930 2221 9 63596000 1052438 48.74 3099668992 0 1 0 3.8865 .008366548 .01415675 0 0 1 1 1 0 1 1240522 8.061123e-07 .9999992 21930 5627 100 12183000 11445 21.35 260107056 1 0 0 3.061052 .008366548 .016861826 0 0 33 1 1 0 1 1240522 8.061123e-07 .9999992 21930 6715 24 14000000 34987 26.14 365960000 1 0 0 3.2634666 .008366548 .0045906655 0 0 25 1 1 0 1 1240522 8.061123e-07 .9999992 21930 7896 100 996000 9651 17.77 17698920 1 0 0 2.877512 .008366548 -.05064716 0 0 9 1 1 0 1 1240522 8.061123e-07 .9999992 21930 4856 100 20340000 75245 15.91 323609408 1 0 0 2.766948 .008366548 -.0031426775 0 0 293 1 1 0 1 1240522 8.061123e-07 .9999992 21930 7108 24 114341000 2592077 9.88 1129689088 1 0 0 2.2905126 .008366548 .072874494 0 0 2 1 1 0 1 1240522 8.061123e-07 .9999992 21930 8181 100 33854000 45563 20.33 688251840 1 0 0 3.0120976 .008366548 .03148057 0 0 8 1 1 0 1 1240522 8.061123e-07 .9999992 21930 4409 14 215397000 1343488 80.62 17365305344 0 0 1 4.3897467 .008366548 .04068469 0 0 55 1 1 0 1 1240522 8.061123e-07 .9999992 21930 1607 24 38378000 43863 107.96 4143288832 0 1 0 4.681761 .008366548 .06567247 0 0 40 1 1 0 1 1240522 8.061123e-07 .9999992 21930 4230 20 22495000 559395 39.32 884503424 1 0 0 3.6717334 .008366548 .17166837 0 0 257 1 1 0 1 1240522 8.061123e-07 .9999992 21930 3565 100 2250000 1296 29.2758 65870552 1 0 0 3.376761 .008366548 .019736437 0 0 34 1 1 0 1 1240522 8.061123e-07 .9999992 21930 5325 17 32200000 60379 27.65 890329984 1 0 0 3.3196256 .008366548 .0018083183 0 0 4 1 1 0 1 1240522 8.061123e-07 .9999992 21930 2869 100 72300000 2971153 29.8 2154540032 0 1 0 3.3945084 .008366548 .01510067 0 0 55 1 1 0 1 1240522 8.061123e-07 .9999992 21930 4516 100 9800000 5844 26.48 259504000 1 0 0 3.27639 .008366548 .008119335 0 0 21 1 1 0 1 1240522 8.061123e-07 .9999992 21930 5841 100 27709000 80442 23.81 659751296 1 0 0 3.170106 .008366548 .034859303 0 0 24 1 1 0 1 1240522 8.061123e-07 .9999992 21930 7248 100 225000 0 65.6763 14777168 1 0 0 4.184738 .008366548 .02661386 0 0 13 1 1 0 1 1240522 8.061123e-07 .9999992 21930 5721 1 363416000 9634964 2.96 1075711360 1 0 0 1.0851892 .008366548 -.125 0 0 162 1 1 0 1 1240522 8.061123e-07 .9999992 21930 3315 2 64725000 380175 14.05 909386240 1 0 0 2.6426225 .008366548 .1900356 0 0 14 1 1 0 1 1240522 8.061123e-07 .9999992 21930 6593 16 4600000 6557 26.7251 122935456 1 0 0 3.285603 .008366548 .0028100924 0 0 67 1 1 0 1 1240522 8.061123e-07 .9999992 21930 2005 9 50307000 2240780 87.21 4387273216 0 1 0 4.468319 .008366548 -.05882353 0 0 15 1 1 0 1 1240522 8.061123e-07 .9999992 21930 3663 14 26150000 612661 2.73 71389504 1 0 0 1.0043017 .008366548 .15750916 0 0 74 1 1 0 1 1240522 8.061123e-07 .9999992 21930 2111 15 35857000 68306 20.24 725745664 1 0 0 3.007661 .008366548 -.00444664 0 0 22 1 1 0 1 1240522 8.061123e-07 .9999992 21930 4152 14 632238000 0 8.931 5646517760 0 1 0 2.1895285 .008366548 .010077259 0 0 4 1 1 0 1 1240522 8.061123e-07 .9999992 21930 5827 100 32397000 384343 17.39 563383808 1 0 0 2.855895 .008366548 -.03105233 0 0 58 1 1 0 1 1240522 8.061123e-07 .9999992 21930 7143 1 8775000 3332 7.15 62741248 1 0 0 1.9671123 .008366548 -.012587412 0 0 26 1 1 0 1 1240522 8.061123e-07 .9999992 21930 3093 100 2500000 5882 19.09 47725000 1 0 0 2.9491646 .008366548 -.019381875 0 0 3 1 1 0 1 1240522 8.061123e-07 .9999992 21930 1399 100 200000 410 22.59 4518000 1 0 0 3.117507 .008366548 .013058876 0 0 232 1 1 0 1 1240522 8.061123e-07 .9999992 21930 1005 1 35125000 9450 5.445 191255632 1 0 0 1.6946977 .008366548 -.015610652 0 0 11 1 1 0 1 1240522 8.061123e-07 .9999992 21930 4303 100 23350000 89134 21.61 504593504 1 0 0 3.073156 .008366548 .016658954 0 0 219 1 1 0 1 1240522 8.061123e-07 .9999992 21930 2138 100 5100000 8238 57.08 291108000 1 0 0 4.0444536 .008366548 .02014716 0 0 17 1 1 0 1 1240522 8.061123e-07 .9999992 21930 949 14 352431000 4834484 29.75 10484822016 0 0 1 3.392829 .008366548 .029915966 0 0 2 1 1 0 1 1240522 8.061123e-07 .9999992 21930 7047 15 20000000 22598 28.44 5.688e+08 1 0 0 3.347797 .008366548 .0014064697 0 0 40 1 1 0 1 1240522 8.061123e-07 .9999992 21930 2161 100 71000 0 72.1633 5123595 1 0 0 4.2789316 .008366548 -.002810293 0 0 20 1 1 0 1 1240522 8.061123e-07 .9999992 21930 4672 100 11647000 27273 14.69 171094432 1 0 0 2.687167 .008366548 .0013478557 0 0 9 1 1 0 1 1240522 8.061123e-07 .9999992 21930 4251 100 2050000 620 12.175 24958750 1 0 0 2.4993846 .008366548 .01560575 0 0 14 1 1 0 1 1240522 8.061123e-07 .9999992 21930 4330 100 17250000 58303 37.21 641872512 1 0 0 3.6165776 .008366548 .025262026 0 0 49 1 1 0 1 1240522 8.061123e-07 .9999992 21930 3064 100 2025000 7133 28.8677 58457092 1 0 0 3.362723 .008366548 .020528134 0 0 27 1 1 0 1 1240522 8.061123e-07 .9999992 21930 7880 23 281896000 1427995 155.18 43744620544 0 0 1 5.044586 .008366548 .03982472 0 0 90 1 1 0 1 1240522 8.061123e-07 .9999992 21930 3263 100 600000 51 50.8385 30503100 1 0 0 3.928654 .008366548 .006268871 0 0 85 1 1 0 1 1240522 8.061123e-07 .9999992 21930 3016 100 56700000 236382 148.19 8402373120 0 1 0 4.998495 .008366548 .04021864 0 0 30 1 1 0 1 1240522 8.061123e-07 .9999992 21930 2793 1 18000000 46152 25.21 453780000 1 0 0 3.227241 .008366548 .01547005 0 0 23 1 1 0 1 1240522 8.061123e-07 .9999992 21930 3603 100 17400000 225100 9.86 171564000 1 0 0 2.2884862 .008366548 .0030425964 0 0 25 1 1 0 1 1240522 8.061123e-07 .9999992 21930 4909 2 20698000 199336 34.99 724223040 1 0 0 3.555062 .008366548 -.01914833 0 0 92 1 1 0 1 1240522 8.061123e-07 .9999992 21930 5127 16 9659000 22299 6.33 61141472 1 0 0 1.8453002 .008366548 .008688783 0 0 105 1 1 0 1 1240522 8.061123e-07 .9999992 21930 1031 100 4750000 30231 30.66 145635008 1 0 0 3.422959 .008366548 .012557077 0 0 120 1 1 0 1 1240522 8.061123e-07 .9999992 21930 3380 100 35550000 535305 48.04 1707821952 1 0 0 3.872034 .008366548 .0010407993 0 0 14 1 1 0 1 1240522 8.061123e-07 .9999992 21930 5716 14 92094000 661914 106.33 9792355328 0 1 0 4.6665473 .008366548 -.04175679 0 0 25 1 1 0 1 1240522 8.061123e-07 .9999992 21930 2227 100 612000 903 9.5492 5844111 1 0 0 2.2564573 .008366548 -.021551544 0 0 91 1 1 0 1 1240522 8.061123e-07 .9999992 21930 2279 100 4574000 164914 48 219552000 1 0 0 3.871201 .008366548 -.020625 0 0 106 1 1 0 1 1240522 8.061123e-07 .9999992 21930 5950 1 6900000 9779 25.52 176088000 1 0 0 3.2394624 .008366548 .005485893 0 0 21 1 1 0 1 1240522 8.061123e-07 .9999992 21930 3609 21 101212000 369008 73.12 7400621568 0 1 0 4.292102 .008366548 .010530635 0 0 2 1 1 0 1 1240522 8.061123e-07 .9999992 21930 2415 13 91529000 700962 234.41 21455312896 0 0 1 5.457072 .008366548 .035919968 0 0 153 1 1 0 1 1240522 8.061123e-07 .9999992 21930 683 1 1.684e+08 1394296 .3362 56616080 1 0 0 -1.090049 .008366548 -.189768 0 0 181 1 1 0 1 1240522 8.061123e-07 .9999992 21930 4524 100 1650000 3693 36.6 60390000 1 0 0 3.600048 .008366548 .04344262 0 0 5 1 1 0 1 1240522 8.061123e-07 .9999992 21930 5087 9 306462000 1478237 34.745 10648022016 0 0 1 3.5480356 .008366548 -.003309829 0 0 5 1 1 0 1 1240522 8.061123e-07 .9999992 21930 4348 3 19261000 554776 24.32 468427520 1 0 0 3.191299 .008366548 .11554276 0 0 283 1 1 0 1 1240522 8.061123e-07 .9999992
0 Response to Calculate probability in relation to formula provided
Post a Comment