View source: R/subsystem_school_enrolment.R
| school_enrolment | R Documentation |
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.
school_enrolment(transition, month, name = "school_enrolment")
transition |
Which declared transition(s) the rule applies to: an
|
month |
The enrolment month, a whole number from 1 to 12. |
name |
The subsystem's name in the model and in
|
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.
A subsystem, for add_subsystem().
After a run, result$extensions[[name]] holds
n_enrolmentsthe number of enrolments during the run;
enrolmentsone 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_presentenrolments the rule would have moved into the past, placed on the day the child was scheduled instead;
by_transitionenrolments per enrolment transition;
by_monthenrolments by calendar month of the drawn date,
"01" to "12": how much the calendar rule moved.
add_subsystem(), move()
school_enrolment(move("edu", "none", "primary"), month = 9)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.