Language 0.8 example catalog
Fifty small models, each tested
Copy a complete file, compare modeling patterns, or run the catalog validator to check the parser, model lowering, derivatives, initial state, and generated quantities.
Stan-inspired, not Stan-compatible01–10 · Foundations
Conjugacy, likelihoods, and constraints
| Script | Pattern | Main feature |
|---|---|---|
| 01 beta-binomial | Coin toss posterior | Bounded probability and predictive binomial RNG |
| 02 A/B test | Two independent arms | Multiple bounded parameters |
| 03 normal mean | Known observation scale | Conjugate location |
| 04 location/scale | Vectorized normal data | Positive scale and prediction |
| 05 robust location | Outlier-resistant model | Vectorized Cauchy likelihood |
| 06 gamma–Poisson | Count-rate posterior | Positive rate and count RNG |
| 07 exponential rate | Waiting-time model | Vectorized positive data |
| 08 Bernoulli | Binary outcome | Beta prior and Bernoulli RNG |
| 09 binomial | Grouped binary outcomes | Binomial likelihood |
| 10 bounded latent | Latent location on [-2,2] | Two-sided transform and uniform prior |
11–20 · Regression and structure
Transformed parameters, links, hierarchy, order, and simplex state
| Script | Pattern | Main feature |
|---|---|---|
| 11 precision | Scale-to-precision conversion | Transformed parameter |
| 12 standardized effect | Non-centered latent effect | Derived scientific parameter |
| 13 log response | Normal model on log data | Vector data and prediction |
| 14 Poisson log link | Count regression | exp link |
| 15 logistic | Single binary observation | inv_logit link |
| 16 two-point logistic | Two predictor values | Multiple transformed probabilities |
| 17 two groups | Difference in means | Two vectorized likelihoods |
| 18 non-centered groups | Partial-pooling skeleton | Standardized effects |
| 19 ordered means | Monotone locations | Ordered vector and indexing |
| 20 three categories | Category probabilities | Simplex and manual log target |
21–30 · Priors, transformations, and prediction
Prior predictive simulation and generated quantities
| Script | Pattern | Main feature |
|---|---|---|
| 21 beta predictive | Prior-only probability | Bernoulli prior prediction |
| 22 gamma predictive | Prior-only rate | Poisson prior prediction |
| 23 half-Cauchy scale | Positive constrained scale | Cauchy prior on a transformed parameter |
| 24 bounded location | Finite prior support | Uniform prior and normal likelihood |
| 25 centered data | Subtract a known offset | Transformed data block |
| 26 endpoint sum | Baseline plus change | Transformed parameter block |
| 27 normal RNG | Continuous prediction | normal_rng |
| 28 Bernoulli RNG | Binary prediction | bernoulli_rng |
| 29 binomial RNG | Future successes | binomial_rng |
| 30 Poisson RNG | Future count | poisson_rng |
31–40 · Extended surface
Remaining RNGs, manual density terms, indexing, and pooled groups
| Script | Pattern | Main feature |
|---|---|---|
| 31 gamma RNG | Positive prediction | Shape/rate convention |
| 32 exponential RNG | Future waiting time | exponential_rng |
| 33 uniform RNG | Reference simulation | uniform_rng |
| 34 Cauchy RNG | Heavy-tailed prediction | cauchy_rng |
| 35 manual target | Explicit prior and likelihood | target += *_lpdf |
| 36 nonlinear mean | Exponential response curve | Nonlinear transformed parameter |
| 37 indexed vector | Three explicit observations | One-based indexing |
| 38 ordered prior | Four latent cutpoints | Vectorized prior on ordered state |
| 39 simplex regularization | Balanced weights | Manual simplex prior |
| 40 pooled groups | Grand mean and contrast | Two vectorized group likelihoods |
41 · Data and control flow
Start with a real file-backed workflow
| Script | Pattern | Main feature |
|---|---|---|
| 41 CSV normal mean | CSV observations through Java or script | for, indexing, external data binding, and normal prediction |
Run it with McmcDataIngestionExamples.java or follow the data and compilation tutorial.
42–50 · Version 0.8.2 additions
Apply the expanded language and probability catalog
| Script | Pattern | Main feature |
|---|---|---|
| 42 robust Student-t | Location/scale data with an outlier | student_t, transformed degrees of freedom, and RNG |
| 43 Bernoulli-logit | Binary regression | Logit likelihood and RNG without manual probability conversion |
| 44 beta-binomial | Overdispersed grouped successes | Mean/concentration transformation and predictive count |
| 45 negative-binomial log link | Overdispersed count regression | neg_binomial_2_log likelihood and RNG |
| 46 piecewise errors | Robustify observations past a cutoff | Scoped locals, while, if, assignment, and | |
| 47 contamination mixture | Clean and outlier observation regimes | log_mix and local log densities |
| 48 Weibull lifetime | Positive event times | Vectorized Weibull likelihood and RNG |
| 49 circular direction | Angular observation | Von Mises likelihood and circular RNG |
| 50 reaction time | Gaussian core with exponential delay | Exponentially modified normal likelihood and RNG |
The companion ModelScriptCompilationExamples.java loads a checked-in script and compares in-memory, cached-JDK, and generated-source workflows.
51 · First-passage reaction time
Fit a Wiener drift-diffusion likelihood
| Script | Pattern | Main feature |
|---|---|---|
| 51 Wiener reaction time | Upper-response reaction times | Stable wiener likelihood and conditional wiener_rng |
The four-parameter likelihood follows Stan's upper-response convention. JDistlib's RNG is an extension and samples time conditional on that response.
Validate
Run the semantic catalog gate
./gradlew validateModelScriptsThe validator supplies representative typed data for each file, compiles the script, checks its analytic gradient against central finite differences, requires a finite initial density, and evaluates generated quantities.