How can I tidy non-standard output (specifically GLMs with clustered standard errors)?



The code below estimates a logit model via rms::lrm(), then computes cluster-robust standard errors using rms::robcov().

fit <- lrm(degree ~ religion + gender + age, x=T, y=T, data=WVS)
fit_clus <- robcov(fit, cluster= WVS$country)



I would like to tidy the resulting estimates for use by huxtable() or some other package, but the attempt at tidying generates an error as below.

> fit_clus
Logistic Regression Model
 lrm(formula = degree ~ religion + gender + age, data = WVS, x = T, 
     y = T)
                             Model Likelihood     Discrimination    Rank Discrim.    
                                Ratio Test           Indexes           Indexes       
 Obs                5381    LR chi2      46.01    R2       0.013    C       0.561    
  no                4238    d.f.             3    g        0.264    Dxy     0.122    
  yes               1143    Pr(> chi2) <0.0001    gr       1.302    gamma   0.123    
 Cluster on  WVS$country                          gp       0.043    tau-a   0.041    
 Clusters              4                          Brier    0.166                     
 max |deriv|       9e-11                                                             
              Coef    S.E.   Wald Z Pr(>|Z|)
 Intercept    -0.7886 0.3122 -2.53  0.0115  
 religion=yes  0.1124 0.1316  0.85  0.3930  
 gender=male  -0.0768 0.1148 -0.67  0.5035  
 age          -0.0132 0.0028 -4.78  <0.0001 
> tidy(fit_clus)
Error in : 
  cannot coerce class "c("lrm", "rms", "glm")" to a data.frame

I know that rms:lrm() is not on the list of available tidiers in the broom package, so I'm not surprised tidy(fit_clus) returns an error, but does anyone have strategies for extracting the regression table elements from the fit_clus object?



To solve (in a way) the problem I posed here, the texreg package was able to correctly extract the coefficients, standard errors, etc. for a table whereas I could not make the alternatives work.