Package 'fertilmodel'

Title: Fertility Models
Description: Four fertility models are fitted using non-linear least squares. These are the Hadwiger, the Gamma, the Model1 and Model2, following the terminology of the following paper: Peristera P. and Kostaki A. (2007). "Modeling fertility in modern populations". Demographic Research, 16(6): 141--194. <doi:10.4054/DemRes.2007.16.6>. Model based averaging is also supported.
Authors: Michail Tsagris [aut, cre]
Maintainer: Michail Tsagris <[email protected]>
License: GPL (>= 2)
Version: 1.4
Built: 2024-11-30 12:24:02 UTC
Source: CRAN

Help Index


This is an R package that fits 4 fertility models.

Description

Four fertility models are fitted using non-linear least squares. These are the Hadwiger, the Gamma, the Model1 and Model2, following the terminology of the following paper: Peristera P. and Kostaki A. (2007). Modeling fertility in modern populations. Demographic Research, 16(6): 141–194. <doi:10.4054/DemRes.2007.16.6>.

Details

Package: nlgmcr Type: Package
Version: 1.4
Date: 2024-11-29
License: GPL-2

Maintainers

Michail Tsagris [email protected].

Note

Acknowledgments: This package is dedicated to Sanaa who introduced me to these models and whom I may never see again.

Author(s)

Michail Tsagris [email protected].

References

Peristera P. and Kostaki A. (2007). Modeling fertility in modern populations. Demographic Research, 16(6), 141–194. <doi:10.4054/DemRes.2007.16.6>.


Model based average of the estimated values from two or more fertility models

Description

Model based average of the estimated values from two or more fertility models.

Usage

comb(models)

Arguments

models

A list with possible models.

Value

A list including:

weights

The weights assigned to each model.

fit

The weighted fitted age-specific fertility rates f^(x)\hat{f}(x).

Author(s)

Michail Tsagris.

R implementation and documentation: Michail Tsagris [email protected].

See Also

Hadwiger

Examples

rate <- c(0.0001, 0.0006, 0.0033, 0.0111, 0.0263, 0.0412, 0.0544, 0.0622,
0.0660, 0.0704,0.0723, 0.0753, 0.0814, 0.0873, 0.0924, 0.0962, 0.0989,
0.1006, 0.0990, 0.0933,0.0831, 0.0747, 0.0634, 0.0529, 0.0424, 0.0326,
0.0242, 0.0172, 0.0115, 0.0073, 0.0040, 0.0022, 0.0012, 0.0006, 0.0003,
0.0002, 0.0001)
age <- 13:49
mod1 <- Hadwiger(rate, age)
mod2 <- Gama(rate, age)
mod3 <- Model1(rate, age)
mod4 <- Model2(rate, age)
a <- list(mod1 = mod1, mod2 = mod2, mod3 = mod3, mod4 = mod4)
comb(a)

Plot of the age-specific fertility rates and the estimated values from one or more fertility models

Description

Plot of the age-specific fertility rates and the estimated values from one or more fertility models.

Usage

fertil.plot(rate, age, fit = NULL, grid = FALSE, names = NULL)

Arguments

rate

A vector with the age-specific fertility rates.

age

A vector with the age of the women.

fit

Here you can specify nothing (omly plot the fertility rates across the ages), or you can specify a vector or a matrix with fitted values from at least one model.

grid

Do you want a grid of vertical and horizontal lines? TRUE or FALSE.

names

If you provided fitted models from a model, you can specify the name(s) of the model(s) so that they appear as a legend.

Value

A plot with the age-specific fertility rates across the mothers' age and perhaps the fitted values from at least one model.

Author(s)

Michail Tsagris.

R implementation and documentation: Michail Tsagris [email protected].

See Also

Hadwiger, comb

Examples

rate <- c(0.0000, 0.0005, 0.0023, 0.0073, 0.0175, 0.0283,
0.0420, 0.0523, 0.0601, 0.0712, 0.0789, 0.0865, 0.0939,
0.0991, 0.1052, 0.1115, 0.1155, 0.1178, 0.1211, 0.1159,
0.1104, 0.1031, 0.0916, 0.0776, 0.0639, 0.0498, 0.0387,
0.0281, 0.0185, 0.0117, 0.0067, 0.0038, 0.0020, 0.0011,
0.0007, 0.0003, 0.0002)
age <- 13:49
mod1 <- Hadwiger(rate, age)
mod2 <- Gama(rate, age)
fertil.plot(rate, age)
fertil.plot(rate, age, cbind(mod1$fit, mod2$fit), grid = TRUE, names = c("Hadwiger", "Gama") )

