[R] calibration/validation sets

Liaw, Andy andy_liaw at merck.com
Sun Aug 15 03:05:22 CEST 2004


There are many ways to do this.  One example, supposing your data is in
`myData':

## randomly pick 1/3 for validation:
valid.idx <- sample(nrow(myData), round(nrow(myData)/3), replace=FALSE) 

## training set:
myData.tr <- myData[-valid.idx,]
## validation set:
myData.valid <- myData[valid.idx,]

HTH,
Andy

> From: Peyuco Porras Porras .
> 
> Hi; 
> Does anyone know how to create a calibration and validation 
> set from a particular dataset? I have a dataframe with nearly 
> 20,000 rows! and I would like to select (randomly) a subset 
> from the original dataset (...I found how to do that) to use 
> as calibration set. However, I don't know how to remove this 
> "calibration" set from the original dataframe in order to get 
> my "validation" set.....Any hint will be greatly appreciated. 
> TT
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
>




More information about the R-help mailing list