I am having trouble interpreting the results of my model. I have run a mixed effects model with two fixed effects, two random effects using frailty(), and two interaction terms (fixed:fixed and fixed:random). I am interested in reconstructing a function to predict survival time for individuals, so the estimates of variance for the random effects terms are important (Hence why I cannot use cluster() to identify them). Here is some sample code to generate what my dataset looks like on a very reduced scale:
library(survival)
library(ggplot2)
library(ggfortify)
# Generating data
Hospital <- rep(c("Facility 1", "Facility 2", "Facility 3", "Facility 4"), each = 32)
Doctor <- rep(c("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32"), each = 4)
Treatment <- rep(c("A", "B"), each = 16, 4)
City <- rep(c("LA", "NY"), each = 64)
Time1 <- c(NA,1,2,3,4,1,2,3,1,4,NA,1,3,4,1,2,4,3,4,3,3,4,2,4,4,2,3,3,4,4,4,3,3,2,1,3,1,1,2,1,NA,1,NA,1,1,NA,2,3,3,4,2,4,2,3,3,4,3,2,2,2,1,3,4,4,1,2,NA,2,1,1,2,1,2,1,1,1,1,2,NA,3,4,3,2,3,4,4,2,2,4,4,4,3,2,3,3,4,1,1,2,NA,NA,1,1,1,2,1,2,3,1,1,2,3,4,3,4,3,3,4,3,4,1,3,4,3,3,4,4,4)
Time2 <- Time1 + 1
data = data.frame(Hospital, Doctor, Treatment, City, Time1, Time2)
data$Time2[is.na(data$Time2)] <- 1
data$Time2[data$Time2 == 5] <- NA
Using the ggplot libraries in the next section, it is obvious that there is an effect on survival due to Treatment, where individuals with Treatment B live longer (confirmed with p < 0.01) and that there is no significant effect due to City (p >> 0.05) or the interaction between Treatment and City (p >> 0.05). My issue lies in understanding the output for the gamma terms. Is this telling me the effect size of the random effects? If so, why do I not see outputs for Doctor in addition to Hospital? Why do some of the interaction terms output NA's and 0's?
# Model fit and results
sobj <- Surv(data$Time1, data$Time2, type = 'interval2')
data$label <- paste(data$City, data$Treatment)
autoplot(survfit(sobj ~ data$label))
fit <- survreg(sobj ~ data$Treatment + data$City + data$Treatment:data$City +
frailty(data$Hospital) + frailty(data$Doctor) + frailty(data$Hospital):data$City, dist = "weibull")
summary(fit)
I'm not sure if my problem lies in the way I am coding my model or in my understanding of statistics (probably both), but seeing errors in the output makes me hesitate to trust even the conclusions about the fixed effects. Please let me know if there is a better place to post my questions.