Skip to content

Getting started ​

The home page says what the package is for and shows the shortest fit that runs. The tutorials below go further.

Installation ​

julia
using Pkg
Pkg.add("DistributionsInference")

Fitting needs a sampler and a chain type as well, and you choose both. The tutorials sample with AdvancedMH or Turing and hold the draws in FlexiChains.

julia
Pkg.add(["AdvancedMH", "Turing", "FlexiChains"])

Two tutorials ask for more. The custom-distribution page finds a maximum-a-posteriori point through Bijectors and Optim, and the composed-tree page needs ComposedDistributions.

julia
Pkg.add(["Bijectors", "Optim", "ComposedDistributions"])

The route through a fit ​

Every fit here is the same three steps, whatever the distribution and sampler.

StepWhat you writeWhat it gives
Declareparameter_rows and reconstruct on your typeone row per scalar parameter, and a way back from a flat vector
Scoredistribution_to_logdensity or distribution_to_turinga LogDensityProblems problem, or a DynamicPPL model
Read backinference_to_distribution or inference_to_distributionsthe fitted distribution

Only the first step is written per type, and a distribution from a package that already implements the protocol skips it. A point estimate replaces the last two: optimise_distribution takes the distribution, the data and an optimiser, and returns the fitted distribution.

Tutorials ​

  • Fitting a custom distribution writes the protocol for a hand-rolled type, samples it with AdvancedMH, and finds a maximum-a-posteriori point with an external optimiser.

  • Sampling with Turing fits the same distribution as a DynamicPPL model and reads the chain back with the same two calls.

  • Fitting a composed distribution runs both routes against a ComposedDistributions tree, partial pooling included. Its extension writes the protocol methods.

Getting help ​

For usage questions, ask on the Julia Discourse (the SciML or usage categories) or the epinowcast community forum, our home for epidemiological modelling questions. Please use GitHub issues for bug reports and feature requests only.

The layout, navigation, and infrastructure of this site are generated by EpiAwarePackageTools. Its docs cover customising the generated pages and how template sync keeps this repository current.