View source: R/distribution_convertors.R
norm2trunc | R Documentation |
Convert a normal (gaussian) distribution to a truncated normal distribution with specified minimum and maximum
norm2trunc(
x,
min = -Inf,
max = Inf,
mu = mean(x),
sd = stats::sd(x),
x_mu = mean(x),
x_sd = stats::sd(x)
)
x |
the normally distributed vector |
min |
the minimum of the truncated distribution to return |
max |
the maximum of the truncated distribution to return |
mu |
the mean of the distribution to return (calculated from x if not given) |
sd |
the SD of the distribution to return (calculated from x if not given) |
x_mu |
the mean of x (calculated from x if not given) |
x_sd |
the SD of x (calculated from x if not given) |
a vector with a uniform distribution
x <- rnorm(10000)
y <- norm2trunc(x, 1, 7, 3.5, 2)
g <- ggplot2::ggplot() + ggplot2::geom_point(ggplot2::aes(x, y))
ggExtra::ggMarginal(g, type = "histogram")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.