Dirichlet
params.Dirichlet(alpha, names=None)Dirichlet distribution: a vector of transition probabilities summing to 1.
Multivariate: inside a ParameterSet a Dirichlet named p with component names ("a", "b") expands to draw columns p[a] and p[b]. Sampling uses the standard construction of independent Gamma(alpha_i, 1) marginals normalised to sum to one, which makes each component compatible with the copula machinery. Leave the correlation entries for Dirichlet component columns at zero; correlating the underlying gammas with other parameters distorts the Dirichlet.
Example
from heormodel.params import Dirichlet d = Dirichlet((80, 15, 5), names=(“stay”, “progress”, “die”)) d.mean().round(2).tolist() [0.8, 0.15, 0.05]
Attributes
| Name | Description |
|---|---|
| n_components | Number of components in the probability vector. |
Methods
| Name | Description |
|---|---|
| component_gammas | The independent Gamma(alpha_i, 1) marginals used for sampling. |
| component_labels | Expanded column names, e.g. base[stay] or base[0]. |
| mean | Component means alpha_i / sum(alpha). |
| sample | Draw n probability vectors, shape (n, n_components). |
component_gammas
params.Dirichlet.component_gammas()The independent Gamma(alpha_i, 1) marginals used for sampling.
component_labels
params.Dirichlet.component_labels(base)Expanded column names, e.g. base[stay] or base[0].
mean
params.Dirichlet.mean()Component means alpha_i / sum(alpha).
sample
params.Dirichlet.sample(n, rng=None)Draw n probability vectors, shape (n, n_components).