I'm writing a term paper, where we need to compare the Fama-French 5-factor model and a q-factor model. For the empirical part, I'm using the Python-based Linearmodels library by Kevin Sheppard.
My problem is that I should perform a GRS test (Gibbon, Ross and Shanken (1989)) on the models, but I just can't figure this one out.
The GRS test equation is: $$\frac{T-N-1}{N}\left[1+\left(\frac{E_{T}[f]}{\hat{\sigma}_{T}(f)}\right)^{2}\right]^{-1} \hat{\mathbb{\alpha}}^{\prime} \hat{\Sigma}^{-1} \hat{\mathbb{\alpha}} \sim F_{N, T-N-1}$$
Here are the attributes we get from Linearmodels https://bashtage.github.io/linearmodels/asset-pricing/asset-pricing/linearmodels.asset_pricing.results.LinearFactorModelResults.html#linearmodels.asset_pricing.results.LinearFactorModelResults
The J statistic in Linearmodels library is defined as $J=\hat{\alpha}^{\prime} \hat{\Sigma}_{\alpha}^{-1} \hat{\alpha}^{\prime}$, so that part is probably sorted and the same goes for the first part of the equation. However, the middle part is something I can't figure out... Can someone help me with this?