cps | R Documentation |
Maximum entropy sampling with fixed sample size. It select a sample with fixed sample size with unequal inclusion probabilities.
cps(pik, eps = 1e-06)
pik |
A vector of inclusion probabilities. |
eps |
A scalar that specify the tolerance to transform a small value to the value 0. |
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).
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.
Raphaël Jauslin raphael.jauslin@unine.ch
Tille, Y. (2006), Sampling Algorithms, springer
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.