Microsimulation API: /home/marcle/src/R/microsimulation/inst/include/microsimulation.h File Reference

Microsimulation API

Classes | Namespaces | Macros | Typedefs | Functions | Variables
microsimulation.h File Reference
`#include <RcppCommon.h>`
`#include <unordered_map>`
`#include <tuple>`
`#include <vector>`
`#include <utility>`
`#include <map>`
`#include <string>`
`#include <Rcpp.h>`
`#include <R.h>`
`#include <Rmath.h>`
`#include <Rdefines.h>`
`#include <R_ext/Random.h>`
`#include <siena/ssim.h>`
`#include <RngStream.h>`
`#include <rcpp_table.h>`
`#include <algorithm>`
`#include <functional>`
`#include <set>`
Include dependency graph for microsimulation.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Classes
struct | std::hash< std::tuple< TT... > >
struct | std::hash< std::pair< T1, T2 > >
class | ssim::cMessage
| cMessage class for OMNET++ API compatibility. This provides a heavier message class than Sim::Event, with short 'kind' and std::string 'name' attributes. The events by default are scheduled using cProcess::scheduleAt(), and handled using cProcess::handleMessage() (as per OMNET++). NB: cProcess::scheduleAt() uses simulation time rather than time in state (which is used by Sim::self_signal_event()). More...
class | ssim::cProcess
| cProcess class for OMNET++ API compatibility. More...
class | ssim::Means
| Utility class to incrementally add values to calculate the mean, sum, variance and standard deviation. This could be replaced by boost::accumulator. More...
class | ssim::Rpexp
| Rpexp is a random number generator class for piecewise constant hazards. Given time lower bounds t and piecewise constant hazards h, rand() returns a random time. The random number is calculated using the inversion formula. Constructors provided for arrays. More...
class | ssim::Rng
class | ssim::EventReport< State, Event, Time, Utility >
| EventReport class for collecting statistics on person-time, prevalence and numbers of events. More...
class | ssim::SummaryReport< State, Event, Time, Utility, Cost >
| SummaryReport class for collecting statistics on person-time, prevalence, events and costs. More...
class | ssim::CostReport< State, Time, Cost >
| CostReport class for collecting statistics on costs. More...
class | ssim::SimpleReport< T >
| SimpleReport class for collecting data for homogeneous fields of type T with string names. More...

## Namespaces
| Rcpp
| ssim
| name space for the Siena simulator.
| R

## Macros
#define | WithRNG(rng, expr) (rng->set(), expr)
| WithRNG is a macro for using the random number generator rng and then evaluating the expression expr. More...

## Typedefs
typedef Time | ssim::simtime_t
| simtime_t typedef for OMNET++ API compatibility More...

