Displaying 1 result from an estimated 1 matches for "prob0".
Did you mean:
probe
2017 Nov 07
0
Survfit when new data has only 1 row of data
...ro-inflated negative binomial models for the same data (albeit in a different format)
To my mind, and based on what I've read, the best way to do this is to use survfit. I want to make predictions for each individual, therefore, I have tried this code:
trialnos <- unique(bdat5$trialno)
prob0 <- function(ids,dataset,model,time){
probs <- rep(0,length(ids))
for(i in 1:length(ids)){
print(i)
sdata <- subset(dataset,trialno==ids[i])
sfit <- survfit(model,newdata=sdata)
probs[i] <-sum(summary(sfit,time)$surv)
}
return(probs)
}
prob0ests <- prob0(trialnos,...