I am attempting to run a Cox proportional hazards model using brms. I have been getting an error message that, after a few hours of trying to figure it out, I cannot solve. The error message reads:
Error in FUN(X[[i]], ...) : Stan does not support NA (in Zbhaz) in data failed to preprocess the data; sampling not done
Here is the code used to specify the model:
abandon_glm <- brm(commitment_latency | cens(censored) ~ age_stndrd + location_string + first + gender_string, data = abandon_latency, family = brmsfamily("cox"), iter = 5000, warmup = 1500, control = list(adapt_delta = 0.99, max_treedepth = 50), save_pars = save_pars(all = TRUE), cores = 4)
I constructed the censoring variable as follows:
abandon_latency <- wesch_data %>% mutate(commitment_latency = ifelse(commitment_latency > 61, 61, commitment_latency), censored = ifelse(commitment_latency == 61, "right", "none"), commitment_latency = as.integer(commitment_latency)) %>% relocate(censored, .after = commitment_latency) %>% select(commitment_latency, censored, age_stndrd, location_string, first, gender_string, condition_string)
I have come across a thread from a few years ago on this forum wherein someone had the same problem (Brms package for survival). However, the issue was at the time resolved by the individual updating their version of brms, which seems in my case to not be a possible solution given that my version of brms is up to date (brms 2.15.0; OS: Mac Catalina 10.15.7)?
Thank you for your attention to this post and any help offered. I am happy to provide more information on my problem if that may be of use.