Fertility models

Description

Fertility models.

Usage

Hadwiger(rate, age)
Gama(rate, age)
Model1(rate, age)
Model2(rate, age)

Arguments

rate

A vector with the age-specific fertility rates.

age

A vector with the age of the women.

Details

The following fertility models are fitted: Hadwiger:

f(x)=abc(cx)3/2exp[b2(cx+xc2)],f(x)=\frac{ab}{c}(\frac{c}{x})^{3/2}\exp[-b^2(\frac{c}{x}+\frac{x}{c}-2)],

where xx is the age of the mother at birth, aa is associated with total fertility, the parameter bb determines the height of the curve and the parameter cc is related to the mean age of motherhood.

Gama:

f(x)=R1Γ(b)cb(xd)b1exp(xdc),f(x)=R\frac{1}{\Gamma(b)c^b}(x-d)^{b-1}\exp(-\frac{x-d}{c}),

where dd represents the lower age at childbearing, while the parameter RR determines the level of fertility.

Model1:

f(x)=c1exp[(xμ)2σ2(x)],f(x)=c_1\exp[-\frac{(x-\mu)^2}{\sigma^2(x)}],

where σ(x)=σ11\sigma(x)=\sigma_{11} if xμx \leq \mu and σ(x)=σ12\sigma(x)=\sigma_{12} if x>μx>\mu. The parameter c1c_1 describes the base level of the fertility curve and is associated with the total fertility rate, μ\mu reflects the location of the distribution, i.e. the modal age and σ11\sigma_{11} and σ12\sigma_{12} reflect the spread of the distribution before and after its peak, respectively.

Model2:

f(x)=c1exp[(xμ1)2σ12]+c2exp[(xμ2)2σ22],f(x)=c_1\exp[-\frac{(x-\mu_1)^2}{\sigma_1^2}] + c_2\exp[-\frac{(x-\mu_2)^2}{\sigma_2^2}],

where the parameters c1c_1 and c2c_2 express the severity i.e. the total fertility rates of the first and the second hump respectively, μ1\mu_1 and μ2\mu_2 are related to the mean ages of the two subpopulations the one with earlier fertility and the other with fertility at later ages, while σ1\sigma_1 and σ2\sigma_2 reflect the variances of the two humps.

Value

A list including:

param

The vector of the estimated parameters.

sse

The sum of squars of the errors i=1n(fxf^(x))2\sum_{i=1}^n(f_x-\hat{f}(x))^2, where fxf_x denotes the observed age-specific fertility rates and f^(x)\hat{f}(x) denote the fitted age-specific fertility rates.

fx

The fitted values, the fitted age-specific fertility rates f^(x)\hat{f}(x).

res

The residuals, fxf^xf_x-\hat{f}_x.

Author(s)

Michail Tsagris.

R implementation and documentation: Michail Tsagris [email protected].

References

Peristera P. and Kostaki A. (2007). Modeling fertility in modern populations. Demographic Research, 16(6): 141–194.

See Also

fertil.plot, comb

Examples

rate <- c(0.0001, 0.0006, 0.0033, 0.0111, 0.0263, 0.0412, 0.0544, 0.0622,
0.0660, 0.0704,0.0723, 0.0753, 0.0814, 0.0873, 0.0924, 0.0962, 0.0989,
0.1006, 0.0990, 0.0933,0.0831, 0.0747, 0.0634, 0.0529, 0.0424, 0.0326,
0.0242, 0.0172, 0.0115, 0.0073, 0.0040, 0.0022, 0.0012, 0.0006, 0.0003,
0.0002, 0.0001)
age <- 13:49
mod1 <- Hadwiger(rate, age)
mod2 <- Gama(rate, age)
mod3 <- Model1(rate, age)
mod4 <- Model2(rate, age)