R0vec {DemoDecomp} | R Documentation |
pfem
.This function is only provided for the examples of horiuchi()
.
It calculates the sum of the row products of rates
multiplied by pfem
.
R0vec(x, pfem = 0.4886)
x |
a single vector containing Lx followed by Fx or vice versa. Here, |
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 ( |
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()
.
the value of R0 for the given set of rates and proportion female of births.
data(rates1)
# take vec:
x <- c(rates1)
R0vec(x)