coxed icon indicating copy to clipboard operation
coxed copied to clipboard

Can not calculate confidence interval with "object X not found error"

Open achinmay17 opened this issue 2 years ago • 1 comments

`cox_fit <- coxph(Surv(time_index, time_index1, outcome) ~ treatment + tenure + job_level_name_5 + job_level_name_6 + job_level_name_7 + job_level_name_8 + regulatory_region_geo_AMER + regulatory_region_geo_APJ + regulatory_region_geo_EMEA + regulatory_region_geo_LCC, data=df, method = 'breslow')

ed1 <- coxed(cox_fit, method = 'npsf', id = 'oppid' ,bootstrap = TRUE, B =30, confidence = 'empirical') head(ed1$exp.dur) `

It is a panel data. As soon as I run the ed<- line, I get "Error in eval(predvars, data, env) : object 'X' not found" error. Not sure why this is happening. Please hlep.

achinmay17 avatar Feb 07 '23 17:02 achinmay17

Can reproduce by adding bootstrap = T to one of the vignette's examples:

library(survival)
library(coxed)

bs.surv <- Surv(time = boxsteffensmeier$start, time2 = boxsteffensmeier$te, event = boxsteffensmeier$cut_hi)
bs.cox <- coxph(bs.surv ~ ec + dem + south + iv, data = boxsteffensmeier, method = "breslow")

ed1 <- coxed(bs.cox, method="npsf", id=boxsteffensmeier$caseid,
             bootstrap = T)
#> Error in eval(predvars, data, env): object 'X' not found

Created on 2024-04-12 with reprex v2.1.0

arcruz0 avatar Apr 12 '24 07:04 arcruz0