class: center, middle, inverse, title-slide # Laboratorio Bio-demografico ## Lezione 17 - Fecondità e Indice Sviluppo Umano ### Nicola Barban
Alma Mater Studiorum Università di Bologna
Dipartimento di Scienze Statistiche ### 24 Marzo 2021
--- # Advances in development reverse fertility declines ### Mikko Myrskyla, Hans-Peter Kohler & Francesco C. Billari ### *Nature* 460(6) 741-743 <img src="nature08230.pdf" alt="" class="center" width="550" height="550" > --- # Fecondità e Sviluppo Umano >...The negative association of fertility with economic and social development has become one of the most solidly established and generally accepted empirical regularities in the social sciences > more than half of the global population now lives in regions with below- 4 replacement fertility (less than 2.1 children per woman) > ..Our analyses show that at advanced HDI levels, **further development can reverse the declining trend in fertility** --- # Human Development Index L'indice di sviluppo umano (HDI-Human Development Index) è un indice comparativo dello sviluppo dei vari paesi calcolato tenendo conto di: 1. tassi di aspettativa di vita 2. istruzione 3. reddito nazionale lordo procapite È divenuto uno strumento standard per misurare il benessere di un paese. --- # Carico i dati ```r hdi <- read_csv("nature08230-s2.csv") %>% select(1:32) %>% pivot_longer(cols=-"country", names_to="year", values_to="hdi", names_prefix="HDI.") %>% mutate(year = year %>% as.numeric()) ``` --- ```r hdi %>% ggplot(aes(x=year, y=hdi, group=country))+ geom_line(col="grey", alpha=.5)+geom_line(data= hdi %>% filter(country=="Ireland") , aes(col="Ireland"), size=1.1)+ scale_color_manual("Country", values="darkred")+labs(y="Human Development Index") ``` <img src="lezione17_files/figure-html/unnamed-chunk-2-1.png" width="50%" /> --- # Top 10 countries ```r hdi_top2005<- hdi %>% filter(year==2005) %>% arrange(-hdi) %>% head(n=10) kable(hdi_top2005) ``` |country | year| hdi| |:----------|----:|---------:| |Australia | 2005| 0.9656471| |Norway | 2005| 0.9613572| |Iceland | 2005| 0.9563735| |Ireland | 2005| 0.9497891| |Luxembourg | 2005| 0.9492867| |Sweden | 2005| 0.9474523| |Canada | 2005| 0.9455638| |NL | 2005| 0.9451833| |Finland | 2005| 0.9448557| |France | 2005| 0.9447272| --- ```r hdi_top1975<- hdi %>% filter(year==1980) %>% arrange(-hdi) %>% head(n=10) kable(hdi_top1975) ``` |country | year| hdi| |:-----------|----:|---------:| |Canada | 1980| 0.9019683| |NL | 1980| 0.8933627| |USA | 1980| 0.8903073| |Switzerland | 1980| 0.8880443| |Norway | 1980| 0.8874847| |Denmark | 1980| 0.8767196| |France | 1980| 0.8749357| |Sweden | 1980| 0.8744130| |Finland | 1980| 0.8731324| |Iceland | 1980| 0.8721067| --- ```r hdi<- hdi %>% group_by(year) %>% arrange(-hdi) %>% mutate(rank=row_number()) hdi %>% filter(year==2005, country=="Ireland") %>% select(country, rank) ``` ``` ## # A tibble: 1 x 3 ## # Groups: year [1] ## year country rank ## <dbl> <chr> <int> ## 1 2005 Ireland 4 ``` ```r hdi %>% filter(year==1975, country=="Ireland") %>% select(country, rank) ``` ``` ## # A tibble: 1 x 3 ## # Groups: year [1] ## year country rank ## <dbl> <chr> <int> ## 1 1975 Ireland 23 ``` --- # Tasso di fecondità totale * Il tasso di fecondità totale (Total Fertility Rate) esprime il numero medio di figli per donna in età feconda (15-49 anni). * In un’ottica generazionale il tasso di fecondità che assicura ad una popolazione la possibilità di riprodursi mantenendo costante la propria struttura è pari a 2,1 figli per donna. * **Low fertility** TFR>1,5 * **Very Low Fertility** TFR>1,3 www.humanfertility.org --- ```r tfr <- read_csv("nature08230-s2.csv") %>% select(1,32:63) %>% pivot_longer(cols=-"country", names_to="year", values_to="tfr", names_prefix="TFR.") %>% mutate(year = year %>% as.numeric()) ``` --- # Fertility and development >For example, the 2005 TFR levels for countries with an HDI between 0.9 and 0.92 is on average 1.24; in contrast, the average TFR is 1.89 in countries at the highest levels of development (HDI . 0.95). These differential fertility levels at intermediate and very advanced development stages have markedly different long-term implications: the former, **if prevailing in the long term in the absence of migration, indicates a halving of the population and birth cohort approximately every 40–45 years;** in contrast, the latter level can sustain population replacement with relatively modest levels of in-migration --- ```r tfr %>% ggplot(aes(x=year, y=tfr, group=country))+ geom_line(col="grey", alpha=.5)+geom_line(data= tfr %>% filter(country=="Italy") , aes(col="Italy"), size=1.1)+ scale_color_manual("Country", values="darkred")+labs(y="Total Fertility Rate") ``` <img src="lezione17_files/figure-html/unnamed-chunk-7-1.png" width="60%" /> --- # Merge datasets ```r codes<-read_csv("codes.csv") df<-left_join(tfr, hdi, by=c("year", "country")) %>% filter(year>0) df %>% ggplot(aes(x=hdi, y=tfr))+geom_point(col="grey", alpha=.5) ``` <img src="lezione17_files/figure-html/unnamed-chunk-8-1.png" width="60%" /> --- # Trasformo HDI e TFR ```r transf.hdi <- function(x) -log(1-x) transf.tfr <- function(x, mu=31,prop.fem=.4886) log(prop.fem * x)/mu library(scales) hdi.transf <- trans_new("transf.hdi", function(x) -log(1-x), function(y) 1-exp(-y), domain=c(0, Inf), breaks=c(0.3,.6,.8,.9,.95)) tfr.transf <- trans_new("transf.tfr", function(x) log(.4886 * x)/31, function(y) exp(y*31)/.4886, domain=c(1, Inf), breaks=c(1.2,1.5,2,3,4,6,8)) ``` --- # Creo il grafico base ```r baseplot<-df %>% filter(year==1975 |year==2005) %>% ggplot(aes(x=hdi, y=tfr, col=as.factor(year), pch=as.factor(year)))+ coord_trans(y = tfr.transf, x=hdi.transf)+ scale_y_continuous(breaks = c(1.2,1.5,2,3,4,6,8),limits=c(1.15,9))+ scale_x_continuous(breaks = c(0.3,.6,.8,.9,.95))+ theme_minimal()+ labs(title="Human Development Index and Fertility", x="Human development index", y="Total fertility rate", caption="Source: Myrskyla et al., 2009")+ theme(axis.line = element_line(colour = "black"), panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.border = element_blank(), panel.background = element_blank()) ``` --- ```r baseplot ``` <img src="lezione17_files/figure-html/unnamed-chunk-11-1.png" width="60%" /> --- # Aggiungo rettangolo ```r plot1<-baseplot+geom_rect(aes(xmin=.85, xmax=.9, ymin=-Inf, ymax=Inf),fill="grey",col=NA, alpha=.1, show.legend = FALSE) ``` --- ```r plot1 ``` <img src="lezione17_files/figure-html/unnamed-chunk-13-1.png" width="60%" /> --- # Aggiungo punti e trend ```r plot2<- plot1 + geom_point()+ geom_smooth( method="loess", se=FALSE, show.legend=FALSE, span=c(.45)) ``` --- ```r plot2 ``` <img src="lezione17_files/figure-html/unnamed-chunk-15-1.png" width="60%" /> --- Aggiungo la legenda ```r plot_final<-plot2+ scale_color_manual("", values=c("blue", "red"), labels=c("1975", "2005") )+ scale_shape_manual(name = "", values=c(15,17), labels=c("1975", "2005") )+ theme(legend.position = c(0.8, .9)) ``` --- ```r plot_final ``` <img src="lezione17_files/figure-html/unnamed-chunk-17-1.png" width="60%" /> ```r ggsave(filename="Fig1.pdf",width=10, height=10, units = "cm" ) ``` --- # Grafico 2 ### Seleziono paesi che raggiungono HDI alto nel 2005 ```r countries_high_hdi<-df %>% filter(year==2005 & hdi>=.9 & country!="Slovenia") %>% select(country) %>% as_vector() ``` --- # Preparo i dati ```r df_refs<-df %>% filter(year>0, country %in% countries_high_hdi) %>% group_by(country) %>% mutate(high_hdi=(hdi>=.85 & hdi<=.9), year_high=year*high_hdi) %>% filter(year_high>0) %>% mutate(ref_tfr=min(tfr), ref_year= max(0, year*(tfr==ref_tfr)), ref_hdi=max(0, hdi*(tfr==ref_tfr))) %>% group_by(country) %>% select(country,ref_year, ref_tfr, ref_hdi ) %>% summarize_all(max) ``` --- # Creo dataset per fig2 ```r df_plot <- df %>% left_join(df_refs) %>% filter( country %in% countries_high_hdi) %>% mutate(change_tfr=tfr-ref_tfr, change_hdi=hdi-ref_hdi) ``` --- # Scheletro grafico ```r plot0<-df_plot %>% filter(year==2005 | year==1975) %>% ggplot(aes(x=change_hdi, y=change_tfr, col=country))+ scale_y_continuous(breaks = c(-.5, 0, .5, 1),limits=c(-.55,1.1))+ scale_x_continuous(breaks = c(-.10, -.05, 0, .05, .1),limits=c(-.11,.11))+ theme_minimal()+ labs( x="Change in HDI compared to reference year", y="Change in TFR compared to reference year", caption="Source: Myrskyla et al., 2009")+ theme(axis.line = element_blank(), panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.border = element_rect(colour = "black", fill=NA, size=1), panel.background = element_blank()) + geom_hline(yintercept=0, lty=2)+ geom_vline(xintercept=0, lty=2) ``` --- ```r plot0 ``` <img src="lezione17_files/figure-html/unnamed-chunk-22-1.png" width="60%" /> --- # Aggiungo punti e segmenti ```r plot1<-plot0+ geom_point(data=df_plot %>% filter(year==2005 | year==1975) %>% filter(is.na(hdi)==F & is.na(tfr)==F), show.legend = FALSE)+ geom_segment(data=df_plot %>% filter(year==2005 | year==1975), aes( xend = 0, yend = 0, colour = country),lty=4, show.legend = FALSE) ``` --- ```r plot1 ``` <img src="lezione17_files/figure-html/unnamed-chunk-24-1.png" width="60%" /> --- # Aggiungo linee paesi ```r countries_lines<-c("USA", "NL", "Japan", "Norway") plot_final<-plot1+ geom_line(data=df_plot %>% filter(country %in% countries_lines), show.legend = FALSE, size=1.5 ) ``` --- # Figura 2 ```r library(plotly) ggplotly(plot_final) ```
--- # Modello di regressione > We use a differences-in-differences regression model with time fixed-effects and a structural change in the HDI–fertility relationship at a critical HDI level that is estimated from the data. * `differences-in-differences` = metodo di regressione che confronta dati prima e dopo **trattamento.** * `time fixed-effects` = dummy variables (year) * `structural change` = trend separati per prima e dopo **trattamento** --- # Modello di regressione >The starting point of our statistical model linking development to fertility is the relationship `\(TFR_it = (\alpha^{pre} + \beta^{pre} \times HDI_{it}) \times B^{pre} + (\alpha^{post} + \beta^{post} \times HDI_{it}) \times B^{post} + \epsilon_{it}\)` `\(\epsilon_{it}\)` contiene caratteristiche *time invariant* del paese ### Modello di regressione **Analisi delle differenze:** `\(\Delta TFR_{it} = \alpha \Delta B^{post} + \beta^{pre} \Delta HDI^{pre} + \beta^{post} \Delta HDI^{post} + \Delta \gamma_t + \Delta \eta_{it}\)` --- # Preparo dati per modello di regressione ```r countries_models<- df %>% filter(year==2005 & hdi>=.86) %>% select(country) %>% as_vector() ``` --- # Calcolo dummies pre- e post- trattamento ```r df_models.0<-df %>% filter(year>0, country %in% countries_models) %>% mutate(high_hdi=ifelse(hdi>=.86, 1,0 ), year_high=year*high_hdi, year_high=na_if(year_high,0)) %>% group_by(country) %>% mutate(break_year=min(year_high, na.rm=T) , post=ifelse(year>=break_year,1,0), pre=ifelse(year<break_year,1,0)) ``` --- # preparo variabili per regressione pre- post- trattamento ```r df_models.1 <- df_models.0 %>% group_by(country) %>% arrange(country, year) %>% mutate(diff_tfr=c(0,diff(tfr)), diff_hdi=c(0,diff(hdi)), diff_post=c(0,diff(post)), diff_pre=c(0,diff(pre)), dhdi_pre=diff_hdi*pre, dhdi_post=diff_hdi*post ) ``` --- # Modello 1 ```r library(broom) mod1<- lm(diff_tfr~diff_post +dhdi_pre + dhdi_post +factor(year), data=df_models.1) tidy(mod1) %>% filter(term %in% c("dhdi_pre", "dhdi_post")) %>% kable(digits =2) ``` |term | estimate| std.error| statistic| p.value| |:---------|--------:|---------:|---------:|-------:| |dhdi_pre | -1.80| 0.81| -2.22| 0.03| |dhdi_post | 3.86| 0.94| 4.08| 0.00| --- # Preparo dati per modello 2 ```r df_models.2 <- df_models.1 %>% group_by(country) %>% mutate(lag_hdi_pre=lag(dhdi_pre, 1), lag_hdi_post=lag(dhdi_post, 1)) ``` --- # Modello 2 ```r mod2<- lm(diff_tfr~lag_hdi_pre +lag_hdi_post + diff_post+ factor(year)-1, data=df_models.2 ) tidy(mod2) %>% filter(term %in% c("lag_hdi_pre", "lag_hdi_post")) %>% kable(digits =2) ``` |term | estimate| std.error| statistic| p.value| |:------------|--------:|---------:|---------:|-------:| |lag_hdi_pre | -1.11| 0.84| -1.32| 0.19| |lag_hdi_post | 4.05| 0.97| 4.16| 0.00| --- # Conclusioni > The existence of a positive HDI–fertility relationship at advanced development stages indicates that further development has the potential to reverse earlier fertility declines once countries reach very high HDI levels 1. **investigate the different mechanisms that may underlie this reversal** * labour-market flexibility, * social security and individual welfare, * gender and economic equality, * human capital and social/family policies can facilitate relatively high levels of fertility 2. Policies targeted at further increasing HDI levels in advanced societies may therefore be suitable as a general strategy to reduce demographic imbalances caused by very low fer- tility levels.