Summary method for mcc
objects
Usage
# S3 method for class 'mcc'
summary(object, ...)
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)