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:
Change the method of dealing with ties in your original clogit function.
The default for the method command is method="exact"
. If you use method="efron"
, for example, then the robust=TRUE
command works.