# Stochastic Information Packets (SIPs)

Any arbitrary probability distribution can be approximately represented by its Monte Carlo sample. When a consistent ordering of the Monte Carlo samples is maintained along the common Run index, the representation also captures complex correlation relationships relative to other variables. http://ProbabilityManagement.org advocates a corporate framework in which organizations maintain libraries of official distributions for key uncertain quantities, which can be exchanged between model builders so that all models rely on common assumptions. Each univariate Monte Carlo sample is collected into a unit called a Stochastic Information Packet (SIP), which is a textual XML snippet containing a compressed representation of the Monte Carlo sample. The DISTTM standard specifies a unified representation for SIPs which is used by several products in addition to Analytica. Analytica’s SipEncode() and SipDecode() function convert Monte Carlo samples to the DISTTM standard representation for a SIP. When additional indexes are present, the result is an array of SIPs, which is termed a Stochastic Library Unit with Relationships Preserved (SLURP).

See: Sam Savage, Stefan Scholtes, and Daniel Zweidler (Feb 2006), “Probability Management -Part 1”, OR/MS Today 33(1).

## SipEncode(x, i, name, type, origin, version)

Encodes a Stochastic Information Packet (SIP) in accordance with the DISTTM standard as a textual XML snippet. «x» is an uncertain quantity with a Monte Carlo sample indexed by «i». The index «i» is typically not specified and defaults to Run. The optional «name» parameter is a textual identifier that is embedded in the XML to identify what the quantity represents. The «type» parameter specifies how the distribution should be compressed, with these possible values:

• 'Single': A lossy compression that uses about 1 1/3 character per number. Stores the values using 256 distinct bins.
• 'Double': A slightly lossy compression that uses about 2 2/3 characters per bin, with 65536 distinct bins. The precision is substantially better than with 'Single'.
• 'Binary': Encodes a Bernoulli (true/false, 0/1) quantity, losslessly, encoding 6 binary values per character.

Use the optional «origin» parameter to include citation information to indicate the source of the distribution, when available. The optional «version» parameter can be set to 1 or 1.1 to specify the DISTTM 1.0 or DISTTM 1.1 standard. The 1.1 standard is the default. See also SipEncode.

SipEncode( Normal(0, 1), type: 'Single') →
'<dist name="Va10" avg="0.000e+000"
min = "-2.575829303549574e+000" max="2.575829303549574e+000"
ver="1.1" count="100" type="Single">kZZuaXGdVbAssn5JJpow2buPYuv/
Wnqlw5UeZUd8o5mBts+ndUSoZtOTtK5q4QCieziAWItTg41foMc/
NWi+FJJRild0l3B2S6qciYRNrI5ybJ9dPG3AhYhBY39cyoZ3T3lguAAA</dist>'

## SipDecode(xml, resultIndex, localIndexName)

Decodes a textual Stochastic Information Packet (SIP), encoded according to the DISTTM standard, into a Monte Carlo sample indexed by the system index Run when neither «resultIndex» or «localIndexName» is specified. When an index is specified for «resultIndex», the index is used to index the result. When «localIndexName» is specifed (as text), then a local index is created with the same length as the original sample and used to index the result. It is an error to specify both «resultIndex» and «localIndexName». See SipDecode.

SipDecode(SipEncode(Normal(0, 1), type: 'Single')) →

Note: This plot was produced by selecting the Probability Density result view and using a standard line for the graph line style. Although the compression and decoding is lossy, no distortion is perceivable to the naked eye.

## See Also

Comments

You are not allowed to post comments.