ci.gm: Confidence interval of a Geometric mean

Description Usage Arguments Value Author(s) See Also Examples

Description

Calculate the Confidence Interval (CI) of a geometric mean.

Usage

1
ci.gm(x)

Arguments

x

Vector of numeric values. For example, a vector of HRs.

Value

Vector of the CI of a geometric mean.

Author(s)

Haleh Yasrebi

See Also

gm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
v = c(1.5,2.5,7,4)
ci.gm(v)

## The function is currently defined as
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)
}

Example output

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)
}

survJamda documentation built on May 1, 2019, 8:50 p.m.