Skip to contents

Summary method for mcc objects

Usage

# S3 method for class 'mcc'
summary(object, ...)

Arguments

object

An mcc object

...

Additional arguments (currently unused)

Value

A summary object with class summary.mcc

Examples

# Attach dplyr
library(dplyr)
# Create sample data with recurrent events
df <- data.frame(
  id = c(1, 2, 3, 4, 4, 4, 5, 5),
  time = c(8, 1, 5, 2, 6, 7, 3, 3), # Times will be adjusted for id = 5
  cause = c(0, 0, 2, 1, 1, 1, 1, 2)
 ) |>
  arrange(id, time)  # Sort the data by id and time

# Calculate MCC using the equation method (default)
mcc_eq <- mcc(df, id_var = "id", time_var = "time", cause_var = "cause")
#> Warning: Found 1 participant where last observation is an event of interest (`cause_var`
#> = 1)
#> ! ID: 4
#>  `mcc()` assumes these participants are censored at their final `time_var`
#>  If participants were actually censored or experienced competing risks after
#>   their last event, add those observations to ensure correct estimates
#>  Adjusted time points for events occurring simultaneously for the same subject.

summary(mcc_eq)
#> 
#> ── Summary of Mean Cumulative Count Results ────────────────────────────────────
#>  Method: Dong-Yasui Equation Method
#> 
#> ── Summary Statistics ──
#> 
#> Number of time points: 5
#> Time range: [0, 7]
#> Final MCC: 1

# Calculate MCC using the sum of cumulative incidence method
mcc_sci <- mcc(
  df,
  id_var = "id",
  time_var = "time",
  cause_var = "cause",
  method = "sci"
)
#> Warning: Found 1 participant where last observation is an event of interest (`cause_var`
#> = 1)
#> ! ID: 4
#>  `mcc()` assumes these participants are censored at their final `time_var`
#>  If participants were actually censored or experienced competing risks after
#>   their last event, add those observations to ensure correct estimates
#>  Adjusted time points for events occurring simultaneously for the same subject.

summary(mcc_sci)
#> 
#> ── Summary of Mean Cumulative Count Results ────────────────────────────────────
#>  Method: Sum of Cumulative Incidence Method
#> 
#> ── Summary Statistics ──
#> 
#> Number of time points: 5
#> Time range: [0, 7]
#> Final MCC: 1

# Clean up
rm(df, mcc_eq, mcc_sci)