Description Usage Arguments Value
View source: R/sample_partitions.R
Generate Random, Non-Overlapping Similarly-Weighted Partition of Indices
1 2 3 4 5 6 7 8 | sample_partitions_similar_weights(
w,
fraction = NULL,
size = NULL,
w_tolerance = 0.01,
max_rejections = 100L,
warn = TRUE
)
|
w |
Numeric vector of |
fraction |
A numeric in (0,1] specifying the size of each set
relative to |
size |
An integer in {1, 2, ..., n} specifying the size of each
set. If |
w_tolerance |
Maximum allowed difference between target weight of
each set (e.g. |
max_rejections |
The maximum number of rejections before giving up. |
warn |
If |
A list of P random non-overlapping (disjoint) sets where
each element holds indices in {1, 2, ..., n} and where the union of
all sets is {1, 2, ..., n}.
Attribute weights
is a numeric vector of length P where each element
is he sum of all normalized weight of the corresponding set. The
partition found is such that |weight_i - 1/P| ≤q w_{tolerance}|
is true for each set.
Attribute count
gives the number of internal samples produced before
arriving at an accepted sample.
If no accepted sample was found, the NA
is returned
(with count
attribute set).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.