Hello,
I am trying to compare survival between site and treatment (categorical variables) in rstanarm using stan_surv(). I am first looking to compare the hazard of death and I am not sure if my interpretation is correct but I think print() is giving me in “SiteB:New.TreatmentNE” the hazard rate with respect to the “site A and Treatment NE” but I would like to compare the hazard of death from Site A in treatment “E” to the same site A in treatment "NE ", then site B in treatment “E” to site B in treatment “NE” as I am interested in compare “hazard of death” for each site by treatment. So, my question is how I can extract those values?
I tried posterior_surv () type =“haz” but that is giving me an estimate for each point in time.
Also, is it possible with this model to get the hazard death for species “S1” in site “A” under the treatment “E”?
Here is a trial data
library(rstanarm)
data_NHN <- expand.grid(
Site = c("A","B","C"),
New.Treatment = c(rep("E",21),rep("NE",40)))
data_NHN$subplot_by_site = c(rep(1,63), rep(2,60), rep(3,60))
data_NHN$Status_surv = sample(0:1,183, replace = TRUE)
data_NHN$New.Species.name = c(rep("S1",10), rep("S2",40), rep("S3",80), rep("S2",20), rep("S1",33))
data_NHN$days = sample(10, size = nrow(data_NHN), replace = TRUE)
mod1 = stan_surv(
formula = Surv(days, Status_surv) ~ Site*New.Treatment + (1| subplot_by_site) + (Site | New.Species.name),
data = data_NHN,
basehaz = "weibull",
chains = 4,
iter = 30,
cores = 4)
print(mod1, digits=2)
summary(mod1, digits=2)
- Operating System: Mac OS Catalina 10.15.6
- R version: 4.0
- rstan version: 2.21.2
- rstanarm Version: rstanarm_2.21.2
TIA!