redistributeCategory {dembase} | R Documentation

## Redistribute values from one or more categories among the remaining categories.

### Description

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.

### Usage

    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
    )

### Arguments

`counts` | Object of class `Counts` consisting of non-negative integers, or a single non-negative integer.
`dimension` | Names or indices for dimensions whose categories are to be reallocated. If the dimensions have `dimtypes` `"origin"` and `"destination"` or `"parent"` and `"child"`, then the base names may be used.
`category` | Names or indices of the categories to be reallocated.
`means` | If `FALSE` (the default) the allocation is done randomly; if `TRUE`, values are set equal to their means.
`epsilon` | Small quantity added to counts for remaining categories.
`n` | Number of iterations to generate. Ignored if `counts` or `weights` has a dimension with `dimtype` `"iteration"`.

### Details

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`.

### Value

A `Counts` object without the categories specified by `categories`.

[Package dembase version 0.0.0.119 Index]