link_mean_variance estimates the mean and variance of travel duration for each link in the data.

link_mean_variance(data, L = 5L, bins = unique(data$timeBin))

Arguments

data

A data frame of trips and their road level travel information, formatted as trips, see trips or data(trips); View(trips).

L

The minimum number of observation needed to estimate (and not impute) parameters. Default (L=5). see

bins

a vector of predefined naming for time bins. Default unique(data$timeBin).

Value

Returns a hashed environment with keys as paste0(linkID.from,'.', linkID.to,'.', timeBin) and values containing list(mean, sd, imputed_mean, imputed_sd) as the mean and standard deviation of travel time for each unit, while imputed_mean and imputed_sd indicate whether the calculated quantities are imputed or calculated from observed data.

Details

For links (linkID.from, linkID.to, timeBin) that have less than L number of observations, first they are imputed by (linkID.from, timeBin) estimates, if there at least L observations in that category, and second by timeBin estimates.

Examples

if (FALSE) {

data(trips)
link_mean_variance(trips)
}