This function fits the distribution parameters, i.e. mean
and sd
, of a truncated
normal distribution from an arbitrary confidence interval and, optionally, the median.
1 2 3 
p 

ci 

median 
if 
lowerTrunc 

upperTrunc 

relativeTolerance 

fitMethod 
optimization method used in 
... 
further parameters to be passed to 
For details of the truncated normal distribution see tnorm
.
The cumulative distribution of a truncated normal F_{μ, σ}(x) gives the probability that a sampled value is less than x. This is equivalent to saying that for the vector of quantiles q=(q(p_1), …, q(p_k)) at the corresponding probabilities p=(p_1, …, p_k) it holds that
p_i = F_{μ, σ}(q(p_i)), i = 1, … k.
In the case of arbitrary postulated quantiles this system of equations might not have a solution in μ and σ. A least squares fit leads to an approximate solution:
∑_{i=1}^k (p_i  F_{μ, σ}(q(p_i)))^2 = min
defines the parameters μ and σ of the underlying normal distribution. This method solves this minimization problem for two cases:
ci[[1]] < median < ci[[2]]
: The parameters are fitted on the lower and upper value
of the confidence interval and the median, formally:
k=3
p_1=p[[1]]
, p_2=0.5
and p_3=p[[2]]
;
q(p_1)=ci[[1]]
,
q(0.5)=median
and
q(p_3)=ci[[2]]
median=NULL
: The parameters are fitted on the lower and upper value of the
confidence interval only, formally:
k=2
p_1=p[[1]]
, p_2=p[[2]]
;
q(p_1)=ci[[1]]
,
q(p_2)=ci[[2]]
The (p[[2]]p[[1]])
 confidence interval must be symmetric in the sense that
p[[1]] + p[[2]] = 1
.
A list with elements mean
and sd
, i.e. the parameters of the underlying
normal distribution.
Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.