school_enrolment: Adjust transitions to the school enrolment calendar

View source: R/subsystem_school_enrolment.R

school_enrolmentR Documentation

Adjust transitions to the school enrolment calendar

Description

A subsystem for add_subsystem(): every time one of the given transitions is drawn, its date is moved to the first day of month – in the same year if the drawn date falls in or before that month, otherwise in the next year.

Usage

school_enrolment(transition, month, name = "school_enrolment")

Arguments

transition

Which declared transition(s) the rule applies to: an move() or moves_of() selector, a list of them, or transition labels.

month

The enrolment month, a whole number from 1 to 12.

name

The subsystem's name in the model and in result$extensions.

Details

Elementary-school enrolment is written in two halves. The rate says WHEN in a person's life the transition happens, e.g., function(age) ifelse(age == 6, Inf, 0), an Inf rate that makes the transition forced: it happens on that date rather than at a random one. This subsystem then says on WHICH calendar day it happens.

So with month = 9, a child whose rate fires in March 2018 starts school on 1 September 2018, and one whose rate fires in October 2018 on 1 September 2019.

Which transition is the enrolment is up to the model: name it, e.g. move("edu", "none", "primary"). No education label has a meaning of its own, so a model can call its levels anything, and can have more than one education variable.

The date is moved before competing risks are resolved: the enrolment competes with every other transition at its calendar date, so a child who would die or emigrate before 1 September does so. A date that the rule would move into the past – a child scheduled after the 1st of the enrolment month with an enrolment due now – is placed at the present instead.

Value

A subsystem, for add_subsystem().

Report

After a run, result$extensions[[name]] holds

n_enrolments

the number of enrolments during the run;

enrolments

one row per enrolment: ID, date (yyyymmdd, the enrolment date), age (years, two decimals), transition ("from -> to"), drawnDate (the date the rate alone produced) and shiftDays (enrolment date minus drawn date: positive when the enrolment was postponed to the next enrolment month, negative when it was brought forward to the first day of the month it was drawn in);

n_at_present

enrolments the rule would have moved into the past, placed on the day the child was scheduled instead;

by_transition

enrolments per enrolment transition;

by_month

enrolments by calendar month of the drawn date, "01" to "12": how much the calendar rule moved.

See Also

add_subsystem(), move()

Examples

school_enrolment(move("edu", "none", "primary"), month = 9)


MicSim documentation built on Dec. 2, 2026, 1:09 a.m.