Skip to contents

The DiseasyModelGLM module implements common structure and functionality to GLM regression class of models beyond the model structure provided by DiseasyModelRegression.

Most notably, the model module implements the $fit_regression() and $get_prediction() methods using GLM.

diseasy includes two simple models that uses the DiseasyModelGLM module: DiseasyModelG0 and DiseasyModelG1 These models implements a constant predictor and a exponential model based on the previous 7 and 21 days of observations, respectively.

When making a custom GLM model, the subclass should implement the $update_formula() method. The $update_formula() method should update the formula based on the stratifications. If the model should flexibly adapt to different stratifications, this method should be implemented. See DiseasyModelG0 and DiseasyModelG1 for examples of how this can be done.

Value

A new instance of the DiseasyModelGLM, DiseasyModelG0 or DiseasyModelG1 R6 class.

Super classes

DiseasyBaseModule -> DiseasyModel -> DiseasyModelRegression -> DiseasyModelGLM

Methods

Public methods

Inherited methods


DiseasyModelGLM$clone()

The objects of this class are cloneable with this method.

Usage

DiseasyModelGLM$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Super classes

DiseasyBaseModule -> DiseasyModel -> DiseasyModelRegression -> DiseasyModelGLM -> DiseasyModelB_ -> DiseasyModelG0

Methods

Inherited methods


DiseasyModelG0$new()

Usage

DiseasyModelG0$new(parameters = NULL, ...)

Arguments

parameters

(named list())
List of parameters to set for the model during initialization.

Parameters controlling the dynamics of the model:
* season.scale (numeric(1))
Sets the scale of the season model. The scale is the percent wise difference between most active and least active period. If NULL (default), the default value of the season module is used.

* season.peak (numeric(1))
Sets the period of maximal activity (days past new-year). By default, risk of infection is in antiphase with the DMI climate normal of the maximum daily temperature (for Denmark). If NULL (default), the default value of the season module is used.

Additional parameters are: (named list())
List of parameters to set for the model during initialization.

Each model has their own parameters.

Common parameters are:
* training_length (named numeric(3))
The number of days that should be included in the training splits of the data for the model. Allowed splits are: "training", "testing", and "validation".

...

parameters sent to DiseasyModelG_ R6 constructor

Returns

A new instance of the DiseasyModelG0 R6 class.


DiseasyModelG0$clone()

The objects of this class are cloneable with this method.

Usage

DiseasyModelG0$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Super classes

DiseasyBaseModule -> DiseasyModel -> DiseasyModelRegression -> DiseasyModelGLM -> DiseasyModelB_ -> DiseasyModelG1

Methods

Inherited methods


DiseasyModelG1$new()

Usage

DiseasyModelG1$new(parameters = NULL, ...)

Arguments

parameters

(named list())
List of parameters to set for the model during initialization.

Parameters controlling the dynamics of the model:
* season.scale (numeric(1))
Sets the scale of the season model. The scale is the percent wise difference between most active and least active period. If NULL (default), the default value of the season module is used.

* season.peak (numeric(1))
Sets the period of maximal activity (days past new-year). By default, risk of infection is in antiphase with the DMI climate normal of the maximum daily temperature (for Denmark). If NULL (default), the default value of the season module is used.

Additional parameters are: (named list())
List of parameters to set for the model during initialization.

Each model has their own parameters.

Common parameters are:
* training_length (named numeric(3))
The number of days that should be included in the training splits of the data for the model. Allowed splits are: "training", "testing", and "validation".

...

parameters sent to DiseasyModelG_ R6 constructor

Returns

A new instance of the DiseasyModelG1 R6 class.


DiseasyModelG1$clone()

The objects of this class are cloneable with this method.

Usage

DiseasyModelG1$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

 model <- DiseasyModelG0$new()

 rm(model)