While working on Squiggle, we’ve encountered many technical challenges in writing probabilistic functionality with Javascript. Some of these challenges are solved in Python and must be ported over, and some apply to all languages. We think the following tasks could be good fits for others to tackle. These are fairly isolated and could be done in contained NPM packages or similar. The solutions would be useful for Squiggle and might be handy for others in the Javascript ecosystem as well. Advice and opinions are also appreciated.
The first is a simple tool to generate a Z random generator from a given correlation matrix
The second is more specific to generate correlated random numbers from underlying risk factors example: `price= N( Q25$, Q75$, 'demand', 0.4, 'inflation', 0.4))`
It works for discrete distribution if the number of samples is under the target resolution and generates a pdf and cdf that maintains the average of samples received.
As samples are received, it tries to spread the retained points to cover the range of probabilities, handling skewed distributions quite well.
Open Technical Challenges around Probabilistic Programs and Javascript
Regarding *6-correlation* maybe [https://www.npmjs.com/package/correl-z] or [https://www.npmjs.com/package/@hugov/correl-range] can be relevant.
The first is a simple tool to generate a Z random generator from a given correlation matrix
The second is more specific to generate correlated random numbers from underlying risk factors example: `price= N( Q25$, Q75$, 'demand', 0.4, 'inflation', 0.4))`
I was dabbling in something related to squiggle since 2014... schem.ist: [https://schem.ist/montecode2/#en/1wCX!-FSg45'SghgncJgx8/'/u9+NqYVx:kYYf14AlrAG+lw/@&ljlzatb(dB1.KS9KOn~$LHDuu..8,H,@qt8;*'Z?i3C?w!$n;flmrK=PB(,.uh3-4aYo.5#jAn1cy1;TA6=I&OI/)~MCC(#=qCrUkfG_&_GLC2VsP#z&f.#;*ffKI7TwJm_jvsW4:BfoD,WS]
Regarding #1-density and #2-quantiles, maybe [https://www.npmjs.com/package/sample-distribution] can be of use.
It works for discrete distribution if the number of samples is under the target resolution and generates a pdf and cdf that maintains the average of samples received.
As samples are received, it tries to spread the retained points to cover the range of probabilities, handling skewed distributions quite well.