# Chapter8 # 20200528 T8.1 <- data.frame(MPA = c(16:29+0.5, 6:10*5+2.5, 60), BM = c(255, 871, 3267, 7288, 13783, 21422, 26468, 28997, 27758, 24378, 20320, 16561, 12769, 9854, 24580, 8517, 2873, 1388, 784, 1163)) sum(T8.1$MPA*T8.1$BM)/sum(T8.1$BM) # The mean age at marriage # SMAM (Singulate Mean Age at Marriage) T8.2 <- data.frame(Age = 3:10*5+2.5, PSG = c(98.96, 74.81, 34.09, 16.60, 11.17, 9.28, 8.95, 8.72)) # Total years of singleness living before age 50 TYSLBA50 <- 15*100 + sum(T8.2$PSG[T8.2$Age < 50])*5 # Percentage still single at exact age 50 PSA50 <- mean(T8.2$PSG[T8.2$Age > 45]) SMAM <- (TYSLBA50 - PSA50*50) / (100 - PSA50) print(SMAM) # SMAM for Nigeria (Table 8.3) T8.3 <- c(73.01, 17.73, 5.21, 3.03, 2.26, 0.85, 2.02, 2.78) PSA50 <- mean(T8.3[7:8]) (10*100 + sum(T8.3[1:7])*5 - PSA50*50)/(100-PSA50) # SMAM for Mali (Table8.4), here PSA50=0 T8.4 <- c(88.9, 79.8, 71.2, 59, 37.1, 22.7, 16.4, 12.8, 6.6, 3.1, 1.1, 0.7, 0) (15*100 + sum(T8.4[1:10])*1 + sum(T8.4[11:13])*5)/100