Skip to contents

Performs flexible competing risks analysis using advanced regression techniques including spline-based hazards, time-varying effects, and robust prediction models with comprehensive model validation.

Usage

flexcomprisk(
  data,
  time,
  event,
  covs,
  eventOfInterest = 1,
  modelType = "splines",
  splineType = "rcs",
  splineDf = 4,
  timeInteractions,
  validationType = "cv",
  cvFolds = 5,
  bootstrapSamples = 500,
  predictionTimes = "1, 3, 5",
  conf = 0.95,
  showModelComparison = TRUE,
  showValidationResults = TRUE,
  showPredictions = TRUE,
  showEducational = TRUE,
  plotCumulativeIncidence = TRUE,
  plotModelComparison = FALSE,
  plotValidation = FALSE
)

Arguments

data

The data as a data frame.

time

Follow-up time variable

event

Event type variable (0=censored, 1=event of interest, 2=competing event, etc.)

covs

Covariates to include in the model

eventOfInterest

Numeric code for the event of interest (primary event)

modelType

Type of flexible competing risks model to fit

splineType

Type of splines for flexible parametric models

splineDf

Degrees of freedom for spline functions

timeInteractions

Variables with time-varying effects (interactions with time)

validationType

Method for model validation and performance assessment

cvFolds

Number of folds for cross-validation

bootstrapSamples

Number of bootstrap samples for validation

predictionTimes

Comma-separated list of time points for prediction

conf

Confidence level for confidence intervals

showModelComparison

Compare performance across different model types

showValidationResults

Display cross-validation and bootstrap results

showPredictions

Display predicted cumulative incidence at specified time points

showEducational

Display educational information about flexible competing risks models

plotCumulativeIncidence

Display cumulative incidence function plots

plotModelComparison

Display performance comparison plots across models

plotValidation

Display validation and calibration plots

Value

A results object containing:

results$todoa html
results$educationalInfoa html
results$modelSummarya table
results$coefficientsTablea table
results$predictionsTablea table
results$modelComparisonTablea table
results$validationResultsa table
results$timeVaryingEffectsa table
results$methodsInfoa html
results$recommendationsInfoa html
results$cifPlotan image
results$modelComparisonPlotan image
results$validationPlotan image

Tables can be converted to data frames with asDF or as.data.frame. For example:

results$modelSummary$asDF

as.data.frame(results$modelSummary)

Examples

# \donttest{
# example will be added
# }