#Y is the vector of dependent variable #xpbest is the matrix of independent variables #of the best model nsim=100 rmseskill=1:nsim corskill=1:nsim index=1:legnth(Y) for(i in 1:nsim){ d10 = sample(1:length(Y),10,replace=FALSE) indexkeep=setdiff(index,d10) Ykeep=Y[indexkeep] Xpkeep = Xpbest[indexkeep,] tempmod = lm(Ykeep ~ ., data=Xpkeep) yhat = predict(tempmod,newdata=Xpbest[d10,]) rmseskill[i]=mean(((Y[d10]-yhat)/sd(Y[d10]))^2) corskill[i]=cor(Y[d10],yhat) } ### boxplot corskill and rmseskill ### and overlay coryhat and rmseyhat ## i.e. the values from the model fit without ### dropping