Skip to contents

A pre-evaluated mcmodule object containing simulation results for the illustrative animal-import risk assessment. The module represents two hypothetical pathogens imported from three regions of origin and includes input nodes, intermediate calculations, and the probability that an infected animal is not detected before import.

Usage

imports_mcmodule

Format

An object of class mcmodule with the following components:

data

A named list containing the model input data.

exp

A named list containing the evaluated model expression.

node_list

A named list of Monte Carlo input and output nodes with their associated metadata. This includes w_prev, test_sensi, test_origin, infected, false_neg, no_test, and no_detect.

modules

Character vector identifying the modules represented in the object.

Source

Generated from simulated data for demonstration purposes.

Details

The object is generated from imports_data, imports_data_keys, imports_mctable, and imports_exp. It is provided so that package functions can be demonstrated without rebuilding the model each time.

Examples

imports_mcmodule
#> $data
#> $data$imports_data
#>   pathogen origin h_prev_min h_prev_max w_prev_min w_prev_max farms_n
#> 1        a   nord       0.08       0.10       0.15        0.2       5
#> 2        a  south       0.02       0.05       0.15        0.2      10
#> 3        a   east       0.10       0.15       0.15        0.2       7
#> 4        b   nord       0.50       0.70       0.45        0.6       5
#> 5        b  south       0.25       0.30       0.37        0.4      10
#> 6        b   east       0.30       0.50       0.45        0.6       7
#>   animals_n_mean animals_n_sd test_origin test_sensi_min test_sensi_mode
#> 1            100            6   sometimes           0.89            0.90
#> 2            130           10   sometimes           0.89            0.90
#> 3            140           12       never           0.89            0.90
#> 4            100            2      always           0.80            0.85
#> 5            130            4   sometimes           0.80            0.85
#> 6            140            3     unknown           0.80            0.85
#>   test_sensi_max
#> 1           0.91
#> 2           0.91
#> 3           0.91
#> 4           0.90
#> 5           0.90
#> 6           0.90
#> 
#> 
#> $exp
#> $exp$imports
#> {
#>     infected <- w_prev
#>     false_neg <- infected * test_origin * (1 - test_sensi)
#>     no_test <- infected * (1 - test_origin)
#>     no_detect <- false_neg + no_test
#> }
#> 
#> 
#> $node_list
#> $node_list$w_prev
#> $node_list$w_prev$type
#> [1] "in_node"
#> 
#> $node_list$w_prev$mc_func
#> [1] "runif"
#> 
#> $node_list$w_prev$description
#> [1] "Within herd prevalence"
#> 
#> $node_list$w_prev$inputs_col
#> [1] "w_prev_min" "w_prev_max"
#> 
#> $node_list$w_prev$input_dataset
#> [1] "prevalence_region"
#> 
#> $node_list$w_prev$keys
#> [1] "pathogen" "origin"  
#> 
#> $node_list$w_prev$exp_name
#> [1] "imports"
#> 
#> $node_list$w_prev$mc_name
#> [1] "w_prev"
#> 
#> $node_list$w_prev$mcnode
#>   node    mode  nsv nsu nva variate  min  mean median max Nas type outm
#> 1    x numeric 1001   1   6       1 0.15 0.176  0.177 0.2   0    V each
#> 2    x numeric 1001   1   6       2 0.15 0.176  0.176 0.2   0    V each
#> 3    x numeric 1001   1   6       3 0.15 0.175  0.175 0.2   0    V each
#> 4    x numeric 1001   1   6       4 0.45 0.525  0.525 0.6   0    V each
#> 5    x numeric 1001   1   6       5 0.37 0.385  0.385 0.4   0    V each
#> 6    x numeric 1001   1   6       6 0.45 0.524  0.524 0.6   0    V each
#> 
#> $node_list$w_prev$data_name
#> [1] "imports_data"
#> 
#> 
#> $node_list$infected
#> $node_list$infected$type
#> [1] "out_node"
#> 
#> $node_list$infected$node_exp
#> [1] "w_prev"
#> 
#> $node_list$infected$inputs
#> [1] "w_prev"
#> 
#> $node_list$infected$exp_name
#> [1] "imports"
#> 
#> $node_list$infected$mc_name
#> [1] "infected"
#> 
#> $node_list$infected$keys
#> [1] "pathogen" "origin"  
#> 
#> $node_list$infected$exp_param
#> [1] "w_prev"
#> 
#> $node_list$infected$mcnode
#>   node    mode  nsv nsu nva variate  min  mean median max Nas type outm
#> 1    x numeric 1001   1   6       1 0.15 0.176  0.177 0.2   0    V each
#> 2    x numeric 1001   1   6       2 0.15 0.176  0.176 0.2   0    V each
#> 3    x numeric 1001   1   6       3 0.15 0.175  0.175 0.2   0    V each
#> 4    x numeric 1001   1   6       4 0.45 0.525  0.525 0.6   0    V each
#> 5    x numeric 1001   1   6       5 0.37 0.385  0.385 0.4   0    V each
#> 6    x numeric 1001   1   6       6 0.45 0.524  0.524 0.6   0    V each
#> 
#> $node_list$infected$data_name
#> [1] "imports_data"
#> 
#> 
#> $node_list$test_origin
#> $node_list$test_origin$type
#> [1] "in_node"
#> 
#> $node_list$test_origin$description
#> [1] "Probability of the animals being tested in origin"
#> 
#> $node_list$test_origin$inputs_col
#> [1] "test_origin"
#> 
#> $node_list$test_origin$input_dataset
#> [1] "prevalence_region"
#> 
#> $node_list$test_origin$keys
#> [1] "pathogen" "origin"  
#> 
#> $node_list$test_origin$exp_name
#> [1] "imports"
#> 
#> $node_list$test_origin$mc_name
#> [1] "test_origin"
#> 
#> $node_list$test_origin$mcnode
#>   node    mode nsv nsu nva variate min mean median max Nas type outm
#> 1    x numeric   1   1   6       1 0.5  0.5    0.5 0.5   0    0 each
#> 2    x numeric   1   1   6       2 0.5  0.5    0.5 0.5   0    0 each
#> 3    x numeric   1   1   6       3 0.0  0.0    0.0 0.0   0    0 each
#> 4    x numeric   1   1   6       4 1.0  1.0    1.0 1.0   0    0 each
#> 5    x numeric   1   1   6       5 0.5  0.5    0.5 0.5   0    0 each
#> 6    x numeric   1   1   6       6 0.0  0.0    0.0 0.0   0    0 each
#> 
#> $node_list$test_origin$data_name
#> [1] "imports_data"
#> 
#> 
#> $node_list$test_sensi
#> $node_list$test_sensi$type
#> [1] "in_node"
#> 
#> $node_list$test_sensi$mc_func
#> [1] "rpert"
#> 
#> $node_list$test_sensi$description
#> [1] "Test sensitivity"
#> 
#> $node_list$test_sensi$inputs_col
#> [1] "test_sensi_min"  "test_sensi_mode" "test_sensi_max" 
#> 
#> $node_list$test_sensi$input_dataset
#> [1] "test_sensitivity"
#> 
#> $node_list$test_sensi$keys
#> [1] "pathogen"
#> 
#> $node_list$test_sensi$exp_name
#> [1] "imports"
#> 
#> $node_list$test_sensi$mc_name
#> [1] "test_sensi"
#> 
#> $node_list$test_sensi$mcnode
#>   node    mode  nsv nsu nva variate   min  mean median   max Nas type outm
#> 1    x numeric 1001   1   6       1 0.891 0.900  0.900 0.910   0    V each
#> 2    x numeric 1001   1   6       2 0.890 0.900  0.900 0.909   0    V each
#> 3    x numeric 1001   1   6       3 0.890 0.900  0.900 0.909   0    V each
#> 4    x numeric 1001   1   6       4 0.804 0.850  0.850 0.894   0    V each
#> 5    x numeric 1001   1   6       5 0.806 0.850  0.850 0.897   0    V each
#> 6    x numeric 1001   1   6       6 0.806 0.851  0.851 0.894   0    V each
#> 
#> $node_list$test_sensi$data_name
#> [1] "imports_data"
#> 
#> 
#> $node_list$false_neg
#> $node_list$false_neg$function_call
#> [1] TRUE
#> 
#> $node_list$false_neg$type
#> [1] "out_node"
#> 
#> $node_list$false_neg$node_exp
#> [1] "infected * test_origin * (1 - test_sensi)"
#> 
#> $node_list$false_neg$inputs
#> [1] "infected"    "test_origin" "test_sensi" 
#> 
#> $node_list$false_neg$exp_name
#> [1] "imports"
#> 
#> $node_list$false_neg$mc_name
#> [1] "false_neg"
#> 
#> $node_list$false_neg$keys
#> [1] "pathogen" "origin"  
#> 
#> $node_list$false_neg$exp_param
#> [1] "infected"    "test_origin" "test_sensi" 
#> 
#> $node_list$false_neg$mcnode
#>   node    mode  nsv nsu nva variate     min    mean  median    max Nas type
#> 1    x numeric 1001   1   6       1 0.00707 0.00879 0.00884 0.0107   0    V
#> 2    x numeric 1001   1   6       2 0.00688 0.00878 0.00880 0.0107   0    V
#> 3    x numeric 1001   1   6       3 0.00000 0.00000 0.00000 0.0000   0    V
#> 4    x numeric 1001   1   6       4 0.05007 0.07882 0.07818 0.1104   0    V
#> 5    x numeric 1001   1   6       5 0.01920 0.02879 0.02890 0.0378   0    V
#> 6    x numeric 1001   1   6       6 0.00000 0.00000 0.00000 0.0000   0    V
#>   outm
#> 1 each
#> 2 each
#> 3 each
#> 4 each
#> 5 each
#> 6 each
#> 
#> $node_list$false_neg$data_name
#> [1] "imports_data"
#> 
#> 
#> $node_list$no_test
#> $node_list$no_test$function_call
#> [1] TRUE
#> 
#> $node_list$no_test$type
#> [1] "out_node"
#> 
#> $node_list$no_test$node_exp
#> [1] "infected * (1 - test_origin)"
#> 
#> $node_list$no_test$inputs
#> [1] "infected"    "test_origin"
#> 
#> $node_list$no_test$exp_name
#> [1] "imports"
#> 
#> $node_list$no_test$mc_name
#> [1] "no_test"
#> 
#> $node_list$no_test$keys
#> [1] "pathogen" "origin"  
#> 
#> $node_list$no_test$exp_param
#> [1] "infected"    "test_origin"
#> 
#> $node_list$no_test$mcnode
#>   node    mode  nsv nsu nva variate   min   mean median max Nas type outm
#> 1    x numeric 1001   1   6       1 0.075 0.0879 0.0883 0.1   0    V each
#> 2    x numeric 1001   1   6       2 0.075 0.0878 0.0881 0.1   0    V each
#> 3    x numeric 1001   1   6       3 0.150 0.1746 0.1748 0.2   0    V each
#> 4    x numeric 1001   1   6       4 0.000 0.0000 0.0000 0.0   0    V each
#> 5    x numeric 1001   1   6       5 0.185 0.1925 0.1926 0.2   0    V each
#> 6    x numeric 1001   1   6       6 0.450 0.5243 0.5238 0.6   0    V each
#> 
#> $node_list$no_test$data_name
#> [1] "imports_data"
#> 
#> 
#> $node_list$no_detect
#> $node_list$no_detect$function_call
#> [1] TRUE
#> 
#> $node_list$no_detect$type
#> [1] "out_node"
#> 
#> $node_list$no_detect$node_exp
#> [1] "false_neg + no_test"
#> 
#> $node_list$no_detect$inputs
#> [1] "false_neg" "no_test"  
#> 
#> $node_list$no_detect$exp_name
#> [1] "imports"
#> 
#> $node_list$no_detect$mc_name
#> [1] "no_detect"
#> 
#> $node_list$no_detect$keys
#> [1] "pathogen" "origin"  
#> 
#> $node_list$no_detect$exp_param
#> [1] "false_neg" "no_test"  
#> 
#> $node_list$no_detect$mcnode
#>   node    mode  nsv nsu nva variate    min   mean median   max Nas type outm
#> 1    x numeric 1001   1   6       1 0.0821 0.0967 0.0972 0.110   0    V each
#> 2    x numeric 1001   1   6       2 0.0819 0.0966 0.0968 0.110   0    V each
#> 3    x numeric 1001   1   6       3 0.1501 0.1746 0.1748 0.200   0    V each
#> 4    x numeric 1001   1   6       4 0.0501 0.0788 0.0782 0.110   0    V each
#> 5    x numeric 1001   1   6       5 0.2063 0.2213 0.2212 0.237   0    V each
#> 6    x numeric 1001   1   6       6 0.4504 0.5243 0.5238 0.600   0    V each
#> 
#> $node_list$no_detect$data_name
#> [1] "imports_data"
#> 
#> 
#> 
#> attr(,"class")
#> [1] "mcmodule"
class(imports_mcmodule)
#> [1] "mcmodule"
names(imports_mcmodule$node_list)
#> [1] "w_prev"      "infected"    "test_origin" "test_sensi"  "false_neg"  
#> [6] "no_test"     "no_detect"  
mc_summary(imports_mcmodule, "no_detect")
#>     mc_name pathogen origin       mean          sd        Min       2.5%
#> 1 no_detect        a   nord 0.09672319 0.007918844 0.08212834 0.08327604
#> 2 no_detect        a  south 0.09659241 0.007844882 0.08193967 0.08300295
#> 3 no_detect        a   east 0.17457745 0.014002392 0.15006892 0.15118934
#> 4 no_detect        b   nord 0.07882384 0.011451563 0.05007489 0.05848176
#> 5 no_detect        b  south 0.22133183 0.006089013 0.20633320 0.21056531
#> 6 no_detect        b   east 0.52426066 0.043177508 0.45041178 0.45397775
#>          25%        50%        75%     97.5%       Max  nsv Na's
#> 1 0.08994074 0.09716583 0.10359879 0.1093953 0.1102474 1001    0
#> 2 0.09005791 0.09680435 0.10291212 0.1093358 0.1103894 1001    0
#> 3 0.16254631 0.17482117 0.18649966 0.1982050 0.1999157 1001    0
#> 4 0.07047387 0.07818301 0.08711637 0.1005788 0.1104362 1001    0
#> 5 0.21665153 0.22117476 0.22593424 0.2327192 0.2370769 1001    0
#> 6 0.48702148 0.52379528 0.56172396 0.5970621 0.5999985 1001    0