3.20. Script 20: Preschool Attendance

This file creates the parameter for preschool attendance. This is a scenario parameter and filled with some default values only

3.20.1. File output

The code below generates one model parameter stored in a Modgen .dat file

  • Preschool attendance: proportion of school entrants who previousely attended preschool and proportion of preschool attendants who attended two years. Values by sex and region.

3.20.2. Code

####################################################################################################
# 
#  DYNAMIS-POP Parameter Generation File 20 - Preschool attendance
#  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-11-25
#
####################################################################################################

####################################################################################################
# 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_residents_dat

# Constants
n_maxreg        <- max(dat$M_ROB)

####################################################################################################
# PARAMETER: PreSchoolAttendancePreSchoolAttendance[SEX][REGION_NAT][PRE_SCHOOL_PARA]
####################################################################################################

# Set Parameter Output File

parafile <- file(g_para_preschool, "w")

# Write the parameter PreSchoolAttendancePreSchoolAttendance[SEX][REGION_NAT][PRE_SCHOOL_PARA]

cat("parameters { \n", file=parafile)
cat("//EN Proportion of school entrants previousely in preschool\n", file=parafile, append=TRUE)

cat("double	PreSchoolAttendance[SEX][REGION_NAT][PRE_SCHOOL_PARA] = {(2) { (", file=parafile, append=TRUE)
cat(n_maxreg,") {	0.5, 0.5 }} \n	};", file=parafile, append=TRUE) 		
cat("\n};\n", file=parafile, append=TRUE)
close(parafile)