Skip to content

Models

get_model("pd_v2") returns the registered model after checking the sha256 of its Stan programs.

program role label
model.stan the population model of record, byte-identical to the study VALIDATED
forecast_gq.stan standalone generated quantities: y_rep_c, y_rep_p, mu_c TESTED
conditional.stan one participant conditioned on fixed global parameters EXPERIMENTAL use

ModelConfig.primary() sets the study's primary arm: A01 off, A02 on, A03 on for MoCA only. ModelConfig.a01_sensitivity() sets the pre-declared sensitivity arm.

New models register beside pd_v2 with register_model(ModelSpec(...)), each with its own digests. pd_v2 can never be replaced. Read its assumptions and known limits on the model card.

pd_bb: a discrete observation model (EXPERIMENTAL)

pd_v2 reads each score as a bounded Gaussian. Yet MDS-UPDRS Part III, MoCA and SCOPA-AUT are integer sum scores. pd_bb keeps the pd_v2 latent process and swaps the observation model. It is registered beside pd_v2 under its own name and digest, and pd_v2 is unchanged.

Each score y on L to U is read as L plus a beta-binomial count on n = U - L trials. The mean share p comes from the pd_v2 link, and a precision phi per endpoint sets the spread. The mean is L + n p and the variance is n p (1 - p) (phi + n) / (phi + 1). Every integer on the scale has positive mass, so floors and ceilings need no truncation or censoring switch.

MoCA also carries a transient practice term. On the logit scale of p it adds gamma_practice times a weight w. The weight is zero at a participant's first MoCA and exp(-gap / tau) at a later one. Here gap is the time in years since the previous MoCA, and tau is 1 year by default. The term moves the recorded score only; the latent transition never sees it.

from symphony_dt.data import discrete_stan_data, simulate_discrete_cohort
from symphony_dt.fit import fit

cohort = simulate_discrete_cohort(40, seed=1)  # integer scores from the pd_bb prior
result = fit(cohort.stan_data, model="pd_bb", chains=4)
print(result.draws("gamma_practice").mean())

block = discrete_stan_data(stan_data, practice_tau_years=1.0)  # from build_stan_data

discrete_stan_data converts a pd_v2 data block. It raises on a score that is not a whole number, unless round_scores=True, which rounds and records the count in the audit. practice_weights computes w from any data block, and beta_binomial_moments gives the mean and variance used above.

pd_bb_prior_design is the simulation-based calibration design for pd_bb. A smoke run with require_gates=False checks the machinery on a few replicates. It is not a calibration result. A full-size run has not been done.

Beta-binomial models for bounded health scores were described by Arostegui, Nunez-Anton and Quintana (2007). Practice effects under serial cognitive testing are reviewed by Goldberg and colleagues (2015). Read the assumptions and limits on the model card with model_card("pd_bb").