|
mrgsolve
|
Functions | |
| Rcpp::Environment | mrgx::get_envir (const databox &self) |
| Return the model environment. | |
| double | mrgx::rnorm (const double mean, const double sd, const double lower, const double upper) |
| double | mrgx::rlognorm (const double mean, const double sd, const double lower, const double upper) |
| template<typename _T___> | |
| _T___ | mrgx::get (const std::string name, const databox &self) |
| template<typename _T___> | |
| void | mrgx::assign (const std::string x, const _T___ &value, const databox &self) |
| template<typename _T___> | |
| _T___ | mrgx::get (const std::string name) |
| template<typename _T___> | |
| _T___ | mrgx::get (const std::string package, const std::string name) |
| template<typename _T___> | |
| _T___ | mrgx::readRDS (const std::string filename) |
| Rcpp::Function | mrgx::mt_fun () |
Extra C++ functions provided by mrgsolve. To use these functions, use $PLUGIN mrgx in your model file. Using mrgx will also invoke the Rcpp plugin.
| void mrgx::assign | ( | const std::string | x, |
| const _T___ & | value, | ||
| const databox & | self ) |
Assign an object to the model environment.
Example:
| x | a variable name to be assigned in the model evironment. |
| value | a value to be assigned to x in the model environment. |
| self | the model object; the assignment happens in self.envir. |
| _T___ mrgx::get | ( | const std::string | name | ) |
Get an R object from the global environment.
Example:
Note: for this to work, x must be a numeric vector in .GlobalEnv.
| name | name of the R object to get |
| _T___ mrgx::get | ( | const std::string | name, |
| const databox & | self ) |
Get an R object from the model environment.
Example:
Note: for this to work, you must define a numeric matrix called mat in $ENV.
| name | name of the R object to get |
| self | the model data object |
| _T___ mrgx::get | ( | const std::string | package, |
| const std::string | name ) |
Get an R object from a package namespace. This is typically used to get a function from a specific package.
Example:
To get a function, use this code:
| package | name of the package |
| name | name of the object to get |
| Rcpp::Environment mrgx::get_envir | ( | const databox & | self | ) |
Return the model environment.
With each mrgsolve model object, there is an R environment that can be used to maintain arbitrary R objects, potentially for use in the model.
| self | the model databox object |
| Rcpp::Function mrgx::mt_fun | ( | ) |
An empty R function. This is typically used as a placeholder when declaring an Rcpp::Function object in $GLOBAL. This pattern of declaring in $GLOBAL and (re)defining in $PREAMBLE could be used for efficiency when the function must be called many times.
| _T___ mrgx::readRDS | ( | const std::string | filename | ) |
Read an RDS file.
| filename | the name of the RDS file to read. |
| double mrgx::rlognorm | ( | const double | mean, |
| const double | sd, | ||
| const double | lower, | ||
| const double | upper ) |
Simulate random lognormal variate between lower and upper boundaries. An error is generated if a variate between lower and upper bounds cannot be generated in 50 tries.
Example:
| mean | normal distribution mean |
| sd | normal distribution standard deviation |
| lower | lower bound for variates |
| upper | upper bound for variates |
| double mrgx::rnorm | ( | const double | mean, |
| const double | sd, | ||
| const double | lower, | ||
| const double | upper ) |
Simulate random normal variate between lower and upper boundaries. An error is generated if a variate between lower and upper bounds cannot be generated in 50 tries.
Example:
| mean | normal distribution mean |
| sd | normal distribution standard deviation |
| lower | lower bound for variates |
| upper | upper bound for variates |