### Publications

### Demosim: An Overview of Methods and Data Sources

# General functions and features of Demosim

## Archived Content

Information identified as archived is provided for reference, research or recordkeeping purposes. It is not subject to the Government of Canada Web Standards and has not been altered or updated since it was archived. Please "contact us" to request a format other than those available.

Demosim is a *microsimulation* model, which means that it projects individuals in the population one by one, rather than projecting the population on the basis of aggregate data, as is done with cohort-component and multistate models.^{Note 1} Demosim simulates the life of each person in its base population, as well as the newborns and immigrants who are added to the population during the simulation.^{Note 2} The individuals advance through time and are subject to the likelihood of ‘experiencing’ various events simulated by the model (for example, the birth of a child, death, a change in education level or registration on the Indian Register) until they die, emigrate or reach the end of the simulation.

The probabilities (or risks) of ‘experiencing’ each event depend on the individual’s characteristics. The probabilities are used to derive waiting times, which—being a function of the probabilities associated with the events, individual characteristics and a random process—correspond to the time that will elapse between the present and the occurrence of each event (see Box 1). The event with the shortest waiting time occurs first. After an event occurs, a new set of waiting times are calculated for the events that depend on the characteristic that has changed; the individual then advances through time to the next event (again, the one with the shortest waiting time), and so on. Since Demosim is a continuous-time model, the various simulated events may occur at any time of the year, although some of them occur on a fixed date (for example, birthdays). As well, some characteristics are imputed annually to the individuals. Events and waiting times are managed using the computer language Modgen,^{Note 3} in which Demosim is written.

## Box 1–On calculating waiting times, as well as the concepts of transition rate (risk) and probability

In a continuous-time model like Demosim, events can occur at any time. Their occurrence depends on waiting times, which are associated with each individual based on his or her present characteristics. The individual-level waiting times required to run a microsimulation model like Demosim cannot be obtained from observation data; they must be derived.

Waiting times are derived from the transition rate (which quantifies the risk) denoted by λ. The transition rate is defined by the number of events observed divided by the number of person-years lived. An example of a transition rate in demography is the mortality rate (mx), found in mortality tables alongside the death probability (qx), which represents the probability that a person will die during the year.

The waiting time before an event occurs follows an exponential distribution of parameter λ. Under this exponential law, it is assumed that the risk of experiencing an event (e.g., death) remains constant during a given period of time. The risks in Demosim are thus assumed to be constant, as long as the characteristics that determine the modelled event remain unchanged for the individual. Since most events in Demosim are age-dependent, this period for these events is a maximum of one year.

The probability of an event occurring before or exactly at time *t *is given by the exponential distribution function: P(T ≤ *t*) = F(*t*) = 1- e- λt.

The inverse exponential distribution function, *t* = -ln(1- F(*t*)) / λ, indicates the time *t* at which a proportion F(*t*) of the population will have experienced the event, knowing that the transition rate is λ.

Demosim uses a random process in conjunction with the inverse exponential distribution function to generate individual-level waiting times for each simulated event. First, a random value is obtained from the uniform distribution U[0,1]. This value is inserted into the inverse exponential distribution function in place of F(*t*). For example, if an event has a transition rate of λ = 0.15 and the random number generated is 0.5, then the waiting time generated for this event will be *t *= -ln(1- F(*t*)) / λ = -ln(1- 0.5) / 0.15 = 4.62 years. Any lower random value will give a waiting time below 4.62 years, and any higher value will give a longer waiting time.

The projection parameters often consist of probabilities rather than transition rates. When this is the case, they need to be converted to transition rates by isolating λ in the exponential distribution function to obtain λ = -ln(1- F(*t*)) / *t*, and then replacing F(*t*) with the annual probability and *t* with 1 year. Therefore, an annual probability of dying of 0.10 has a transition rate of 0.1053 because λ = -ln(1- 0.10) / 1 = 0.1053.

Although the concept of probability is frequently used in this document, it should be noted that the Demosim model actually uses risks to derive waiting times. Furthermore, the term “risk” is used only in reference to the more precise concept of transition rate for the sake of simplicity.

To learn more about calculating waiting times, please consult Willekens (2011).

This approach is used to yield projections at a level of detail that is not possible using standard models because of their matrix nature. The simultaneous and consistent projection of a large number of variables made possible through microsimulation permits the use of more characteristics, both as determinants of simulated events and for tabulating results. Demosim has also shown flexibility in formulating assumptions and projection scenarios, as well as an ability to reproduce the results of cohort-component models at an aggregate level.^{Note 4}

The use of this method assumes that the probabilities (or risks) associated with simulated events have been calculated in advance. Calculations are done using existing data sources (censuses, surveys and administrative data) to which various methods are applied. The next section describes these methods in more detail.

## Notes

- Date modified: