I'm relatively new on R and yet having to do something quite complicated (at least for me).
I have stock's returns (r`i') and market return (Rm) for a total of 100 stocks, even though I will replicate the analysis for other markets. My analysis is composed of three phases, but I'm stuck in the first.
I need to find intercept and coefficient for a system of simultaneous equations, one modeled as msmFift and the other as OLS. In particular I want the beta of the second equation to be conditional on the regime identified in the first equation. Algebraically:
In this way I aim to find the conditional betas, depending on each regime (assume 2). In addition, for further analysis, I need to extract the variance-covariance matrix for each system of equations, that is looping over all the stocks in the market.
Any idea about the way to proceed, functions/packages?