cps: Conditional Poisson sampling design

View source: R/RcppExports.R

cpsR Documentation

Conditional Poisson sampling design

Description

Maximum entropy sampling with fixed sample size. It select a sample with fixed sample size with unequal inclusion probabilities.

Usage

cps(pik, eps = 1e-06)

Arguments

pik

A vector of inclusion probabilities.

eps

A scalar that specify the tolerance to transform a small value to the value 0.

Details

Conditional Poisson sampling, the sampling design maximizes the entropy:

I(p) = - ∑ s p(s) log[p(s)].

where s is of fixed sample size. Indeed, Poisson sampling is known for maximizing the entropy but has no fixed sample size. The function selects a sample of fixed sample that maximizes entropy.

This function is a C++ implementation of UPmaxentropy of the package sampling. More details could be find in Tille (2006).

Value

A vector with elements equal to 0 or 1. The value 1 indicates that the unit is selected while the value 0 is for rejected units.

Author(s)

Raphaël Jauslin raphael.jauslin@unine.ch

References

Tille, Y. (2006), Sampling Algorithms, springer

Examples


pik <- inclprob(seq(100,1,length.out = 100),10)
s <-  cps(pik)



# simulation with piktfrompik MUCH MORE FASTER
s <- rep(0,length(pik))
SIM <- 100
pikt <- piktfrompik(pik)
w <- pikt/(1-pikt)
q <- qfromw(w,sum(pik))
for(i in 1 :SIM){
  s <- s + sfromq(q)
}
p <- s/SIM # estimated inclusion probabilities
t <- (p-pik)/sqrt(pik*(1-pik)/SIM)
1 - sum(t > 1.6449)/length(pik) # should be approximately equal to 0.95 


StratifiedSampling documentation built on Oct. 26, 2022, 5:09 p.m.