Dear Stata Community!
I'm very new in stata and am now working on my thesis. I want to calculate Stock Price Crash Risk (NSKEW) using this equation:
this is the code line that he uses:
note: I also attach my stata data
best regard,
Yusuf
I'm very new in stata and am now working on my thesis. I want to calculate Stock Price Crash Risk (NSKEW) using this equation:
from the paper that I read, before calculating NSKEW, I need to calculate the firm-specific weekly return for firm j in week τ by this equation:
NSKEW = - [n(n-1)3/2 ΣW3 j,τ] / [(n-1)(n-2) (ΣW2j,τ)3/2] ...... (1)
the problem is to get the firm-specific weekly return, I dont know how to get the residual return for each firm using this equation:
(Wj,τ = ln(1+ej,τ)) ...... (2)
I've seen a tutorial on youtube on how to solve this problem, but he calculates the residual return using R, here is the youtube link: https://www.youtube.com/watch?v=sjCs6eAdzn0
rj,τ = ⍺j + 𝛾1,j rm,𝝉-2 + 𝛾2,j rm,𝝉-1 + 𝛾3,j rm,𝝉 + 𝛾4,j rm,𝝉+1 + 𝛾5,j rm,𝝉+2 + ej,𝝉 ......... (3)
this is the code line that he uses:
* First, initialize the residual matrix to a null matrix, the size is based on the size of the input dataCan anyone help me to build command line for stata using the same concept?
residuals_expanded model<-matrix (0,517,100)
* Then, generate the residuals matrix using the expanded market model
for (i in 1:100) {
Residuals_ expanded model [,i] <- resid(Im(crash data[,i+1] ~ crash data[,102] + crash data[, 103] + crash data[, 104] + crash data [,105] + crash data [,106]))
}
note: I also attach my stata data
best regard,
Yusuf
Comment