comp_fcn: Parses a function of each of a vector of model compartments...

View source: R/comp_fcn.R

comp_fcnR Documentation

Parses a function of each of a vector of model compartments and aggregates the results.

Description

This function serves as a placeholder in order to generate documentation on how to specify the comp_fcn string. It also checks that the aggregation term is correctly specified.

Usage

comp_fcn(fcn, aggregation, compartments = NULL)

Arguments

fcn

function of each the model compartments, e.g. log(I_ADJ) would apply the log function to each of the adjacent compartments prior to aggregation.

aggregation

either sum or prod for whether the sum or product of the model compartments is desired.

compartments

list of compartments to be substituted for the reserved word, e.g. all adjacent compartments would be substituted for I_ADJ. This argument is generated internally and should not be provided by the user.

Details

comp_fcn facilitates quick specification of rates that depend on multiple compartments. It is provided as part of a rate string, and is parsed and evaluated internally in order to generate a usable function of model compartments. In particular, it allows a user to consisely specify a function that is to be applied to each desired model compartment, and whether the resulting quantities should be added or multiplied together.

Value

Nothing. Text string is parsed internally by sub_comp_rate and sub_comp_emit.

Examples

# The following rate specification would be used to model the force
# of infection as the sum of beta times the number of infecteds in an
# individual's own compartment, and gamma times the sum of the log number of
# infecteds in adjacent compartments.

fintzij/stemr documentation built on March 25, 2022, 12:25 p.m.