Announcement

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

  • Cross-sectional regression

    Hello,

    I'm trying to replicate a finance paper with more updated data and I'm struggling with the cross sectional regression the paper used as below:
    Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	174.9 KB
ID:	1641154



    My sample looks like this:
    Click image for larger version

Name:	Capture2.PNG
Views:	1
Size:	16.1 KB
ID:	1641155


    Please kindly advice on how I should carry out the cross sectional regression in this case. Thank you!

  • #2
    I think you want
    Code:
    collapse (p50) IACR, by(dealnumber pre_merger) // CALCULATE MEDIAN pre AND post IACR FOR EACH FIRM
    drop if missing(pre_merger)
    reshape wide IACR, i(dealnumber) j(pre_merger)
    regress IACR0 IACR1 // DO THE REGRESSION
    Notes:

    1. The subscript i in the equation you post is said to index firms. There is no variable in your data that obviously corresponds to that. I'm guessing that dealnumber is firm. If not, then in the code, replace dealnumber by the actual name of the variable that designates the firm. If there is no such variable, then what you want cannot be done with your data.

    2. Because the data example was posted as a screenshot, the least helpful way to show data here, this code could not be tested. As such it may contain typos or errors. In the future, when showing data examples, please use the -dataex- command to do so. If you are running version 17, 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

    Comment

    Working...
    X