| routed_unit_cost | R Documentation |
Selects n units from the frame n_rep times, routes each sample from
the depot, prices it with the cost model and returns the mean cost per
sampled unit. This is the planning value of the cost of a primary unit
(c1 in two_stage_allocation()) or of an area-frame unit (cost_a in
dual_frame_allocation()); it depends on n because a larger sample is
denser and cheaper to reach per unit.
routed_unit_cost(
frame,
depot,
cost_model,
n,
size = NULL,
strata = NULL,
selection = c("lpm", "systematic", "srs"),
replicates = 1,
matrix = NULL,
method = c("haversine", "euclidean", "osrm"),
max_length = Inf,
max_stops = Inf,
n_rep = 10,
iterations = 100,
seed = 1
)
frame |
Data frame of units as in |
depot |
Name of the depot unit in |
cost_model |
A |
n |
Sample size (a number, or a vector named by stratum). |
size |
Optional size column for probability-proportional-to-size selection. |
strata |
Optional stratum column, passed to |
selection |
Selection method of |
replicates |
Replicates of a |
matrix |
Optional |
method |
Distance method of |
max_length, max_stops |
Route limits passed to |
n_rep |
Replications per sample size. |
iterations |
GRASP iterations per routing. |
seed |
Seed. |
A one-row tibble: n, cost_per_unit, travel_per_unit,
cost_mean, routes_mean, n_rep.
set.seed(1)
frame <- data.frame(
unit = c("depot", paste0("s", 1:40)),
x = c(5, runif(40, 0, 10)), y = c(5, runif(40, 0, 10))
)
model <- field_cost_model(
per_travel = 2, per_unit = 30, per_interview = 10,
interviews_per_unit = 4
)
routed_unit_cost(frame, "depot", model,
n = 12, method = "euclidean", n_rep = 3,
iterations = 20
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.