Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Time Series Regression with lag period

    Hmmm...I guess this is a basic question.

    Panel data, only six variables and permno represents frims, I want to regress ret on mkt, but need to estimate from -252 to -2 days. (250 trading days every year)

    The aim is to get the standard deviation (sd) of the residual values of each observation, then

    egen category= xtile(sd), nq(2) by(country year)

    Anyone can help? Great thanks!

    Here is the sample:


    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input double permno long date double(ret mkt) float(year country)
    
    10560 15431  -.001123514142818749              -.00103797 2002 4
    10560 15432  -.010123751126229763    -.008657960000000001 2002 4
    10560 15433  -.006818229332566261             -.009497969 2002 4
    10560 15434   -.03546904772520065             .0009252949 2002 4
    10560 15435   .021352235227823257             -.002536663 2002 4
    10560 15438  -.010452869348227978    .0029621160000000003 2002 4
    10560 15439 -.0023474714253097773    -.005543889000000001 2002 4
    10560 15440                     0               .01146895 2002 4
    10560 15441  -.008235258050262928              -.02131968 2002 4
    10560 15442   .023724768310785294     .008221537000000001 2002 4
    10560 15445   .012746194377541542   -.0059918670000000005 2002 4
    10560 15446     .0366133488714695     .021961500000000002 2002 4
    10560 15447   .014348692260682583              -.00197307 2002 4
    10560 15448  -.009793167002499104               -.0015112 2002 4
    10560 15449   .020879073068499565             .0007277678 2002 4
    10560 15452   -.02045205421745777              -.01474083 2002 4
    10560 15453   -.02087917923927307    -.005266656000000001 2002 4
    10560 15454   .002244720235466957              -.00611083 2002 4
    10560 15455   -.01007840409874916             -.001793705 2002 4
    10560 15456   .003393634920939803                -.013429 2002 4
    10560 15459  .0033821570686995983             -.008791372 2002 4
    10560 15460   .011235998012125492               .01211754 2002 4
    10560 15461   .016666624695062637    .0075035100000000006 2002 4
    10560 15462    .01311484631150961   -.0017030830000000002 2002 4
    10560 15463 -.0032363198697566986             -.008915835 2002 4
    10560 15466  -.019480450078845024              -.01828207 2002 4
    10560 15467                     0             -.003717511 2002 4
    10560 15468   -.04083894193172455               .03447537 2002 4
    10560 15469    -.0333716906607151              -.01394325 2002 4
    10560 15470  -.010714191012084484              -.01537608 2002 4
    10560 15473   .030084233731031418               .01704317 2002 4
    10560 15474     .0221962109208107               .02093527 2002 4
    10560 15475    .00571430753916502   -.0033533300000000003 2002 4
    10560 15476   .037499990314245224              .003507912 2002 4
    10560 15477   .010952839627861977    .0069477670000000005 2002 4
    10560 15480   -.00866738148033619              -.01192497 2002 4
    10560 15481  -.016393400728702545              -.01114189 2002 4
    10560 15482  -.007777743972837925    .0036900780000000003 2002 4
    10560 15483    .01791711524128914               .01048167 2002 4
    10560 15484  -.006600705906748772              -.01130689 2002 4
    10560 15488   -.02325581945478916    -.006814430000000001 2002 4
    10560 15489  -.018140573054552078    -.006592150000000001 2002 4
    10560 15490   .002309521660208702             -.002312602 2002 4
    10560 15491 -.0011521000415086746              .002116311 2002 4
    10560 15494                     0              -.02389322 2002 4
    10560 15495  -.010380640625953674   -.0014366000000000001 2002 4
    10560 15496   .008158472366631031              .007665978 2002 4
    10560 15497   .015028915368020535              -.01833249 2002 4
    10560 15498  -.021640043705701828            -.0002324682 2002 4
    10560 15501   .008148974739015102    .0017297340000000001 2002 4
    10560 15502   .027713600546121597              -.01594817 2002 4
    10560 15503   .013483241200447083              .004637798 2002 4
    10560 15504    .02882475219666958              -.01033263 2002 4
    10560 15505   -.02262931503355503             -.000915054 2002 4
    10560 15508    .01874311827123165               .02683938 2002 4
    10560 15509  -.003246724372729659             .0003382146 2002 4
    10560 15510   .009232302196323872              -.01550487 2002 4
    10560 15511   -.01191762275993824    -.012607420000000001 2002 4
    10560 15512  -.005482477135956287              -.01439292 2002 4
    10560 15515   .002205122262239456    .0012857510000000001 2002 4
    10560 15516    .01760174334049225              -.01543866 2002 4
    10560 15517   -.03783787786960602   -.0032656860000000003 2002 4
    10560 15518   .013483241200447083               .01633429 2002 4
    10560 15519    .02328149415552616              .002097349 2002 4
    10560 15522   .016251416876912117              -.02197462 2002 4
    10560 15523  -.017057552933692932              -.02241959 2002 4
    10560 15524   .006507534068077803              .003617307 2002 4
    10560 15526   .007543173618614674               .03443228 2002 4
    10560 15529   .002138984389603138              -.01124195 2002 4
    10560 15530   -.02774815633893013              -.02187526 2002 4
    10560 15531  -.026344651356339455              -.02981698 2002 4
    10560 15532  -.016910893842577934     .005016232000000001 2002 4
    10560 15533  .0011467058211565018    -.005822412000000001 2002 4
    10560 15536  -.019472982734441757             -.004883475 2002 4
    10560 15537   -.00817764550447464              -.01420123 2002 4
    10560 15538  -.018845682963728905              .005966138 2002 4
    10560 15539   .026410596445202827              -.02506872 2002 4
    10560 15540    -.0467836931347847              -.03292375 2002 4
    10560 15543  -.047852687537670135              -.03210708 2002 4
    10560 15544     -.097938172519207    -.029571510000000002 2002 4
    10560 15545    .06000000983476639               .05232159 2002 4
    10560 15546  -.005390830338001251             -.005705609 2002 4
    10560 15547   .027100244536995888               .01489685 2002 4
    10560 15550   .014511890709400177               .05315623 2002 4
    10560 15551   -.01950586400926113               .00475356 2002 4
    10560 15552 -.0026525172870606184     .005619043000000001 2002 4
    10560 15553  -.003989389631897211              -.02585134 2002 4
    10560 15554   -.03738314285874367              -.02251538 2002 4
    10560 15557   -.01664353534579277              -.03287776 2002 4
    10560 15558    .02397744357585907                .0301243 2002 4
    10560 15559   .012396649457514286               .01678832 2002 4
    10560 15560   .031292520463466644     .029335260000000002 2002 4
    10560 15561   .014511890709400177    .0034100610000000003 2002 4
    10560 15564  -.042912863194942474   -.0038551220000000003 2002 4
    10560 15565   -.00815216638147831              -.02023059 2002 4
    10560 15566  -.012328787706792355               .03545215 2002 4
    10560 15567   .011095689609646797               .01174583 2002 4
    10560 15568    .01646088995039463    .0008134799000000001 2002 4
    10560 15571   .036437246948480606               .02098419 2002 4
    10560 15572     .0403645783662796              -.01209941 2002 4
    10560 15573   .003754779463633895               .01357249 2002 4
    10560 15574   .003740614978596568               .01278118 2002 4
    10560 15575   -.05093171447515488              -.02157278 2002 4
    10560 15578   .003926729317754507              .008443749 2002 4
    10560 15579  -.003911370411515236              -.01432564 2002 4
    10560 15580  -.019633520394563675              -.01767162 2002 4
    10560 15581  -.012015978805720806              .001877727 2002 4
    10560 15582   .002702699974179268             -.002311057 2002 4
    10560 15586 -.0026954151690006256              -.03817137 2002 4
    10560 15587   -.04324326664209366               .01724335 2002 4
    10560 15588   -.02341243252158165              -.01545321 2002 4
    10560 15589   -.00875911582261324               .01755805 2002 4
    10560 15592  -.008836516179144383              .008644613 2002 4
    10560 15593    .04309063404798508              .006447205 2002 4
    10560 15594   .007122534327208996             .0006631404 2002 4
    10560 15595  -.033946286886930466    -.022894440000000002 2002 4
    10560 15596   -.01610543765127659              .003227357 2002 4
    10560 15599  -.013392808847129345  -.00014139060000000001 2002 4
    10560 15600  -.012066353112459183              -.01842255 2002 4
    10560 15601  -.019847344607114792             -.005118227 2002 4
    10560 15602  -.006230523809790611              -.02872136 2002 4
    10560 15603  -.007837020792067051              .002169982 2002 4
    10560 15606   .011058478616178036               -.0148512 2002 4
    10560 15607  -.040625035762786865              -.01505498 2002 4
    10560 15608    .06840392202138901               .02396856 2002 4
    10560 15609   .010670757852494717               .01718507 2002 4
    10560 15610                     0              -.02840519 2002 4
    10560 15613   .021116118878126144              -.01204248 2002 4
    10560 15614   .023633655160665512               .03372957 2002 4
    10560 15615   -.05627703666687012    -.022599730000000002 2002 4
    10560 15616  -.013761491514742374              -.01120494 2002 4
    10560 15617                     0              -.02221361 2002 4
    10560 15620  -.009302317164838314              -.02035911 2002 4
    10560 15621  -.018779324367642403                .0140489 2002 4
    10560 15622   -.01594894751906395    -.027466090000000002 2002 4
    10560 15623  -.004862270783632994               .03386865 2002 4
    10560 15624   .011400680057704449               .03679847 2002 4
    10560 15627  -.016103044152259827     .006552453000000001 2002 4
    10560 15628   .058919746428728104               .04515275 2002 4
    10560 15629  -.010819118469953537              -.02302641 2002 4
    10560 15630    .06562501192092896               .02370828 2002 4
    10560 15631    .02346038818359375     .004821997000000001 2002 4
    10560 15634   .021489985287189484               .01640538 2002 4
    10560 15635   -.06030859798192978              -.01125797 2002 4
    10560 15636  -.016417859122157097     .007436201000000001 2002 4
    10560 15637  -.027314158156514168              -.01322834 2002 4
    10560 15638    .03276131674647331               .01632205 2002 4
    10560 15641    .03474320471286774   -.0075023550000000005 2002 4
    10560 15642   -.01751823164522648             -.009313422 2002 4
    10560 15643   -.05052008107304573               .01054064 2002 4
    10560 15644 -.0062597752548754215   -.0037328900000000004 2002 4
    10560 15645   .022047223523259163               .01704744 2002 4
    10560 15648   .021571703255176544     .008633341000000001 2002 4
    10560 15649   -.03167421370744705    .0061600280000000006 2002 4
    10560 15650   .015576308593153954     .009801866000000001 2002 4
    10560 15651   .012269927188754082              -.02177217 2002 4
    10560 15652                     0             -.008825398 2002 4
    10560 15655   -.02878788858652115    -.020446620000000002 2002 4
    10560 15656 -.0046801455318927765              .008294911 2002 4
    10560 15657  .0015673591988161206            -.0002856239 2002 4
    10560 15658   .028169061988592148               .02405469 2002 4
    10560 15659   .022830991074442863     .006031460000000001 2002 4
    10560 15662                     0             -.009043442 2002 4
    10560 15663   .008928634226322174             -.004532441 2002 4
    10560 15664   .011799398809671402               .01845823 2002 4
    10560 15665   .058309052139520645               .02122514 2002 4
    10560 15666 -.0013774419203400612             -.001961244 2002 4
    10560 15669   .009655196219682694    .0034065170000000004 2002 4
    10560 15670  -.009562864899635315              -.01972993 2002 4
    10560 15671   .055172428488731384                .0272073 2002 4
    10560 15673   .014379101805388927   -.0025903970000000004 2002 4
    10560 15676   -.05025777593255043           -.00005879485 2002 4
    10560 15677  -.009497923776507378              -.01482633 2002 4
    10560 15678                     0             -.003824486 2002 4
    10560 15679  -.015068511478602886               -.0107528 2002 4
    10560 15680  .0013907861430197954    .0057480100000000004 2002 4
    10560 15683  -.026388831436634064              -.02167103 2002 4
    10560 15684   -.00427963025867939               .01414205 2002 4
    10560 15685   .034383922815322876             .0009574851 2002 4
    10560 15686    .03462604060769081             -.002188237 2002 4
    10560 15687  -.004016028717160225              -.01308725 2002 4
    10560 15690  -.010752677917480469               .02163166 2002 4
    10560 15691    .02309783548116684    -.007770620000000001 2002 4
    10560 15692  -.016721121966838837    -.013160690000000001 2002 4
    10560 15693   .046321481466293335             -.006741055 2002 4
    10560 15694   .010416719131171703               .01162272 2002 4
    10560 15697    .01675252988934517              .002628974 2002 4
    10560 15698  -.005069703795015812             -.004790023 2002 4
    10560 15700   .002547768410295248             -.001643703 2002 4
    10560 15701  -.003811910282820463              -.01505677 2002 4
    10560 15704  -.019132664427161217              .003477504 2002 4
    10560 15705  .0026007776614278555              .001781613 2002 4
    10560 15707    .02464332804083824               .03045194 2002 4
    10560 15708   .030379777774214745  -.00033843510000000003 2002 4
    10560 15711   .017198940739035606               .02018948 2002 4
    10560 15712  -.027777723968029022   -.0065190180000000006 2002 4
    10560 15713    .00745334941893816              -.01325887 2002 4
    10560 15714   .012330504134297371               .01815404 2002 4
    10560 15715   .006090157199651003             .0005831067 2002 4
    10560 15718                     0              -.00112158 2002 4
    10560 15719   .024213051423430443    .0053313580000000005 2002 4
    10560 15720   .004728127736598253              -.01233774 2002 4
    10560 15721  -.009411755949258804   -.0028920200000000004 2002 4
    10560 15722  -.022565383464097977              -.01385198 2002 4
    10560 15726  -.010935504920780659              -.01531292 2002 4
    10560 15727    .01474200002849102             -.008938634 2002 4
    10560 15728  -.010895902290940285              .009997987 2002 4
    10560 15729  -.014687868766486645              -.02611977 2002 4
    10560 15732  -.029813693836331367              -.01634459 2002 4
    10560 15733  .0038412560243159533               .01188056 2002 4
    10560 15734  -.024234700947999954              .006300624 2002 4
    10560 15735   -.04967321828007698    -.020068700000000002 2002 4
    10560 15736    .03163686767220497               .01265674 2002 4
    10560 15739   .004000028129667044    .0035528010000000004 2002 4
    10560 15740 -.0013280515559017658    -.012516880000000001 2002 4
    10560 15741   .011968105100095272              -.00455032 2002 4
    10560 15742  -.040735866874456406   -.0062541110000000006 2002 4
    10560 15743  -.019178127869963646              -.01022994 2002 4
    10560 15746  -.016759760677814484              .006078084 2002 4
    10560 15747 -.0028409063816070557             -.006161223 2002 4
    10560 15748   .038461536169052124              -.01221062 2002 4
    10560 15749                     0             -.001821462 2002 4
    10560 15750   -.02194785326719284               .01821922 2002 4
    10560 15754   .028050463646650314               .01932077 2002 4
    10560 15755   -.02864939160645008   -.0069393680000000004 2002 4
    10560 15756   .007022498641163111             -.007044942 2002 4
    10560 15757   .013946987688541412                .0123613 2002 4
    10560 15760  -.016506174579262733              -.01669836 2002 4
    10560 15761  .0013985666446387768     .006280198000000001 2002 4
    10560 15762   .025139708071947098              -.01131671 2002 4
    10560 15763    .01089917216449976                .0112222 2002 4
    10560 15764 -.0026954151690006256              .004280278 2002 4
    10560 15767  -.002702699974179268    -.006389837000000001 2002 4
    10560 15768   -.03523038327693939              -.01381653 2002 4
    10560 15769   .007022498641163111              .007481039 2002 4
    10560 15770   -.04184103012084961             -.008136163 2002 4
    10560 15771   .002911205403506756              .006951007 2002 4
    10560 15774  -.007256852462887764              -.02283119 2002 4
    10560 15775   .007309899665415287             -.007927164 2002 4
    10560 15776  -.029027549549937248              .002232773 2002 4
    10560 15777   .016091175377368927               .03204764 2002 4
    10560 15778   .023774122819304466    .0014285690000000002 2002 4
    10560 15781    .03773588314652443               .03261439 2002 4
    10560 15782    .03216783329844475              .004911885 2002 4
    10560 15783   .010840097442269325               .00676649 2002 4
    10560 15784  -.008042887784540653              .003069117 2002 4
    10560 15785   .025675682350993156               .02115079 2002 4
    10560 15788    -.0368906706571579              -.03282164 2002 4
    10560 15789    .01367987785488367               .01178779 2002 4
    10560 15790  -.018893370404839516             -.004859988 2002 4
    10560 15791  -.024759260937571526   -.0007400565000000001 2002 4
    10560 15792   .008462615311145783             -.004284182 2002 4
    10560 15795  -.027972066774964333    -.015742970000000002 2002 4
    10560 15796   .027338137850165367               .01074658 2003 4
    10560 15797    .03501400724053383               .02490913 2003 4
    10560 15798 -.0013531463919207454              -.00476877 2003 4
    10560 15799  -.017615191638469696              .001555383 2003 4
    10560 15802   .022068943828344345              .002207784 2003 4
    10560 15803 -.0026990529149770737   -.0017482110000000002 2003 4
    10560 15804  -.017591290175914764              -.01170668 2003 4
    10560 15805  -.008264520205557346              .005246373 2003 4
    10560 15806    -.0347222238779068   -.0028741860000000004 2003 4
    10560 15809                     0     .017886700000000002 2003 4
    10560 15810  -.007194203790277243     .006340716000000001 2003 4
    10560 15811   -.02463769167661667              -.01023455 2003 4
    10560 15812   .004457683302462101               .01518125 2003 4
    10560 15816  -.010355054400861263            -.0003837631 2003 4
    10560 15817   .007473798934370279               .02017503 2003 4
    10560 15818   .014836852438747883              .008326646 2003 4
    10560 15819  -.026315834373235703             -.008319537 2003 4
    10560 15820  -.012012001127004623              -.01257103 2003 4
    10560 15823   .021276576444506645               .01685574 2003 4
    10560 15824   .007440504617989063    .0032375100000000003 2003 4
    10560 15825   .033973414450883865    .0007191690000000001 2003 4
    10560 15826  -.010000024922192097             .0002545663 2003 4
    10560 15827   .014430070295929909               .01488455 2003 4
    10560 15830   .004267387092113495             -.000874254 2003 4
    10560 15831   .025495726615190506     .008622841000000001 2003 4
    10560 15832  -.015193323604762554             -.004809125 2003 4
    10560 15833                     0             -.009287659 2003 4
    10560 15834  -.015427788719534874               .01352057 2003 4
    10560 15837 -.0028490000404417515               .01228107 2003 4
    10560 15838  -.007142884191125631   -.0018916430000000001 2003 4
    10560 15839  -.028776951134204865             -.001457495 2003 4
    10560 15840 -.0029629601631313562              .006900171 2003 4
    10560 15841    .03120357170701027             -.002020748 2003 4
    10560 15844   -.01873200573027134              -.02201572 2003 4
    10560 15845  -.020557982847094536            -.0003085079 2003 4
    10560 15846   -.04497753828763962              .003964566 2003 4
    10560 15847    .01883828639984131              .009071107 2003 4
    10560 15848   .009245057590305805              .002716399 2003 4
    10560 15852   .003053432097658515                .0186159 2003 4
    10560 15853    .00608827406540513              .001870113 2003 4
    10560 15854   .015128578059375286   -.0023826010000000002 2003 4
    10560 15855   .010432216338813305               .01491741 2003 4
    10560 15858   .028023535385727882              .004381376 2003 4
    10560 15859   -.01291243638843298    .0035977210000000003 2003 4
    10560 15860   .027616286650300026               .01528082 2003 4
    10560 15861  -.001414459547959268     .005794893000000001 2003 4
    10560 15862  -.011331434361636639   -.0033428650000000004 2003 4
    10560 15865   -.02865326777100563              -.01258501 2003 4
    10560 15866    .03687315434217453     .009562863000000001 2003 4
    10560 15867    .03129442036151886               .01338106 2003 4
    10560 15868   -.07862071692943573              .001634393 2003 4
    10560 15869 -.0014969689073041081             -.009964079 2003 4
    10560 15872  -.005996995605528355               .02052042 2003 4
    10560 15873    .03318247199058533              .001214709 2003 4
    10560 15874  -.007299228571355343   -.0016798590000000001 2003 4
    10560 15875   -.00904711801558733              -.01422459 2003 4
    10560 15876   -.01636899635195732           -.00003083221 2003 4
    10560 15879   .001512821763753891              -.01482436 2003 4
    10560 15880  .0060422904789447784              .001760229 2003 4
    10560 15881  -.027027001604437828   -.0050374600000000005 2003 4
    10560 15882 -.0030864167492836714               .01058036 2003 4
    10560 15883   -.00619194470345974             -.007564974 2003 4
    10560 15886 -.0015576680889353156             -.001248856 2003 4
    10560 15887   .021840928122401237              .006775881 2003 4
    10560 15888   .004580111708492041                .0126728 2003 4
    10560 15889  -.013677834533154964   -.0064308410000000005 2003 4
    10560 15893    .03235748037695885     .017833830000000002 2003 4
    10560 15894   -.01940293237566948              .004626922 2003 4
    10560 15895    -.0182648953050375             -.003128853 2003 4
    10560 15896   -.02635652758181095    -.013117450000000001 2003 4
    10560 15897  -.012738917022943497     .008938096000000001 2003 4
    10560 15900 -.0032258033752441406     .007308436000000001 2003 4
    10560 15901    .02103561721742153             -.004231139 2003 4
    10560 15902                     0             -.006052214 2003 4
    10560 15903   .020602237433195114               -.0144893 2003 4
    10560 15904    .02329193986952305               .01063905 2003 4
    10560 15907  -.013657079078257084               -.0131461 2003 4
    10560 15908    .01538460049778223              .009228488 2003 4
    10560 15909  -.021212100982666016              .002126621 2003 4
    10560 15910   .032507747411727905    -.005790513000000001 2003 4
    10560 15911    .03448276221752167     .014815430000000001 2003 4
    10560 15914   -.00724640442058444  -.00009380097999999999 2003 4
    10560 15915   .016058413311839104             -.005694888 2003 4
    10560 15916  -.018678177148103714             -.002025189 2003 4
    10560 15917    .01610543765127659    .0029482780000000004 2003 4
    10560 15918   .017291050404310226              -.00993201 2003 4
    10560 15921  -.011331434361636639             .0006155979 2003 4
    10560 15922   -.03438398987054825              -.01591369 2003 4
    10560 15923  -.007418355438858271  .000031120899999999995 2003 4
    10560 15924  -.016442472115159035    .0058457380000000005 2003 4
    10560 15925   .016717346385121346              .003423488 2003 4
    10560 15928   .047832611948251724     .004931484000000001 2003 4
    10560 15929  -.014265389181673527               .01029711 2003 4
    10560 15930   .028943601995706558              -.00439562 2003 4
    10560 15931    .00843881070613861              .005481798 2003 4
    10560 15932  .0055787949822843075    .0010983520000000001 2003 4
    10560 15935   .019417457282543182              .009742485 2003 4
    10560 15936   .008163257502019405              .004369134 2003 4
    10560 15937   .025641033425927162   -.0011983920000000002 2003 4
    10560 15938   .005263152997940779              .004297808 2003 4
    10560 15939   .002617798512801528              -.01006986 2003 4
    10560 15942  -.013054817914962769            -.0008540691 2003 4
    10560 15943  -.014550282619893551              .003080741 2003 4
    10560 15944    .02147655375301838    .0020672340000000003 2003 4
    10560 15945  -.031537484377622604     .007008978000000001 2003 4
    10560 15946    .02713708207011223     .005252529000000001 2003 4
    10560 15950   .017173003405332565               .01328562 2003 4
    10560 15951  -.025974001735448837    .0046340420000000005 2003 4
    10560 15952   .005333328153938055              .002506477 2003 4
    10560 15953  -.019893912598490715             -.005386265 2003 4
    10560 15956   .006765925791114569               .01033172 2003 4
    10560 15957  -.001344116753898561   -.0075219150000000005 2003 4
    10560 15958  -.004037649370729923              -.01331587 2003 4
    10560 15959  -.005405399948358536              .005893345 2003 4
    10560 15960   .005434777121990919    .0024132890000000003 2003 4
    10560 15963  -.005405399948358536   -.0033999010000000003 2003 4
    10560 15964   .010869554243981838     .013475840000000001 2003 4
    10560 15965   .013211010955274105   -.0022898980000000003 2003 4
    10560 15966  -.005319143645465374               .01191731 2003 4
    10560 15967  -.005347588565200567             -.001436888 2003 4
    10560 15970   -.03225809708237648              -.01224191 2003 4
    10560 15971  -.009722179733216763              .006261244 2003 4
    10560 15972  -.004207603167742491              -.01765159 2003 4
    10560 15973   .007042280398309231             -.008072996 2003 4
    10560 15974  -.018181834369897842              -.00838796 2003 4
    10560 15977  -.007122534327208996              .009706215 2003 4
    10560 15978   .004304191097617149             -.009053303 2003 4
    10560 15979   .014285700395703316               .02088903 2003 4
    10560 15980  -.005633797496557236              .003325403 2003 4
    10560 15981   .018413614481687546     .009705084000000001 2003 4
    10560 15984    .01390819251537323              .005167856 2003 4
    10560 15985   -.02194785326719284    .0049961120000000005 2003 4
    10560 15986 -.0014025566633790731    -.004393004000000001 2003 4
    10560 15987   -.01685391739010811     .005323710000000001 2003 4
    10560 15988  -.008571420796215534             .0001379931 2003 4
    
    end
    format %d date

  • #2
    Panel data, only six variables and permno represents frims, I want to regress ret on mkt, but need to estimate from -252 to -2 days. (250 trading days every year)
    Well, we can make a start on that:

    Code:
    rangestat (reg) ret mkt, by(permno) interval(date -252 -2)
    This requires that you install the -rangestat- program, by Robert Picard, Nick Cox, and Roberto Ferrer, available from SSC. But I'll bet that you don't really want to estimate from -252 to -2 days because the 250 trading days each year are not consecutive dates, being interrupted by weekends an holidays. So you probably need to create a business calendar which omits those non-market-trading dates. I don't use business calendars in my line of work, so I can't show you how to do that. But run -help business calendars- and then click on the link to the associated PDF manual entry near the top of the window to find out how to do that.

    The aim is to get the standard deviation (sd) of the residual values of each observation
    Calculating the residuals after the above would be:
    Code:
    gen resid = ret - b_cons - b_mkt*mkt
    But I don't know what you mean by the standard deviation of the residual values of each observation. Each observation has only a single residual associated with it, and so there is no variation for any one observation and the standard deviation is either zero or undefined depending on whether you are referring to sigma or s. So you'll need to better explain what sets of residuals you want to calculate standard deviations of. Calculating the standard deviation "of each observation" makes no sense.

    Comment


    • #3

      Thanks a lot I am going to have a try!

      Comment

      Working...
      X