R/synthetic-fcip-core.R
assign_ri_grids.RdPlaces each agent entirely in ONE RI grid per replication, drawn from its
county-commodity candidate grids with the supplied probabilities (the
sampled-assignment alternative to probability-weighted apportionment,
which smooths away within-county placement risk). Replications are
reproducible in isolation: replication r uses seed seed + r, so a
given replication is identical regardless of how many replications are
requested, and the set of replications can be extended later without
disturbing existing ones.
assign_ri_grids(
agents,
candidates,
reps = 100,
seed = 20260703,
key_cols = c("state_code", "county_code", "commodity_code")
)data.table with agent_uid plus the key columns linking
agents to candidate sets (e.g. from
build_agent_panel(method = "grid_free")).
Candidate grids: either long
(key_cols + grid_id + probability) or nested with a
ri_candidates list-column.
Either a single count (replications 1:reps) or an explicit
vector of replication indices (e.g. 51:100 to extend an existing set).
Master seed; replication r draws under seed + r.
Columns linking agents to candidate sets.
data.table with replication, agent_uid, grid_id; one row
per agent per replication. Agents with no candidate set are dropped with
a message.
Other synthetic-fcip-core:
attach_peril_probabilities(),
build_agent_panel(),
build_peril_probabilities(),
col_status_labels,
identify_cause_of_loss(),
identify_pp_units(),
pp_status_labels