DemoDecompGeneral demographic decomposition methods
Install from CRAN in the standard way:
install.packages("DemoDecomp")
Or install the github development version (maybe it has new toys!):
# install.packages("devtools")
library(devtools)
# install_github("timriffe/DemoDecomp")
install.packages("DemoDecomp", repos = c('https://timriffe.r-universe.dev', 'https://cloud.r-project.org'))
Then you can run the examples like so:
library(DemoDecomp)
data(rates1)
data(rates2)
# we need rates1 and rates2 as vectors
rates1 <- c(rates1)
rates2 <- c(rates2)
?horiuchi
A <- horiuchi(func = R0vec,
pars1 = rates1,
pars2 = rates2,
N = 10,
pfem = .4886)
?stepwise_replacement
B <- stepwise_replacement(func = R0vec,
pars1 = rates1,
pars2 = rates2,
pfem = .4886,
symmetrical = TRUE,
direction = "up")
This package supersedes DecompHoriuchi