Announcement

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

  • Deltacovar A.Brunnermeier

    Goodmorning. I'm doing an analysis on a sample of 59 banks (DATASET UNBALANCED).
    I'm following the paper based on the costruction of deltaCOVAR written by A.Brunnermeier.
    I just know the commands to calculate Var and Covar in order to estimate deltaCOVAR finally.

    The commands are:

    qreg Xi IBOVESPAReturnlag IBOVESPAVolatilitylag LiquiditySpreadlag ChangeCreditSpreadlag ChangeYieldSlopelag ChangeTbilllag ,quantile(.05)
    predict Xi_predict95 ,xb

    gen Xi_predict95lag = Xi_predict95[_n-1]


    qreg XSYST Xi_predict95 IBOVESPAReturnlag IBOVESPAVolatilitylag LiquiditySpreadlag ChangeCreditSpreadlag ChangeYieldSlopelag ChangeTbilllag,quantile(.05)
    predict XSYST_predict95,xb

    qreg Xi IBOVESPAReturnlag IBOVESPAVolatilitylag LiquiditySpreadlag ChangeCreditSpreadlag ChangeYieldSlopelag ChangeTbilllag,quantile(.50)
    predict Xi_predict50,xb

    gen Xi_predict50lag = Xi_predict50[_n-1]

    qreg XSYST Xi_predict50 IBOVESPAReturnlag IBOVESPAVolatilitylag LiquiditySpreadlag ChangeCreditSpreadlag ChangeYieldSlopelag ChangeTbilllag,quantile(.50)
    predict XSYST_predict9550,xb

    gen deltacovar = XSYST_predict95 - XSYST_predict9550

    The problem is that i obtained the same value of Xi_predict95 for each banks in spite of each banks have different Xi. Probably i must use the command "forvalues...." but i don't have results probably because i must distinguish id banks and time variabile because it's UNBALANCED.

    forvalues i = 1/59 {
    qreg Xi IBOVESPAReturnlag IBOVESPAVolatilitylag LiquiditySpreadlag ChangeCreditSpreadlag ChangeYieldSlopelag ChangeTbilllag if IDBanks ==`i', quantile(.05)
    predict var5_`i' if IDBaks==`i', xb `i'
    replace var5_`i'=0 if var5_`i'==.
    replace var5=var5+var5_`i'
    drop var5_`i'
    }

    Someone, can help me with the right commands?
    Thank you so much,
Working...
X