Description Usage Arguments Value Examples
This function simulates driving distances for censored observations under the
condition that the operating time of these items is known up to a certain date
where analysis is made. Operating times for these units can be estimated with
functions like mcs_delay_register
, mcs_delay_report
and mcs_delays
.
The failed observations (where the driving distances are known) are used to
estimate an annual mileage distribution. If the mileage distribution is fully
specified annual random driving distances are drawn from this distribution and
afterwards adjusted to the operating times of the censored observations.
1 2  mcs_mileage(x, event, mileage, distribution = "lognormal", seed = NULL,
details = FALSE)

x 
a numeric vector of operating times. If not available use 
event 
a vector of binary data (0 or 1) indicating whether unit i is a right censored observation (= 0) or a failure (= 1). 
mileage 
a numeric vector of driven distances. If not available use 
distribution 
supposed distribution of the random variable. The default
value is 
seed 
if 
details 
a logical variable, where the default value is 
A numerical vector of simulated driving distances for the censored
units and the input driving distances for the failed units if
details = FALSE
. If details = TRUE
the output is a list which
consists of the following elements:
mileage
: Simulated driving distances for the censored
units and the input driving distances for the failed units.
mileage_sim_annual
: Simulated annual driving distances of
specified distribution with estimated parameters. The length of
x_sim
is equal to the number of censored observations.
coefficients
: Estimated coefficients of supposed
distribution.
int_seed
: Integer seed number for reproducibility.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46  # Example 1  Simplified vector output (complete data):
date_of_registration < c("20140817", "20140329", "20141206",
"20140909", "20140514", "20140701",
"20140616", "20140403", "20140523",
"20140509", "20140531", "20140812",
"20140413", "20140215", "20140707",
"20140312", "20140527", "20140602",
"20140520", "20140321", "20140619",
"20140212", "20140327")
date_of_repair < c("20141021", "20140915", "20150704", "20150410",
"20150215", "20150414", "20150424", "20150227",
"20150425", "20150424", "20150612", "20150826",
"20150504", "20150404", "20150906", "20150522",
"20150821", "20150917", "20150915", "20150815",
"20151126", "20150822", "20151005")
op_time < as.numeric(difftime(as.Date(date_of_repair),
as.Date(date_of_registration),
units = "days"))
mileage < c(5227, 15655, 13629, 18292, 24291, 34455, 33555, 21659, 21737,
29870, 21068, 22986, 122283, 31592, 49050, 36088, 10918, 11153,
122437, 122842, 20349, 65656, 40777)
state < sample(c(0, 1), size = length(op_time), replace = TRUE)
mileage_corrected < mcs_mileage(x = op_time, event = state,
mileage = mileage,
distribution = "lognormal", seed = NULL,
details = FALSE)
# Example 2  Detailed list output (complete data):
list_detail < mcs_mileage(x = op_time, event = state, mileage = mileage,
distribution = "lognormal", seed = NULL,
details = TRUE)
# Example 3  Detailed list output (realistic example):
op_time < c(65, 170, 210, 213, 277, 287, 312, 330, 337, 350, 377, 379, 386,
413, 426, 436, 451, 472, 483, 512, 525, 556, 557)
mileage < c(NA, 15655, 13629, NA, 24291, 34455, NA, 21659, 21737,
NA, 21068, 22986, NA, 31592, 49050, NA, 10918, 11153,
NA, 122842, 20349, NA, 40777)
state < c(0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0,
1, 1, 0, 1)
list_detail < mcs_mileage(x = op_time, event = state, mileage = mileage,
distribution = "lognormal", seed = NULL,
details = TRUE)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.