ModifiedDistributions.jl
distributions
modification
Wrap Distributions.jl distributions to rescale, weight, modify hazards, or transform, keeping the full distribution interface.
Wrappers for Distributions.jl univariate distributions that each change one behaviour — rescaling, likelihood weighting, hazard modification, or a forward transform — while everything else keeps working. A wrapped distribution stays a real, samplable Distribution, so a Turing model (or any PPL built on Distributions.jl) remains a complete generative model.
affine— exact rescaling and shifting of any univariate distribution.weight— scale an observation’s log-likelihood contribution.modify— proportional or additive hazard changes, in closed form.get_dist— recover the distribution underneath any wrapper.
Modifiers apply across ComposedDistributions.jl chains, and are tested against ForwardDiff, ReverseDiff, Enzyme, and Mooncake.
Install
Experimental — install from GitHub while the API settles:
using Pkg
Pkg.add(url = "https://github.com/EpiAware/ModifiedDistributions.jl")using ModifiedDistributions, Distributions
# the exact distribution of Y = 2X + 1
d = affine(LogNormal(1.5, 0.5); scale = 2.0, shift = 1.0)