GenericModel-class: Class implementing a simple natural aging model on a group of...

Description Details Fields Methods See Also

Description

This class implements a natural aging model on a group of people represented as a study_group of Person class objects.

Details

The main aim of this Class is to act as a framework for building more complex models through extension of this class. The simple natural aging model implemented in updateSubject acts as an example and place holder for subclasses to override with a more complex implementation of the function

Fields

study_results

A two dimensional matrix containing summary of model state at each year of the study. Each column describes a particular property or tally of the study population's state. Results for females and males of the population are recorded separately in odd and even numbered row respectively. So the number of rows is 2x the number of iterations (years).

Methods

doIteration()

Performs one model iteration over all subjects in the study_group

Performs one model iteration over all subjects in the model's study_group, sums the iteration results of all subjects into separate aggregated results for females and males, returns the aggregated results.

@return A two row matrix the same width as the model's study_result matrix. The first row contains aggregated iteration results for females, the second, for males.

@callGraph

@author Luke Domanski luke.domanski@@csiro.au

getModelResultSize()

Returns the number of columns in the model's study result matrix

@author Luke Domanski luke.domanski@@csiro.au

initialize(study_group = list(), iterations = 0, iteration_resolution = 1, num_subjects = 0, base_seed = NA, commencement_age = 1, study_results = NA, ...)

Create and initialize a new instance of a GenericModel

This function creates and initializes a new instance of the GenericModel class. Parameters relating to the length of the modelled study and the number of subjects in the study group are passed to this function. See run to run the created model.

@section Model details:

The GenericModel classes present a framework or set of base classes on which to build more complex models. As a place holder the GenericModel implements a simple natural aging model, and and records the number of non-deceased subjects remaining at each iteration.

@param study_group list containing objects of a class derived from Person. Used to specify an existing group you wish to run/continue the model on

@param iterations the number of iterations the model should run to

@param iteration_resolution how many iterations are modelled in one call to the subject model step function updateSubject

@param num_subjects integer indicating number of subjects in the study group. If study_group is not specified, a new random study_group of size sum_subjects, containing objects of class Person, is created. Otherwise, it is taken as the size of the specified study_group and may result in study_group being truncated

@param base_seed integer RNG seed used for model

@param commencement_age integer indicating age at which to start running the model of subjects of the study_group

@param study_results an integer matrix with iterations*2 rows and enough columns to fit the model's iteration results. Used to specify existing results when an existing study_group is specified.

@param ... additional model values/parameters

@return a new object of type GenericModel with specified configuration

@seealso run to run the model

@family model_initializers

@callGraph

@author Luke Domanski luke.domanski@@csiro.au

@aliases GenericModel$new

run()

Runs the model

Runs the model for the number of iterations specified at model initialization, defined as num_iterations-commencement_age, and sets the male and female result rows for each iteration in the model's study_results matrix.

The start iteration is commencement_age, rows of the study_result matrix prior to study_result[commencement_age] are unchanged.

@callGraph @author Luke Domanski luke.domanski@@csiro.au

updateSubject(subject)

Applies a model step to an individual subject

This function applies a model step to an individual subject updating the subject's state. It implements the main, overall, structure and flow of the model.

@param subject an object of class Person on which to apply a model step

@return an integer vector of length equal to the width of the model's study_result matrix, containing the iteration results for the subject

@callGraph

@author Luke Domanski luke.domanski@@csiro.au

See Also

Other GenericModel_classes: ClinicalHistory, ClinicalHistory-class; Person, Person-class; Test, Test-class


csiro-crc-spin/SpinModels documentation built on May 14, 2019, 12:24 p.m.