Description Usage Arguments Details Value
Take counts from one or more categories (eg an "Other" category") and allocate them the remaining categories, in proportion to the current size of those categories.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | redistributeCategory(
counts,
dimension,
category,
means = FALSE,
epsilon = 0,
n = NULL
)
## S4 method for signature 'Counts'
redistributeCategory(
counts,
dimension,
category,
means = FALSE,
epsilon = 0,
n = NULL
)
|
counts |
Object of class |
dimension |
Names or indices for dimensions whose categories are to be
reallocated. If the dimensions have |
category |
Names or indices of the categories to be reallocated. |
means |
If |
epsilon |
Small quantity added to counts for remaining categories. |
n |
Number of iterations to generate. Ignored if |
When means
is FALSE
(the default) the allocation is done
randomly, via multinomial draws. When means
is FALSE
the
allocation is done deterministically, and exactly matches the existing
distribution.
Argument epsilon
provides a quick and dirty way of using the function
with sparse data, when all of the remaining categories may be zero (so that
the weights are undefined.) The quantity epsilon
is added to all
counts before calculating. With sparse data a better approach would be to
fit a model and then redistribute using the fitted values, using function
redistribute
.
A Counts
object without the categories
specified by categories
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.