R0vec {DemoDecomp}R Documentation

R0vec Calculates net reproduction, R0, according to a given set of rates Lx,fx and a fixed proportion female of births, pfem.

Description

This function is only provided for the examples of horiuchi(). It calculates the sum of the row products of rates multiplied by pfem.

Usage

R0vec(x, pfem = 0.4886)

Arguments

x

a single vector containing Lx followed by Fx or vice versa. Here, Lx is the survival function integrated within each age interval and with a lifetable radix of 1. Fx is the fertility function, calculated as births/ person years of exposure. Fx should simply contain zeros in ages with no fertility, OR, all vectors should be limited to reproductive ages. Both Lx and Fx should for this function be of the same length.

pfem

the proportion female of births. Something like .49, .48, or (1/(2.05)). This can either be specified as a single number, or it may be allowed to vary by age. For the later case, be sure to specify a value for each age (length(x)/2 values). Default .4886.

Details

The main feature that functions need to have when specified for horiuchi() or stepwise\_replacement() is that the rates must all go into a (potentially long) vector, probably consisting in your rate vectors one after the other. Really the decomposition function does not care how things are arranged in the vector- the components of change vector that is returned from horiuchi() will be arranged in exactly the same way as its input rate vectors, so as long as you know how to sort it out, and your function can extract what it needs from the vectors, then it can be specified in any way. For this particular example function, R0vec(), x must be specified with either Lx followed by Fx or vice versa. It would also be possible to redefine the function to place pfem in with the rates vector, x, which would allow this item to be decomposed too. Here it is specified separately in order to demonstrate passing on parameters to the function within horiuchi().

Value

the value of R0 for the given set of rates and proportion female of births.

Examples

data(rates1)
# take vec:
x <- c(rates1)
R0vec(x)

[Package DemoDecomp version 1.0.1 Index]