pps: Stratified probability-proportional-to-size sampling

View source: R/pps.R

ppsR Documentation

Stratified probability-proportional-to-size sampling

Description

Stratified probability-proportional-to-size (Pareto PiPS) sampling using permanent random numbers. Can also be used for non-stratified Pareto PiPS using a dummy stratum taking the same value for each object.

Usage

pps(frame, stratid, nsamp, prn, size)

Arguments

frame

Data frame (or data.table or tibble) containing the elements to sample from.

stratid

Variable in frame containing the strata.

nsamp

Variable in frame containing the sample sizes.

prn

Variable in frame containing the permanent random numbers.

size

Variable in frame containing the size measure.

Value

A copy of the input sampling frame together with the boolean variable sampled, indicating sample inclusion, as well as a numeric variable lambda containing the estimated first-order inclusion probabilities and the numeric variable

Q = \frac{prn(1 - lambda)}{lambda(1 - prn)}

that determines which elements are sampled.

See Also

prnsamplr, samp, srs, transformprn, ExampleData

Examples

dfOut <- pps(
  frame = ExampleData,
  nsamp = ~nsample,
  stratid = ~stratum,
  prn = ~rands,
  size = ~sizeM
)

prnsamplr documentation built on April 3, 2025, 7:35 p.m.