| SHGInterface | R Documentation |
The SHG Interface class provides an Rcpp interface to the Smoking History Generator (SHG)
SHGInterface Class
An SHGInterface reference object (R6-style external pointer) wrapping the C++
simulation engine. Configure fields, then call simulation methods such as
runSimFromFixedValues or runSimFromDataFrame; use
getConfig / useConfig for settings and
shg_load_params (via load_params()) for parameter bundles.
number_of_segmentsNumber of segments to use for simulation. Use -1 for auto-calculation (default), 1 for single segment, or N > 1 for explicit segment count. Auto-calculation uses: min(cores * 10, repeat / 1000). Note: MersenneTwister RNG is restricted to 1 segment.
num_threadsThread count: -1 = auto (all cores, multi-threaded), 1 = single-threaded, N = use N threads. Default: -1. Note: MersenneTwister RNG requires num_threads = 1.
rng_strategy'RngStream' for MRG32k3a (default) or 'MersenneTwister' for Mersenne Twister RNG. 'RngStream' is recommended for reproducibility especially with multi-threaded simulations. Note: MersenneTwister RNG is restricted to single-segment, non-parallel execution due to limitations in maintaining IID properties across segments.
input_data_folderSet or get the base folder for input data files
initiation_filenameSet or get the initiation filename
cessation_filenameSet or get the cessation filename
mortality_filenameSet or get the mortality probabilities filename (e.g. acm.csv or ocm-excl-lung-cancer.csv)
smok_params_sourceURL or local path of the last load_params() smoking zip (empty if unset)
mort_params_sourceURL or local path of the last load_params() mortality zip (empty if unset)
mort_params_typeMortality table from last load_params(): acm or ocm (empty if unset)
params_cache_dirRead-only. Directory where load_params() stores extracted bundles (same as shg_params_cache_dir()). Delete this folder to clear the cache manually.
cpd_filenameSet or get the cpd filename
immediate_cessation_yearSet or get Immediate Cessation Year; If 0, no immediate cessation
mt_seedsSet or get MersenneTwister seeds. Must be a numeric vector of exactly 4 values (one for each stream: initiation, cessation, life table, individual). If not set, default seeds are used. Only used when rng_strategy is "MersenneTwister".
rngstream_seedSet or get RngStream seed. Must be a numeric vector of exactly 6 values (a single seed vector that generates 4 substreams, one for each stream: initiation, cessation, life table, individual). If not set, default seed is used. Only used when rng_strategy is "RngStream".
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.