I am trying to get robust standard errors for a clogit regression from the survival package in R. In doing so, I am trying to replicate the standard errors reported by the Stata clogit
command with the vce(robust)
option.
My formula in R is
conditional_logit <- clogit(dependent_variable ~ independent_variable + some_controls + strata(year), method= "exact", data = data_frame)
Adding the robust = TRUE
argument to the function fails with the error:
Error in residuals.coxph(fit2, type = "dfbeta", weighted = TRUE) :
score residuals are not available for the exact method
Any attempt to extract robust standard errors via the sandwich or plm packages as suggested here, here, here, and here fails with the same error. Similarly, the clogit function includes a condition to stop attempts to calculate robust standard errors when using the exact
method (line 44). However, conditional_logit$residuals and conditional_logit$score exist in the clogit regression object.
I would be thankful if somebody could help answer the following questions:
- Is it generally impossible or "wrong" to calculate robust standard errors for "exact" conditional logistic regressions? If so, why does Stata allow doing so?
- If not: How could I calculate robust standard errors for clogit regressions in R?
- If it's not possible to calculate robust standard errors based on the data in the clogit regression object: Is there another R package that produces conditional logistic regression models that are equivalent to those produced by the clogit function of the survival package and that include the data that I need to calculate robust standard errors?