SampleControl-class {simFrame}R Documentation

Class "SampleControl"

Description

Class for controlling the setup of samples.

Objects from the Class

Objects can be created by calls of the form new("SampleControl", ...) or SampleControl(...).

Slots

design:
Object of class "BasicVector" specifying the variables (columns) to be used for stratified sampling.
group:
Object of class "BasicVector" specifying a variable (column) to be used for sampling whole groups rather than individual observations.
method:
Object of class "function" to be used for sampling (defaults to srs). It should return a vector containing the indices of the sampled items (observations or groups).
size:
Object of class "OptNumeric"; an optional non-negative integer giving the number of items (observations or groups) to sample. For stratified sampling, a vector of non-negative integers, each giving the number of items to sample from the corresponding stratum.
prob:
Object of class "OptNumeric"; an optional numeric vector giving the probability weights.
dots:
Object of class "list" containing additional arguments to be passed to method.
k:
Object of class "numeric"; a single positive integer giving the number of samples to be set up.

Details

There are some restrictions on the argument names of the function supplied to method. If it needs population data as input, the corresponding argument should be called x and should expect a data.frame. If the sampling method only needs the population size as input, the argument should be called N. Note that method is not expected to have both x and N as arguments, and that the latter is much faster for stratified sampling or group sampling. Furthermore, if the function has arguments for sample size and probability weights, they should be called size and prob, respectively. Note that a function with prob as its only argument is perfectly valid (for probability proportional to size sampling). Further arguments of method may be supplied as a list via the slot dots.

Extends

Class "VirtualSampleControl", directly.

Methods

clusterSetup
signature(cl = "ANY", x = "data.frame", control = "SampleControl"): set up multiple samples on a snow cluster.
setup
signature(x = "data.frame", control = "SampleControl"): set up multiple samples.

Author(s)

Andreas Alfons, alfons@statistik.tuwien.ac.at

See Also

VirtualSampleControl, SampleSetup, setup, draw

Examples

showClass("SampleControl")

[Package simFrame version 0.1.1 Index]