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))
A data frame of trips and their road level travel information, formatted as trips
, see trips
or data(trips); View(trips)
.
The minimum number of observation needed to estimate (and not impute) parameters. Default (L=5
). see
a vector of predefined naming for time bins. Default unique(data$timeBin)
.
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.
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.
if (FALSE) {
data(trips)
link_mean_variance(trips)
}