prnsamplr-package | R Documentation |
This package provides two functions for drawing stratified
PRN-assisted samples: srs
and pps
. The former –
simple random sampling – assumes that each unit k
in a given
stratum h
is equally likely to be sampled, with inclusion
probability
\pi_k = \frac{n_h}{N_h}
for each stratum h
.
The function then samples the n_h
elements with the smallest PRN's,
for each stratum h
.
The latter – Pareto \pi ps
sampling – assumes that large units are
more likely to be sampled than small units. The function approximates this
unknown inclusion probability as
\lambda_k = n_h \frac{x_k}{\sum_{i=1}^{n_h} x_i},
where
x_k
is a size measure, and samples the n_h
elements with the
smallest values of
Q_k = \frac{PRN_k(1 - \lambda_k)}{\lambda_k(1 - PRN_k)},
for each stratum h
.
These two functions can be run standalone or via the wrapper function
samp
. Input to the functions is the sampling frame, stratification
information and PRN's given as variables on the frame, and in the case for
pps
also a size measure given as variable on the frame. Output is a
copy of the sampling frame containing sampling information, and in the case
for pps
also containing \lambda
and Q
.
Provided is also a function transformprn
via which it is possible to
select where to start counting and in which direction when enumerating the
PRN's in the sampling routines. This is done by specifying starting point
and direction to transformprn
and then calling srs
or
pps
on its output.
Finally, an example dataset is provided that can be used to illustrate the functionality of the package.
Maintainer: Kira Coder Gylling kira.gylling@gmail.com (ORCID)
Lindblom, A. (2014). "On Precision in Estimates of Change over Time where Samples are Positively Coordinated by Permanent Random Numbers." Journal of Official Statistics, vol.30, no.4, 2014, pp.773-785. https://doi.org/10.2478/jos-2014-0047.
srs, pps, samp, transformprn, ExampleData
dfSRS <- srs(
frame = ExampleData,
nsamp = ~nsample,
stratid = ~stratum,
prn = ~rands
)
dfPPS <- pps(
frame = ExampleData,
nsamp = ~nsample,
stratid = ~stratum,
prn = ~rands,
size = ~sizeM
)
dfPRN <- transformprn(
frame = ExampleData,
prn = ~rands,
direction = "U",
start = 0.2
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.