rmed0non0u95 {httk} | R Documentation |
Draw random numbers with LOD median but non-zero upper 95th percentile
Description
This function draws N random numbers from a distribution that approximates a median that is equal to the limit of detection (LOD, value x.LOD) but has an upper 95th percentile (x.u95) that is above x.LOD. We make the assumption that values above x.u95 are uniformly distributed between x.u95 and x.u95 + (x.u95 - x.LOD)
Usage
rmed0non0u95(n, x.u95, x.min = 0, x.LOD = 0.005)
Arguments
n |
Number of samples to draw |
x.u95 |
The upper limit on the 95th confidence/credible intervale (this is the 97.5 percentile) |
x.min |
The minimum allowed value (defaults to 0) |
x.LOD |
The limit of detection (defaults to 0.005) |
Value
A vector of N samples where the 50th and 97.5th quantiles approximate x.LOD and x.u95 respectively
Author(s)
John Wambaugh
References
Breen M, Wambaugh JF, Bernstein A, Sfeir M, Ring CL (2022). “Simulating toxicokinetic variability to identify susceptible and highly exposed populations.” Journal of Exposure Science & Environmental Epidemiology, 32(6), 855–863.
Examples
Fup.95 <- 0.02
N <- 1000
set.seed(1235)
Fup.vec <- rmed0non0u95(n=N, x.u95=Fup.95)
quantile(Fup.vec,c(0.5,0.975))
quantile(rmed0non0u95(200,x.u95=0.05,x.min=10^-4,x.LOD=0.01),c(0.5,0.975))
hist(rmed0non0u95(1000,x.u95=0.05,x.min=10^-4,x.LOD=0.01))
quantile(rmed0non0u95(200,x.u95=0.005,x.min=10^-4,x.LOD=0.01),c(0.5,0.975))
hist(rmed0non0u95(1000,x.u95=0.005,x.min=10^-4,x.LOD=0.01))