Basic Modgen concepts

Actor: An actor is the entity whose life is simulated in a Modgen model. A model's actor is often a person, although this is not a requirement--other models have been developed that use dwellings or occupations as actors. Nevertheless, in RiskPaths, the actor is a person or more specifically, a female (since it is a model for the study of childlessness)

State: States describe the characteristics of a model's actors. Some states can be continuous, such as age, whereas others are categorical, such as gender. For categorical states, the actual categories or levels are defined via Modgen's classification command.

Overall, there are two major kinds of states in Modgen-simple states and derived states, both of which are used by RiskPaths and both of which are declared within an actor declaration. A simple state is a state whose value can be initialized and changed by the code that a model developer creates. Simple states are changed by explicitly declared events. A derived state, on the other hand, is a state whose value is given as an expression which is normally derived from or based on other states. A derived state's values are automatically maintained by Modgen throughout a simulation run. An additional useful Modgen concept is the self-scheduling derived state. This is a state which changes in a predefined time sequence, such as integer_age, a state in RiskPaths that changes at each birthday.

Event: In Modgen, simulation takes place through the execution of events. Each event consists of two functions: a time function to determine the time of the next occurrence of the event, and an implementation function to determine the consequences when the event happens. RiskPaths has several events, including a mortality event, union formation and dissolution events, and a first pregnancy event.

Parameter: Parameters are used to give model users a degree of control over the simulations they run. The ability to change different hazards or probabilities that affect various aspects of a simulation allows different scenarios to be explored. Parameters can have many dimensions (such as age, gender, and year) and are stored in .dat data files. In RiskPaths, there is one parameter file, Base(RiskPaths).dat, which stores parameters such as death probabilities by age and risks of first pregnancy by age group. More complex models will usually incorporate more than one .dat file.

Table: Modgen has a powerful cross-tabulation facility built in to report aggregated results in the form of tables. There are two central elements of a table declaration-its captured dimensions (defining when an actor enters and leaves a cell) and its analysis dimension (recording what happens while an actor is in that cell). When running simulations, the tabulations to fill a table are created on the fly, thus removing the need to create and write to large temporary interim files for subsequent reporting. Several examples of table declarations are shown later in this document for the RiskPaths model.