Skip to content

Instantly share code, notes, and snippets.

@richarddmorey
Created October 28, 2016 09:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richarddmorey/b884788c971f88948452ffc14ed8071d to your computer and use it in GitHub Desktop.
Save richarddmorey/b884788c971f88948452ffc14ed8071d to your computer and use it in GitHub Desktop.
example XML for distribution
<?xml version="1.0" encoding="utf-8"?>
<distribution>
<names>
<shortname>Normal</shortname>
<longname>Normal</longname>
<alternate>Gaussian</alternate>
<id>normal</id>
</names>
<type>continuous</type>
<support>
<lower>-Inf</lower>
<inner>reals</inner>
<upper>Inf</upper>
</support>
<parametrization>
<names>
<shortname>variance</shortname>
<longname>Mean/variance</longname>
<id>var</id>
</names>
<parameter>
<id>mu</id>
<support>
<lower>-Inf</lower>
<inner>reals</inner>
<upper>Inf</upper>
</support>
<symbols>
<html><![CDATA[&mu;]]></html>
<latex>\mu</latex>
<text>mu</text>
</symbols>
<role>location</role>
<note/>
</parameter>
<parameter>
<id>sigma-squared</id>
<support>
<lower>0</lower>
<inner>reals</inner>
<upper>Inf</upper>
</support>
<symbols>
<html><![CDATA[&sigma;<sup>2</sup>]]></html>
<latex>\sigma^2</latex>
<text>sigma^2</text>
</symbols>
<role>variance</role>
<note/>
</parameter>
<functions>
<pdf>
<latex>
(2\pi\sigma^2)^{-\frac{1}{2}}\exp\left\{-\frac{1}{2}\left(\frac{x - mu}{\sigma}\right)^2\right\}
</latex>
<code type="R">
function( x, mu, sigma-squared ){
dnorm( x, mu, sqrt( sigma-squared ) )
}
</code>
<code type="javascript">
function( x, mu, sigma-squared ){
Math.sqrt( 2 * Math.PI * sigma-squared ) * Math.exp( .5 * ( x - mu )*( x - mu )/sigma-squared )
}
</code>
</pdf>
</functions>
</parametrization>
<references>
<wikipedia>https://en.wikipedia.org/wiki/Normal_distribution</wikipedia>
</references>
</distribution>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment