simace.censoring¶
censor¶
simace.censoring.censor
¶
Observation censoring for simulated phenotypes.
Applies age-window censoring and competing-risk death censoring to raw event times produced by the Weibull frailty phenotype model.
age_censor
¶
Apply per-individual [left, right] age censoring.
- t < left: left-censored (onset before observation window), t set to left
- t > right: right-censored (onset after observation window), t set to right
A zero-width window (left == right, e.g. [80, 80]) fully censors the
generation: every individual is flagged as censored because no continuous
onset time can fall strictly within a zero-length interval.
| PARAMETER | DESCRIPTION |
|---|---|
t
|
array of time-to-onset values
TYPE:
|
left
|
array of left-censoring ages (per individual)
TYPE:
|
right
|
array of right-censoring ages (per individual)
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
(t_censored, age_censored)
|
tuple of arrays |
Source code in simace/censoring/censor.py
death_censor
¶
Apply competing risk death censoring with Weibull hazard.
| PARAMETER | DESCRIPTION |
|---|---|
t
|
array of time-to-onset values
TYPE:
|
seed
|
random seed
TYPE:
|
scale
|
Weibull scale parameter for death hazard
TYPE:
|
rho
|
Weibull shape parameter for death hazard
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
(t_censored, death_censored)
|
tuple of arrays |
Source code in simace/censoring/censor.py
run_censor
¶
Apply censoring to raw phenotype event times.
| PARAMETER | DESCRIPTION |
|---|---|
phenotype
|
DataFrame with raw event times (t1, t2) from run_phenotype.
TYPE:
|
censor_age
|
maximum follow-up age (right boundary of the default observation window).
TYPE:
|
seed
|
RNG seed for the competing-risk death draw.
TYPE:
|
gen_censoring
|
per-generation
TYPE:
|
death_scale
|
Weibull scale for the competing-risk death hazard.
TYPE:
|
death_rho
|
Weibull shape for the competing-risk death hazard.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
DataFrame with original columns plus censoring columns: |
DataFrame
|
death_age, age_censored1/2, t_observed1/2, death_censored1/2, affected1/2 |
Source code in simace/censoring/censor.py
cli
¶
Command-line interface for censoring phenotype data.