Hi all,
I am trying to do something in Stata but I am not sure where to start. I have a set of panel data containing the following information:
- 2320 firms,
- pricing data for every firm for 36 months
- market values (MV) for every firm for 36 months
I calculated returns for every firm for every month.
Now I am facing the following challenges in calculating weighted returns.
For some firms, no more price data is available after a certain time, and hence no more returns (which, for example, could be after 5 month for firm X, and could be after 27 month for firm Y, etc). If this happens, I want to allocate the weights of these firms to the remaining firms in the portfolio. So if one firm has no more returns after month 5, the other firms should receive an equal weight of 1/2319 for the subsequent months. In case of the value weight, a new total market value has to be calculated and new weights have to be calculated for each firm for the subsequent months.
I would be grateful if there is someone who could help me out.
Kind regards,
Bram
I am trying to do something in Stata but I am not sure where to start. I have a set of panel data containing the following information:
- 2320 firms,
- pricing data for every firm for 36 months
- market values (MV) for every firm for 36 months
I calculated returns for every firm for every month.
Now I am facing the following challenges in calculating weighted returns.
- I want to calculate equally weighted returns across the entire sample. So every firm has the same weight in the portfolio. (so 1/2320 is the return for every firm, I divide this by 36 so also every month has the same weight). In Excel this is relatively straight forward but I would like to do this in stata in case my sample changes and I could just use the same formula again.
- I want to calculate value-weighted returns across the entire sample. Based on the market value (MV) at month 1, I want to assign a certain weight to every firm. I want to do this by summing the market values for every firm at month 1 and then divide the MV of each individual firm by the sum of market values. Again this needs to be divided by 36 so every month receive the same weight.
For some firms, no more price data is available after a certain time, and hence no more returns (which, for example, could be after 5 month for firm X, and could be after 27 month for firm Y, etc). If this happens, I want to allocate the weights of these firms to the remaining firms in the portfolio. So if one firm has no more returns after month 5, the other firms should receive an equal weight of 1/2319 for the subsequent months. In case of the value weight, a new total market value has to be calculated and new weights have to be calculated for each firm for the subsequent months.
I would be grateful if there is someone who could help me out.
Kind regards,
Bram
Comment