Returns the metadata attributes attached to results from analog_search(),
or any analog_*() wrapper function that calls it, as a named list. These
same values can be accessed individually via attr(x, "<name>");
metadata() is a convenience that bundles them into a consistent
list structure independent of the underlying attribute layout.
Use it to inspect or programmatically reconstruct the parameterization
that produced a result. Each attribute records one user-facing parameter
or input-data property.
Value
A named list. Elements depend on which attributes are present on
x; missing attributes are simply absent from the returned list (no
NA placeholders). Possible elements include:
Selection and aggregation parameters
selectSelection strategy:
"all","knn_env", or"knn_geog".kNumber of neighbors for kNN selection modes;
NULLforselect = "all".statAggregation statistic(s) requested. Character vector;
"none"for pair-mode results.kernel_envEnvironmental weighting kernel shape:
"uniform","gaussian", or"inverse"."uniform"when environment is not distance-weighted.kernel_geogGeographic weighting kernel shape:
"uniform","gaussian", or"inverse"."uniform"when geography is not distance-weighted.theta_envScale parameter for the environmental kernel (Gaussian bandwidth or inverse half-weight distance);
NULLif the environmental kernel is uniform.theta_geogScale parameter for the geographic kernel;
NULLif the geographic kernel is uniform.lambdaRidge penalty for
stat = "regression";0for ordinary weighted least squares.seStandard-error framing applied to SE-supporting stats:
"none","ess", or"design".max_envEnvironmental-distance threshold used for analog selection. Scalar for Euclidean / Mahalanobis radius, or length-
n_envfor per-variable thresholds.max_geogGeographic-distance threshold used for analog selection. Units are km when
coord_type = "lonlat", projection units otherwise.min_geogGeographic-distance lower threshold (annulus inner radius): analogs closer than this to the focal were excluded.
NULLwhen no lower bound was set. Same units asmax_geog. Mainly used as a spatial buffer for cross-validation.exclude_selfLogical: was each focal's own pool row excluded from its analog neighborhood?
TRUEfor results fromanalog_cv()(LOO) or fromanalog_search(exclude_self = TRUE).
Input-data properties
n_xNumber of focal locations in the input
x.n_poolNumber of reference locations in the input
pool.n_envNumber of environmental variables.
coord_typeCoordinate system:
"lonlat"(great-circle distances in km) or"projected"(planar distances in projection units).x_cov_providedLogical: was a per-focal covariance matrix (
x_cov) supplied? IfTRUE, environmental distances were computed in Mahalanobis units using location-specific covariance; otherwise Euclidean.downsample_actualActual downsampling rate applied to the reference pool (1.0 if no downsampling). May exceed the requested rate when maintaining at least one point per occupied bin requires it.
Index diagnostics (lattice-related)
These attributes describe the internal lattice index used to
accelerate the search; they're useful for performance debugging but
not needed to reproduce the result. See build_analog_index() for
detail.
binning_methodInternal indexing method; one of
"lattice"or"lattice_ecef".total_bins,n_bins_nonempty,min_bin_occupancy,max_bin_occupancy,avg_bin_occupancy,avg_nonempty_bin_occupancyLattice occupancy summaries.
env_res_adj,geog_res_adjPer-family resolution adjustments used to build the index: each scales its family's bin count relative to a data-dependent default (
1= default,0= deactivated). Seebuild_analog_index().env_target,geo_targetRealized per-family bin-count targets passed to the lattice builder (the absolute values the
*_res_adjresolve to).bins_per_axisInteger vector of realized bins per axis (geographic axes first, then environment), showing how the budget was distributed.
Cross-validation metadata
Present only when x is a result from analog_cv().
cv_method"loo"or"kfold".cv_funName of the analog function being cross-validated (e.g.
"analog_impact").cv_n_foldsNumber of folds (k-fold only).
cv_pred_targetMechanism used to extract predictions for residuals:
"weighted_mean","regression", or"none".
Details
metadata() is the documented entry point for reading these
attributes; the attribute names themselves are also part of the public
contract, so attr(x, "select") etc. are equally valid for individual
values. The function's main advantages over raw attributes() are: it
filters out R-internal attributes (names, class, dim, ...), and
the ?metadata help page gives a single canonical reference for
every attribute the package attaches.
Examples
if (FALSE) { # \dontrun{
result <- analog_velocity(
x = future_climate,
pool = current_climate,
env = kernel(max = 0.5)
)
# Get the full parameterization as a list
meta <- metadata(result)
meta$select
meta$max_env
meta$n_pool
# Or read individual attributes directly
attr(result, "select")
} # }