| Type: | Package | 
| Title: | Fertility Models | 
| Version: | 1.4 | 
| Date: | 2024-11-29 | 
| Author: | Michail Tsagris [aut, cre] | 
| Maintainer: | Michail Tsagris <mtsagris@uoc.gr> | 
| Depends: | R (≥ 4.0) | 
| Imports: | quadprog, stats | 
| Suggests: | Rfast, Rfast2 | 
| 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. | 
| License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] | 
| NeedsCompilation: | no | 
| Packaged: | 2024-11-29 14:28:39 UTC; mtsag | 
| Repository: | CRAN | 
| Date/Publication: | 2024-11-29 15:00:02 UTC | 
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 mtsagris@uoc.gr.
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 mtsagris@uoc.gr.
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>.
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)=\frac{ab}{c}(\frac{c}{x})^{3/2}\exp[-b^2(\frac{c}{x}+\frac{x}{c}-2)],
where x is the age of the mother at birth, a is associated with total fertility, the parameter b determines the height of the curve and the parameter c is related to the mean age of motherhood.
Gama:
f(x)=R\frac{1}{\Gamma(b)c^b}(x-d)^{b-1}\exp(-\frac{x-d}{c}),
where d represents the lower age at childbearing, while the parameter R determines the
level of fertility.
Model1:
f(x)=c_1\exp[-\frac{(x-\mu)^2}{\sigma^2(x)}],
where \sigma(x)=\sigma_{11} if x \leq \mu and \sigma(x)=\sigma_{12} if x>\mu. The parameter c_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 \sigma_{11} and \sigma_{12} reflect the spread of the distribution before and after its peak, respectively.
Model2:
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 c_1 and c_2 express the severity i.e. the total fertility rates of the first
and the second hump respectively, \mu_1 and \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 \sigma_1 and \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  | 
| fx | The fitted values, the fitted age-specific fertility rates  | 
| res | The residuals,  | 
Author(s)
Michail Tsagris.
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.
References
Peristera P. and Kostaki A. (2007). Modeling fertility in modern populations. Demographic Research, 16(6): 141–194.
See Also
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)
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  | 
Author(s)
Michail Tsagris.
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.
See Also
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 mtsagris@uoc.gr.
See Also
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") )