gm_conf | R Documentation |
gm_conf
takes as input a numeric vector, the desired confidence
interval, and returns the lower and upper values for the confidence interval.
Note that, because calculating a confidence interval relies on an accurate
estimate of the mean and standard deviation, your data should be log-normally
distributed.
gm_conf(
x,
CI = 0.9,
na.rm = TRUE,
zero.propagate = FALSE,
distribution_type = "t"
)
x |
A vector of numbers |
CI |
The confidence interval desired; default is 90 as a decimal, e.g., 0.95. |
na.rm |
Should NA values be removed? (logical) |
zero.propagate |
Should zeroes be propagated? (logical) |
distribution_type |
use a "t" distribution (default) or a "Z" distribution. Note: The Simcyp Simulator calculates geometric confidence intervals with a t distribution. |
x <- rnorm(100, 5, 1)
gm_conf(x)
gm_conf(x, CI = 0.9)
# PK data are often log-normally distributed, so try this function with
# some example concentration-time data. (For this, we're not worried
# about independence; we just need some example data to work with.)
data(MDZConcTime)
# Making values larger just so we're not dealing w/tiny decimals and
# removing 0's for simplicity.
x <- MDZConcTime$Conc[MDZConcTime$Conc != 0]*100
# Compare the distributions of the untransformed vs. log-transformed data:
ggplot2::qplot(x, bins = 15)
ggplot2::qplot(x, bins = 15) + ggplot2::scale_x_log10()
gm_conf(x)
# Compare the results with confInt()
confInt(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.