## Functions
template<class T1 , class T2 >
SEXP | Rcpp::wrap (const std::vector< std::pair< T1, T2 > > v)
template<class T1 , class T2 >
SEXP | Rcpp::wrap (const std::vector< std::tuple< T1, T2 > > v)
template<class T1 , class T2 , class T3 >
SEXP | Rcpp::wrap (const std::vector< std::tuple< T1, T2, T3 > > v)
template<class T1 , class T2 , class T3 , class T4 >
SEXP | Rcpp::wrap (const std::vector< std::tuple< T1, T2, T3, T4 > > v)
template<class T1 , class T2 , class T3 , class T4 , class T5 >
SEXP | Rcpp::wrap (const std::vector< std::tuple< T1, T2, T3, T4, T5 > > v)
template<class T1 , class T2 , class T3 , class T4 , class T5 , class T6 >
SEXP | Rcpp::wrap (const std::vector< std::tuple< T1, T2, T3, T4, T5, T6 > > v)
template<class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 >
SEXP | Rcpp::wrap (const std::vector< std::tuple< T1, T2, T3, T4, T5, T6, T7 > > v)
template<class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 >
SEXP | Rcpp::wrap (const std::vector< std::tuple< T1, T2, T3, T4, T5, T6, T7, T8 > > v)
template<class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 >
SEXP | Rcpp::wrap (const std::vector< std::tuple< T1, T2, T3, T4, T5, T6, T7, T8, T9 > > v)
template<class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 >
SEXP | Rcpp::wrap (const std::vector< std::tuple< T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 > > v)
template<class T1 , class T2 >
SEXP | Rcpp::wrap_map (const std::map< T1, T2 > v)
template<class T1a , class T1b , class T2 >
SEXP | Rcpp::wrap_map (const std::map< std::pair< T1a, T1b >, T2 > v, std::string key, std::string name1, std::string name2)
template<class T1a , class T1b , class T1c , class T2 >
SEXP | Rcpp::wrap_map (const std::map< std::tuple< T1a, T1b, T1c >, T2 > v, std::string key, std::string name1, std::string name2, std::string name3)
template<class T1 , class T2 , class T3 , class T4 , class T5 >
SEXP | Rcpp::wrap_map (const std::map< std::pair< std::tuple< T1, T2, T3 >, T4 >, T5 > v, std::string key, std::string name1, std::string name2)
template<class T1 , class T2 >
SEXP | Rcpp::wrap_map (const std::unordered_map< T1, T2 > v)
template<class T1a , class T1b , class T2 >
SEXP | Rcpp::wrap_map (const std::unordered_map< std::pair< T1a, T1b >, T2 > v, std::string key, std::string name1, std::string name2)
template<class T1a , class T1b , class T1c , class T2 >
SEXP | Rcpp::wrap_map (const std::unordered_map< std::tuple< T1a, T1b, T1c >, T2 > v, std::string key, std::string name1, std::string name2, std::string name3)
template<class T1 , class T2 , class T3 , class T4 , class T5 >
SEXP | Rcpp::wrap_map (const std::unordered_map< std::pair< std::tuple< T1, T2, T3 >, T4 >, T5 > v, std::string key, std::string name1, std::string name2)
void | ssim::Cancel (std::function< bool(const cMessage *msg)> pred)
| Cancel is a function to cancel messages who satisfy a predicate. More...
void | ssim::RemoveKind (short kind)
| RemoveKind is a function to remove messages with the given kind from the queue. More...
void | ssim::CancelKind (short kind)
| CancelKind is a function to remove messages with the given kind from the queue. More...
void | ssim::RemoveName (string name)
| RemoveName is a function to remove messages with the given name from the queue. More...
void | ssim::CancelName (string name)
| CancelName is a function to remove messages with the given name from the queue. More...
void | ssim::CancelEvents ()
| CancelEvents is a function to remove messages from the queue. More...
Time | ssim::simTime ()
| simTime() function for OMNET++ API compatibility More...
Time | ssim::now ()
| now() function for compatibility with C++SIM More...
double | ssim::rweibullHR (double shape, double scale, double hr)
| Random Weibull distribution for a given shape, scale and hazard ratio. More...
void | ssim::r_create_current_stream ()
| A utility function to create the current_stream. Used when initialising the microsimulation package in R. More...
void | ssim::r_remove_current_stream ()
| A utility function to remove the current_stream. Used when finalising the microsimulation package in R. More...
void | ssim::r_set_user_random_seed (double *seed)
| A utility function to set the user random seed for the simulation. More...
void | ssim::r_get_user_random_seed (double *seed)
| A utility function to set the user random seed for the simulation. More...
void | ssim::r_next_rng_substream ()
| A utility function to move to the next user random stream for the simulation. More...
void | ssim::r_rng_advance_substream (double *seed, int *n)
| A utility function to advance the random sub-stream n steps for a specified seed. More...
void | ssim::test_rstream2 (double *x)
| Simple test of the random streams (with a stupid name) More...
double | ssim::discountedInterval (double start, double end, double discountRate)
| Simple function to calculate the integral between the start and end times for (1+kappa)^(-u), where kappa is the discountRate (e.g. 0.03) More...
double | ssim::discountedInterval (double y, double start, double end, double discountRate)
| Simple function to calculate the integral between the start and end times for y*(1+kappa)^(-u), where kappa is the discountRate (e.g. 0.03) More...
double | ssim::discountedPoint (double time, double discountRate)
| Simple function to calculate 1/(1+discountRate)^(time) More...
double | ssim::discountedPoint (double y, double time, double discountRate)
| Simple function to calculate y/(1+discountRate)^(time) More...
template<class T >
std::vector< std::vector< T > > | ssim::transpose (const std::vector< std::vector< T > > data)
| Function to transpose a vector of vectors. This assumes that all inner vectors have the same size and allocates space for the complete result in advance. From http://stackoverflow.com/questions/6009782/how-to-pivot-a-vector-of-vectors. More...
template<class T1 , class T2 >
SEXP | Rcpp::wrap (const vector< pair< T1, T2 > > v)
template<class T1 , class T2 , class T3 , class T4 , class T5 >
SEXP | Rcpp::wrap_map (const std::map< std::pair< std::tuple< T1, T2, T3 >, T4 >, T5 > v, std::string name1, std::string name2)
template<class T1 , class T2 , class T3 , class T4 , class T5 >
SEXP | Rcpp::wrap_map (const std::unordered_map< std::pair< std::tuple< T1, T2, T3 >, T4 >, T5 > ov, std::string name1, std::string name2)
double | R::rnormPos (double mean, double sd)
| rnorm function constrained to be positive. This uses brute-force re-sampling rather than conditioning on the distribution function. More...
double | R::rllogis (double shape, double scale)
| rllogis function for a random covariate from a log-logistic distribution with shape and scale. S(t) = 1/(1+(t/scale)^shape). More...
double | R::rllogis_trunc (double shape, double scale, double left)
| rllogis_trunc function for a random covariate from a log-logistic distribution with shape and scale with minimum time left. S(t|t>x)=S(t)/S(x) where S(t)=1/(1+(t/scale)^shape). More...
double | R::rgompertz (double shape=1.0, double rate=1.0)
| Random draw from a Gompertz distribution. More...

## Variables
static int | ssim::counter_id = 0
| C++ wrapper class for the RngStream library. set() sets the current R random number stream to this stream. This is compliant with being a Boost random number generator. More...

## Detailed Description

Author
  Mark Clements mark..nosp@m.clem.nosp@m.ents@.nosp@m.ki.s.nosp@m.e

Version
  1.0

# LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details at http://www.gnu.org/copyleft/gpl.html

# DESCRIPTION

cMessage and cProcess classes, providing some compatability between SSIM and the OMNET++ API. This is specialised for use as an R package.

It also provides several utility classes: Means for statistical collection and Rpexp for piecewise constant exponential random number generation. It also provides a utility function rweibullHR().

Definition in file microsimulation.h.

## Macro Definition Documentation

## ◆ WithRNG

#define WithRNG | ( |  | rng,
|  |  | expr
| ) |  | (rng->set(), expr)

WithRNG is a macro for using the random number generator rng and then evaluating the expression expr.

Definition at line 200 of file microsimulation.h.