Description Usage Arguments Details Value See Also Examples
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 | 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, ...)
|
object |
An object of class |
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 |
... |
Not currently used. |
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
.
A Counts
object in which all
age groups lie within the range (min
, max
).
collapseIntervals
collapses age intervals
without reallocating values upwards or downwards.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.