Announcement

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

  • ratio's of two regressions for large dataset

    Dear all,

    I have trouble creating ratio’s of regressions results and I really hope someone can help me out. I am trying to write a loop but it is not working out so far.
    In a short synopsis what I want to do:

    First, I need to regress the daily returns of a firm per month on the return of the market using the two regressions below. The two regressions are run per company per month.

    π‘Ÿπ‘—,𝑑=π‘Žπ‘—+π›Ώπ‘—π‘…π‘š.𝑑+πœ€π‘—,𝑑 (Market Model)
    π‘Ÿπ‘—,𝑑=π‘Žπ‘—+π›½π‘—π‘…π‘š,𝑑+Ξ£n=5 π‘…π‘š,π‘‘βˆ’π‘›+πœ€π‘—,𝑑 (Extended Market Model)

    Where π‘Ÿπ‘—,𝑑 is return of firm i on day t; π‘—π‘…π‘š.𝑑denotes the market return on day t; Ξ£n=5 π‘…π‘š,π‘‘βˆ’π‘› denotes the market return n days prior to day t. I want to use five lags to include all trading days in one week in the extended model.

    Second, I need to create the ratio’s. I have to use the R^2 of each regression, as well as the sum of the absolute values of the coefficients and the standard errors.

    The first ratio measure is the ratio of the R-squared of the two models:
    𝐷1=1βˆ’(𝑅^2π‘šπ‘Žπ‘Ÿπ‘˜π‘’π‘‘/𝑅^2𝑒π‘₯𝑑𝑒𝑛𝑑𝑒𝑑)

    The second ratio measure is as follows:
    𝐷2=[Ξ£π‘›βˆ—(π‘Žπ‘π‘ (𝛿𝑗𝑛)/𝑠𝑒(𝛿𝑗𝑛))] / [π‘Žπ‘π‘ (𝛽𝑗)/𝑠𝑒(𝛽𝑗)+Ξ£(π‘Žπ‘π‘ (𝛿𝑗𝑛)/𝑠𝑒(𝛿𝑗𝑛))]

    My dataset consists of 212,825 observations of 66 isin codes (company codes) with different dates.
    Please see below an extract of my data set. This is only one company (of 66). Some companies start later than 31-12-2004 in my dataset.

    I would appreciate hearing from you.

    Thank you in advance.
    Yours sincerely,
    Philip

    Example generated by -dataex-. To install: ssc install dataex
    clear
    input str12 isin str34 Name float(date dailyreturn marketreturn)
    "AU000000AGL7" "AGL ENERGY" 16436 . .
    "AU000000AGL7" "AGL ENERGY" 16439 0 0
    "AU000000AGL7" "AGL ENERGY" 16440 .025229136 .001908903
    "AU000000AGL7" "AGL ENERGY" 16441 -.007148289 -.00467403
    "AU000000AGL7" "AGL ENERGY" 16442 .007852731 -.0022448753
    "AU000000AGL7" "AGL ENERGY" 16443 -.0014202315 .008170644
    "AU000000AGL7" "AGL ENERGY" 16446 .002849267 .002883604
    "AU000000AGL7" "AGL ENERGY" 16447 -.0042715184 -.00049514294
    "AU000000AGL7" "AGL ENERGY" 16448 -.015095659 -.0005052004
    "AU000000AGL7" "AGL ENERGY" 16449 .005060907 -.00016436777
    "AU000000AGL7" "AGL ENERGY" 16450 -.01818393 -.0018909447
    "AU000000AGL7" "AGL ENERGY" 16453 .00949867 .0037905644
    "AU000000AGL7" "AGL ENERGY" 16454 -.008024584 -.003554615
    "AU000000AGL7" "AGL ENERGY" 16455 -.005146404 -.0023028844
    "AU000000AGL7" "AGL ENERGY" 16456 .010255355 -.004089844
    "AU000000AGL7" "AGL ENERGY" 16457 .02020049 .0018976744
    "AU000000AGL7" "AGL ENERGY" 16460 -.013660502 .0002369563
    "AU000000AGL7" "AGL ENERGY" 16461 -.007995436 .0027406595
    "AU000000AGL7" "AGL ENERGY" 16462 0 0
    "AU000000AGL7" "AGL ENERGY" 16463 .0116067 .01206822
    "AU000000AGL7" "AGL ENERGY" 16464 -.0116067 -.001603791
    "AU000000AGL7" "AGL ENERGY" 16467 .0036402016 .0020414055
    "AU000000AGL7" "AGL ENERGY" 16468 .008691583 .004856797
    "AU000000AGL7" "AGL ENERGY" 16469 .02281129 .004248197
    "AU000000AGL7" "AGL ENERGY" 16470 .02230252 .0015283107
    "AU000000AGL7" "AGL ENERGY" 16471 -.0152854 .0025987765
    "AU000000AGL7" "AGL ENERGY" 16474 .00627994 .006574787
    "AU000000AGL7" "AGL ENERGY" 16475 -.004873889 -.002529164
    "AU000000AGL7" "AGL ENERGY" 16476 .0027849546 -.0017694422
    "AU000000AGL7" "AGL ENERGY" 16477 -.01261533 .000595743
    "AU000000AGL7" "AGL ENERGY" 16478 -.0014199505 -.00010046188
    "AU000000AGL7" "AGL ENERGY" 16481 -.013514671 -.005666091
    "AU000000AGL7" "AGL ENERGY" 16482 .0028546855 -.0013095372
    "AU000000AGL7" "AGL ENERGY" 16483 .007835613 .001578935
    "AU000000AGL7" "AGL ENERGY" 16484 -.0135641 .003574669
    "AU000000AGL7" "AGL ENERGY" 16485 .012851356 -.0008343064
    "AU000000AGL7" "AGL ENERGY" 16488 .010584725 .0011386069
    "AU000000AGL7" "AGL ENERGY" 16489 -.0014119764 -.003667351
    "AU000000AGL7" "AGL ENERGY" 16490 -.006335591 -.008238011
    "AU000000AGL7" "AGL ENERGY" 16491 -.013535118 -.005374756
    end
    format %td date
    [/CODE]

  • #2
    You did not get a quick answer. You'll increase the chances of a useful answer by following the FAQ on asking questions - Stata code in code delimiters, readable Stata output, and sample data using dataex. I appreciate your including some data. You need to simplify your post to the absolute minimum needed to demonstrate your problem. Your post looks like you're asking for help when you haven't bothered to try to solve your problem yourself. You're asking a solution to a lot of programming.

    There have been many posts on estimating betas on the Forum. Often, statsby helps with such problems. You can generally write things like r-squares into variables by doing replace statements. It is often helpful to enter return list and ereturn list after an estimation to see how to refer to the generated parameters and other numbers. If you can make some progress on your own, we can help with specific problems. But we are not likely to try to program this kind of big job for you.

    Comment

    Working...
    X