Hi everyone.
I am trying to generate abnormal returns in STATA.
To do so, I need to calculate the expected returns (Expected return = α+β*R)
R is the average return of the market, for which I want to do a value weighted calculation (with returns and market capitalization)
I have a dataset with around 550 companies and for each company I have more than 300 daily returns and the associated market cap for the day.
I was able to calculate the average market return for one day by doing the following:
egen num=total(QJ*QK)
egen den=total(QJ)
gen wtmean=num/den
My Variables are named from QJ, QK, QL,...,ATI.
QJ is daily market cap, QK daily return
QL is daily market cap, QM daily return
and so on (every second variable is market cap)
I want to create wtmean for every day and then calculate the mean, so that I have the average return for the market for the time period I am looking at.
Can anyone help me on how to create the average return for the market? I already tried foreach but I didn't find the right code, as I don't know how to address only every second variable.
Related Posts with Abnormal Returns/ Average return of the market, value-weighted
Assigning variable values to observations based common values of other variables...I have a data set with 3 variables: one identifies the contract number; one identifies the type of c…
factor variables and time-series operators not allowedHi, I am trying to run the following the codes, but get the error message "factor variables and tim…
Is it possible to divide a variable by the mean across individuals for a regression???Hello, is it okay to divide each individual's value of a variable by the mean of the sample and the…
getting estimates when using bayes prefix for melogitHi Stata forum members, I need some advice on how to get estimates after fitting melogit using baye…
Merging datesHi, I'm trying to merge two dates variables from the same dataset, but I would like to prioritize o…
Subscribe to:
Post Comments (Atom)
0 Response to Abnormal Returns/ Average return of the market, value-weighted
Post a Comment