Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

simple_rs_probabilities

Inclusion Probabilities: Simple Random Sampling


Description

Inclusion Probabilities: Simple Random Sampling

Usage

simple_rs_probabilities(N, prob = NULL, prob_unit = NULL,
  check_inputs = TRUE, simple = TRUE)

Arguments

N

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

prob

prob is the probability of being sampled must be a real number between 0 and 1 inclusive, and must be of length 1. (optional)

prob_unit

prob is the probability of being sampled must be a real number between 0 and 1 inclusive, and must be of length N. (optional)

check_inputs

logical. Defaults to TRUE.

simple

logical. internal use only.

Value

A vector length N indicating the probability of being sampled.

Examples

probs <- simple_ra_probabilities(N = 100)
table(probs)

probs <- simple_ra_probabilities(N = 100, prob = 0.3)
table(probs)

randomizr

Easy-to-Use Tools for Common Forms of Random Assignment and Sampling

v0.20.0
MIT + file LICENSE
Authors
Alexander Coppock [aut, cre], Jasper Cooper [ctb], Neal Fultz [ctb] (C version of restricted partitions)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.