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.

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

Arguments

x

A numeric vector of distances covered. Use NA for missing elements.

time

A numeric vector of operating times. Use NA for missing elements.

distribution

Supposed distribution of the annual mileage.

...

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

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 in one of the related vector elements c(mileage[i], time[i]). 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$$

See also

Examples

# Example 1 - Assuming lognormal annual mileage distribution:
params_mileage_annual <- dist_mileage(
  x = field_data$mileage,
  time = field_data$dis,
  distribution = "lognormal"
)

# Example 2 - Assuming exponential annual mileage distribution:
params_mileage_annual_2 <- dist_mileage(
  x = field_data$mileage,
  time = field_data$dis,
  distribution = "exponential"
)