This function models a mileage random variable on an annual basis with respect to a supposed continuous distribution. First, the distances are calculated for one year (365 days) using a linear relationship between the distance and operating time. Second, the parameter(s) of the assumed distribution are estimated with maximum likelihood. See 'Details' for more information.

dist_mileage(x, ...)

# S3 method for wt_mcs_mileage_data
dist_mileage(x, distribution = c("lognormal", "exponential"), ...)

Arguments

x

A tibble of class wt_mcs_mileage_data returned by mcs_mileage_data.

...

Further arguments passed to or from other methods. Currently not used.

distribution

Supposed distribution of the annual mileage.

Value

A list with class wt_mileage_estimation which contains:

  • coefficients : A named vector of estimated parameter(s).

  • miles_annual : A numeric vector of element-wise computed annual distances using the linear relationship described in 'Details'.

  • distribution : Specified distribution.

Details

The distribution parameter(s) is (are) determined on the basis of complete cases, i.e. there is no NA (row-wise) in one of the related columns mileage and time. Distances and operating times less than or equal to zero are not considered as well.

Assumption of linear relationship: Imagine a component in a vehicle has endured a distance of 25000 kilometers (km) in 500 days (d), the annual distance of this unit is $$25000 km \cdot (\frac{365 d} {500 d}) = 18250 km$$

Examples

# MCS data preparation:
mcs_tbl <- mcs_mileage_data(
  field_data,
  mileage = mileage,
  time = dis,
  status = status,
  id = vin
)

# Example 1 - Assuming lognormal annual mileage distribution:
params_mileage_annual <- dist_mileage(
  x = mcs_tbl,
  distribution = "lognormal"
)

# Example 2 - Assuming exponential annual mileage distribution:
params_mileage_annual_2 <- dist_mileage(
  x = mcs_tbl,
  distribution = "exponential"
)