I am trying to compute value weighted average daily portfolio returns for a portolio, but am not sure how to correctly code this
my data looks the following:
How can I create the last column "Market weighted return (not yet created)"
Thereafter, I would like to reduce the table size to the following
This i expect to do the following:
duplicates drop date marketreturn eventdummy marketweightedreturn
drop company companyreturn marketcap2016 industry.
I am just a bit lost on how to first create the market weighted return (that consists of the daily value(market cap) weighted average return for the portfolio that consists of all the companies in the sample
Could you help me with this?
my data looks the following:
date | company | companyreturn | marketcap2016 | marketreturn | industry | eventdummy | Market weighted return (not yet created) |
1 | x | 1 | 300 | 3 | d | 0 | UU |
2 | x | 2 | 300 | 2 | d | 1 | VV |
3 | x | 1 | 300 | 3 | d | 0 | WW |
1 | y | 0 | 200 | 3 | e | 0 | UU |
2 | y | 3 | 200 | 2 | e | 1 | VV |
3 | y | 1 | 200 | 3 | e | 0 | WW |
1 | z | -1 | 150 | 3 | f | 0 | UU |
2 | z | -3 | 150 | 2 | f | 1 | VV |
3 | z | 5 | 150 | 3 | f | 0 | WW |
Thereafter, I would like to reduce the table size to the following
date | marketreturn | eventdummy | Market weighted return (not yet created) |
1 | 3 | 0 | UU |
2 | 2 | 1 | VV |
3 | 3 | 0 | WW |
duplicates drop date marketreturn eventdummy marketweightedreturn
drop company companyreturn marketcap2016 industry.
I am just a bit lost on how to first create the market weighted return (that consists of the daily value(market cap) weighted average return for the portfolio that consists of all the companies in the sample
Could you help me with this?
Comment