mcs_delay_data {weibulltools} | R Documentation |
MCS Delay Data
Description
Create consistent mcs_delay_data
based on an existing data.frame
(preferred)
or on multiple equal length vectors.
Usage
mcs_delay_data(
data = NULL,
date_1,
date_2,
time,
status = NULL,
id = NULL,
.keep_all = FALSE
)
Arguments
data |
Either |
date_1 |
A date of class If more than one delay is to be considered, use a list for the vector-based approach and a vector of column names or positions for the data-based approach. The first element is the earlier date of the first delay, the second element is the earlier date of the second delay, and so forth (see 'Examples'). |
date_2 |
A date of class |
time |
Operating times. Use |
status |
Optional argument. If used, it must contain binary data (0 or 1) indicating whether a unit is a right censored observation (= 0) or a failure (= 1). If |
id |
Identification of every unit. |
.keep_all |
If |
Value
A tibble
with class wt_mcs_delay_data
that is formed for the downstream
Monte Carlo method mcs_delay.
It contains the following columns (if .keep_all = FALSE
):
Column(s) preserving the input of
date_1
. For the vector-based approach with unnamed input, column name(s) is (are)date_1
(date_1.1
,date_1.2
,...
,date_1.i
).Column(s) preserving the input of
date_2
. For the vector-based approach with unnamed input, column name(s) is (are)date_2
(date_2.1
,date_2.2
,...
,date_2.i
).-
time
: Input operating times. -
status
(optional) :If
is.null(status)
columnstatus
does not exist.If
status
is provided the column contains the entered binary data (0 or 1).
-
id
: Identification for every unit.
If .keep_all = TRUE
, the remaining columns of data
are also preserved.
The attributes mcs_start_dates
and mcs_end_dates
hold the name(s) of the
column(s) that preserve the input of date_1
and date_2
.
See Also
dist_delay for the determination of a parametric delay distribution and mcs_delay for the Monte Carlo method with respect to delays.
Examples
# Example 1 - Based on an existing data.frame/tibble and column names:
mcs_tbl <- mcs_delay_data(
data = field_data,
date_1 = production_date,
date_2 = registration_date,
time = dis,
status = status
)
# Example 2 - Based on an existing data.frame/tibble and column positions:
mcs_tbl_2 <- mcs_delay_data(
data = field_data,
date_1 = 7,
date_2 = 8,
time = 2,
id = 1
)
# Example 3 - Keep all variables of the tibble/data.frame entered to argument data:
mcs_tbl_3 <- mcs_delay_data(
data = field_data,
date_1 = production_date,
date_2 = registration_date,
time = dis,
status = status,
id = vin,
.keep_all = TRUE
)
# Example 4 - For multiple delays (data-based):
mcs_tbl_4 <- mcs_delay_data(
data = field_data,
date_1 = c(production_date, repair_date),
date_2 = c(registration_date, report_date),
time = dis,
status = status
)
# Example 5 - Based on vectors:
mcs_tbl_5 <- mcs_delay_data(
date_1 = field_data$production_date,
date_2 = field_data$registration_date,
time = field_data$dis,
status = field_data$status,
id = field_data$vin
)
# Example 6 - For multiple delays (vector-based):
mcs_tbl_6 <- mcs_delay_data(
date_1 = list(field_data$production_date, field_data$repair_date),
date_2 = list(field_data$registration_date, field_data$report_date),
time = field_data$dis,
status = field_data$status,
id = field_data$vin
)
# Example 7 - For multiple delays (vector-based with named dates):
mcs_tbl_7 <- mcs_delay_data(
date_1 = list(d11 = field_data$production_date, d12 = field_data$repair_date),
date_2 = list(d21 = field_data$registration_date, d22 = field_data$report_date),
time = field_data$dis,
status = field_data$status,
id = field_data$vin
)