| cost_variance_frontier | R Documentation |
For each sample size in n_grid, draws n_rep spatially balanced samples
from the frame, routes the field work from the depot, prices it with the
cost model and, when a study variable is given, estimates the variance of
the total. The result is the trade-off a survey planner faces: how much the
field work costs and how precise the estimate is at each sample size.
cost_variance_frontier(
frame,
depot,
cost_model,
n_grid,
y = NULL,
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 = 20,
iterations = 100,
seed = 1
)
frame |
Data frame of units as in |
depot |
Name of the depot unit in |
cost_model |
A |
n_grid |
Sample sizes to evaluate: a numeric vector of total sizes
(allocated across strata as in |
y |
Optional column of the study variable for the whole frame (a
planning value); when given, the variance of the estimated total is
computed with |
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 tibble of class fieldopt_frontier with one row per sample
size: n, cost_mean, cost_sd, cost_per_unit (the planning value
for c1 in two_stage_allocation() or cost_a in
dual_frame_allocation()), travel_mean, routes_mean,
variance_mean and cv_mean (when y is given), n_rep, and
allocation (a list column with the stratum sizes) when strata are
used.
set.seed(3)
frame <- data.frame(
unit = c("depot", paste0("s", 1:40)),
x = c(5, runif(40, 0, 10)), y = c(5, runif(40, 0, 10))
)
frame$crop <- c(NA, 20 + 3 * frame$x[-1] + rnorm(40))
model <- field_cost_model(
per_travel = 2, per_unit = 30, per_interview = 10,
interviews_per_unit = 4
)
cost_variance_frontier(frame,
depot = "depot", cost_model = model, n_grid = c(8, 16),
y = "crop", 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.