Learn R Programming

randomizr (version 0.16.1)

complete_rs_probabilities: Inclusion Probabilities: Complete Random Sampling

Description

Inclusion Probabilities: Complete Random Sampling

Usage

complete_rs_probabilities(N, n = NULL, prob = NULL, check_inputs = TRUE)

Arguments

N

The number of units. N must be a positive integer. (required)

n

Use for a design in which exactly n units are sampled. (optional)

prob

Use for a design in which either floor(N*prob) or ceiling(N*prob) units are sampled. The probability of being sampled is exactly prob because with probability 1-prob, floor(N*prob) units will be sampled and with probability prob, ceiling(N*prob) units will be sampled. prob must be a real number between 0 and 1 inclusive. (optional)

check_inputs

logical. Defaults to TRUE.

Value

A vector length N indicating the probability of being sampled.

Examples

Run this code
# NOT RUN {
probs <- complete_rs_probabilities(N = 100)
table(probs)

probs <- complete_rs_probabilities(N = 100, n = 50)
table(probs)

probs <- complete_rs_probabilities(N=100, prob = .3)
table(probs)

# }

Run the code above in your browser using DataLab