In this question, I asked whether it is better to use clustered or GMM-based standard errors for estimating and testing asset pricing models such as the CAPM. However, I then realized that I am not sure how to set up the panel data model needed for obtaining the clustered standard errors, because the $\beta$s are unobservable. I looked around and found a few threads referring to the panel data model: 1, 2, 3. E.g. in this answer, Matthew Gunn writes:
A modern approach to consistently estimate standard errors might be to run the following panel regression and cluster by time $t$: $$ R_{it} - R^f_t = \gamma_0 + \gamma_1 \beta_i + \epsilon_{it}$$
However, $\beta_i$ is unobservable, so we cannot estimate the model using the usual techniques. I am not sure if the author actually meant $\beta_i$ or an estimate thereof, though. But if we substitute $\beta_i$ by its estimate $\hat\beta_i$ from an appropriate time series regression, we face the errors-in-variables problem (a.k.a. measurement error). This suggests the estimation results will be suboptimal, and clustering by time will not address that. Thus my question:
- How does one set up an appropriate panel data model for estimating (and later testing) the CAPM?