Provides a character vector with possible values of "Estimation",
"Validation" and "Holdout" that can then be used to assign observations of a
data frame to estimation, validation, or (optionally) holdsout samples using
the subset option of a variety of functions.
The percentage of the total sample to allocate to the estimation
sample. The value of est should range from zero to one
val
The percentage of the total sample to allocate to the validation
sample. The value of val should range from zero to one
rand.seed
A parameter passed to set.seed for to specify the seed
of the random number generator.
Details
The values of est and val should sum to a value between
zero and one. If greater than one, an error is returned. If less than one,
the remaining percentage of the sample is allocated to the holdout sample.
Value
A character vector with possible values of "Estimation", "Validation" and
(optionally) "Holdout". The length of the vector equals the number of rows
in the original data frame.
Author(s)
Dan Putler
See Also
set.seed
Examples
data(CCS)
# Create a new set of samples with 40 percent in each of the estimation and
# validation samples, and 20 percent in the holdout sample.
CCS$Sample <- create.samples(CCS, est=0.4, val=0.4)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(BCA)
Error in library(BCA) : there is no package called 'BCA'
Execution halted