Package: primarycensored 1.5.1

Sam Abbott

primarycensored: Primary Event Censored Distributions

Provides functions for working with primary event censored distributions and 'Stan' implementations for use in Bayesian modeling. Primary event censored distributions are useful for modeling delayed reporting scenarios in epidemiology and other fields (Charniga et al. (2024) <doi:10.48550/arXiv.2405.08841>). It also provides support for arbitrary delay distributions, a range of common primary distributions, and allows for truncation and secondary event censoring to be accounted for (Park et al. (2024) <doi:10.1101/2024.01.12.24301247>). A subset of common distributions also have analytical solutions implemented, allowing for faster computation. In addition, it provides multiple methods for fitting primary event censored distributions to data via optional dependencies.

Authors:Sam Abbott [aut, cre, cph], Sam Brand [aut], Adam Howes [ctb], James Mba Azam [aut], Carl Pearson [aut], Sebastian Funk [aut], Kelly Charniga [aut]

primarycensored_1.5.1.tar.gz
primarycensored_1.5.1.zip(r-4.7)primarycensored_1.5.1.zip(r-4.6)primarycensored_1.5.1.zip(r-4.5)
primarycensored_1.5.1.tgz(r-4.6-any)primarycensored_1.5.1.tgz(r-4.5-any)
primarycensored_1.5.1.tar.gz(r-4.7-any)primarycensored_1.5.1.tar.gz(r-4.6-any)
primarycensored_1.5.1.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
primarycensored/json (API)

# Install 'primarycensored' in R:
install.packages('primarycensored', repos = c('https://epinowcast.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/epinowcast/primarycensored/issues

Pkgdown/docs site:https://primarycensored.epinowcast.org

Datasets:

On CRAN:

Conda:

censoringdistributionsmc-stantruncation

8.72 score 9 stars 2 packages 34 scripts 1.2k downloads 28 exports 0 dependencies

Last updated from:25316493fd (on v1.5.1). Checks:7 ERROR, 2 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64ERROR153
source / vignettesOK218
linux-release-x86_64ERROR177
macos-release-arm64ERROR117
macos-oldrel-arm64ERROR114
windows-develERROR87
windows-releaseERROR85
windows-oldrelERROR95
wasm-releaseOK125

Exports:add_name_attributecheck_dprimarycheck_pdistcheck_truncationdexpgrowthdpcensdprimarycensoredfitdistdoublecensnew_pcenspcd_as_stan_datapcd_cmdstan_modelpcd_dist_namepcd_load_stan_functionspcd_stan_dist_idpcd_stan_filespcd_stan_function_depspcd_stan_functionspcd_stan_pathpcens_cdfpcens_quantilepexpgrowthppcenspprimarycensoredqpcensqprimarycensoredrexpgrowthrpcensrprimarycensored

Dependencies:

Analytic solutions for censored delay distributions
Introduction | What are we going to do in this vignette | Analytic solutions for exponentially tilted primary event times | Uniform primary event time ($r=0$) | General partial expectation | General discrete censored delay distribution | Gamma distributed delay times | Gamma partial expectation | Survival function of $S_{+}$ for Gamma distribution | CDF form of $S_{+}$ for Gamma distribution | Gamma discrete censored delay distribution | Log-Normal distribution | Log-Normal partial expectation | Survival function of $S_{+}$ for Log-Normal distribution | CDF form of $S_{+}$ for Log-Normal distribution | Log-Normal discrete censored delay distribution | Weibull distribution | Weibull partial expectation | Survival function of $S_{+}$ for Weibull distribution | CDF form of $S_{+}$ for Weibull distribution | Weibull discrete censored delay distribution | Learning more | References

Last update: 2026-04-22
Started: 2024-09-24

Why it works
Introduction | What are we going to do in this vignette | Censoring and right truncation problems in time to event analysis | Statistical model used in primarycensored | Censored delay time distribution | Survival function of time from the end of the primary censoring window to the secondary event time | CDF form of $S_+$ for uniform primary | Probability of secondary event time within a secondary censoring window | Connections to other approaches | Connection to Park et al 2024 | Learning more | References

Last update: 2026-04-22
Started: 2024-09-18

Getting started with primarycensored
Introduction | Packages in this getting started vignette. | Generating random samples with rprimarycensored() | Compute the primary event censored cumulative distribution function (CDF) for delays with pprimarycensored() | Compute the primary event censored probability mass function (PMF) with dprimarycensored() | Other key functionality | Learning more

Last update: 2026-02-12
Started: 2024-10-09

Readme and manuals

Help Manual

Help pageTopics
Helper method for custom distributionsadd_name_attribute
Check if a function is a valid bounded probability density function (PDF)check_dprimary
Check if a function is a valid cumulative distribution function (CDF)check_pdist
Check if truncation time is appropriate relative to the maximum delaycheck_truncation
Compute the primary event censored PMF for delaysdpcens dprimarycensored
Exponential growth distribution functionsdexpgrowth expgrowth pexpgrowth rexpgrowth
Fit a distribution to doubly censored datafitdistdoublecens
S3 class for primary event censored distribution computationnew_pcens
Prepare data for primarycensored Stan modelpcd_as_stan_data
Create a CmdStanModel with primarycensored Stan functionspcd_cmdstan_model
Get distribution function cdf or pdf namepcd_dist_name
Supported delay distributionspcd_distributions
Load Stan functions as a stringpcd_load_stan_functions
Supported primary event distributionspcd_primary_distributions
Get distribution stan ID by namepcd_stan_dist_id
Get Stan files containing specified functionspcd_stan_files
Get dependencies for a Stan functionpcd_stan_function_deps
Get Stan function names from Stan filespcd_stan_functions
Get the path to the Stan codepcd_stan_path
Compute primary event censored CDFpcens_cdf
Default method for computing primary event censored CDFpcens_cdf.default
Method for Gamma delay with uniform primarypcens_cdf.pcens_pgamma_dunif
Method for Log-Normal delay with uniform primarypcens_cdf.pcens_plnorm_dunif
Method for Weibull delay with uniform primarypcens_cdf.pcens_pweibull_dunif
Compute primary event censored quantilespcens_quantile
Default method for computing primary event censored quantilespcens_quantile.default
Compute the primary event censored CDF for delaysppcens pprimarycensored
Compute quantiles corresponding to target probabilities for primary event censored delaysqpcens qprimarycensored
Generate random samples from a primary event censored distributionrpcens rprimarycensored