Re: [R] Error of Cross Validation

2011-06-20 Thread Dennis Murphy
Hi: I was curious to see how to do this. I generated two versions of the same function - one for 10-fold predictions when the number of observations is an exact multiple of 10, returning a matrix, and another that lets the user define the number of folds and works with lists. The function also ret

Re: [R] Error of Cross Validation

2011-06-20 Thread jim holtman
You real error was this: Error in pre[sam[[j]], i] <- predict(fit, data = dat[sam[[j]], ]) : number of items to replace is not a multiple of replacement length Take a look at the statement and you will see that 'predict' is returning 100 values and you are trying to store it into only 10 rows (

Re: [R] Error of Cross Validation

2011-06-20 Thread zhu yao
error in pre[sam[[j]], i] <- predict(fit, data = dat[sam[[j]], ]) : * Yao Zhu* *Department of Urology Fudan University Shanghai Cancer Center Shanghai, China* 2011/6/20 Jim Holtman > what was the error? > > Sent from my iPad > > On Jun 20, 2011, at 1:34, zhu yao wrote: > > > Dear R users: >

[R] Error of Cross Validation

2011-06-19 Thread zhu yao
Dear R users: Recently, I tried to write a program to calculate cross-validated predicted value. My sources are as follows. However, the R reported an error. Could you please check the sources? Thanks. set.seed(100) x<-rnorm(100) y<-sample(rep(0:1,50),replace=T) dat<-data.frame(x,y) library(rms)