stdev_transform: Translate Standard Deviation from the Natural Scale to the...

Description Usage Arguments Value Examples

View source: R/RcppExports.R

Description

This function changes a given standard deviation so that when a vector of samples is drawn from the given distribution, the original standard deviation will be recovered once it is back-transformed from the log or logit scale. In effect, the function "translates" a standard deviation from the natural scale to the log or logit scale for the purposes of random draws from a probability distribution.

Usage

1

Arguments

mu

The mean of the distribution on the natural scale.

sigma

The standard devation of the distribution on the natural scale.

dist

The distribution to which the standard deviation should be transformed.

Value

The standard deviation translated to the log or logit scale.

Examples

1
2
3
4
5
6
7
8
mean <- 10
stdev <- 2
mean_trans <- log(mean)
stdev_trans <- stdev_transform(mean, stdev, "log")
draws <- rnorm(50, mean_trans, stdev_trans)
natural_scale <- exp(draws)
mean(draws)
sd(draws)

colorednoise documentation built on Aug. 5, 2020, 5:10 p.m.