sampling {simFrame} | R Documentation |
Random sampling
Description
Functions for random sampling.
Usage
srs(N, size, replace = FALSE)
ups(N, size, prob, replace = FALSE)
brewer(prob, eps = 1e-06)
midzuno(prob, eps = 1e-06)
tille(prob, eps = 1e-06)
Arguments
N |
a non-negative integer giving the number of observations from which to sample. |
size |
a non-negative integer giving the number of observations to sample. |
prob |
for |
replace |
a logical indicating whether sampling should be performed with or without replacement. |
eps |
a numeric control value giving the desired accuracy. |
Details
srs
and ups
are wrappers for simple random sampling and
unequal probability sampling, respectively. Both functions make use of
sample
.
brewer
, midzuno
and tille
perform Brewer's, Midzuno's and
Tillé's method, respectively, for unequal probability sampling
without replacement and fixed sample size.
Value
An integer vector giving the indices of the sampled observations.
Note
brewer
, midzuno
and tille
are faster C++ implementations
of UPbrewer
, UPmidzuno
and UPtille
, respectively, from
package sampling
.
Author(s)
Andreas Alfons
References
Brewer, K. (1975), A simple procedure for sampling \pi
pswor,
Australian Journal of Statistics, 17(3), 166-172.
Midzuno, H. (1952) On the sampling system with probability proportional to sum of size. Annals of the Institute of Statistical Mathematics, 3(2), 99–107.
Tillé, Y. (1996) An elimination procedure of unequal probability sampling without replacement. Biometrika, 83(1), 238–241.
Deville, J.-C. and Tillé, Y. (1998) Unequal probability sampling without replacement through a splitting method. Biometrika, 85(1), 89–101.
See Also
"SampleControl"
, "TwoStageControl"
,
setup
, inclusionProb
, sample
Examples
## simple random sampling
# without replacement
srs(10, 5)
# with replacement
srs(5, 10, replace = TRUE)
## unequal probability sampling
# without replacement
ups(10, 5, prob = 1:10)
# with replacement
ups(5, 10, prob = 1:5, replace = TRUE)
## Brewer, Midzuno and Tille sampling
# define inclusion probabilities
prob <- c(0.2,0.7,0.8,0.5,0.4,0.4)
# Brewer sampling
brewer(prob)
# Midzuno sampling
midzuno(prob)
# Tille sampling
tille(prob)