reallocateToEndAges {dembase} | R Documentation

## Reallocate counts or values to youngest and oldest age groups.

### Description

With fertility data, it is common to confine age-specific fertility rates to a limited range of age-gropus, eg ages 12 to 49, or ages 15-19 to 45-49. Births outside these age groups are reallocated to the bottom' and top age groups. The procedure preserves the total number of birth and total fertility, and has only a minor effect on the age profile for fertility, provided that the number of births that are reallocated is small.

### Usage

    reallocateToEndAges(object, min = 15, max = 50, weights, ...)

    ## S4 method for signature 'Counts,ANY,ANY,missing'
    reallocateToEndAges(object, min = 15, max = 50, weights, ...)

    ## S4 method for signature 'Counts,ANY,ANY,ANY'
    reallocateToEndAges(object, min = 15, max = 50, weights, ...)

    ## S4 method for signature 'Values,ANY,ANY,missing'
    reallocateToEndAges(object, min = 15, max = 50, weights, ...)

    ## S4 method for signature 'Values,ANY,ANY,Counts'
    reallocateToEndAges(object, min = 15, max = 50, weights, ...)

### Arguments

`object` | An object of class `Counts` or (less commonly) `Values`.
`min` | The lower limit of the youngest age group, after restriction of the age range.
`max` | The upper limit of the oldest age group, after restriction of the age range.
`weights` | An object of class `Counts`.
`...` | Not currently used.

### Details

`reallocateToEndAges` reallocates counts or rates. There is no requirement' that the counts or rates relate to fertility, though this is by far the most common scenario.

If `min` is set to a value that is less than the lower limit of the youngest age group in `object`, then the return value from `reallocateToEndAges` has the same youngest age group as `code`. Similarly, if `max` is set to a value higher than the upper limit of the oldest age group, then `reallocateToEndAges` leaves the oldest age group untouched.

A `weights` argument is prohibited if `object` has class `Counts`, and required if it has class `Values`.

### Value

A `Counts` object in which all age groups lie within the range (`min`, `max`).

### See Also

`collapseIntervals` collapses age intervals without reallocating values upwards or downwards.

### Examples

    ## make some fake data on births
    births <- Counts(array(10,
                           dim = c(45, 2),
                           dimnames = list(age = 10:54, region = c("A", "B"))),
                     dimscales = c(age = "Intervals"))

    ## default ages
    reallocateToEndAges(births)
    ## non-default ages
    reallocateToEndAges(births, min = 12, max = 45)

    ## make some fake data on birth rates
    birth.rates <- Values(array(0.1,
                          dim = c(45, 2),
                          dimnames = list(age = 10:54, region = c("A", "B"))),
                          dimscales = c(age = "Intervals"))
    women <- Counts(array(100,
                          dim = c(45, 2),
                          dimnames = list(age = 10:54, region = c("A", "B"))),
                    dimscales = c(age = "Intervals"))
    ## with rates, need to supply weights
    reallocateToEndAges(birth.rates, weights = women)

[Package dembase version 0.0.0.119 Index]