paramtnormci_fit: Fit parameters of truncated normal distribution based on a...

Description Usage Arguments Details Value See Also

View source: R/paramtnormci_fit.R


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.


paramtnormci_fit(p, ci, median = mean(ci), lowerTrunc = -Inf,
  upperTrunc = Inf, relativeTolerance = 0.05, fitMethod = "Nelder-Mead",



numeric 2-dimensional vector; probabilities of upper and lower bound of the corresponding confidence interval.


numeric 2-dimensional vector; lower, i.e ci[[1]], and upper bound, i.e ci[[2]], of the confidence interval.


if NULL: truncated normal is fitted only to lower and upper value of the confidence interval; if numeric: truncated normal is fitted on the confidence interval and the median simultaneously. For details cf. below.


numeric; lower truncation point of the distribution (>= -Inf).


numeric; upper truncation point of the distribution (<= Inf).


numeric; the relative tolerance level of deviation of the generated probability levels from the specified confidence interval. If the relative deviation is greater than relativeTolerance a warning is given.


optimization method used in constrOptim.


further parameters to be passed to constrOptim.


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:

  1. ci[[1]] < median < ci[[2]]: The parameters are fitted on the lower and upper value of the confidence interval and the median, formally:
    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]]

  2. median=NULL: The parameters are fitted on the lower and upper value of the confidence interval only, formally:
    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.

See Also

tnorm, constrOptim

decisionSupport documentation built on May 29, 2017, 6:39 p.m.

Search within the decisionSupport package
Search all R packages, documentation and source code