Skip to content

Latest commit

 

History

80 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CureSurvMRI

Code and prepared data for “A Regularized Semiparametric Cure-Rate Model with High-Dimensional Imaging Data.”

CureSurvMRI fits a mixture cure-rate model with an imaging effect in each of two components:

  • the incidence component models whether a subject is susceptible to the event; and
  • the latency component models time to event among susceptible subjects.

Images on an irregular brain domain are represented by degree-2 bivariate Bernstein polynomials over a triangulation. An EM algorithm then alternates between latent susceptibility updates and penalized logistic/Cox regressions. The fitted imaging effects remain spatially localized and directly visualizable.

A look at the spatial model

The default 91 × 109 brain slice is represented over a 384-triangle mesh with 2,304 Bernstein basis functions. The approximation retains the irregular boundary instead of treating the image as a rectangular predictor.

Original brain slice and its Bernstein approximation over the triangular mesh

The representative registered slice used for this example is preserved as docs/images/sample-brain-slice.png; it is documentation provenance, not an analysis input.

The simulation below shows the true and estimated incidence effects (\alpha(s)) and latency effects (\beta(s)) for one (n=1000), (J=8) replicate. Red and blue mark positive and negative localized effects.

True and estimated incidence and latency coefficient functions from a simulation

Quick start

Run every command from the repository root. The analysis scripts were written for R 4.5.0 on a Slurm cluster and have also been checked with R 4.6.1.

Install the packages used by the main simulation and ADNI workflows:

install.packages(c(
  "argparse", "fmesher", "glmnet", "survival", "Matrix",
  "jpeg", "png", "imager", "dplyr",
  "riskRegression", "survAUC", "RhpcBLASctl",
  "tidyverse", "kableExtra", "hdcuremodels"
))

There is currently no lockfile, so save sessionInfo() with new production runs. EBImage is needed only to reconstruct the brain boundary from raw images; see Optional preprocessing.

Check the installation and exercise the end-to-end simulation path in a few seconds:

Rscript experiments/simu.R \
  --n 200 \
  --seed 1 \
  --auto-grid FALSE \
  --lambda-alpha 0.03 \
  --lambda-beta 0.06 \
  --refine-grid FALSE \
  --ic-type gBIC \
  --select-ic gBIC \
  --max-iter 100 \
  --save-results FALSE \
  --plot FALSE

This is a pipeline check, not a manuscript experiment. It uses one fixed penalty pair rather than the full coarse-to-fine tuning procedure.

Running experiments

One simulation replicate

The defaults reproduce the manuscript’s baseline design: (n=1000), no image noise, cure rate 0.35, susceptible-group censoring rate 0.30, 384 triangles, and four active triangles in each model component.

Rscript experiments/simu.R --seed 1

The script selects the incidence and latency penalties, evaluates support recovery and discrimination, and writes a tab-separated row set to results/simu/. Use Rscript experiments/simu.R --help for all settings.

Full simulation study

The manuscript uses 500 replicates per configuration and varies sample size, cure rate, susceptible-group censoring rate, image noise, active support size, and mesh resolution. The supplied launcher submits these jobs to Slurm:

bash experiments/submit_simu.sh 500

This is a large cluster run—thousands of one-core jobs—not a laptop command. After all jobs finish, aggregate them with:

Rscript experiments/analyze_simu.R \
  --results-dir results/simu \
  --output-dir results \
  --expected-reps 500

The aggregator writes results/res_supp.csv and results/res_est.csv and prints the LaTeX-ready tables used in the manuscript and supplement. Versioned copies of the manuscript summaries are retained in docs/reference-results/ for comparison.

Generate the representative coefficient-recovery plots with:

bash experiments/plot_simu.sh 1

ADNI cross-validation

The tracked data/*.rds and util_data/*.rds files are sufficient to run the prepared ADNI analysis; raw scan images are not required.

For one fold:

Rscript experiments/run_adni.R \
  --nfold 5 \
  --fold 1 \
  --ncores 8 \
  --results-dir results/adni

For all five folds on Slurm:

bash experiments/submit_adni.sh 5

The launcher separates the spline/Z-only fits from the FPCA/sFPCA fits because the latter need more memory. Once every fold is complete:

Rscript experiments/analyze_adni.R \
  --nfold 5 \
  --results-dir results/adni \
  --save-results TRUE

This creates the cross-validated susceptibility AUC, time-dependent AUC/Brier, Uno C-index, prediction files, and coefficient-map figures.

For an exact mapping from commands and artifacts to every manuscript figure and table, read Reproducing the manuscripts.

Repository map

Path Role
R/ Statistical model, Bernstein basis, mesh, FPCA/sFPCA, and plotting functions; see R/README.md
experiments/ Simulation and ADNI entry points, aggregators, helpers, and Slurm launchers; see experiments/README.md
data/ Prepared event, demographic, and image-basis inputs; see data/README.md
util_data/ Boundary, meshes, Bernstein designs, and Gram matrices; see util_data/README.md
docs/ Reproduction guide, image provenance, and manuscript-level reference results; see docs/README.md
results/ Ignored generated fits, replicate outputs, tables, and figures; see results/README.md
get_contour.R Optional extraction of a brain boundary from a representative registered image
make_mesh.R Optional regeneration of a mesh, Bernstein designs, and Gram matrix

All scripts assume the repository root is the working directory because source and data paths are relative.

Data and generated artifacts

The prepared analysis contains 814 subjects, 2,304 image features, two standardized demographic covariates, and the 384-triangle default mesh. Alternative 172- and 610-triangle mesh/design objects support the supplement’s mesh-resolution experiment.

Generated contents of results/ and all of logs/ are intentionally ignored by Git; only the result-directory READMEs are tracked. A fresh clone therefore contains the prepared inputs and code, but not cluster logs, replicate rows, or fitted model objects. The compact manuscript-level reference CSVs in docs/reference-results/ are tracked for comparison; they do not replace the raw replicate or fold objects needed for a full audit. Archive production outputs outside the working tree before starting a new run, and note that simulation result files append when the same seed filename already exists.

Raw neuroimages under data/brain_img/ are also ignored and are unnecessary for the standard reproduction. Their expected naming and relationship to the prepared matrices are documented in data/README.md. Follow the applicable ADNI access and data-use requirements when reconstructing image features.

Optional preprocessing

The standard reproduction starts from the tracked prepared objects. To rebuild earlier stages:

  1. get_contour.R extracts and smooths the brain boundary from a representative registered image in data/brain_img/. It requires imager, readr, and Bioconductor’s EBImage.
  2. make_mesh.R constructs the mesh, Bernstein design matrices, fine plotting design, and Gram matrix.
  3. experiments/form_adni_data.R forms event data, smooths baseline images, and creates C, X, and Z.

These files currently expose their preprocessing choices as editable settings rather than command-line options. Review read.only, image paths, mesh resolution, and the diagnostic block before running them; they write tracked data objects in place.

To install the optional Bioconductor dependency:

if (!requireNamespace("BiocManager", quietly = TRUE)) {
  install.packages("BiocManager")
}
BiocManager::install("EBImage")

Citation

If this code supports your work, cite the accompanying manuscript:

A Regularized Semiparametric Cure-Rate Model with High-Dimensional Imaging Data.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages