Data source: EUROSTAT, personal elaboration of data. Population by age and sex at 1st of July 2020.
On Demotrends you can find some of the main findings from my collaboration with Daniel Devolder, during my stay at CED in Barcelona. Enjoy!
Simulation results showing the percentage of realized and simulated total fertility with respect to desired fertility.
Comparison between desired family size obtained through Rodriguez and Trussel’s (1981) formula and that from the Fertility and Family Survey.
I have been working a lot with the demography library in R, it is a great teaching tool for demography, modeling, life tables, graphic visualization of demographic data, and for many other things (see demography ).
There are a lot of examples available using data from the Human Fertility and Mortality Database.
Here I am using data that I have obtained from Spanish Statistics, a fertility rates time series consisting of 5 years age groups (available from download from here).
It is very nice to plot fertility rates by age groups as one can appreciate the changes in fertility occurred over time (in terms of quantum) and how much each age group contributes to fertility. In the case of Spain,.
The very same plot can be obtained through ggplot2 library (given an appropriate theme (see ggplot themes):
ggplot(ddfert, aes(Year, Female, group= Age,col= Age))+
scale_color_manual(values= c("red", "yellow", "lightgreen", "green","lightblue", "blue", "violet"))+
scale_x_continuous(labels = c(1975, 1985, 1995, 2005, 2015))+
I find it often interesting to plot using a log scale, so that small values don’t get compressed to the end of the graph. In this case it would be sufficient to add to the demography code:
plot(spain, plot.type="time", xlab= "Year", lwd=2, transform=T)...
and to ggplot :
ggplot(ddfert, aes(Year, log(Female), group= Age,col= Age))+...