search for: newpr

Displaying 3 results from an estimated 3 matches for "newpr".

Did you mean: newer
2013 Jan 31
1
obtainl survival curves for single strata
...many subjects? I have a model based on Surv(time,response) object, so there is a single row per subject and no start,stop and no switching of strata. The newdata has many subjects and each subject has a strata and the survival based on the subject risk and the subject strata is needed. If I do newpred <- survfit(cph.approve,new=newapp,se=F) I get all strata for every subject. Attempting > newpred <- survfit(cph.approve,new=newapp,id=CertId,se=F) Error in survfit.coxph(cph.approve, new = newapp, id = CertId, se = F) : The individual option is only valid for start-stop data >...
2006 Jun 07
1
knn - 10 fold cross validation
Hi, I was trying to get the optimal 'k' for the knn. To do this I was using the following function : knn.cvk <- function(datmat, cl, k = 2:9) { datmatT <- (datmat) cv.err <- cl.pred <- c() for (i in k) { newpre <- as.vector(knn.cv(datmatT, cl, k = i)) cl.pred <- cbind(cl.pred, newpre) cv.err <- c(cv.err, sum(cl != newpre)) } k0 <- k[which.min(cv.err)] print(k0) return(k0) } However, the knn.cv function does a 'leave one out' cross validation. I checked the...
2003 Dec 16
0
Help w/ termplot & predict.coxph/ns
...For my model, the effect of x1 is VERY small (not statistically significant) and when I overlay the results w/ those produced by termplot (using "lines") they do not line up at all: # Predict linear predictor vs. x2 for x1 =1 newdata<-data.frame(x1=rep(1,60), x2=seq(0,30, length=60)) newpred<-predict(model.fit, newdata, type="lp", safe=T) termplot(model.fit) lines(newdata[,2], newpred) Interestingly enough, predict(model.fit) does give back the correct values for the actual data set used in the fitting: max(predict(model.fit)-model.fit$linear.predictors)=0. Am I missin...