Learn R Programming

decisionSupport (version 1.114)

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

Description

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.

Usage

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

Value

A list with elements mean and sd, i.e. the parameters of the underlying normal distribution.

Arguments

p

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

ci

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

median

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.

lowerTrunc

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

upperTrunc

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

relativeTolerance

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.

fitMethod

optimization method used in constrOptim.

...

further parameters to be passed to constrOptim.

Details

For details of the truncated normal distribution see tnorm.

The cumulative distribution of a truncated normal \(F_{\mu, \sigma}\)(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), \ldots, q(p_k))\) at the corresponding probabilities \(p=(p_1, \ldots, p_k)\) it holds that $$p_i = F_{\mu, \sigma}(q_{p_i}),~i = 1, \ldots, k$$ In the case of arbitrary postulated quantiles this system of equations might not have a solution in \(\mu\) and \(\sigma\). A least squares fit leads to an approximate solution: $$\sum_{i=1}^k (p_i - F_{\mu, \sigma}(q_{p_i}))^2 = \min$$ defines the parameters \(\mu\) and \(\sigma\) 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:
    \(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]]

  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.

See Also