## 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".   ## runmulticore.m - Run Multi-Core

There are two available possibilities to calculate using multiple CPU cores in octave: either function 'multicore' in octave forge package 'multicore' or function 'parcellfun' (or 'pararrayfun') in octave forge package 'general'. Parcellfun is faster, but limited by memory. Multicore can run on multiple computers, but is slower because creates a lot of files. And for script debugging, parallel computing is not convenient at all. So the following script gives possibility to simply switch between these three methods.

Function File: RESULT = runmulticore (METHOD, FUNCTIONHANDLE, PARAMETERCELL, PROCNO, TMPDIR, VERBOSE)
Get script.

Evaluate a function on multiple cores by means of either 'general' or 'multicore' octave forge packages, or test calculations by serial computing. Function enables to easly change between methods for easy debugging or running at different machines/octaves with different installed pacakges.

`METHOD - Function used in multicore calculations. To use function 'parcellfun' from package 'general', set to "parcellfun", to use function 'startmulticoremaster' from package 'multicore', set to "multicore", to use serial computing, set to 'cellfun'.
`FUNCTIONHANDLE' - Handle of the function to calculate (with at sign at the beginning).
`PARAMETERCELL' - Cell with parameters for function FUNCTIONHANDLE.
`PROCNO' - When specified, number of parallel processes will be limited. If ommited, set to 0, negative value or Inf, number of processes will be equal to number of computer cores.
`TMPDIR' - When specified, temporary directory for function 'startmulticoremaster' will be set, otherwise temporary directory is given by octave function 'tempdir'. Not usefull for function 'parcellfun'.
`RESULT' - Cell of the same size as PARAMETERCELL with all results.
`VERBOSE' - Verbose level. If equal to zero, messages will be supressed.
Example: compare calculation times:
for i=1:10
parametercelli=i;
endfor
tic
result=runmulticore('cellfun', parametercell, 0, '~', 0);
toc
tic
result=runmulticore('parcellfun', parametercell, 0, '~', 0);
toc
tic
result=runmulticore('multicore', parametercell, 0, '~', 0);
toc

Quality of the script:

 Tested: yes Contains help: yes Contains demo: no Checks input parameters: partially Can be tested by test command: yes Optimized: N/A