trunc_est | R Documentation |
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).
trunc_est(x, a, b, mu_start = 0, sigma_start = 1, ci_level = 0.95, ...)
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 |
A list with two elements:
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
.
A stanfit
object (the result of fitting the model).
zhou2014truncnormbayes
\insertRefstan2022truncnormbayes
set.seed(22)
x <- truncnorm::rtruncnorm(100, a = -1, b = 2, mean = 0.5, sd = 0.5)
trunc_est(x, a = -1, b = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.