P4 Union
Planned plugin in two steps: P4a, entry into union as a state of one person (planned for 1.0), and P4b, unions as links between two people chosen by matching (planned for 1.1).
In development
P4a is planned for 1.0 and P4b for 1.1. This page describes their design; names and details may still change until each ships, when its generated model description replaces its part of this page.
Union comes in two plugins. P4a treats a union as a state of one person; P4b makes a union a link between two people, chosen by matching. P4b provides the next major version of the contract P4a provides, so swapping P4a for P4b changes only the scenario's plugin tables: Survival, Reproduction, Contraception and the policies do not change.
P4a: exogenous union
Status: Planned for 1.0. Version 0.1 ships no official plugin.
Purpose
P4a decides when a person enters a first union. The union is a state of the person, with its start date. No partner is drawn, no link joins two people, and no union ends in this version.
State and owned attributes
For each person, P4a owns whether the person is in union, whether the person has ever been in union, and the date the union began. A person who enters the population is not in union and has never been.
Processes and their order within the step
P4a runs in the union phase, which by default comes after death and before contraception and conception and birth in phases.order.
- It takes the people who are alive, in the domain and never in union.
- It reads the
formationhazard for each, lets the kernel apply the policies, and draws once. - On a union, it sets the person's state and emits
Formed. - When a person dies, it clears the person's union state.
At the start of the run, each woman's union status comes from the survey table of women.
Events emitted
Formed, with no payload.
Contract
P4a provides official/Union, version 1.
| Item | Kind | What it is |
|---|---|---|
Formed | event | entry into a first union |
in_union | view, true or false | whether the person is in union |
ever_in_union | view, true or false | whether the person has ever been in union |
union_start | view, date, optional | when the union began |
formation | modulation point, hazard per year | entry into a first union of a person never in union |
initial_status | table | union status at the start of the run, from the survey table of women |
form | decision type | the random draw of union entry |
When no union plugin is active, a plugin that reads in_union gets false.
Parameters
- First-union entry: a probability of entering a union by age, as in FPsim, converted to a hazard per person-year.
Data needed from the pipeline
The survey table of women (survey.woman), for each woman's union status at the start of the run, and the table of union probabilities by age.
Data format
- Women of the survey:
survey.woman2.1. It readscurrent_union_statusandfirst_union_datewith its precision and imputation flag, for the union status at the start of the run. - First-union probability by age:
rate.probability2.0; keyquantity,territory_unit,sex,age_lo,period_start_date. The pipeline's generic step from probability to hazard converts it to arate.hazard2.0 table.
Columns of every rate table, in order: quantity, territory_unit, sex, age_lo, period_start_date, period_start_date_precision, age_hi, period_end_date, period_end_date_precision, value, unit, native_step. The first five are the key.
current_union_status takes the values of the union_status vocabulary, in the order of the survey's union status codes. The role names are provisional.
Each table is registered with cohortix-data register and bound to a table role in the scenario's [data.bindings]; see Bring your own data.
Reads
- From the kernel: age and sex.
- It listens to
Mortality.Death.
Variants
union-exogenous: the only variant of version 1.
Policies that can modulate it
Policies act on formation, the hazard of entering a first union.
P4b: endogenous union
Status: Planned for 1.1. Its contract is reviewed and tested with a stand-in plugin in 1.0, so the kernel does not need redesigning later.
Purpose
P4b makes a union a link between two people. People enter unions, are matched with a partner, may be widowed when the spouse dies, may see the union end, and may enter a new union. A wife has at most one husband at a time; a husband may have several wives, each with a rank.
State and owned attributes
P4b owns the union link between a wife and a husband, with the wife's rank, and the union history it implies. The view in_union is the same as in P4a, so plugins that read it do not change.
Processes and their order within the step
P4b runs in the union phase. Its processes are:
- widowhood, which follows the simulated death of a spouse, with no rate of its own;
- entry into a first union, drawn from a hazard;
- adding a wife, drawn for men in union;
- the end of a union, and entry into a new union;
- matching: each positive draw becomes a request for a partner, and the requests are resolved one after another, in a fixed order, so the same run always gives the same couples.
The order of these processes within the phase is not decided yet. When a spouse emigrates, the union link is kept.
Events emitted
The union link's starts and ends are journaled by the kernel's link registry, with the reason a union ends.
Contract
P4b provides official/Union, version 2. Beyond in_union, it declares how many unions may be active at once (a wife one, a husband several) and a view of the duration of the union in months (name provisional). The full list of its items is fixed when the contract is reviewed, before 1.1.
Parameters
All are hazards per year; their names are provisional.
- First-union entry, by age, with schooling as a covariate.
- Adding a wife, for men in union.
- End of a union, by the duration of the union.
- Entry into a new union after a union ends.
- Partner choice: the age gap between spouses; how it enters matching is not decided yet.
The rule that matches women and men is not decided yet.
Data needed from the pipeline
Union histories from the survey files of women and men, through the data pipeline. The exact list is fixed when the contract is reviewed.
Data format
Candidate tables, fixed when the contract is reviewed:
- Women of the survey:
survey.woman2.1. It readscurrent_union_statusandfirst_union_date. - Men of the survey:
survey.man2.1. It readscurrent_union_status; the survey dates only women's first unions. - Links of the initial population:
population.link2.0; keylink_type,from_person_id,to_person_id. Withstart_date,start_date_precision,rank,source_link_id; the unions the kernel loads at the start. - Union hazards:
rate.hazard2.0; key the keys of every rate table. One table per hazard of the parameters.
The role names, and the link type that names a union, are provisional.
Each table is registered with cohortix-data register and bound to a table role in the scenario's [data.bindings]; see Bring your own data.
Reads
- Requires
official/Mortality: widowhood follows a spouse's death. This is one of the two required links among the plugins of the first lot and P4b. - From the kernel: age, sex and territorial unit.
- When a couple forms, P4b asks the kernel to move the couple to a territorial unit. It never chooses the dwelling: housing decisions belong to the Residence and households plugin. Where an added wife lives is not decided yet.
Variants
Each matching algorithm is a variant of version 2; at least two are planned. A shared pool of candidates comes from the plugin SDK, while the matching rules stay in the plugin.
Policies that can modulate it
Policies act on the entry hazards.
P3 Contraception
Planned plugin: starting, choosing, stopping and switching a contraceptive method on a monthly calendar, and the effect of the method on conception. Planned for 1.0; calendar variant planned for 1.1.
P5 Schooling
Planned plugin: whether a child has entered school, attends it grade by grade or has left it. Later; its contract is planned for 1.1.