rfixest

How to access adjusted R2 from summary of feols?


The following code returns the adjusted R2, but I can't find this attribute nor the R2 from the summary function.

I only find the coefficient of correlation sq.cor.

library(fixest)
summary(feols(mpg~wt, mtcars))

How to access the R2 and/or adjusted R2, if possible?


Solution

  • After first looking at the code for summary.fixest and print.fixest and not finding an answer, I did however notice this code:

    print(fitstat(x, fitstat), na.rm = TRUE, group.solo = TRUE)
    

    .... and looking at ?fixest::fitstat I see:

    Usage

    fitstat( x, type,

    type
    Character vector or one sided formula. The type of fit statistic to be computed. The classic ones are: n, rmse, r2, pr2, f, wald, ivf, ivwald. You have the full list in the details section or use show_types = TRUE. Further, you can register your own types with fitstat_register.

    So:

    > fitstat(res, "ar2")
    Adj. R2: 0.744594