Frequently Asked Questions
This page contains frequently asked questions about CensoredDistributions.jl. If you have a question that is not answered here, please open a discussion on the GitHub repository.
Working with tutorials
Q: How can I run the tutorial notebooks?
A: You have two options:
Option 1: Copy and paste (easiest)
Copy code blocks from the online tutorials
Paste into your Julia REPL or script
Modify as needed for your analysis
Option 2: Run tutorial scripts directly
Clone the repository:
git clone https://github.com/EpiAware/CensoredDistributions.jl.gitStart Julia in the repository directory:
julia --project=docsRun a tutorial:
include("docs/src/getting-started/tutorials/analytical-primarycensored-cdfs.jl")
The tutorial .jl files are plain Julia scripts that can be run top-to-bottom in the REPL or executed as scripts.
Using the package
Q: How do I create a primary censored distribution?
A: Use the primary_censored function:
using CensoredDistributions, Distributions
# Delay distribution (e.g., incubation period)
delay_dist = Gamma(2, 3)
# Primary event distribution (e.g., infection within a day)
primary_dist = Uniform(0, 1)
# Create censored distribution
censored_dist = primary_censored(delay_dist, primary_dist)CensoredDistributions.PrimaryCensored{Distributions.Gamma{Float64}, Distributions.Uniform{Float64}, AnalyticalSolver{CensoredDistributions.GaussLegendre{CensoredDistributions._GL{Vector{Float64}, Vector{Float64}}}}}(
dist: Distributions.Gamma{Float64}(α=2.0, θ=3.0)
primary_event: Distributions.Uniform{Float64}(a=0.0, b=1.0)
method: AnalyticalSolver{CensoredDistributions.GaussLegendre{CensoredDistributions._GL{Vector{Float64}, Vector{Float64}}}}(CensoredDistributions.GaussLegendre{CensoredDistributions._GL{Vector{Float64}, Vector{Float64}}}(64, CensoredDistributions._GL{Vector{Float64}, Vector{Float64}}([-0.9993050417357722, -0.9963401167719553, -0.9910133714767443, -0.983336253884626, -0.973326827789911, -0.9610087996520538, -0.9464113748584028, -0.9295691721319396, -0.9105221370785028, -0.8893154459951141 … 0.8893154459951141, 0.9105221370785028, 0.9295691721319396, 0.9464113748584028, 0.9610087996520538, 0.973326827789911, 0.983336253884626, 0.9910133714767443, 0.9963401167719553, 0.9993050417357722], [0.0017832807216964326, 0.004147033260562467, 0.006504457968978363, 0.008846759826363949, 0.011168139460131126, 0.013463047896718644, 0.01572603047602472, 0.01795171577569734, 0.020134823153530212, 0.02227017380838325 … 0.02227017380838325, 0.020134823153530212, 0.01795171577569734, 0.01572603047602472, 0.013463047896718644, 0.011168139460131126, 0.008846759826363949, 0.006504457968978363, 0.004147033260562467, 0.0017832807216964326])))
)Q: What's the difference between the different types of censoring?
A:
Primary event censoring: The timing of the initial event in a delay distribution is uncertain. See the tutorials for detailed examples.
Interval censoring: Continuous values are observed only within discrete intervals. See the API documentation for
interval_censored.Double interval censoring: Combines both types of censoring. See
double_interval_censoredin the API documentation.
Q: How do I fit censored distributions to data?
A: See the Fitting with Turing.jl tutorial in the tutorials section for Bayesian inference examples using Turing.jl.
Q: Which distributions have analytical solutions for better performance?
A: See the Analytical CDF Solutions tutorial in the tutorials section for details on which distribution combinations have optimized implementations.
Q: Can I use this with automatic differentiation?
A: Yes. See the Automatic differentiation backends tutorial for a worked example and per-backend timings. The CI badges on the repo README track which backend/scenario pairs currently pass.
Common issues
Q: I get "Package not found" errors
A: Make sure you're in the right environment:
using Pkg
Pkg.activate(".") # Activate current directory
Pkg.instantiate() # Install dependencies
Pkg.add("CensoredDistributions") # Add the package if neededQ: How do I cite this package?
A: Please cite the GitHub repository and mention the version you used. Citation information for the associated paper will be added when available.
Q: I want to contribute to development
A: See the Developer FAQ and Contributing Guide for development-specific questions and guidelines.
Getting help
Still have questions?
Package-specific: Open a GitHub Discussion
General Julia help: Julia Discourse or Julia Slack
Bug reports: GitHub Issues