## scovint.m - Shortest Length of Coverage Interval

Function File: [SCI, LQ, RQ] = scovint (DATA, CP, [ VERBOSE ] )

Get script.

Calculates shortest coverage interval for given coverage
probability cp from vector of samples of distribution.
The interval can be asymmetric. Thus the output is uncertainty
according to Evaluation of measurement data - Supplement 1
to the "Guide to the expression of uncertainty in measurement"
- Propagation of distributions using a Monte Carlo method, JCGM,
2008. In the case of multiple shortest coverage intervals, the one
symmetric to expectation (mean) is selected.

The function finds shortest coverage interval only such covering the
expectation. This means for multipeaked PDF there can exist shorter
coverage interval, however GUM requires only unimodal (single peaked)
PDF.

Input variables:

`DATA - vector of numbers'

`CP - coverage interval probability'

`VERBOSE - displays output and figures'

Output variables:

`SCI - shortest coverage interval'

`LQ - value of output quantity at the left side of shortest coverage interval'

`RQ - value of output quantity at the right side of shortest coverage interval'

Quality of the script:

Tested: | yes |

Contains help: | yes |

Contains demo: | yes |

Checks input parameters: | yes |

Can be tested by test command: | yes |

Optimized: | yes |

Example: generate random numbers according to gamma distribution and calculate shortest length of coverage interval. Result is: 4.2. Compare it with standard deviation times two: 4.5. Run the example by follwing command: "demo scovint".