3.18. Script 18: Child Vaccination

This file creates the parameters for child vaccination rates. Child vaccination is modeled by logistic regression accounting for sex, region, ethnicity, and mother’s education and birth cohort. Another predictor of child vaccination is the receipt of prenatal care which is also modeled.

3.18.1. File output

The code below generates two model parameter stored in a Modgen .dat file. The parameters gives the odds (base and a set of odds ratios) of

  • mothers’ receipt of prenatal care
  • children’ receipt of all required vaccinations at age 1 by mother’s prenatal care status

The prenatal care model contains the following parameters:

  • Base odds (constant)
  • Odds ratios for medium and higher education of the mother compared to low
  • Odds ratios for each region (compared to region 0)
  • Odds ratio for birth cohorts relative to currently >30 year old, 5 year groups
  • Odds ratio for young age of mother (<18) at birth

The vaccination care model contains the following parameters:

  • Base odds (constant) - BO
  • Odds ratio for male compare to female - OR1
  • Odds ratios for medium and higher education of the mother compared to low - OR2
  • Odds ratios for each region (compared to region 0) - OR3
  • Odds ratios for each ethnicity (compared to ethnicity 0) - OR4
  • Odds ratio for birth cohorts relative to currently >30 year old, 5 year groups - OR5
  • Odds ratio for young age of mother (<18) at birth - OR6

The probability to receive all required vaccinations is

  • odds = BO * OR1 * OR2 * OR3 * OR4 * OR5 * O6
  • probability = odds / ( 1+odds )

3.18.2. Code

####################################################################################################
#
#  DYNAMIS-POP Parameter Generation File 18 - Child Vaccination
#  This file is generic and works for all country contexts.
#  Input file: globals_for_analysis.RData (To generate such a file run the setup script)
#  Last Update: Martin Spielauer 2019-03-20
#
####################################################################################################

####################################################################################################
# Clear work space, load required packages and the input object file
####################################################################################################

rm(list=ls())

library(haven)
library(dplyr)
library(data.table)
library(sp)
library(maptools)
library(survival)
library(fmsb)
library(eha)

load(file="globals_for_analysis.RData")
dat           <- g_children_dat[g_children_dat$M_VACC==0 | g_children_dat$M_VACC==1,]
parafile      <- file(g_para_childvacc, "w")

dat$M_SWEIGHT <- dat$M_WEIGHT/100000 #R does not work well with large weights

# Mothers cohort

dat$m_moyob   <- as.integer((35-as.integer(dat$M_AGEMO/12))/5)
dat$m_moyob[dat$m_moyob < 0] <- 0
dat$m_moyob[dat$m_moyob > 3] <- 3

# Young mother

dat$m_youngmo <- as.integer(dat$M_AGEMO < 18*12)

# Estimation

# (1) Receive pre-natal care

GetCare       <- glm(M_PCARE ~ factor(M_EDUCMO)+factor(M_REGION)
                     +factor(m_moyob) + factor(m_youngmo),
                     family = quasibinomial, weights = M_SWEIGHT, data = dat)

m_odds_pcare  <- exp(GetCare$coefficients)

# (2) Vaccination by pre-natal care

GetVaccNoCare <- glm(M_VACC ~ factor(M_MALE)+factor(M_EDUCMO)+factor(M_REGION)+factor(m_ethnov)
                     +factor(m_moyob) + factor(m_youngmo),
                     family = quasibinomial, weights = M_SWEIGHT, data = dat[dat$M_PCARE==0,])

m_odds_nocare <- exp(GetVaccNoCare$coefficients)

GetVaccCare   <- glm(M_VACC ~ factor(M_MALE)+factor(M_EDUCMO)+factor(M_REGION)+factor(m_ethnov)
                     +factor(m_moyob) + factor(m_youngmo),
                     family = quasibinomial, weights = M_SWEIGHT, data = dat[dat$M_PCARE==1,])

m_odds_care   <- exp(GetVaccCare$coefficients)



####################################################################################################
# Write Parameters
####################################################################################################

cat("parameters  {\n", file=parafile)

cat("   //EN Prenatal Care \n   double  PreNatalCareOdds[SIM_YEAR_RANGE][PRENATCARE_PARA] = {\n  (101) {  ",
    file=parafile, append=TRUE)
cat(format(round(m_odds_pcare,5),scientific=FALSE), file=parafile, sep=", ", append=TRUE)
cat("}\n   };\n", file=parafile, append=TRUE)

cat("   //EN Child Vaccination \n   double  ChildVaccinationOdds[GOT_PRENAT_CARE][SIM_YEAR_RANGE][VACCINATION_PARA] = {\n  (101) {  ",
    file=parafile, append=TRUE)
cat(format(round(m_odds_nocare,5),scientific=FALSE), file=parafile, sep=", ", append=TRUE)
cat("},\n\n(101) {", file=parafile, append=TRUE)
cat(format(round(m_odds_care,5),scientific=FALSE), file=parafile, sep=", ", append=TRUE)
cat("\n   }\n};\n};", file=parafile, append=TRUE)
close(parafile)