Skip to contents

Specifications

Create Model Specifications

Functions for creating new model specification objects, which describe dynamical models with special support for compartmental modelling. The vignette("quickstart") article describes how these functions are used in context.

Find Model Specifications

Functions for finding, copying, and loading existing model specification objects from model libraries. The vignette("example_models") article describes how these functions are used in context.

mp_tmb_library() mp_tmb_entire_library()
Read Item from a Model Library
mp_show_models() show_models() mp_list_models()
Print a Table of Existing Models
mp_model_starter()
Copy Existing Model as a Starting Point
mp_model_docs()
Browse Model Docs

Transform Model Specifications

Functions that take a model specification as input and return a modified version of that specification.

mp_tmb_insert() mp_tmb_update() mp_tmb_delete()
Transform a TMB Model Specification
mp_tmb_insert_reports()
Transform a TMB Model Specification to Account for Reporting Bias
mp_tmb_insert_log_linear()
Insert Log Linear Model of Time Variation (Experimental)
mp_tmb_insert_trans()
Insert Basic Transformations of Model Variables
mp_tmb_insert_backtrans()
Insert Back Transformations of Model Parameters
mp_euler() mp_rk4() mp_rk4_old() mp_euler_multinomial() mp_discrete_stoch() mp_hazard()
Change How State Variables are Updated
mp_expand() mp_reduce()
Expand Model

Unpack Model Specifications

Functions that extract or print information contained within model specifications.

mp_print_spec() mp_print_before() mp_print_during() mp_print_after()
Print Model Specification
mp_initial() mp_initial_list()
Initial Values of Variables Immediately Before the Simulation Loop
mp_default() mp_default_list()
Default Values
mp_flow_frame()
Data Frame Describing Compartmental Model Flows
mp_change_frame()
Data Frame Describing Each Change to Each State Variable
mp_state_vars() mp_flow_vars() mp_state_flow_vars()
State and Flow Variable Names
mp_state_dependence_frame()
Data Frame Describing State Dependent Per-Capita Flow Rates

Simulators

Create New Model Simulators

Functions for creating a model simulator object.

mp_simulator()
Create a Simulator

Generate Simulations

Functions that generate simulations from a simulator object.

mp_trajectory() mp_trajectory_par() mp_trajectory_sd() mp_trajectory_ensemble() mp_trajectory_sim() mp_trajectory_replicate()
Simulate Dynamical Model Trajectories
mp_initial() mp_initial_list()
Initial Values of Variables Immediately Before the Simulation Loop
mp_final() mp_final_list()
Final Values

Unpack Model Simulators

Functions that extract or print information contained within model simulators.

mp_default() mp_default_list()
Default Values
mp_tmb()
Get Underlying TMB Object

Calibrators

Create Model Calibrator

Create a simulator that can be calibrated to data

mp_tmb_calibrator()
Make a Calibrator
mp_par()
Fit Parameters
mp_traj()
Trajectory Specification
mp_rbf()
Fit a Time-Varying Parameter with Radial Basis Functions
mp_identity mp_log mp_logit mp_sqrt
Link Functions and Transformation
mp_sim_bounds()
Simulation Bounds
mp_sim_offset()
Simulation Offsets
mp_time_scale()
Time Scale

Specify Distributional Assumptions

Functions for specifying distributional assumptions for priors and likelihoods.

Optimize Calibrator Model

Functions that take a model calibrator as input and calibrate model parameters, as well as functions that extract underlying objects used during the opimization/calibration process.

mp_optimize()
Optimize Simulation Model
mp_optimizer_output()
Optimizer Output
mp_optimized_spec()
Optimized Model Specification
mp_tmb_objective()
Value of the Objective Function of a Model

Generate Calibrated Simulations, Parameters, and Forecasts

Functions that generate simulations and tables of fitted parameters from a calibator object.

mp_trajectory() mp_trajectory_par() mp_trajectory_sd() mp_trajectory_ensemble() mp_trajectory_sim() mp_trajectory_replicate()
Simulate Dynamical Model Trajectories
mp_tmb_coef()
TMB Model Coefficient Table
mp_effects_descr() mp_add_effects_descr()
Describe Statistical Effects
mp_tmb_fixef_cov()
Covariance of Fixed Effect Estimates
mp_tmbstan_coef()
Model Coefficient Table with stan
mp_forecaster()
Make a Forecaster

Generate Fitted Parameter Tables

Unpack Model Calibrators and Calibrations

Functions that extract or print information contained within model calibrators.

mp_tmb()
Get Underlying TMB Object
mp_parameterization()
Description of Model Parameterization

Utilities

Lightweight Simulation Utilities

Simple functions for simulation without simulator objects, so that the ?engine_functions can be explored in isolation from compartmental models.

engine_eval()
Engine Evaluation
simple_sims()
Simple Iterated Simulation

Creating Matrices, Vectors, and Lists

Utilities for constructing matrices, vectors, and lists for use with macpan2.

nlist()
Self Naming List
empty_matrix
Empty Matrix
empty_trajectory
Empty Trajectory
mp_zero_vector()
Zero Vector
rbf()
Radial Basis Functions
BinaryOperator() mp_binary_operator()
Binary Operator

Developer Utilities

Utilities for macpan2 developers. TODO: Justify why these are exposed to users or do not expose.

finalizer_char() finalizer_index()
Finalizers
initial_valid_vars()
Initial Valid Variables
make_expr_parser()
Generate an Arithmetic Expression Parser
mp_tmb_expr_list()
Expression List
mp_functions_used() mp_generates_randomness()
Functions Used by an Object for Communicating with a Computational Engine
Reader() CSVReader() JSONReader() TXTReader() RReader() NULLReader()
Reader
Transform() Identity() Log() Logit()
Transform

Not Ready

Box Diagram Layouts (Not Ready)

Functions for semi-automatically laying out compartments in model specifications as boxes on a plot.

mp_layout_grid()
Flow Diagram Grid Layout (experimental)
mp_layout_paths()
Flow Diagram Grid Layout (experimental)
find_all_paths()
Find all Paths Through Compartments
dot_layout()
Create a graph from a model specification

Structured Populations (Not Ready)

Functions for specifying population structure (e.g., age, space, immunity status).

mp_dynamic_model()
Dynamic Model
mp_dynamic_simulator()
TMB Simulator from Dynamic Model
LedgerDefinition
Ledgers
mp_cartesian()
Cartesian Product of Index Tables
mp_extract()
Extract Index
mp_index() print(<Index>) names(<Index>) labelling_column_names(<Index>) labels(<Index>)
Model Quantity Index Table
mp_join()
Join Indexes
mp_linear()
Linear Chain Product
mp_positions()
Position Vectors
mp_reference()
Reference Index
mp_rename()
Rename Index Columns
mp_square()
Self Cartesian Product
mp_symmetric()
Symmetric Self Cartesian Product
mp_triangle()
Self Cartesian Product Excluding One Off-Diagonal Side
mp_factors()
Factor an Index
mp_group()
Group an Index
mp_labels()
Index Labels
mp_ledgers()
Bundle up Ledgers
mp_lookup()
Lookup
mp_slices()
Slice an index
mp_structured_vector() mp_set_numbers()
Structured Vectors
mp_subset() mp_setdiff()
Subset of Indexes
mp_union()
Union of Indexes
to_labels() to_names() to_name() to_name_pairs() to_values()
Names and Labels
to_positions()
To Positions
to_string()
To String
mp_aggregate()
Aggregate an Index
StringDataFromFrame() StringDataFromDotted() print(<StringData>)
String Data
all_equal() all_consistent() not_all_equal() all_not_equal()
Comparison Functions