Skip to content

Count Poisson observation model — full MCMC inference path #48

@m-murphy

Description

@m-murphy

Parent

#45

What to build

Deliver the end-to-end count observation model inference path: users load count barcodes (#47), select observation_model = "counts" on run_mcmc (default remains "binary"), and MCMC runs using Poisson count emissions.

Emission model (v1):

Absent (a ∉ S):     n_a ~ Poisson(λ_s / A)
Present (a ∈ S):    n_a ~ (1 - π_s) * Poisson(μ_a) + π_s * Poisson(λ_s / A)
                    μ_a = N / |S|

N = total reads at locus, A = alleles at locus. Parameter mapping: π_s = eps_neg_s × max_eps_neg; λ_s = eps_pos_s × max_eps_pos × (N / A). Reuse existing per-sample eps_pos / eps_neg MCMC state and Beta priors.

Implement CountPoissonObservationModel behind the observation interface (#46). Present-allele mixtures use log-sum-exp; Poisson means floored at a small epsilon. Missing loci contribute zero observation likelihood as today.

Update latent genotype sampling for count mode: preserve combinatorial FP/FN count constraints and MH log-prob correction, but use allele-specific weights from count emissions instead of exchangeable Bernoulli rates. Transmission likelihood and P(any missing) logic must not change.

Misconfiguration errors at MCMC init: e.g. count barcodes (values > 1) with observation_model = "binary", and incompatible data/model pairings with clear messages.

Acceptance criteria

  • run_mcmc(..., observation_model = "binary" | "counts") plumbed through R → C++ Parameters; default "binary"
  • Count Poisson log-likelihood implemented and delegated from chain
  • Count-aware latent genotype sampler with correct MH adjustment terms
  • eps_pos / eps_neg map to noise rate and dropout probability per PRD PRD: Count-based observation model (alternative to binary error process) #45
  • C++ unit tests for count log-likelihood on hand-computed cases (absent noise, present signal, dropout mixture)
  • Misconfiguration validation with clear errors
  • Short MCMC integration test: count barcodes, observation_model = "counts", minimal burnin/samples, passes without error
  • Binary path regression unchanged (default args)

Blocked by

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestready-for-agentFully specified, ready for an AFK agent

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions