posthoc.simulation

class posthoc.simulation.base.PhenotypeModel(additive_indices=<factory>, additive_effects=<factory>, dominant_indices=<factory>, dominant_effects=<factory>, recessive_indices=<factory>, recessive_effects=<factory>, interaction_pairs=<factory>, interaction_effects=<factory>, interaction_triples=<factory>, interaction_triple_effects=<factory>, heritability=0.5, task='linear', prevalence=0.1, seed=None)[source]

Bases: object

Additive + dominant + recessive + interaction liability model, following Yelmen et al. (2026).

Parameters:
additive_indices: ndarray
additive_effects: ndarray
dominant_indices: ndarray
dominant_effects: ndarray
recessive_indices: ndarray
recessive_effects: ndarray
interaction_pairs: list[tuple[int, int]]
interaction_effects: ndarray
interaction_triples: list[tuple[int, int, int]]
interaction_triple_effects: ndarray
heritability: float = 0.5
task: str = 'linear'
prevalence: float = 0.1
seed: int | None = None
all_causal_indices()[source]

Union of every SNP index involved in any effect term.

Return type:

ndarray

class posthoc.simulation.base.SimulationResult(genotype_data, phenotype, causal_indices, liability=None, metadata=<factory>)[source]

Bases: object

Real genotypes + simulated phenotype, with ground truth for scoring.

Parameters:
genotype_data: GenotypeData
phenotype: ndarray
causal_indices: ndarray
liability: ndarray | None = None
metadata: dict
property sample_ids: list[str]
property variant_df: DataFrame
as_pheno_df(pheno_name='PHENO1')[source]
Parameters:

pheno_name (str)

Return type:

DataFrame

causal_variant_ids()[source]
Return type:

list[str]

posthoc.simulation.base.simulate_phenotype(genotypes, model, covariates=None, covariate_effects=None)[source]
Parameters:
Return type:

tuple[ndarray, ndarray | None]

posthoc.simulation.base.simulate(genotype_data, phenotype_model, covariates=None, covariate_effects=None)[source]

Simulate a phenotype on top of real genotype data (e.g. from read_pgen).

Parameters:
Return type:

SimulationResult