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

View source: R/RcppExports.R

stdev_transformR Documentation

Translate Standard Deviation from the Natural Scale to the Log or Logit Scale

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

stdev_transform(mu, sigma, dist)

Arguments

mu

The mean of the distribution on the natural scale.

sigma

The standard deviation 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

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 May 29, 2024, 9:21 a.m.