foldnorm: Folded normal distribution

View source: R/foldnorm.R

foldnormR Documentation

Folded normal distribution

Description

Applying the folded normal distribution using the posterior parameter estimates of effect sizes that are normally distributed. This function will allow one to understand the overall magnitude of effect regardless of effect size direction.

Usage

foldnorm(mu, sd, type = c("mean", "mode", "raw"))

Arguments

mu

The posterior distribution of mean estimates from an MCMCglmm object. Alternatively, you can give it the mean and sd of a normal distribution and it will provide the mean (only used if type = "raw").

sd

The standard deviation of the posterior distribution of variance-covariance matrix from an MCMCglmm object or just the sd of a normal distribution.

type

Indicates whether the posterior mean (i.e. "mean") or mode (i.e. "mode") should be returned. Alternatively, if one knows the mean and the sd of you can use type = "raw" to get the mean and variance of the folded normal distribution.

Value

Posterior mean or mode along with the 95 percent credible intervals (i.e. the highest posterior density interval - HPDinterval). Alternatively if type = "raw" it will return the mean and variance for the folded normal distribution.

Author(s)

Daniel Noble - daniel.noble@anu.edu.au

References

Morrisey, M.B. 2016. Meta-analysis of magnitudes, differences and variation in evolutionary parameters. Journal of Evolutionary Biology, 29:1882-1904

Morrisey, M.B. 2016. Rejoinder: Further considerations for meta-analysis of transformed quantities such as absolute values. Journal of Evolutionary Biology, 29:1922-1931

Examples

set.seed(60)
x <- rnorm(1000, 1, 1)
mean(x)
sd(x)
# Calculate the mean of the folded norm from raw x
foldnorm(mu = mean(x), sd = sd(x), type = "raw")
#Should be close to: 
mean(abs(x))
var(abs(x))

daniel1noble/metaAidR documentation built on Oct. 14, 2023, 3:23 p.m.