survival 1.1.23__cp314-cp314-manylinux_2_39_aarch64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of survival might be problematic. Click here for more details.

survival/py.typed ADDED
File without changes
@@ -0,0 +1,675 @@
1
+ Metadata-Version: 2.4
2
+ Name: survival
3
+ Version: 1.1.23
4
+ Classifier: Development Status :: 5 - Production/Stable
5
+ Classifier: Intended Audience :: Science/Research
6
+ Classifier: Intended Audience :: Healthcare Industry
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Operating System :: POSIX :: Linux
9
+ Classifier: Operating System :: MacOS
10
+ Classifier: Operating System :: Microsoft :: Windows
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Rust
13
+ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
14
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
15
+ Classifier: Typing :: Typed
16
+ Requires-Dist: pre-commit==4.5.1 ; extra == 'dev'
17
+ Requires-Dist: pytest==9.0.2 ; extra == 'dev'
18
+ Requires-Dist: numpy==2.4.0 ; extra == 'dev'
19
+ Requires-Dist: pytest==9.0.2 ; extra == 'test'
20
+ Requires-Dist: numpy==2.4.0 ; extra == 'test'
21
+ Requires-Dist: pandas==2.3.3 ; extra == 'test'
22
+ Requires-Dist: polars==1.36.1 ; extra == 'test'
23
+ Provides-Extra: dev
24
+ Provides-Extra: test
25
+ License-File: LICENSE
26
+ Summary: A high-performance survival analysis library written in Rust with Python bindings
27
+ Keywords: survival-analysis,kaplan-meier,cox-regression,statistics,biostatistics,rust
28
+ Author-email: Cameron Lyons <cameron.lyons2@gmail.com>
29
+ Maintainer-email: Cameron Lyons <cameron.lyons2@gmail.com>
30
+ License: MIT
31
+ Requires-Python: >=3.9
32
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
33
+ Project-URL: Documentation, https://github.com/Cameron-Lyons/survival#readme
34
+ Project-URL: Issues, https://github.com/Cameron-Lyons/survival/issues
35
+ Project-URL: Repository, https://github.com/Cameron-Lyons/survival
36
+
37
+ # survival
38
+
39
+ [![Crates.io](https://img.shields.io/crates/v/survival.svg)](https://crates.io/crates/survival)
40
+ [![PyPI version](https://img.shields.io/pypi/v/survival.svg)](https://pypi.org/project/survival/)
41
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
42
+
43
+ A high-performance survival analysis library written in Rust, with a Python API powered by [PyO3](https://github.com/PyO3/pyo3) and [maturin](https://github.com/PyO3/maturin).
44
+
45
+ ## Features
46
+
47
+ - Core survival analysis routines
48
+ - Cox proportional hazards models with frailty
49
+ - Kaplan-Meier and Aalen-Johansen (multi-state) survival curves
50
+ - Nelson-Aalen estimator
51
+ - Parametric accelerated failure time models
52
+ - Fine-Gray competing risks model
53
+ - Penalized splines (P-splines) for smooth covariate effects
54
+ - Concordance index calculations
55
+ - Person-years calculations
56
+ - Score calculations for survival models
57
+ - Residual analysis (martingale, Schoenfeld, score residuals)
58
+ - Bootstrap confidence intervals
59
+ - Cross-validation for model assessment
60
+ - Statistical tests (log-rank, likelihood ratio, Wald, score, proportional hazards)
61
+ - Sample size and power calculations
62
+ - RMST (Restricted Mean Survival Time) analysis
63
+ - Landmark analysis
64
+ - Calibration and risk stratification
65
+ - Time-dependent AUC
66
+ - Conditional logistic regression
67
+ - Time-splitting utilities
68
+
69
+ ## Installation
70
+
71
+ ### From PyPI (Recommended)
72
+
73
+ ```sh
74
+ pip install survival
75
+ ```
76
+
77
+ ### From Source
78
+
79
+ #### Prerequisites
80
+
81
+ - Python 3.9+
82
+ - Rust (see [rustup.rs](https://rustup.rs/))
83
+ - [maturin](https://github.com/PyO3/maturin)
84
+
85
+ Install maturin:
86
+ ```sh
87
+ pip install maturin
88
+ ```
89
+
90
+ #### Build and Install
91
+
92
+ Build the Python wheel:
93
+ ```sh
94
+ maturin build --release
95
+ ```
96
+
97
+ Install the wheel:
98
+ ```sh
99
+ pip install target/wheels/survival-*.whl
100
+ ```
101
+
102
+ For development:
103
+ ```sh
104
+ maturin develop
105
+ ```
106
+
107
+ ## Usage
108
+
109
+ ### Aalen's Additive Regression Model
110
+
111
+ ```python
112
+ from survival import AaregOptions, aareg
113
+
114
+ data = [
115
+ [1.0, 0.0, 0.5],
116
+ [2.0, 1.0, 1.5],
117
+ [3.0, 0.0, 2.5],
118
+ ]
119
+ variable_names = ["time", "event", "covariate1"]
120
+
121
+ # Create options with required parameters (formula, data, variable_names)
122
+ options = AaregOptions(
123
+ formula="time + event ~ covariate1",
124
+ data=data,
125
+ variable_names=variable_names,
126
+ )
127
+
128
+ # Optional: modify default values via setters
129
+ # options.weights = [1.0, 1.0, 1.0]
130
+ # options.qrtol = 1e-8
131
+ # options.dfbeta = True
132
+
133
+ result = aareg(options)
134
+ print(result)
135
+ ```
136
+
137
+ ### Penalized Splines (P-splines)
138
+
139
+ ```python
140
+ from survival import PSpline
141
+
142
+ x = [0.1 * i for i in range(100)]
143
+ pspline = PSpline(
144
+ x=x,
145
+ df=10,
146
+ theta=1.0,
147
+ eps=1e-6,
148
+ method="GCV",
149
+ boundary_knots=(0.0, 10.0),
150
+ intercept=True,
151
+ penalty=True,
152
+ )
153
+ pspline.fit()
154
+ ```
155
+
156
+ ### Concordance Index
157
+
158
+ ```python
159
+ from survival import perform_concordance1_calculation
160
+
161
+ time_data = [1.0, 2.0, 3.0, 4.0, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0]
162
+ weights = [1.0, 1.0, 1.0, 1.0, 1.0]
163
+ indices = [0, 1, 2, 3, 4]
164
+ ntree = 5
165
+
166
+ result = perform_concordance1_calculation(time_data, weights, indices, ntree)
167
+ print(f"Concordance index: {result['concordance_index']}")
168
+ ```
169
+
170
+ ### Cox Regression with Frailty
171
+
172
+ ```python
173
+ from survival import perform_cox_regression_frailty
174
+
175
+ result = perform_cox_regression_frailty(
176
+ time_data=[...],
177
+ status_data=[...],
178
+ covariates=[...],
179
+ # ... other parameters
180
+ )
181
+ ```
182
+
183
+ ### Person-Years Calculation
184
+
185
+ ```python
186
+ from survival import perform_pyears_calculation
187
+
188
+ result = perform_pyears_calculation(
189
+ time_data=[...],
190
+ weights=[...],
191
+ # ... other parameters
192
+ )
193
+ ```
194
+
195
+ ### Kaplan-Meier Survival Curves
196
+
197
+ ```python
198
+ from survival import survfitkm, SurvFitKMOutput
199
+
200
+ # Example survival data
201
+ time = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]
202
+ status = [1.0, 1.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0] # 1 = event, 0 = censored
203
+ weights = [1.0] * len(time) # Optional: equal weights
204
+
205
+ result = survfitkm(
206
+ time=time,
207
+ status=status,
208
+ weights=weights,
209
+ entry_times=None, # Optional: entry times for left-truncation
210
+ position=None, # Optional: position flags
211
+ reverse=False, # Optional: reverse time order
212
+ computation_type=0 # Optional: computation type
213
+ )
214
+
215
+ print(f"Time points: {result.time}")
216
+ print(f"Survival estimates: {result.estimate}")
217
+ print(f"Standard errors: {result.std_err}")
218
+ print(f"Number at risk: {result.n_risk}")
219
+ ```
220
+
221
+ ### Fine-Gray Competing Risks Model
222
+
223
+ ```python
224
+ from survival import finegray, FineGrayOutput
225
+
226
+ # Example competing risks data
227
+ tstart = [0.0, 0.0, 0.0, 0.0]
228
+ tstop = [1.0, 2.0, 3.0, 4.0]
229
+ ctime = [0.5, 1.5, 2.5, 3.5] # Cut points
230
+ cprob = [0.1, 0.2, 0.3, 0.4] # Cumulative probabilities
231
+ extend = [True, True, False, False] # Whether to extend intervals
232
+ keep = [True, True, True, True] # Which cut points to keep
233
+
234
+ result = finegray(
235
+ tstart=tstart,
236
+ tstop=tstop,
237
+ ctime=ctime,
238
+ cprob=cprob,
239
+ extend=extend,
240
+ keep=keep
241
+ )
242
+
243
+ print(f"Row indices: {result.row}")
244
+ print(f"Start times: {result.start}")
245
+ print(f"End times: {result.end}")
246
+ print(f"Weights: {result.wt}")
247
+ ```
248
+
249
+ ### Parametric Survival Regression (Accelerated Failure Time Models)
250
+
251
+ ```python
252
+ from survival import survreg, SurvivalFit, DistributionType
253
+
254
+ # Example survival data
255
+ time = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]
256
+ status = [1.0, 1.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0] # 1 = event, 0 = censored
257
+ covariates = [
258
+ [1.0, 2.0],
259
+ [1.5, 2.5],
260
+ [2.0, 3.0],
261
+ [2.5, 3.5],
262
+ [3.0, 4.0],
263
+ [3.5, 4.5],
264
+ [4.0, 5.0],
265
+ [4.5, 5.5],
266
+ ]
267
+
268
+ # Fit parametric survival model
269
+ result = survreg(
270
+ time=time,
271
+ status=status,
272
+ covariates=covariates,
273
+ weights=None, # Optional: observation weights
274
+ offsets=None, # Optional: offset values
275
+ initial_beta=None, # Optional: initial coefficient values
276
+ strata=None, # Optional: stratification variable
277
+ distribution="weibull", # "extreme_value", "logistic", "gaussian", "weibull", or "lognormal"
278
+ max_iter=20, # Optional: maximum iterations
279
+ eps=1e-5, # Optional: convergence tolerance
280
+ tol_chol=1e-9, # Optional: Cholesky tolerance
281
+ )
282
+
283
+ print(f"Coefficients: {result.coefficients}")
284
+ print(f"Log-likelihood: {result.log_likelihood}")
285
+ print(f"Iterations: {result.iterations}")
286
+ print(f"Variance matrix: {result.variance_matrix}")
287
+ print(f"Convergence flag: {result.convergence_flag}")
288
+ ```
289
+
290
+ ### Cox Proportional Hazards Model
291
+
292
+ ```python
293
+ from survival import CoxPHModel, Subject
294
+
295
+ # Create a Cox PH model
296
+ model = CoxPHModel()
297
+
298
+ # Or create with data
299
+ covariates = [[1.0, 2.0], [2.0, 3.0], [1.5, 2.5]]
300
+ event_times = [1.0, 2.0, 3.0]
301
+ censoring = [1, 1, 0] # 1 = event, 0 = censored
302
+
303
+ model = CoxPHModel.new_with_data(covariates, event_times, censoring)
304
+
305
+ # Fit the model
306
+ model.fit(n_iters=10)
307
+
308
+ # Get results
309
+ print(f"Baseline hazard: {model.baseline_hazard}")
310
+ print(f"Risk scores: {model.risk_scores}")
311
+ print(f"Coefficients: {model.get_coefficients()}")
312
+
313
+ # Predict on new data
314
+ new_covariates = [[1.0, 2.0], [2.0, 3.0]]
315
+ predictions = model.predict(new_covariates)
316
+ print(f"Predictions: {predictions}")
317
+
318
+ # Calculate Brier score
319
+ brier = model.brier_score()
320
+ print(f"Brier score: {brier}")
321
+
322
+ # Compute survival curves for new covariates
323
+ new_covariates = [[1.0, 2.0], [2.0, 3.0]]
324
+ time_points = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0] # Optional: specific time points
325
+ times, survival_curves = model.survival_curve(new_covariates, time_points)
326
+ print(f"Time points: {times}")
327
+ print(f"Survival curves: {survival_curves}") # One curve per covariate set
328
+
329
+ # Create and add subjects
330
+ subject = Subject(
331
+ id=1,
332
+ covariates=[1.0, 2.0],
333
+ is_case=True,
334
+ is_subcohort=True,
335
+ stratum=0
336
+ )
337
+ model.add_subject(subject)
338
+ ```
339
+
340
+ ### Cox Martingale Residuals
341
+
342
+ ```python
343
+ from survival import coxmart
344
+
345
+ # Example survival data
346
+ time = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0]
347
+ status = [1, 1, 0, 1, 0, 1, 1, 0] # 1 = event, 0 = censored
348
+ score = [0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2] # Risk scores
349
+
350
+ # Calculate martingale residuals
351
+ residuals = coxmart(
352
+ time=time,
353
+ status=status,
354
+ score=score,
355
+ weights=None, # Optional: observation weights
356
+ strata=None, # Optional: stratification variable
357
+ method=0, # Optional: method (0 = Breslow, 1 = Efron)
358
+ )
359
+
360
+ print(f"Martingale residuals: {residuals}")
361
+ ```
362
+
363
+ ### Survival Difference Tests (Log-Rank Test)
364
+
365
+ ```python
366
+ from survival import survdiff2, SurvDiffResult
367
+
368
+ # Example: Compare survival between two groups
369
+ time = [1.0, 2.0, 3.0, 4.0, 5.0, 1.5, 2.5, 3.5, 4.5, 5.5]
370
+ status = [1, 1, 0, 1, 0, 1, 1, 1, 0, 1]
371
+ group = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2] # Group 1 and Group 2
372
+
373
+ # Perform log-rank test (rho=0 for standard log-rank)
374
+ result = survdiff2(
375
+ time=time,
376
+ status=status,
377
+ group=group,
378
+ strata=None, # Optional: stratification variable
379
+ rho=0.0, # 0.0 = log-rank, 1.0 = Wilcoxon, other = generalized
380
+ )
381
+
382
+ print(f"Observed events: {result.observed}")
383
+ print(f"Expected events: {result.expected}")
384
+ print(f"Chi-squared statistic: {result.chi_squared}")
385
+ print(f"Degrees of freedom: {result.degrees_of_freedom}")
386
+ print(f"Variance matrix: {result.variance}")
387
+ ```
388
+
389
+ ### Built-in Datasets
390
+
391
+ The library includes 30 classic survival analysis datasets:
392
+
393
+ ```python
394
+ from survival import load_lung, load_aml, load_veteran
395
+
396
+ # Load the lung cancer dataset
397
+ lung = load_lung()
398
+ print(f"Columns: {lung['columns']}")
399
+ print(f"Number of rows: {len(lung['data'])}")
400
+
401
+ # Load the acute myelogenous leukemia dataset
402
+ aml = load_aml()
403
+
404
+ # Load the veteran's lung cancer dataset
405
+ veteran = load_veteran()
406
+ ```
407
+
408
+ **Available datasets:**
409
+ - `load_lung()` - NCCTG Lung Cancer Data
410
+ - `load_aml()` - Acute Myelogenous Leukemia Survival Data
411
+ - `load_veteran()` - Veterans' Administration Lung Cancer Study
412
+ - `load_ovarian()` - Ovarian Cancer Survival Data
413
+ - `load_colon()` - Colon Cancer Data
414
+ - `load_pbc()` - Primary Biliary Cholangitis Data
415
+ - `load_cgd()` - Chronic Granulomatous Disease Data
416
+ - `load_bladder()` - Bladder Cancer Recurrences
417
+ - `load_heart()` - Stanford Heart Transplant Data
418
+ - `load_kidney()` - Kidney Catheter Data
419
+ - `load_rats()` - Rat Treatment Data
420
+ - `load_stanford2()` - Stanford Heart Transplant Data (Extended)
421
+ - `load_udca()` - UDCA Clinical Trial Data
422
+ - `load_myeloid()` - Acute Myeloid Leukemia Clinical Trial
423
+ - `load_flchain()` - Free Light Chain Data
424
+ - `load_transplant()` - Liver Transplant Data
425
+ - `load_mgus()` - Monoclonal Gammopathy Data
426
+ - `load_mgus2()` - Monoclonal Gammopathy Data (Updated)
427
+ - `load_diabetic()` - Diabetic Retinopathy Data
428
+ - `load_retinopathy()` - Retinopathy Data
429
+ - `load_gbsg()` - German Breast Cancer Study Group Data
430
+ - `load_rotterdam()` - Rotterdam Tumor Bank Data
431
+ - `load_logan()` - Logan Unemployment Data
432
+ - `load_nwtco()` - National Wilms Tumor Study Data
433
+ - `load_solder()` - Solder Joint Data
434
+ - `load_tobin()` - Tobin's Tobit Data
435
+ - `load_rats2()` - Rat Tumorigenesis Data
436
+ - `load_nafld()` - Non-Alcoholic Fatty Liver Disease Data
437
+ - `load_cgd0()` - CGD Baseline Data
438
+ - `load_pbcseq()` - PBC Sequential Data
439
+
440
+ ## API Reference
441
+
442
+ ### Classes
443
+
444
+ **Core Models:**
445
+ - `AaregOptions`: Configuration options for Aalen's additive regression model
446
+ - `PSpline`: Penalized spline class for smooth covariate effects
447
+ - `CoxPHModel`: Cox proportional hazards model class
448
+ - `Subject`: Subject data structure for Cox PH models
449
+ - `ConditionalLogisticRegression`: Conditional logistic regression model
450
+ - `ClogitDataSet`: Dataset for conditional logistic regression
451
+
452
+ **Survival Curves:**
453
+ - `SurvFitKMOutput`: Output from Kaplan-Meier survival curve fitting
454
+ - `SurvfitKMOptions`: Options for Kaplan-Meier fitting
455
+ - `KaplanMeierConfig`: Configuration for Kaplan-Meier
456
+ - `SurvFitAJ`: Output from Aalen-Johansen survival curve fitting
457
+ - `NelsonAalenResult`: Output from Nelson-Aalen estimator
458
+ - `StratifiedKMResult`: Output from stratified Kaplan-Meier
459
+
460
+ **Parametric Models:**
461
+ - `SurvivalFit`: Output from parametric survival regression
462
+ - `SurvregConfig`: Configuration for parametric survival regression
463
+ - `DistributionType`: Distribution types for parametric models (extreme_value, logistic, gaussian, weibull, lognormal)
464
+ - `FineGrayOutput`: Output from Fine-Gray competing risks model
465
+
466
+ **Statistical Tests:**
467
+ - `SurvDiffResult`: Output from survival difference tests
468
+ - `LogRankResult`: Output from log-rank test
469
+ - `TrendTestResult`: Output from trend tests
470
+ - `TestResult`: General test result output
471
+ - `ProportionalityTest`: Output from proportional hazards test
472
+ - `SurvObrienResult`: Output from O'Brien transformation
473
+
474
+ **Validation:**
475
+ - `BootstrapResult`: Output from bootstrap confidence interval calculations
476
+ - `CVResult`: Output from cross-validation
477
+ - `CalibrationResult`: Output from calibration analysis
478
+ - `PredictionResult`: Output from prediction functions
479
+ - `RiskStratificationResult`: Output from risk stratification
480
+ - `TdAUCResult`: Output from time-dependent AUC calculation
481
+
482
+ **RMST and Survival Metrics:**
483
+ - `RMSTResult`: Output from RMST calculation
484
+ - `RMSTComparisonResult`: Output from RMST comparison between groups
485
+ - `MedianSurvivalResult`: Output from median survival calculation
486
+ - `CumulativeIncidenceResult`: Output from cumulative incidence calculation
487
+ - `NNTResult`: Number needed to treat result
488
+
489
+ **Landmark Analysis:**
490
+ - `LandmarkResult`: Output from landmark analysis
491
+ - `ConditionalSurvivalResult`: Output from conditional survival calculation
492
+ - `HazardRatioResult`: Output from hazard ratio calculation
493
+ - `SurvivalAtTimeResult`: Output from survival at specific times
494
+ - `LifeTableResult`: Output from life table calculation
495
+
496
+ **Power and Sample Size:**
497
+ - `SampleSizeResult`: Output from sample size calculations
498
+ - `AccrualResult`: Output from accrual calculations
499
+
500
+ **Utilities:**
501
+ - `CoxCountOutput`: Output from Cox counting functions
502
+ - `SplitResult`: Output from time-splitting
503
+ - `CondenseResult`: Output from data condensing
504
+ - `Surv2DataResult`: Output from survival-to-data conversion
505
+ - `TimelineResult`: Output from timeline conversion
506
+ - `IntervalResult`: Output from interval calculations
507
+ - `LinkFunctionParams`: Link function parameters
508
+ - `CchMethod`: Case-cohort method specification
509
+ - `CohortData`: Cohort data structure
510
+
511
+ ### Functions
512
+
513
+ **Model Fitting:**
514
+ - `aareg(options)`: Fit Aalen's additive regression model
515
+ - `survreg(...)`: Fit parametric accelerated failure time models
516
+ - `perform_cox_regression_frailty(...)`: Fit Cox proportional hazards model with frailty
517
+
518
+ **Survival Curves:**
519
+ - `survfitkm(...)`: Fit Kaplan-Meier survival curves
520
+ - `survfitkm_with_options(...)`: Fit Kaplan-Meier with configuration options
521
+ - `survfitaj(...)`: Fit Aalen-Johansen survival curves (multi-state)
522
+ - `nelson_aalen_estimator(...)`: Calculate Nelson-Aalen estimator
523
+ - `stratified_kaplan_meier(...)`: Calculate stratified Kaplan-Meier curves
524
+ - `agsurv4(...)`: Anderson-Gill survival calculations (version 4)
525
+ - `agsurv5(...)`: Anderson-Gill survival calculations (version 5)
526
+
527
+ **Statistical Tests:**
528
+ - `survdiff2(...)`: Perform survival difference tests (log-rank, Wilcoxon, etc.)
529
+ - `logrank_test(...)`: Perform log-rank test
530
+ - `fleming_harrington_test(...)`: Perform Fleming-Harrington weighted test
531
+ - `logrank_trend(...)`: Perform log-rank trend test
532
+ - `lrt_test(...)`: Likelihood ratio test
533
+ - `wald_test_py(...)`: Wald test
534
+ - `score_test_py(...)`: Score test
535
+ - `ph_test(...)`: Proportional hazards assumption test
536
+ - `survobrien(...)`: O'Brien transformation for survival data
537
+
538
+ **Residuals:**
539
+ - `coxmart(...)`: Calculate Cox martingale residuals
540
+ - `agmart(...)`: Calculate Anderson-Gill martingale residuals
541
+ - `schoenfeld_residuals(...)`: Calculate Schoenfeld residuals
542
+ - `cox_score_residuals(...)`: Calculate Cox score residuals
543
+
544
+ **Concordance:**
545
+ - `perform_concordance1_calculation(...)`: Calculate concordance index (version 1)
546
+ - `perform_concordance3_calculation(...)`: Calculate concordance index (version 3)
547
+ - `perform_concordance_calculation(...)`: Calculate concordance index (version 5)
548
+ - `compute_concordance(...)`: General concordance calculation
549
+
550
+ **Validation:**
551
+ - `bootstrap_cox_ci(...)`: Bootstrap confidence intervals for Cox models
552
+ - `bootstrap_survreg_ci(...)`: Bootstrap confidence intervals for parametric models
553
+ - `cv_cox_concordance(...)`: Cross-validation for Cox model concordance
554
+ - `cv_survreg_loglik(...)`: Cross-validation for parametric model log-likelihood
555
+ - `calibration(...)`: Model calibration assessment
556
+ - `predict_cox(...)`: Predictions from Cox models
557
+ - `risk_stratification(...)`: Risk group stratification
558
+ - `td_auc(...)`: Time-dependent AUC calculation
559
+ - `brier(...)`: Calculate Brier score
560
+ - `integrated_brier(...)`: Calculate integrated Brier score
561
+
562
+ **RMST and Survival Metrics:**
563
+ - `rmst(...)`: Calculate restricted mean survival time
564
+ - `rmst_comparison(...)`: Compare RMST between groups
565
+ - `survival_quantile(...)`: Calculate survival quantiles (median, etc.)
566
+ - `cumulative_incidence(...)`: Calculate cumulative incidence
567
+ - `number_needed_to_treat(...)`: Calculate NNT
568
+
569
+ **Landmark Analysis:**
570
+ - `landmark_analysis(...)`: Perform landmark analysis
571
+ - `landmark_analysis_batch(...)`: Perform batch landmark analysis at multiple time points
572
+ - `conditional_survival(...)`: Calculate conditional survival
573
+ - `hazard_ratio(...)`: Calculate hazard ratios
574
+ - `survival_at_times(...)`: Calculate survival at specific time points
575
+ - `life_table(...)`: Generate life table
576
+
577
+ **Power and Sample Size:**
578
+ - `sample_size_survival(...)`: Calculate required sample size
579
+ - `sample_size_survival_freedman(...)`: Sample size using Freedman's method
580
+ - `power_survival(...)`: Calculate statistical power
581
+ - `expected_events(...)`: Calculate expected number of events
582
+
583
+ **Utilities:**
584
+ - `finegray(...)`: Fine-Gray competing risks model data preparation
585
+ - `perform_pyears_calculation(...)`: Calculate person-years of observation
586
+ - `perform_pystep_calculation(...)`: Perform step calculations
587
+ - `perform_pystep_simple_calculation(...)`: Perform simple step calculations
588
+ - `perform_score_calculation(...)`: Calculate score statistics
589
+ - `perform_agscore3_calculation(...)`: Calculate score statistics (version 3)
590
+ - `survsplit(...)`: Split survival data at specified times
591
+ - `survcondense(...)`: Condense survival data by collapsing adjacent intervals
592
+ - `surv2data(...)`: Convert survival objects to data format
593
+ - `to_timeline(...)`: Convert data to timeline format
594
+ - `from_timeline(...)`: Convert from timeline format to intervals
595
+ - `tmerge(...)`: Merge time-dependent covariates
596
+ - `tmerge2(...)`: Merge time-dependent covariates (version 2)
597
+ - `tmerge3(...)`: Merge time-dependent covariates (version 3)
598
+ - `collapse(...)`: Collapse survival data
599
+ - `coxcount1(...)`: Cox counting process calculations
600
+ - `coxcount2(...)`: Cox counting process calculations (version 2)
601
+ - `agexact(...)`: Exact Anderson-Gill calculations
602
+ - `norisk(...)`: No-risk calculations
603
+ - `cipoisson(...)`: Poisson confidence intervals
604
+ - `cipoisson_exact(...)`: Exact Poisson confidence intervals
605
+ - `cipoisson_anscombe(...)`: Anscombe Poisson confidence intervals
606
+ - `cox_callback(...)`: Cox model callback for iterative fitting
607
+
608
+ ## PSpline Options
609
+
610
+ The `PSpline` class provides penalized spline smoothing:
611
+
612
+ **Constructor Parameters:**
613
+ - `x`: Covariate vector (list of floats)
614
+ - `df`: Degrees of freedom (integer)
615
+ - `theta`: Roughness penalty (float)
616
+ - `eps`: Accuracy for degrees of freedom (float)
617
+ - `method`: Penalty method for tuning parameter selection. Supported methods:
618
+ - `"GCV"` - Generalized Cross-Validation
619
+ - `"UBRE"` - Unbiased Risk Estimator
620
+ - `"REML"` - Restricted Maximum Likelihood
621
+ - `"AIC"` - Akaike Information Criterion
622
+ - `"BIC"` - Bayesian Information Criterion
623
+ - `boundary_knots`: Tuple of (min, max) for the spline basis
624
+ - `intercept`: Whether to include an intercept in the basis
625
+ - `penalty`: Whether to apply the penalty
626
+
627
+ **Methods:**
628
+ - `fit()`: Fit the spline model, returns coefficients
629
+ - `predict(new_x)`: Predict values at new x points
630
+
631
+ **Properties:**
632
+ - `coefficients`: Fitted coefficients (None if not fitted)
633
+ - `fitted`: Whether the model has been fitted
634
+ - `df`: Degrees of freedom
635
+ - `eps`: Convergence tolerance
636
+
637
+ ## Development
638
+
639
+ Build the Rust library:
640
+ ```sh
641
+ cargo build
642
+ ```
643
+
644
+ Run tests:
645
+ ```sh
646
+ cargo test
647
+ ```
648
+
649
+ Format code:
650
+ ```sh
651
+ cargo fmt
652
+ ```
653
+
654
+ The codebase is organized with:
655
+ - Core routines in `src/`
656
+ - Tests and examples in `test/`
657
+ - Python bindings using PyO3
658
+
659
+ ## Dependencies
660
+
661
+ - [PyO3](https://github.com/PyO3/pyo3) - Python bindings
662
+ - [ndarray](https://github.com/rust-ndarray/ndarray) - N-dimensional arrays
663
+ - [faer](https://github.com/sarah-ek/faer-rs) - Pure-Rust linear algebra
664
+ - [itertools](https://github.com/rust-itertools/itertools) - Iterator utilities
665
+ - [rayon](https://github.com/rayon-rs/rayon) - Parallel computation
666
+
667
+ ## Compatibility
668
+
669
+ - This build is for Python only. R/extendr bindings are currently disabled.
670
+ - macOS users: Ensure you are using the correct Python version and have Homebrew-installed Python if using Apple Silicon.
671
+
672
+ ## License
673
+
674
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
675
+
@@ -0,0 +1,8 @@
1
+ survival/__init__.py,sha256=GnlNEQ5WtMH1BtVycBOXD_TI0wZuqrEqGJYsXgjbhVI,115
2
+ survival/__init__.pyi,sha256=phbQd5RA8G_WqOUfceRiboKGkcVCLKybWxf1f1XDjZY,22470
3
+ survival/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ survival/survival.cpython-314-aarch64-linux-gnu.so,sha256=am2CwfAN1sYEabsNTQil_Kr_biv9HtALp4r70yfms2o,6646984
5
+ survival-1.1.23.dist-info/METADATA,sha256=pldX0qGFY_SNBcHg8aa1iPGwAA-ygGIK9ES8pzVpQ64,22494
6
+ survival-1.1.23.dist-info/WHEEL,sha256=31rCVV0n74-4x99Hvo2QCcyD8qUA4Fn0K5heIXXx22U,110
7
+ survival-1.1.23.dist-info/licenses/LICENSE,sha256=hS2BuXZUcQTPPxaojumqQeGtQjachYGOChZXBWbQQ7E,1070
8
+ survival-1.1.23.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.11.5)
3
+ Root-Is-Purelib: false
4
+ Tag: cp314-cp314-manylinux_2_39_aarch64