Announcement

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

  • Calculating yearly stock beta from daily data

    Hi all,
    I just started using STATA, so I don't have much much knowledge about it.
    I have two major problems;
    I have data on daily stock returns of FTSE 350 firms, the daily risk free rate and daily return for FTSE 350 index for the year 2000 and I have to calculate yearly beta (systematic risk) for each stock in a CAPM equation (R-Rf = Bo + B1(Rm-Rf; where R is the daily stock return of stock, Rf is the daily risk free rate; Rm is the daily return of the market index, B1 is he beta to be estimated) also I have to calculate the standard deviation of the residual of the equation for each stock (to represent Unsystematic risk). These would be used as dependent variables in different models
    Guidance or codes to get these is much appreciated. Attached is my data
    Attached Files

  • #2
    Guidance or codes to get these is much appreciated. Attached is my data
    Please refer to the FAQ (http://www.statalist.org/forums/help) on how to use -dataex- to post some example data. Most users here will not download data files (due to online security), not to mention download a file and then having to do the importing.
    1. In Stata, go to the top menu bar, choose File > Import and then properly import the xlsx file.
    2. If you are using Stata 17, use the command -dataex- to create a code-based data example. For example, if you have 3 variables (a, b, c) and you want to post 60 cases of them, simply run:
      Code:
      dataex a b c, count(60)
      and the paste the data code here.
    That way, users here can set up the sample data and start tackling the actual issue.

    Comment


    • #3
      Thanks for your response, Ken.

      My data looks like;
      Date Risk free Astraze Ret FTSE 350 Ret Ang Amer Ret Ass Brit Ret
      " 1/3/2000" ".06" "0" "0" "0" "0"
      " 1/4/2000" ".06" "-.0337630619797347" "-.0279468811054166" "-.0313868613138686" "-.0447845804988663"
      " 1/5/2000" ".06" "-.0184331943064372" ".0087484221769104" ".0158251695553881" "-.0191582730806201"
      " 1/6/2000" ".060469" "-.0104787211931097" ".0245353302981009" ".0949554896142433" "-.0020793741424713"
      " 1/7/2000" ".060781" ".0093480739989864" ".0353156708004509" "-.029810298102981" ".0237405955644369"
      " 1/10/2000" ".060781" ".0145593487001473" ".0105173368179384" ".0104748603351955" ".0276653959409071"
      " 1/11/2000" ".060313" "-.0104596439431217" "-.0228991181594497" "-.0490670352453352" "-.007126883692992"
      " 1/12/2000" ".060469" ".0005327919242615" "-.0113502683626203" ".0356104651162791" "-.0083716557320089"
      " 1/13/2000" ".060156" "-.0002680440979843" ".0174672083143539" ".0007017543859649" ".0008038353250588"
      " 1/14/2000" ".059375" ".0166459935499877" ".0018821035705149" "-.0021037868162693" ".0144615333920965"
      " 1/17/2000" ".06" ".0031468509851683" ".0061099053420635" "-.0007027406886859" "-.0031669596781069"
      " 1/18/2000" ".060313" "-.0226954435237845" "-.0406061924443477" ".0112517580872011" "-.0274119904037669"
      " 1/19/2000" ".060625" "-.0094750279240466" ".0077753004308065" ".0139082058414465" "-.0290054149583512"
      " 1/20/2000" ".060781" "-.0137036821366875" "-.0154399977500914" "-.01440329218107" "-.0088330307042703"
      " 1/21/2000" ".06125" "-.0027346068880952" "-.0176531078610603" "-.0424495476687543" "-.0033984743852503"
      " 1/24/2000" ".060469" ".004813372847541" "-.0267034990791898" "-.0276162790697674" "-.0195914909967342"
      " 1/25/2000" ".06125" "-.0167165021712087" "-.0194891201513717" "-.0306427503736921" "0"
      " 1/26/2000" ".060313" ".0143829966193811" "-.0256251396534563" ".0169622205088666" ".0156407961129595"
      " 1/27/2000" ".060781" ".0083854886776655" "-.0118100797414917" "-.0144048521607278" ".0209600399907038"
      " 1/28/2000" ".061563" "-.0096322326763938" "-.0456319486930655" "-.0130769230769231" "-.0276507196144877"
      " 1/31/2000" ".061563" "-.0166915827532386" "-.0091073875945002" ".004676539360873" "-.0211135404933853"
      " 2/1/2000" ".061875" ".002561862408282" ".0341765939410164" "-.0147401086113266" "-.000437696004332"
      " 2/2/2000" ".060781" ".0004760169527694" ".0002804262478968" ".0125984251968504" ".0215738675863812"
      " 2/3/2000" ".060781" ".0040314670224036" "-.0169286838756981" "-.005443234836703" ".0146577285602549"
      " 2/4/2000" ".06125" "-.0194018458584842" "-.0005703505462203" "-.0367474589523065" "-.0412082886931981"
      " 2/7/2000" ".061406" "-.0097398772923545" ".0268437225636522" "-.0373376623376623" "-.0287982848213962"
      " 2/8/2000" ".061406" ".020016622800942" ".0041254301776286" ".0295109612141653" ".0287402016724975"
      " 2/9/2000" ".062188" ".006227507227186" "-.0019158719346049" ".027027027027027" ".0345885786767413"
      " 2/10/2000" ".061406" "-.0066715939236362" "-.0211470374952012" "-.0111642743221691" "-.0098565245094809"
      " 2/11/2000" ".061406" "-.0090357635120289" "-.0260815566135375" "-.05" "-.0398274469425976"
      " 2/14/2000" ".061094" "-.0174002879159962" "-.0244868281223783" ".0118845500848896" "-.0338158892155231"
      " 2/15/2000" ".061406" "-.0091816817586715" "-.0059055569570901" "-.0125838926174497" ".0331336828810899"
      " 2/16/2000" ".061563" ".0203538311616553" ".0023762558973827" ".0271877655055225" "-.0085803721093915"
      " 2/17/2000" ".062031" ".010366368953918" ".0598524690150408" ".1215880893300248" "-.0027369748487892"
      " 2/18/2000" ".059844" "-.0047315565855543" "-.0371777888770657" "-.0184365781710914" "-.0169024770629312"
      " 2/21/2000" ".06125" "-.0115767952116461" "-.0374517897016037" ".0060105184072126" "-.0111523986470391"
      " 2/22/2000" ".061094" "-.0087903499830105" "-.0558152613264911" "-.0044809559372666" "-.0051693653676609"
      " 2/23/2000" ".061875" ".0188332016442795" ".0517564431870355" ".0562640660165041" ".0113367813420114"
      " 2/24/2000" ".06125" "-.0066720141226535" "-.0154907975460123" "-.0071022727272727" "-.1004180293721897"
      " 2/25/2000" ".062031" ".0158703421123903" "-.0638608937409375" "-.0050071530758226" ".0986501016682102"
      " 2/28/2000" ".062188" "-.0135003498107005" "-.0326301236590797" ".0122214234363767" "-.0028391610424468"
      " 2/29/2000" ".062188" ".0181427956338969" "-.0156810332279109" ".0049715909090909" "-.0241675695898704"
      " 3/1/2000" ".061406" ".0214522566680496" ".0166164766616477" ".0515901060070671" ".0461364575605336"
      " 3/2/2000" ".062188" ".0102217525005253" ".0415366305210261" "-.0154569892473118" ".0320363627709954"
      " 3/3/2000" ".061875" ".0095065726204401" "-.0104620307004736" "-.0184300341296928" "-.0130467265583206"
      " 3/6/2000" ".061719" ".0117444331573798" ".0118942222564379" "-.0222531293463143" ".0031914843906975"
      " 3/7/2000" ".061875" "-.0143691603555308" "-.0124010955569081" ".0128022759601707" ".0163538124737995"
      " 3/8/2000" ".062031" "-.0083473305434528" "-.0360398531186607" "-.0203651685393258" ".0022364700436752"
      " 3/9/2000" ".06125" ".016879739299367" ".001371888277681" ".0200716845878136" ".0374687341384341"
      " 3/10/2000" ".061719" ".0053357934499395" "-.0109600702295762" "-.0295151089248067" ".0687843514057906"
      " 3/13/2000" ".061563" "-.0158591452082206" "-.0823986659135535" "-.0094134685010862" ".03499540185328"
      " 3/14/2000" ".061563" ".0026241497565319" ".0622590904427607" "-.033625730994152" "-.0310907460902481"
      " 3/15/2000" ".061094" "-.0083425143446668" "-.0234412726444901" ".178517397881997" ".0397126313884823"
      " 3/16/2000" ".061094" ".0129240710823909" ".0782000565131393" "-.0012836970474968" ".047067385466066"
      " 3/17/2000" ".061719" ".0011897848027751" "-.0114656358514054" "-.0649100257069409" "-.0490048313558394"
      " 3/20/2000" ".061406" ".009274493277392" ".0382290562036056" ".0061855670103093" ".0089094202322883"
      " 3/21/2000" ".062031" "-.0025787340193327" ".0269521474899137" "-.008879781420765" ".0360985673171942"
      " 3/22/2000" ".061563" "-.0012394513944608" "-.0198421085348418" ".0751206064782908" ".0192728599221791"
      " 3/23/2000" ".061563" "-.0021525898346448" "-.0094750060249369" ".0230769230769231" "0"
      " 3/24/2000" ".061406" ".0195137065305422" ".0122035547815398" ".0332080200501253" ".0149082910826125"
      " 3/27/2000" ".061406" "-.0056735269345987" "-.0306281232209501" ".0066707095209218" "-.0193469708601633"
      " 3/28/2000" ".061094" "-.0037314357202135" "-.0386432449363124" ".0626506024096386" "-.0204590743598579"
      " 3/29/2000" ".061406" "-.0073586983308015" "-.003841820181095" "-.072562358276644" "-.0484914534817024"
      " 3/30/2000" ".061563" "-.0224635601058909" "-.014036522213137" "-.0495110024449878" "-.0168549485791447"
      " 3/31/2000" ".062188" ".0114110402366079" ".0366551485832757" ".0765273311897106" ".0123612729167945"
      " 4/3/2000" ".062188" "-.0128090490454687" "-.008239780272526" "-.017921146953405" ".0515951368615717"
      " 4/4/2000" ".062031" "-.0071595821325649" ".0107281135728114" ".0079075425790754" ".0408236924860908"
      " 4/5/2000" ".062188" "-.0077629433710297" "-.0239685030991462" "-.0259505129752565" "-.0115173627379008"
      " 4/6/2000" ".061719" ".0137712778710141" ".0473698555464704" "-.0061957868649318" ".013469081572102"
      " 4/7/2000" ".062031" ".0171081157507776" ".0006635786405747" "-.027431421446384" "-.0039476203803266"
      " 4/10/2000" ".062031" "-.0047860484792615" "-.0100380979624742" ".0038461538461538" ".0082925422575826"
      " 4/11/2000" ".061406" "-.022872661631215" "-.0378800814342944" ".0421455938697318" ".0182416849083516"
      " 4/12/2000" ".062188" "-.0041896497491723" "-.017214782050757" "-.017156862745098" "0"
      " 4/13/2000" ".061875" "-.0009835235461379" "-.0396999583275454" "-.0074812967581047" ".0010550878279594"
      " 4/14/2000" ".061875" "-.0256925878698491" "-.06295203379043" "-.0050251256281407" "-.0284249716721524"
      " 4/17/2000" ".061875" "-.0324098580414533" "-.0878357517752392" "-.0151515151515152" "-.0223885846726867"
      " 4/18/2000" ".061875" ".0134287361388992" ".0623117278727366" "-.0352564102564103" "-.0077600115131455"
      " 4/19/2000" ".062031" ".0162135112593828" "-.0061492385139871" "-.0099667774086379" ".0320194506043964"
      " 4/20/2000" ".0625" ".0081630086990474" ".0214631487833809" ".0308724832214765" ".0238104043848423"
      " 4/21/2000" ".0625" "0" "0" "0" "0"
      " 4/24/2000" ".0625" "0" "0" "0" "0"
      " 4/25/2000" ".0625" ".0059893829060841" ".0226284817575519" ".0182291666666667" "0"
      " 4/26/2000" ".062344" "-.0022415759597572" ".0079027728758422" "-.0281329923273657" "-.0109239083316475"
      " 4/27/2000" ".061875" "-.0115136459878961" ".0297798483602813" ".0059210526315789" "-.0473813002191381"
      " 4/28/2000" ".062031" ".020996484264062" ".0285490404802035" "-.0058862001308044" ".0056090818818604"
      " 5/1/2000" ".062031" "0" "0" "0" "0"
      " 5/2/2000" ".062813" ".0082040722502275" ".0470036941741292" "0" "-.0063212474741698"
      " 5/3/2000" ".063125" "-.0269000598444045" ".0342948145910845" "0" "-.0258218484299703"
      " 5/4/2000" ".062344" ".0021928005812082" ".0075129086637376" ".0263157894736842" ".0072980913895913"
      " 5/5/2000" ".0625" ".0060047087996518" ".0172983940028721" "-.0051282051282051" "-.0026705245254249"
      " 5/8/2000" ".061875" "-.0024030277488555" "-.0043255283878988" "-.0206185567010309" ".0382401831639696"
      " 5/9/2000" ".062656" "-.0136941778802337" ".0271194818032828" ".0263157894736842" ".0257829669292289"
      " 5/10/2000" ".062969" "-.004425627580915" ".0123975838008283" ".0256410256410256" ".0053855271779543"
      " 5/11/2000" ".061875" ".0195313015588084" "-.0199759837890576" "-.02125" ".0189296162450524"
      " 5/12/2000" ".062188" ".0065660290767239" "-.036796895939961" ".0344827586206897" ".0070107478969554"
      " 5/15/2000" ".062344" "-.0051633013496415" "-.0092226963135716" "0" ".0020875113296555"
      " 5/16/2000" ".062031" ".0110145078665745" ".0141233114885649" ".0006172839506173" "-.0017377494008682"
      " 5/17/2000" ".062656" "-.0175073278777669" "-.0237649355102471" "-.0080197409006786" "-.0605418517131289"
      " 5/18/2000" ".061406" ".0048932428374869" ".0090376094239705" "-.0099502487562189" ".039629712601998"

      Comment


      • #4
        You can use asreg (can be downloaded from SSC) for this, see this short video https://www.youtube.com/watch?v=VpJl_upGVcM.
        Code:
        ssc install asreg
        Regards
        --------------------------------------------------
        Attaullah Shah, PhD.
        Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
        FinTechProfessor.com
        https://asdocx.com
        Check out my asdoc program, which sends outputs to MS Word.
        For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

        Comment

        Working...
        X