| Title: | Reproduce IMpower133 Clinical Trial Results |
|---|---|
| Description: | Provides functions to simulate baseline characteristics, reconstruct overall survival data from published Kaplan-Meier curves, and generate publication-ready tables and forest plots reproducing the IMpower133 clinical trial results (Horn et al., 2018, <doi:10.1056/NEJMoa1809064>). The IPD reconstruction method is based on Liu et al. (2021, <doi:10.1186/s12874-021-01285-7>). |
| Authors: | Lu Huang [aut, cre], Wenkai Nie [aut], Qingyang Jiang [aut], Qinxin Chen [aut] |
| Maintainer: | Lu Huang <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.0 |
| Built: | 2026-06-12 09:10:11 UTC |
| Source: | https://github.com/fanfande131/impower133 |
Analyze survival data and print key statistics
analyze_survival(ipd_data, type = c("OS", "PFS"), times = 12)analyze_survival(ipd_data, type = c("OS", "PFS"), times = 12)
ipd_data |
Reconstructed data frame or CSV path |
type |
"OS" or "PFS" |
times |
Landmark time point in months, default 12 |
A list of key statistics (invisibly)
Create a publication-ready baseline characteristics table using the gt package, formatted to match the original IMpower133 publication style.
make_table1(data)make_table1(data)
data |
Data frame from simulate_impower133() |
A gt table object
Create a publication-ready table summarizing objective response rate, duration of response, and disease progression outcomes using the gt package.
make_table2(data)make_table2(data)
data |
Data frame from simulate_impower133() |
A gt table object
Create a publication-ready adverse events table summarizing treatment-related adverse events by grade in the as-treated population, using the gt package.
make_table3(data)make_table3(data)
data |
Data frame from simulate_impower133() |
A gt table object
Calculate hazard ratios for each subgroup based on simulated baseline data merged with reconstructed OS data, and generate a forest plot in the original IMpower133 publication style.
plot_figure2c(data, output_path = "figure2c.png")plot_figure2c(data, output_path = "figure2c.png")
data |
Data frame from simulate_impower133() with os_path specified |
output_path |
Path to output image file, default "figure2c.png" |
No return value, saves image to output_path
Plot survival K-M curve
plot_survival( ipd_data, type = c("OS", "PFS"), output_path = tempfile(fileext = ".png"), width = 10, height = 6 )plot_survival( ipd_data, type = c("OS", "PFS"), output_path = tempfile(fileext = ".png"), width = 10, height = 6 )
ipd_data |
Reconstructed data frame or CSV path |
type |
"OS" or "PFS" |
output_path |
Path to output image file |
width, height
|
Image dimensions in inches |
No return value, called for side effects (saves a plot to file).
Use IPDfromKM to extract coordinates from published Kaplan-Meier curves and reconstruct individual patient data (IPD).
reconstruct_survival( img_path, trisk, nrisk_control, nrisk_treatment, x1 = 0, x2 = 21, y1 = 0, y2 = 1, output_csv = tempfile(fileext = ".csv"), type = c("OS", "PFS") )reconstruct_survival( img_path, trisk, nrisk_control, nrisk_treatment, x1 = 0, x2 = 21, y1 = 0, y2 = 1, output_csv = tempfile(fileext = ".csv"), type = c("OS", "PFS") )
img_path |
Path to K-M curve image |
trisk |
Vector of risk time points |
nrisk_control |
Number at risk for control group |
nrisk_treatment |
Number at risk for treatment group |
x1, x2
|
X-axis range (actual values) |
y1, y2
|
Y-axis range (actual values) |
output_csv |
Path to output CSV file |
type |
"OS" or "PFS" |
A data frame with columns time, status, arm (invisibly)
Generate random numbers following a triangular distribution, useful for simulating continuous variables whose median is not at the center of the range.
rtriang(n, min_val, mode_val, max_val)rtriang(n, min_val, mode_val, max_val)
n |
Sample size |
min_val |
Minimum value |
mode_val |
Mode (peak location) |
max_val |
Maximum value |
A numeric vector of length n
rtriang(100, 28, 64, 90)rtriang(100, 28, 64, 90)
Simulate 403 virtual patients' baseline characteristics, efficacy outcomes, and safety data based on published summary statistics from Tables 1-3.
simulate_impower133( seed = 21, os_path = NULL, pfs_path = NULL, method = c("risk_score", "random"), output_path = tempfile(fileext = ".csv") )simulate_impower133( seed = 21, os_path = NULL, pfs_path = NULL, method = c("risk_score", "random"), output_path = tempfile(fileext = ".csv") )
seed |
Random seed, default 21 |
os_path |
Path to reconstructed OS data CSV (optional) |
pfs_path |
Path to reconstructed PFS data CSV (optional) |
method |
Matching method: "random" or "risk_score" (default) |
output_path |
Path to save output CSV |
A data.frame with 403 rows and all variables (invisibly)
df <- simulate_impower133() head(df)df <- simulate_impower133() head(df)