Description Usage Arguments Details Value Author(s) See Also Examples
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.
1 | create.samples(x, est=0.34, val=0.33, rand.seed=1)
|
x |
A data frame. |
est |
The percentage of the total sample to allocate to the estimation
sample. The value of |
val |
The percentage of the total sample to allocate to the validation
sample. The value of |
rand.seed |
A parameter passed to |
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.
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.
Dan Putler
1 2 3 4 5 | 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.