Learn R Programming

StratifiedSampling (version 0.4.1)

inclprob: Inclusion Probabilities

Description

Computes first-order inclusion probabilities from a vector of positive numbers.

Usage

inclprob(x, n)

Value

A vector of inclusion probabilities proportional to x and such that the sum is equal to the value n.

Arguments

x

vector of positive numbers.

n

sample size (could be a positive real value).

Author

Raphael Jauslin raphael.jauslin@unine.ch

Details

The function is implemented in C++ so that it can be used in the code of other C++ functions. The implementation is based on the function inclusionprobabilities of the package sampling.

See Also

inclusionprobabilities

Examples

Run this code

x <- runif(100)
pik <- inclprob(x,70)
sum(pik)

Run the code above in your browser using DataLab