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

obtain_permutation_probabilities

Obtain the probabilities of permutations


Description

Obtain the probabilities of permutations

Usage

obtain_permutation_probabilities(declaration)

Arguments

declaration

A random assignment declaration, created by declare_ra.

Value

a vector of probabilities

Examples

declaration <- declare_ra(N = 5, prob_each = c(.49, .51))
obtain_num_permutations(declaration)
perm_probs <- obtain_permutation_probabilities(declaration)
perms <- obtain_permutation_matrix(declaration)

# probabilities of assignment from declaration *should* match the average over all permutations
true_probabilities <- declaration$probabilities_matrix[,2]
true_probabilities

# correctly WRONG because the perms have different probs!
rowMeans(perms)

# correctly correct!
perms %*% perm_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.