Displaying 1 result from an estimated 1 matches for "cvpre".
2010 Jan 21
3
cross validation function translated from stata
...ay(line none all modelp1 modelp2 threshold, sort)
=================================================================
Here is my draft of R code. cMain is my dataset.
predca<-rep(0,40000)
dim(predca)<-c(200,200)
for (i in 1:200) {
cvgroup<-rep(1:10,length=110)
cvgroup<-sample(cvgroup)
cvpre<-rep(0,length=110)
cvMain<-cbind(cMain,cvgroup,cvpre)
for (j in 1:10) {
cvdev<-cvMain[cvMain$cvgroup!=j,]
cvval<-cvMain[cvMain$cvgroup==j,]
cvfit<-lrm(Y~X,data=cvdev,x=T,y=T)
cvprej<-predict(cvfit,cvval,type="fitted")
#put the fitted value in dataset
cvMain[cvgroup==j...