introduce_variability: Introduce variability in a data frame containing mean...

Description Usage Arguments Details Author(s) Examples

Description

Allows user to supply data frame with mean parameter values and a SD or CV information for these parameters. Function processes each column (corresponding e.g. to different species) and draws from a normal or log-normal distribution with same mean and appropriate SD/CV>

Usage

1
2
3
4
5
    introduce_variability(input.mean, 
                          input.sd=NULL, 
                          cv=NULL, 
                          log = FALSE,
                          input.name.col = "Parameter") 

Arguments

input.mean

Input data frame with the means.

input.sd

Input data frame with SDs for each of the elements (same dimension as numerical part of input.mean).

cv

(Named) vector of coefficients of variation. Names should correspond to parameter names specified by input.name.col.

log

Whether draws should be made from log-normal distribution. If not, normal will be used.

input.name.col

Column in input.mean storing names of parameters.

Details

...

Author(s)

Witold Wiecek / LA-SER

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    monte.carlo.cv = c("Total Body Water" = .3,
                       "Plasma Volume" = .3,
                       "Cardiac Output" = .3,
                       "Average BW" = .16, 
                       "Total Plasma Protein" = .14,
                       "Plasma albumin"= .1,
                       "Plasma a-1-AGP"= .3,
                       "Hematocrit"= .3,
                       "Urine"= .3,
                       "Bile"= .3,
                       "GFR"=.3,
                       "Average Body Temperature" = 0)
    ll <- list()
    for(i in 1:10000) 
        ll[[i]] <- introduce_variability(input.mean = physiology.data, 
                                         cv = monte.carlo.cv, 
                                         log = TRUE)[["Human"]]
    
    ll2 <- list()
    for(i in 1:10000) 
        ll2[[i]] <- introduce_variability(input.mean = physiology.data, 
                                          cv = monte.carlo.cv, 
                                          log = FALSE)[["Human"]]
    physiology.data[["Human"]]
    
    apply(do.call(rbind, ll), 1, mean) 
    apply(do.call(rbind, ll), 2, mean) 
    apply(do.call(rbind, ll), 1, sd) 
    apply(do.call(rbind, ll), 2, sd)
    
    

wwiecek/httkgui documentation built on May 15, 2019, 6:31 p.m.