dist_delay.default {weibulltools}R Documentation

Parameter Estimation of a Delay Distribution

Description

This function models a delay (in days) random variable (e.g. in logistic, registration, report) using a supposed continuous distribution. First, the element-wise differences in days of both vectors date_1 and date_2 are calculated and then the parameter(s) of the assumed distribution is (are) estimated with maximum likelihood. See 'Details' for more information.

Usage

## Default S3 method:
dist_delay(..., date_1, date_2, distribution = c("lognormal", "exponential"))

Arguments

...

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

date_1

A vector of class character or Date, in the format "yyyy-mm-dd", representing the earlier of the two dates belonging to a particular delay. Use NA for missing elements.

If more than one delay is to be considered, use a list where 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 vector of class character or Date in the format "yyyy-mm-dd". date_2 is the counterpart of date_1 and is used the same as date_1, just with the later date(s) of the particular delay(s). Use NA for missing elements.

distribution

Supposed distribution of the respective delay.

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(date_1[i], date_2[i]). Time differences less than or equal to zero are not considered as well.

Value

A list with class wt_delay_estimation which contains:

If more than one delay was considered, the resulting output is a list with class wt_delay_estimation_list. In this case each list element has class wt_delay_estimation and the items listed above, are included.

See Also

dist_delay

Examples

# Example 1 - Delay in registration:
params_delay_regist  <- dist_delay(
  date_1 = field_data$production_date,
  date_2 = field_data$registration_date,
  distribution = "lognormal"
)

# Example 2 - Delay in report:
params_delay_report  <- dist_delay(
  date_1 = field_data$repair_date,
  date_2 = field_data$report_date,
  distribution = "exponential"
)

# Example 3 - Delays in registration and report with same distribution:
params_delays  <- dist_delay(
  date_1 = list(field_data$production_date, field_data$repair_date),
  date_2 = list(field_data$registration_date, field_data$report_date),
  distribution = "lognormal"
)

# Example 4 - Delays in registration and report with different distributions:
params_delays_2  <- dist_delay(
  date_1 = list(field_data$production_date, field_data$repair_date),
  date_2 = list(field_data$registration_date, field_data$report_date),
  distribution = c("lognormal", "exponential")
)


[Package weibulltools version 2.1.0 Index]