Description Usage Arguments Value Author(s) See Also Examples
Calculate the Confidence Interval (CI) of a geometric mean.
1 | ci.gm(x)
|
x |
Vector of numeric values. For example, a vector of HRs. |
Vector of the CI of a geometric mean.
Haleh Yasrebi
1 2 3 4 5 6 7 8 9 10 11 |
Loading required package: survival
Loading required package: survivalROC
Loading required package: ecodist
Loading required package: survcomp
Loading required package: prodlim
Loading required package: survJamda.data
[1] 1.68 6.10
function (x)
{
gm1 = mean(log(x), na.rm = T)
cil = exp(gm1 - (1.96 * (sd(log(x), na.rm = T)/sqrt(length(x)))))
ciupp = exp(gm1 + (1.96 * (sd(log(x), na.rm = T)/sqrt(length(x)))))
vec = c(round(cil, 2), round(ciupp, 2))
return(vec)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.