# MCS data preparation:
## Data for delay in registration:
mcs_tbl_1 <- mcs_delay_data(
field_data,
date_1 = production_date,
date_2 = registration_date,
time = dis,
status = status,
id = vin
)
## Data for delay in report:
mcs_tbl_2 <- mcs_delay_data(
field_data,
date_1 = repair_date,
date_2 = report_date,
time = dis,
status = status,
id = vin
)
## Data for both delays:
mcs_tbl_both <- mcs_delay_data(
field_data,
date_1 = c(production_date, repair_date),
date_2 = c(registration_date, report_date),
time = dis,
status = status,
id = vin
)
# Example 1 - MCS for delay in registration:
mcs_regist <- mcs_delay(
x = mcs_tbl_1,
distribution = "lognormal"
)
# Example 2 - MCS for delay in report:
mcs_report <- mcs_delay(
x = mcs_tbl_2,
distribution = "exponential"
)
# Example 3 - Reproducibility of random numbers:
set.seed(1234)
mcs_report_reproduce <- mcs_delay(
x = mcs_tbl_2,
distribution = "exponential"
)
# Example 4 - MCS for delays in registration and report with same distribution:
mcs_delays <- mcs_delay(
x = mcs_tbl_both,
distribution = "lognormal"
)
# Example 5 - MCS for delays in registration and report with different distributions:
## Assuming lognormal registration and exponential reporting delays.
mcs_delays_2 <- mcs_delay(
x = mcs_tbl_both,
distribution = c("lognormal", "exponential")
)
Run the code above in your browser using DataLab