Description Usage Arguments Value Examples

Inclusion Probabilities: Cluster Sampling

1 2 3 |

`clusters` |
A vector of length N that indicates which cluster each unit belongs to. |

`n` |
Use for a design in which n clusters are sampled. (optional) |

`n_unit` |
unique(n_unit) will be passed to |

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

`prob_unit` |
unique(prob_unit) will be passed to the prob argument and must be the same for all units. |

`simple` |
logical, defaults to FALSE. If TRUE, simple random sampling of clusters. When simple = TRUE, please do not specify n. |

`check_inputs` |
logical. Defaults to TRUE. |

A vector length N indicating the probability of being sampled.

1 2 3 4 5 6 7 8 9 10 | ```
# Two Group Designs
clusters <- rep(letters, times = 1:26)
probs <- cluster_rs_probabilities(clusters = clusters)
table(probs, clusters)
prob_mat <- cluster_rs_probabilities(clusters = clusters, n = 10)
table(probs, clusters)
prob_mat <- cluster_rs_probabilities(clusters = clusters, prob = .3)
table(probs, clusters)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.