Displaying 1 result from an estimated 1 matches for "prob0ests".
2017 Nov 07
0
Survfit when new data has only 1 row of data
...;- 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,bdat5,cfitcp2,730)
When I do this for the first three trial numbers I get:
0.3001021 2993.4531767 0.3445589
The unusually large "probability" arises when there is only 1 row of data for the relevant trial number. Can anyone therefore explain why there is a probl...