Announcement

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

  • Calculate Portfolio Variance in Panel Data

    Hello everyone,

    I have a dataset which looks as follows:

    Date crsp_fundno cusip stock_return stock_weight

    1993-01 1 1111 0.05 0.40
    1993-01 1 1112 -0.02 0.20
    1993-01 1 1113 0.07 0.40
    1993-02 1 1111 0.03 0.33
    1993-02 1 1112 0.04 0.33
    1993-02 1 1113 -0.02 0.33
    1993-01 2 1111 0.05 0.10
    1993-01 2 1112 -0.02 0.20
    1993-01 2 1113 0.07 0.40
    1993-01 2 1114 0.03 0.15
    1993-01 2 1115 -0.01 0.05
    1993-01 2 1116 0.01 0.10
    1993-02 2 1111 0.01 0.15
    1993-02 2 1112 -0.05 0.12
    1993-02 2 1113 0.04 0.30
    1993-02 2 1114 0.02 0.20
    1993-02 2 1115 -0.05 0.10
    1993-02 2 1116 0.03 0.10
    .....

    I would like to calculate the historical portfolio variance for every portfolio at every month.

    Can someone please elaborate as to how can I calculate that?

    Thank you very much in advance.

    Best,
    Nabil

  • #2
    You'll increase your chances of a useful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output, and sample data using dataex.

    If you have an identifier for portfolios, you can do it with egen monthlysd=sd(stockreturn) , by(date fundno)

    If you want weights, you may need to weight the returns before doing the egen. However, I'm not sure exactly what the standard deviation for a portfolio in a given month means.

    Comment

    Working...
    X