Skip to content

ian-barr/geoDude

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Working with Geometric Statistics

Geometric means, Standard deviations, 95% Confidence intervals, and SEMs are defined based on the log-transformed data. If we have a set of measurements $X_1, X_2, \dots X_n$,

The geometric mean is $\exp{(\mu_l)}$ where

$$\mu_l = \frac{1}{n}\sum_i^n \ln(X_i)$$

The geometric standard deviation (GSD) is $\exp{(\sigma_l)}$ where

$$\sigma_l = \sqrt{\frac{\sum_i^n \left ( \ln(X_i) - \mu_l \right )^2}{n-1} }$$

The geometric standard error of the mean (GSEM) is $\exp{(sem_l)}$ where

$$sem_l = \frac{\sigma_l}{\sqrt{n}}$$

For a confidence level of 95% and a number of datapoints $n$, the confidence interval is given by multiplying the $sem_l$ by the 97.5% quantile of a $t$-distribution with $df= n-1$, then exponentiating to $\exp{\text{(lower, upper)}}$, where (lower, upper) are :

$$\text{(lower, upper)} = \mu_l \pm t(n-1, 0.975)\cdot sem_l$$

This means that the ends of the confidence intervals are

$$\exp(\mu_l - t(n-1, 0.975)\cdot sem_l), ~ \exp(\mu_l + t(n-1, 0.975)\cdot sem_l)$$

Dividing the upper limit by the mean gives

$$\frac{\exp(\mu_l + t(n-1, 0.975)\cdot sem_l)}{\exp(\mu_l )} = \exp(t(n-1, 0.975)\cdot sem_l)$$

Calling that result $R$, we will be able to get an estimate of the $sem_l$:

$$sem_l = \frac{\ln(R)} {t(n-1, 0.975)}$$

Including the definition for $sem_l$ lets us solve for $\sigma_l$:

$$\sigma_l = \frac{\sqrt{n}\cdot \ln(R)} {t(n-1, 0.975)}$$

And since the geometric coefficient of variation (GCV) is $\text{GCV} = \sqrt{\exp{(\sigma_l^2)} ~– 1}$ We are able to solve for GCV, and Convert between the different statistics.

Functions Defined:

GMEAN : Calculates Geometric Mean of a set of data points.

GSD : Calculates Geometric Standard Deviation of a set of data points.

GSEM : Calculates Geometric Standard Error of the Mean of a set of data points.

GCV : Calculates Geometric Coefficient of Variation of a set of data points.

GCI : Calculates Geometric Confidence Interval of a set of data points.

GCV2GCI : Converts Geometric Coefficient of Variation (expressed as a percentage if percent = TRUE) to Confidence interval.

kGCV2GSD : Converts Geometric Coefficient of Variation (expressed as a percentage if percent = TRUE) to Confidence interval using the definition of Kirkwood (1979) Biometrics.

GCV2GSD : Converts Geometric Coefficient of Variation (expressed as a percentage if percent = TRUE) to Geometric Standard Deviation.

GCI2GCV : Converts Geometric Confidence Interval to Geometric Coefficient of Variation (expressed as a percentage if percent = TRUE).

GCV2GSEM : Converts Geometric Coefficient of Variation (expressed as a percentage if percent = TRUE) to Geometric Standard Error of the Mean

GSD2GSEM : Converts Geometric Standard Deviation to Geometric Standard Error of the Mean

About

R functions for handling Geometric Mean, SD, CV, and CI

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages