# Mind the gap: the compass of foregone fertility in Europe

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.

# Using Rodriguez and Trussel (1981) formula to compute Desired Fertility

Comparison between desired family size obtained through Rodriguez and Trussel’s (1981) formula and that from the Fertility and Family Survey.

# A view of Spanish fertility by age groups (with the help of log scales)

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,.

``` library(demography) plot(spain,plot.type="time",xlab="Year",lwd=2) legend("topright",legend=c("15-19","20-24","25-29", "30-34","35-39","40-44","45-49"), col=c("red","yellow","lightgreen","green","lightblue", "blue","violet"),bty="n",lty=1,cex=0.8,lwd=2) ```

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))+ geom_line()+ scale_color_manual(values= c("red", "yellow", "lightgreen", "green","lightblue", "blue", "violet"))+ scale_x_continuous(labels = c(1975, 1985, 1995, 2005, 2015))+ scale_y_continuous("Fertility Rate") ```

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))+...`