Skip to contents

Usage

dist_normal(mean = NULL, sd = NULL)

Arguments

mean

Scalar mean parameter, or NULL as a placeholder.

sd

Scalar standard deviation parameter, or NULL as a placeholder.

Value

A NormalDistribution object.

Details

Both parameters can be overridden with with_params = list(mean = ..., sd = ...).

Examples

mu <- 0
sigma <- 1

d_norm <- dist_normal(mean = mu, sd = sigma)
x <- d_norm$sample(20)
d_emp <- dist_empirical(x)

plot_distributions(
  empirical = d_emp,
  theoretical = d_norm,
  estimated = d_norm,
  with_params = list(
    estimated = list(mean = mean(x), sd = sd(x))
  ),
  .x = seq(-3, 3, length.out = 100)
)