Robust standard errors for clogit regression from survival package in R
Asked Answered
F

1

6

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?
Footgear answered 10/8, 2016 at 11:20 Comment(0)
G
2

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.

Gentility answered 3/12, 2016 at 0:26 Comment(2)
Are you sure this is a correct solution? these two different methods produce different point estimations.Screed
I'm wondering if you maybe have a solution on how to report the SEs and p-values produced that way in regression tables in stargazer. Have been trying to extract them, because stargazer takes the non-robust SEs.Enzymology

© 2022 - 2024 — McMap. All rights reserved.