Skip to contents

Spaces

A space is a set a measure can live on. Every space says how many coordinates one of its elements carries and whether a given point is one of them; a finite one can also list them all.

space()
Spaces
space_dim()
The dimension of one element of a space
contains()
Does a point belong to a space?
enumerate_space()
Every element of a finite sample space
is_finite_space()
Is this sample space finite?
count_space()
The space of k-category count vectors summing to n_trials

Observation models

A parametric_family owns the model p_theta(x): a compiled log-likelihood, score and sampler over a sample space.

parametric_family()
Parametric families
multinomial_family()
Multinomial sampling family
gaussian_family()
Gaussian sampling family with known covariance
compile_loglik()
Compile the log-likelihood function for a fixed set of outcomes
score()
Score d log P_theta(x) / d theta
kernel_draw()
Draw one observation from P_theta per parameter

Regions

Subsets of the real numbers that carry convex geometry. A convex_region can be charted, projected onto, and searched by an optimiser; a union_region is a finite union of them and need not be convex, and its parts may overlap. Every region answers parts() for what it was declared as and cells() for a triangulation of its parts.

region()
Regions of a parameter space
convex_region()
Convex regions
union_region()
A finite union of convex regions
empty_region()
The region with nothing in it
polyhedron_region()
A convex polyhedron given by its generators
h_region()
A convex polyhedron given by its half-space description
polytope_region()
Convex hull of a set of vertices
simplex_region()
A simplex: an affinely independent vertex set
halfspace_region()
Halfspace given by a normal and an offset
point_region()
A single parameter point
real_region()
The whole of R^d as a region
chart()
Coordinate chart for a parameter space
project()
Euclidean projection onto a parameter space
parts()
The convex regions a region was declared as
cells()
The convex regions a region decomposes into for optimisation
is_empty()
Is a region empty?
is_bounded()
Is a region bounded?

Set algebra

Operations that build new regions from old ones, and decide questions about them, composed in exact rational arithmetic and converted to doubles once per chain.

Null hypotheses

A null is a family together with a finite union of convex parameter regions.

null_model()
A null hypothesis: a family together with its parameter region

Distributions

A distribution is a law over a space. Pushing one over a parameter space through a family’s kernel induces a mixture distribution over the family’s sample space.

distribution()
Distributions over a space
log_density()
Log density of a distribution
draw()
Draw outcomes from a distribution
family.distribution
The family a distribution was induced from, if any
mixture()
The distribution P_W induced by a mixing measure W and a family
discrete_dist()
Distributions with finite support
dirac()
A point mass at a single value
finite_dist()
A distribution on finitely many atoms, sum_c w_c delta_{theta_c}
continuous_dist()
Continuous distributions
gaussian_dist()
Multivariate Gaussian distribution
dirichlet() truncated_dirichlet() dirichlet_dist()
Dirichlet priors over the simplex
n_atoms()
Number of atoms in a distribution
atoms()
Atoms of a distribution
weights.distribution weights,ripr::continuous_dist-method
Weights of a distribution
discretise()
Replace a distribution with the empirical distribution of draws from it
prune()
Drop atoms below a weight threshold and renormalise

Random variables

Callable variables on a sample space, with arithmetic for building likelihood ratios.

random_variable()
A random variable on a sample space
likelihood()
The likelihood of a distribution, as a random variable
random_variable_arithmetic
Arithmetic on random variables and scalars

Quadrature engines

Expectations under the alternative are approximated by a quadrature rule: exact enumeration, Monte Carlo, or Gauss-Hermite.

exact_engine()
Exact enumeration over a finite sample space
mc_engine()
Monte Carlo integration against draws from the alternative
gh_engine()
Gauss-Hermite quadrature against a Gaussian alternative

Fitting the RIPr

ripr_init() builds a starting state; the step verbs advance it by Frank–Wolfe, Li–Barron and/or EM; ripr_finish() turns it into a distribution.

ripr_control()
Tuning for the RIPr optimiser
ripr_state()
State of a RIPr fit
ripr_init()
Begin a RIPr fit
oracles
KL Minimisation Oracles
fw_step()
Frank–Wolfe step
lb_step()
Li–Barron greedy step
em_step()
EM sweep
weight_step()
Fully-corrective weight step
ct_step()
Csiszar–Tusnady step
sfw_step()
Sliding Frank–Wolfe step
kl_flat() gap_below() support_gap_below()
Predicates for early stopping
ripr_finish()
Turn a fitted state into a mixture
ripr_fit()
A finished RIPr fit

Certification

Proving (or searching for) an upper bound on the null expectation of a random variable, to correct a fitted ratio into a genuine e-variable.

certify()
Certify an upper bound on the largest null expectation
ripr_certificate()
A certified upper bound on the largest null expectation
e_variable()
An e-variable from a certified bound
certify_trace()
Record how a certification ran, for inspection and plotting
sup_lb()
Estimate the largest null expectation of a random variable
ripr_search()
A searched lower bound on the largest null expectation