trunc_est {truncnormbayes}R Documentation

Estimate truncated normal distribution

Description

Estimates the posterior modes for the mean (mu) and standard deviation (sigma) of the underlying normal distribution, given truncated data with known truncation point(s).

Usage

trunc_est(x, a, b, mu_start = 0, sigma_start = 1, ci_level = 0.95, ...)

Arguments

x

Vector of observations from truncated normal.

a

Left truncation limit.

b

Right truncation limit.

mu_start

Initial value for mu.

sigma_start

Initial value for sigma.

ci_level

Confidence level of the interval – gives a 100*ci_level% symmetric HPD interval (defaults to 95%).

...

Parameters to pass to rstan::sampling().

Value

A list with two elements:

stats

A data frame with two rows and the columns param (mu, sd), mode (posterior mode), mean (posterior mean), median (posterior median), se (standard error), ci_lower (lower CI bound), ci_upper (upper CI bound), rhat.

fit

A stanfit object (the result of fitting the model).

References

Zhou X, Giacometti R, Fabozzi FJ, Tucker AH (2014). “Bayesian estimation of truncated data with applications to operational risk measurement.” Quantitative Finance, 14(5), 863–888. doi:10.1080/14697688.2012.752103.

Stan Development Team (2022). “RStan: the R interface to Stan.” R package version 2.21.5. https://mc-stan.org.

Examples

set.seed(22)
x <- truncnorm::rtruncnorm(100, a = -1, b = 2, mean = 0.5, sd = 0.5)
trunc_est(x, a = -1, b = 2)

[Package truncnormbayes version 0.0.3 Index]