| Title: | Climate Exposure Relative to a Species' Climatic Niche |
|---|---|
| Description: | Quantifies climate exposure by comparing projected conditions with the climates associated with a species' current distribution. Location weights define an empirical climatic niche reference, summarised by a weighted centre and radial boundary. The analysis measures local climatic change, movement towards or away from the reference centre, climatic reconfiguration, and distance beyond the boundary. Occurrence records, range maps, and binary or continuous species distribution model outputs can define location weights. Matrix and spatial workflows provide location-level results, distribution-wide summaries, climatic variable contributions and comparisons across future periods. |
| Authors: | Bohao He [aut, cre] |
| Maintainer: | Bohao He <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.3.9 |
| Built: | 2026-10-26 12:13:40 UTC |
| Source: | https://github.com/bohao0813/climniche |
Niche Boundary Exceedance
boundary_exceedance( psi_future, boundary_value, scale = c("radial", "potential") )boundary_exceedance( psi_future, boundary_value, scale = c("radial", "potential") )
psi_future |
Future squared niche distance. |
boundary_value |
Empirical boundary of the current climatic niche reference in squared-distance units. |
scale |
|
Numeric vector.
psi <- c(0.5, 1, 2) boundary_exceedance(psi, boundary_value = 1)psi <- c(0.5, 1, 2) boundary_exceedance(psi, boundary_value = 1)
Summarise interval changes in range summaries of Niche Boundary Exceedance
climniche_change_rate( x, metric = c("exposed_fraction", "range_wide_relative_exceedance", "mean_niche_boundary_exceedance"), scope = c("current", "all"), aggregation_weight = NULL, area_weight = FALSE, boundary_exceedance_tolerance = NULL )climniche_change_rate( x, metric = c("exposed_fraction", "range_wide_relative_exceedance", "mean_niche_boundary_exceedance"), scope = c("current", "all"), aggregation_weight = NULL, area_weight = FALSE, boundary_exceedance_tolerance = NULL )
x |
A |
metric |
Range summary used to quantify increase. |
scope, aggregation_weight, area_weight, boundary_exceedance_tolerance
|
Arguments passed to |
For a selected range summary , interval rates are
The function reports the largest positive and its interval. Rates
should only be compared among analyses using compatible temporal units and
projection resolution.
A data frame with one row per model and scenario.
Summarise Niche Boundary Exceedance through time
climniche_departure( x, scope = c("current", "all"), persistence = 1L, boundary_exceedance_tolerance = NULL )climniche_departure( x, scope = c("current", "all"), persistence = 1L, boundary_exceedance_tolerance = NULL )
x |
A |
scope |
|
persistence |
Minimum number of consecutive projections required to identify persistent Niche Boundary Exceedance. This setting affects persistence summaries, not the continuous exceedance values. |
boundary_exceedance_tolerance |
Optional non-negative boundary tolerance. The fitted value is used by default. |
At projection time , let be Niche Boundary Exceedance
for cell , divided by the fitted niche boundary distance after the
boundary tolerance is applied. Cumulative relative exceedance is
Mean relative exceedance is . The Time Weighted Niche
Boundary Exceedance Fraction applies the same trapezoidal calculation to
the binary exceedance indicator.
Numeric, Date and POSIXct times may be irregularly spaced. Cumulative values
use the reported time unit; mean values are dimensionless.
Persistent Niche Boundary Exceedance is a run of at least persistence
sampled projections above the selected boundary tolerance. Its onset is the
first sampled projection in that run, not an estimated crossing time between
projections.
A data frame with one row per cell, model and scenario. Primary
temporal fields give the first sampled Niche Boundary Exceedance
(first_boundary_exceedance) and the fraction of supplied projections
beyond the boundary (boundary_exceedance_projection_fraction). Persistent
onset and interval-weighted summaries are also returned.
sim <- simulate_climniche(n = 160, p = 6, seed = 2) future <- lapply(c(0.2, 0.5, 0.8, 1), function(fraction) { sim$current + fraction * (sim$future_away - sim$current) }) series <- fit_climniche_series( sim$current, future, time = c(2030, 2050, 2070, 2090), occupied = sim$occupied, sensitivity = sim$sensitivity ) head(climniche_departure(series))sim <- simulate_climniche(n = 160, p = 6, seed = 2) future <- lapply(c(0.2, 0.5, 0.8, 1), function(fraction) { sim$current + fraction * (sim$future_away - sim$current) }) series <- fit_climniche_series( sim$current, future, time = c(2030, 2050, 2070, 2090), occupied = sim$occupied, sensitivity = sim$sensitivity ) head(climniche_departure(series))
Identifies the climate variable with the largest absolute contribution to future minus current squared niche distance at each evaluated cell.
climniche_dominant_contribution(x, scope = c("current", "all")) ## S3 method for class 'climniche_contribution' summary(object, ...)climniche_dominant_contribution(x, scope = c("current", "all")) ## S3 method for class 'climniche_contribution' summary(object, ...)
x |
A fitted |
scope |
|
object |
A |
... |
Additional arguments passed to methods. |
Let be the contribution returned by
variable_contribution() for cell and variable . The dominant
variable has the largest . Its dominance share is
The share is undefined when every contribution is zero. Equal largest
absolute contributions are reported as "Tied" rather than being assigned
according to column order.
Contributions sum exactly to future minus current squared niche distance.
This total is also
. The terms therefore attribute the
squared-distance change underlying Niche Distance Shift. For a non-diagonal
metric matrix, each variable term includes its part of the cross-variable
terms in the chosen climatic basis. They are not SDM variable importance or
causal effects.
Current-scope summaries use the fitted reference weights; all-scope
summaries give each evaluated cell equal weight.
A climniche_contribution object. table contains the dominant
variable, signed contribution and dominance share for each cell. summary
contains mean contribution shares and signed contributions by variable,
together with the fraction of non-zero analysis weight for which each
variable is uniquely dominant. squared_niche_distance_change is the
row sum of the signed variable contributions. The legacy field
niche_potential_change is retained as an exact alias. Spatial fits also
return raster layers.
sim <- simulate_climniche(n = 300, p = 6, seed = 31) fit <- fit_climniche( sim[["current"]], sim[["future_away"]], occupied = sim[["occupied"]], sensitivity = sim[["sensitivity"]] ) contribution <- climniche_dominant_contribution(fit) summary(contribution) head(contribution[["table"]])sim <- simulate_climniche(n = 300, p = 6, seed = 31) fit <- fit_climniche( sim[["current"]], sim[["future_away"]], occupied = sim[["occupied"]], sensitivity = sim[["sensitivity"]] ) contribution <- climniche_dominant_contribution(fit) summary(contribution) head(contribution[["table"]])
Summarise agreement among projected climate models
climniche_model_agreement( x, scope = c("current", "all"), boundary_exceedance_tolerance = NULL, interval = 0.8 )climniche_model_agreement( x, scope = c("current", "all"), boundary_exceedance_tolerance = NULL, interval = 0.8 )
x |
A |
scope |
|
boundary_exceedance_tolerance |
Optional non-negative boundary tolerance. |
interval |
Central interval reported for Niche Boundary Exceedance across models. |
model_agreement is the proportion of supplied climate models with positive
Niche Boundary Exceedance. It is an ensemble agreement measure, not an
occurrence probability. Agreement is NA when fewer than two finite model
projections are available for a cell, time and scenario.
For available models,
where is boundary_exceedance_tolerance.
A data frame with one row per cell, time and scenario.
Screen ecological criteria against climate exposure
climniche_priority( x, exposure = c("niche_distance_change", "niche_boundary_exceedance", "climate_reconfiguration", "climate_change_amount", "outside_niche_exceedance", "composition_change"), criterion = NULL, criterion_name = NULL, criterion_direction = c("maximize", "minimize"), scope = c("current", "all"), positive_only = NULL, exposure_direction = c("maximize", "minimize") ) ## S3 method for class 'climniche_priority' summary(object, ...)climniche_priority( x, exposure = c("niche_distance_change", "niche_boundary_exceedance", "climate_reconfiguration", "climate_change_amount", "outside_niche_exceedance", "composition_change"), criterion = NULL, criterion_name = NULL, criterion_direction = c("maximize", "minimize"), scope = c("current", "all"), positive_only = NULL, exposure_direction = c("maximize", "minimize") ) ## S3 method for class 'climniche_priority' summary(object, ...)
x |
A fitted |
exposure |
Climatic quantity used as the exposure objective. Available
choices are |
criterion |
Optional second decision criterion. A numeric vector may contain one value per evaluated row or, for a spatial fit, one value per raster cell. A matching one-layer RasterLayer or SpatRaster is also accepted. When omitted, current reference weights are used. |
criterion_name |
Display name for |
criterion_direction |
Whether larger or smaller criterion values are preferred. |
scope |
|
positive_only |
If |
exposure_direction |
Whether larger or smaller exposure values are
preferred in the Pareto comparison. Use |
object |
A |
... |
Unused. |
The function ranks cells on two objectives: the selected climatic exposure
quantity and one reference or decision criterion. Cell dominates cell
when it is at least as preferred on both objectives and strictly
preferred on one. Non-dominated cells form Pareto rank 1. Removing that front
and repeating the comparison produces ranks 2, 3, and subsequent fronts.
If an analysis contains Pareto fronts, pareto_depth_score is
for the rank of cell ; it is 1 when all
cells occupy one front. The score does not order cells within a front and is
not comparable among separate analyses. Pareto dominance is invariant to
monotonic rescaling, so the two criteria are not combined with fitted
weights.
When current reference weights are constant, the default second criterion
does not distinguish cells and ranking is determined by exposure alone.
When the weights vary, the default compares exposure with the current
distribution weights. Supply criterion to use another ecological quantity.
Only one exposure quantity is used at a time. This avoids counting Climatic Displacement, Niche Distance Shift and Climatic Reconfiguration as independent objectives even though their values satisfy the fitted geometric identity. With current habitat suitability as the second criterion, preferring higher suitability and larger positive Niche Distance Shift targets potential exposure hotspots. Preferring higher suitability and lower Climatic Displacement guides the search for potential climatic refugia. Locations on the same front can trade a better value of one criterion for a poorer value of the other.
summary() reports the first-front fraction and the Spearman correlation
between the preference-oriented forms of the two objectives. These describe
how strongly the objectives separate the ranked cells; they are not
inferential tests.
A climniche_priority object containing the two decision criteria,
Pareto ranks, Pareto depth score (pareto_depth_score) and, for spatial
fits, map layers. relative_priority is retained as a compatibility alias
for pareto_depth_score.
summary() returns a summary.climniche_priority object with the
fitted settings and Pareto diagnostics.
Tracey JA, Rochester CJ, Hathaway SA, et al. (2018). Prioritizing conserved areas threatened by wildfire and fragmentation for monitoring and management. PLOS ONE, 13, e0200203. doi:10.1371/journal.pone.0200203
Sacre E, Bode M, Weeks R, Pressey RL (2019). The context dependence of frontier versus wilderness conservation priorities. Conservation Letters, 12, e12632. doi:10.1111/conl.12632
sim <- simulate_climniche(n = 500, p = 6, seed = 18) fit <- fit_climniche( sim[["current"]], sim[["future_away"]], occupied = sim[["occupied"]], sensitivity = sim[["sensitivity"]] ) priority <- climniche_priority(fit) priority priority_table <- priority[["table"]] head(priority_table[priority_table[["included"]], ]) summary(priority)sim <- simulate_climniche(n = 500, p = 6, seed = 18) fit <- fit_climniche( sim[["current"]], sim[["future_away"]], occupied = sim[["occupied"]], sensitivity = sim[["sensitivity"]] ) priority <- climniche_priority(fit) priority priority_table <- priority[["table"]] head(priority_table[priority_table[["included"]], ]) summary(priority)
Summarise Niche Boundary Exceedance across a study domain
climniche_range_summary( x, scope = c("current", "all"), aggregation_weight = NULL, area_weight = FALSE, boundary_exceedance_tolerance = NULL )climniche_range_summary( x, scope = c("current", "all"), aggregation_weight = NULL, area_weight = FALSE, boundary_exceedance_tolerance = NULL )
x |
A |
scope |
|
aggregation_weight |
Optional non-negative cell weights used only for
the range summary. Numeric vectors and, for spatial fits, matching
RasterLayer or SpatRaster objects are accepted. These weights multiply the
reference weights when |
area_weight |
If |
boundary_exceedance_tolerance |
Optional non-negative tolerance used to identify positive Niche Boundary Exceedance. By default, the fitted descriptor tolerance is used. |
Let a_i be the range summary weight, let be the boundary
tolerance, and define
The Weighted Niche Boundary Exceedance Fraction is
Conditional Relative Niche Boundary Exceedance is
Range Mean Relative Niche Boundary Exceedance is
Here, is the indicator function.
For scope = "current", a_i contains the reference weight. Optional
aggregation and cell area weights multiply it. For scope = "all", the
reference weight is omitted. These quantities summarise Niche Boundary
Exceedance and do not add further cell-level exposure metrics.
A data frame containing Weighted Niche Boundary Exceedance Fraction
(exposed_fraction), Conditional Relative Niche Boundary Exceedance
(conditional_relative_exceedance) and Range Mean Relative Niche Boundary
Exceedance (range_wide_relative_exceedance). For a climniche_series,
one row is returned for each time, model and scenario combination.
sim <- simulate_climniche(n = 250, p = 6, seed = 8) fit <- fit_climniche( sim$current, sim$future_away, occupied = sim$occupied, sensitivity = sim$sensitivity ) climniche_range_summary(fit)sim <- simulate_climniche(n = 250, p = 6, seed = 8) fit <- fit_climniche( sim$current, sim$future_away, occupied = sim$occupied, sensitivity = sim$sensitivity ) climniche_range_summary(fit)
Build a climniche report
climniche_report( x, species = NULL, scope = c("current", "all"), top_variables = 5 )climniche_report( x, species = NULL, scope = c("current", "all"), top_variables = 5 )
x |
A fitted |
species |
Optional species name used in printed reports. |
scope |
|
top_variables |
Number of variable contributions to show. |
An object of class climniche_report.
Build a report for a climniche time series
climniche_series_report( x, species = NULL, scope = c("current", "all"), aggregation_weight = NULL, area_weight = FALSE, boundary_exceedance_tolerance = NULL, persistence = 1L, agreement_interval = 0.8 )climniche_series_report( x, species = NULL, scope = c("current", "all"), aggregation_weight = NULL, area_weight = FALSE, boundary_exceedance_tolerance = NULL, persistence = 1L, agreement_interval = 0.8 )
x |
A |
species |
Optional species or study label. |
scope, aggregation_weight, area_weight, boundary_exceedance_tolerance
|
Range-summary settings. |
persistence |
Consecutive projection count used to identify persistent Niche Boundary Exceedance. |
agreement_interval |
Central interval used for model agreement. |
A climniche_series_report object.
Extract a long table from a climniche series
climniche_series_table(x, scope = c("current", "all"))climniche_series_table(x, scope = c("current", "all"))
x |
A |
scope |
|
A data frame with one row per cell and projection.
Summarise climniche results
climniche_summary(x, scope = c("current", "all"))climniche_summary(x, scope = c("current", "all"))
x |
A fitted |
scope |
|
A one-row data frame with summaries of the four continuous reported quantities, descriptor proportions and fitted descriptor thresholds.
Build data for the climniche summary figure
climniche_summary_figure_data( x, scope = c("current", "all"), max_points = 6000L, seed = 1L, plane_bins = 35L, boundary_probs = seq(0.5, 0.99, 0.01), top_variables = 6L )climniche_summary_figure_data( x, scope = c("current", "all"), max_points = 6000L, seed = 1L, plane_bins = 35L, boundary_probs = seq(0.5, 0.99, 0.01), top_variables = 6L )
x |
A fitted climniche object. |
scope |
|
max_points |
Maximum number of rows retained in the returned |
seed |
Random seed used when subsampling the returned |
plane_bins |
Number of fixed bins used to summarize the exposure plane. |
boundary_probs |
Boundary quantiles retained in the returned |
top_variables |
Number of variables to show. |
A list of data frames used by plot_climniche_summary_figure().
Extract a tidy climniche table
climniche_table(x, scope = c("current", "all"))climniche_table(x, scope = c("current", "all"))
x |
A fitted |
scope |
|
A data frame with one row per evaluated cell, including
occupied_weight, the four reported quantities and the old field aliases.
Compares the amount of climatic change at each location with movement towards or away from the current reference centre and distance beyond its estimated climatic range.
fit_climniche( current, future, occupied = NULL, occupied_threshold = NULL, cnfa = NULL, center = NULL, sensitivity = NULL, A = NULL, metric = c("diag", "factor"), boundary = 0.95, scale = TRUE, global_mean = NULL, global_sd = NULL, preprocess = TRUE, preprocess_correlation = 0.95, preprocess_min_sd = 1e-08, tolerance = NULL, tolerance_quantile = 0.1, boundary_exceedance_tolerance = 0 )fit_climniche( current, future, occupied = NULL, occupied_threshold = NULL, cnfa = NULL, center = NULL, sensitivity = NULL, A = NULL, metric = c("diag", "factor"), boundary = 0.95, scale = TRUE, global_mean = NULL, global_sd = NULL, preprocess = TRUE, preprocess_correlation = 0.95, preprocess_min_sd = 1e-08, tolerance = NULL, tolerance_quantile = 0.1, boundary_exceedance_tolerance = 0 )
current |
Numeric matrix or data frame of current climate values. Rows are cells, sites, or samples. Columns are climate variables. |
future |
Numeric matrix or data frame of future climate values with the
same rows and variables as |
occupied |
Location weights used to estimate the empirical climatic
niche reference. Use |
occupied_threshold |
Optional cutoff for numeric reference weights. Values at or below the cutoff are set to 0. Values above it keep their original continuous value. |
cnfa |
Optional compatible CENFA object. Its |
center |
Optional current niche centre on the scale used for distance
calculations. With |
sensitivity |
Optional non-negative climatic variable weights defining
relative contributions to distance. Retained variables receive equal
weights by default. These are separate from the location weights in |
A |
Optional square metric matrix defined for the fitted climatic
space. When supplied, it overrides |
metric |
Method used to build |
boundary |
Weighted quantile used to define the empirical radial boundary of the empirical climatic niche reference. Must be between 0 and 1. |
scale |
Logical. If |
global_mean |
Optional means used for centering when |
global_sd |
Optional standard deviations used for scaling. If
|
preprocess |
Logical. If |
preprocess_correlation |
Maximum absolute pairwise correlation retained among current climate variables during preprocessing. |
preprocess_min_sd |
Minimum current-climate standard deviation as a fraction of the largest finite current standard deviation. Variables at or below this value are removed during preprocessing. |
tolerance |
Optional tolerance around zero for Niche Distance Shift. If
|
tolerance_quantile |
Quantile of absolute Niche Distance Shift used to
set |
boundary_exceedance_tolerance |
Tolerance used to label Niche Boundary Exceedance in descriptor summaries. |
The empirical climatic niche reference summarises the current distribution
of climatic conditions by a weighted centre and radial boundary. It is a
proxy for the species' current climatic niche. With occupied = NULL, it
instead describes the study region.
Let and be current and future climatic conditions at
location in the fitted climatic space, the reference
centre, and the distance under climatic weighting matrix
. The four quantities are:
Climatic Displacement, the amount of local climatic change:
Niche Distance Shift, the signed change in distance from the centre:
Climatic Reconfiguration, the displacement not expressed as a distance shift:
Niche Boundary Exceedance, the distance beyond the fitted boundary:
Here is the -th location-weighted quantile of current
distances from the centre. Negative Niche Distance Shift indicates movement
towards the centre; positive values indicate movement away. When current
and future distances are equal, Niche Distance Shift is zero and Climatic
Reconfiguration equals Climatic Displacement. Niche Boundary Exceedance is
zero at or within the boundary and positive beyond it.
A climniche_fit object containing the reported quantities,
reference weights, fitted niche centre, metric matrix and effective
settings.
Fitted fields are climate_change_amount,
niche_distance_change, climate_reconfiguration, and
niche_boundary_exceedance. The legacy names composition_change and
outside_niche_exceedance are retained as aliases for old code.
boundary controls the empirical radial boundary. tolerance controls the
zero band for Niche Distance Shift. boundary_exceedance_tolerance controls
the boundary descriptor. The fitted values are stored in
descriptor_settings.
boundary_distance and boundary_radius store the fitted boundary in
distance units. boundary_potential stores its squared value and is the
quantity accepted by boundary_exceedance(). boundary_value is retained
as a legacy alias of boundary_distance.
preprocess selects retained variables. scale then converts those
variables to z scores using current-climate means and standard deviations.
Both are enabled by default. When fitted CENFA components are used,
preprocessing must be disabled because the component dimensions are fixed.
Inputs must either already use the CENFA standardisation with scale = FALSE
or provide its exact means and standard deviations through global_mean and
global_sd. climniche reads the required components from the supplied
object and does not call CENFA package functions.
Use fit_climniche() for matrices or data frames,
fit_climniche_raster() for RasterLayer, RasterStack or RasterBrick
objects, and fit_climniche_terra() for SpatRaster objects. All three
functions calculate the same quantities. The spatial functions add domain
masking and return map layers in x$rasters. Use fit_climniche_series()
for ordered projections.
sim <- simulate_climniche(n = 250, p = 6, seed = 7) fit <- fit_climniche( current = sim$current, future = sim$future_away, occupied = sim$occupied, sensitivity = sim$sensitivity ) climniche_summary(fit)sim <- simulate_climniche(n = 250, p = 6, seed = 7) fit <- fit_climniche( current = sim$current, future = sim$future_away, occupied = sim$occupied, sensitivity = sim$sensitivity ) climniche_summary(fit)
Fit climniche to raster data
fit_climniche_raster( current, future, occupied = NULL, occupied_threshold = NULL, domain = NULL, domain_threshold = 0, cnfa = NULL, center = NULL, sensitivity = NULL, A = NULL, metric = c("diag", "factor"), boundary = 0.95, scale = TRUE, global_mean = NULL, global_sd = NULL, preprocess = TRUE, preprocess_correlation = 0.95, preprocess_min_sd = 1e-08, tolerance = NULL, tolerance_quantile = 0.1, boundary_exceedance_tolerance = 0 )fit_climniche_raster( current, future, occupied = NULL, occupied_threshold = NULL, domain = NULL, domain_threshold = 0, cnfa = NULL, center = NULL, sensitivity = NULL, A = NULL, metric = c("diag", "factor"), boundary = 0.95, scale = TRUE, global_mean = NULL, global_sd = NULL, preprocess = TRUE, preprocess_correlation = 0.95, preprocess_min_sd = 1e-08, tolerance = NULL, tolerance_quantile = 0.1, boundary_exceedance_tolerance = 0 )
current |
|
future |
Matching |
occupied |
Optional RasterLayer with binary or continuous occurrence, range, or SDM suitability values. Continuous values are retained on their supplied numerical scale. |
occupied_threshold |
Values at or below this threshold receive zero reference weight. Values above it keep their original value. |
domain |
Optional RasterLayer limiting cells where exposure is analysed. |
domain_threshold |
Values greater than this threshold define the domain. |
cnfa |
Optional compatible CENFA object. Its |
center |
Optional current niche centre on the scale used for distance
calculations. With |
sensitivity |
Optional non-negative climatic variable weights defining
relative contributions to distance. Retained variables receive equal
weights by default. These are separate from the location weights in |
A |
Optional square metric matrix defined for the fitted climatic
space. When supplied, it overrides |
metric |
Method used to build |
boundary |
Weighted quantile used to define the empirical radial boundary of the empirical climatic niche reference. Must be between 0 and 1. |
scale |
Logical. If |
global_mean |
Optional means used for centering when |
global_sd |
Optional standard deviations used for scaling. If
|
preprocess |
Logical. If |
preprocess_correlation |
Maximum absolute pairwise correlation retained among current climate variables during preprocessing. |
preprocess_min_sd |
Minimum current-climate standard deviation as a fraction of the largest finite current standard deviation. Variables at or below this value are removed during preprocessing. |
tolerance |
Optional tolerance around zero for Niche Distance Shift. If
|
tolerance_quantile |
Quantile of absolute Niche Distance Shift used to
set |
boundary_exceedance_tolerance |
Tolerance used to label Niche Boundary Exceedance in descriptor summaries. |
fit_climniche_raster() is the spatial workflow for users working with the
raster package. It fits the current reference from finite current cells
within domain, then evaluates cells with finite current and future values.
Future missing values therefore do not alter the fitted current reference.
Reported quantities are written back to RasterLayer outputs.
An object of class climniche_fit with RasterLayer outputs stored in
x$rasters.
Estimates the preprocessing, standardisation, reference centre,
climatic weighting matrix and empirical radial boundary once. The resulting
object can be reused with project_climniche() for several future periods or
climate models.
fit_climniche_reference( current, occupied = NULL, occupied_threshold = NULL, cnfa = NULL, center = NULL, sensitivity = NULL, A = NULL, metric = c("diag", "factor"), boundary = 0.95, scale = TRUE, preprocess = TRUE, preprocess_correlation = 0.95, preprocess_min_sd = 1e-08, global_mean = NULL, global_sd = NULL )fit_climniche_reference( current, occupied = NULL, occupied_threshold = NULL, cnfa = NULL, center = NULL, sensitivity = NULL, A = NULL, metric = c("diag", "factor"), boundary = 0.95, scale = TRUE, preprocess = TRUE, preprocess_correlation = 0.95, preprocess_min_sd = 1e-08, global_mean = NULL, global_sd = NULL )
current |
Numeric matrix or data frame of current climatic conditions. Rows are cells or sites and columns are climatic variables. |
occupied |
Reference cells or weights, following the rules used by
|
occupied_threshold |
Optional cutoff for numeric reference weights. |
cnfa |
Optional compatible CENFA object. |
center |
Optional current niche centre in the fitted climatic space. |
sensitivity |
Optional non-negative climatic metric weights. |
A |
Optional climatic weighting matrix. |
metric |
Method used to build |
boundary |
Weighted quantile defining the empirical radial boundary. |
scale |
If |
preprocess |
If |
preprocess_correlation |
Maximum absolute correlation retained during preprocessing. |
preprocess_min_sd |
Minimum current-climate standard deviation as a fraction of the largest finite current standard deviation. |
global_mean, global_sd
|
Optional centring and scaling values. |
The empirical climatic niche reference summarises current climatic
conditions by a location-weighted centre and radial boundary. It is a proxy
for the species' current climatic niche. The weights in occupied determine
the contribution of locations; sensitivity or A determines the
contribution of climatic variables to distance.
The reference object fixes the climatic space used for all subsequent projections. Future conditions do not alter the centre, weighting matrix, standardisation or empirical radial boundary.
A climniche_reference object.
sim <- simulate_climniche(n = 200, p = 6, seed = 4) reference <- fit_climniche_reference( sim$current, occupied = sim$occupied, sensitivity = sim$sensitivity ) referencesim <- simulate_climniche(n = 200, p = 6, seed = 4) reference <- fit_climniche_reference( sim$current, occupied = sim$occupied, sensitivity = sim$sensitivity ) reference
Fits one current climatic niche reference and evaluates an ordered set of future projections. Projections may represent time periods, climate models, scenarios, or their combinations.
fit_climniche_series( current, future, time, model = NULL, scenario = NULL, occupied = NULL, occupied_threshold = NULL, domain = NULL, domain_threshold = 0, cnfa = NULL, center = NULL, sensitivity = NULL, A = NULL, metric = c("diag", "factor"), boundary = 0.95, scale = TRUE, preprocess = TRUE, preprocess_correlation = 0.95, preprocess_min_sd = 1e-08, global_mean = NULL, global_sd = NULL, tolerance = NULL, tolerance_quantile = 0.1, boundary_exceedance_tolerance = 0 )fit_climniche_series( current, future, time, model = NULL, scenario = NULL, occupied = NULL, occupied_threshold = NULL, domain = NULL, domain_threshold = 0, cnfa = NULL, center = NULL, sensitivity = NULL, A = NULL, metric = c("diag", "factor"), boundary = 0.95, scale = TRUE, preprocess = TRUE, preprocess_correlation = 0.95, preprocess_min_sd = 1e-08, global_mean = NULL, global_sd = NULL, tolerance = NULL, tolerance_quantile = 0.1, boundary_exceedance_tolerance = 0 )
current |
Current climatic conditions supplied as a numeric matrix,
data frame, |
future |
A list of future objects matching |
time |
Numeric, Date or POSIXct projection times, one per future object. |
model |
Optional climate model identifiers, one per future object or a single value recycled across projections. |
scenario |
Optional scenario identifiers, one per future object or a single value recycled across projections. |
occupied |
Current reference rows, weights or a matching one-layer raster. |
occupied_threshold |
Optional cutoff for continuous reference weights. |
domain |
Optional one-layer raster limiting a spatial analysis. |
domain_threshold |
Threshold used when |
cnfa |
Optional compatible CENFA object. |
center |
Optional current niche centre in the fitted climatic space. |
sensitivity |
Optional non-negative climatic metric weights. |
A |
Optional climatic weighting matrix. |
metric |
Method used to build |
boundary |
Weighted quantile defining the empirical radial boundary. |
scale |
If |
preprocess |
If |
preprocess_correlation |
Maximum absolute correlation retained during preprocessing. |
preprocess_min_sd |
Minimum current-climate standard deviation as a fraction of the largest finite current standard deviation. |
global_mean, global_sd
|
Optional centring and scaling values. |
tolerance |
Optional tolerance around zero for Niche Distance Shift. |
tolerance_quantile |
Quantile used when |
boundary_exceedance_tolerance |
Tolerance used by the empirical boundary descriptor and dynamic summaries. |
The current niche centre, climatic weighting matrix, standardisation and
empirical radial boundary are held fixed. For spatial inputs, this reference is
estimated from finite current cells within domain, independently of
missing values in future projections. Future comparisons use the common set
of finite cells across all projections. All projections also use one Niche
Distance Shift tolerance. When tolerance = NULL, it is the requested
quantile of pooled absolute Niche Distance Shift values across the fitted
series.
A climniche_series object containing one compatible
climniche_fit per projection.
sim <- simulate_climniche(n = 180, p = 6, seed = 12) future <- lapply(c(0.25, 0.50, 0.75, 1), function(fraction) { sim$current + fraction * (sim$future_away - sim$current) }) series <- fit_climniche_series( current = sim$current, future = future, time = c(2030, 2050, 2070, 2090), occupied = sim$occupied, sensitivity = sim$sensitivity ) climniche_range_summary(series)sim <- simulate_climniche(n = 180, p = 6, seed = 12) future <- lapply(c(0.25, 0.50, 0.75, 1), function(fraction) { sim$current + fraction * (sim$future_away - sim$current) }) series <- fit_climniche_series( current = sim$current, future = future, time = c(2030, 2050, 2070, 2090), occupied = sim$occupied, sensitivity = sim$sensitivity ) climniche_range_summary(series)
Fit climniche to terra raster data
fit_climniche_terra( current, future, occupied = NULL, occupied_threshold = NULL, domain = NULL, domain_threshold = 0, cnfa = NULL, center = NULL, sensitivity = NULL, A = NULL, metric = c("diag", "factor"), boundary = 0.95, scale = TRUE, global_mean = NULL, global_sd = NULL, preprocess = TRUE, preprocess_correlation = 0.95, preprocess_min_sd = 1e-08, tolerance = NULL, tolerance_quantile = 0.1, boundary_exceedance_tolerance = 0 )fit_climniche_terra( current, future, occupied = NULL, occupied_threshold = NULL, domain = NULL, domain_threshold = 0, cnfa = NULL, center = NULL, sensitivity = NULL, A = NULL, metric = c("diag", "factor"), boundary = 0.95, scale = TRUE, global_mean = NULL, global_sd = NULL, preprocess = TRUE, preprocess_correlation = 0.95, preprocess_min_sd = 1e-08, tolerance = NULL, tolerance_quantile = 0.1, boundary_exceedance_tolerance = 0 )
current |
terra SpatRaster of current climate layers. |
future |
terra SpatRaster of future climate layers with the same
geometry and variables as |
occupied |
Optional one layer SpatRaster with binary or continuous occurrence, range, or SDM suitability values. Continuous values are retained on their supplied numerical scale. |
occupied_threshold |
Values at or below this threshold receive zero reference weight. Values above it keep their original value. |
domain |
Optional one layer SpatRaster limiting cells where exposure is analysed. |
domain_threshold |
Values greater than this threshold define the domain. |
cnfa |
Optional compatible CENFA object. Its |
center |
Optional current niche centre on the scale used for distance
calculations. With |
sensitivity |
Optional non-negative climatic variable weights defining
relative contributions to distance. Retained variables receive equal
weights by default. These are separate from the location weights in |
A |
Optional square metric matrix defined for the fitted climatic
space. When supplied, it overrides |
metric |
Method used to build |
boundary |
Weighted quantile used to define the empirical radial boundary of the empirical climatic niche reference. Must be between 0 and 1. |
scale |
Logical. If |
global_mean |
Optional means used for centering when |
global_sd |
Optional standard deviations used for scaling. If
|
preprocess |
Logical. If |
preprocess_correlation |
Maximum absolute pairwise correlation retained among current climate variables during preprocessing. |
preprocess_min_sd |
Minimum current-climate standard deviation as a fraction of the largest finite current standard deviation. Variables at or below this value are removed during preprocessing. |
tolerance |
Optional tolerance around zero for Niche Distance Shift. If
|
tolerance_quantile |
Quantile of absolute Niche Distance Shift used to
set |
boundary_exceedance_tolerance |
Tolerance used to label Niche Boundary Exceedance in descriptor summaries. |
fit_climniche_terra() is the SpatRaster workflow for users working with
terra. It fits the current reference from finite current cells within
domain, then evaluates cells with finite current and future values. Future
missing values therefore do not alter the fitted current reference. Reported
quantities are written back to SpatRaster outputs.
An object of class climniche_fit with SpatRaster outputs stored in
x$rasters.
Build a climatic weighting metric
niche_metric(sensitivity = NULL, cnfa = NULL, type = c("diag", "factor"))niche_metric(sensitivity = NULL, cnfa = NULL, type = c("diag", "factor"))
sensitivity |
Numeric vector of climatic metric weights used by the diagonal metric. For a factor metric, complete names can be used to order the CENFA loading rows. |
cnfa |
Optional CENFA |
type |
Metric type. |
For climatic weights , the diagonal metric is
For a CENFA loading matrix and factor eigenvalues , the
factor metric is
The factor metric is constructed from co and eig; a separate
sensitivity vector is not combined with it. This quadratic metric is a
climniche construction from CENFA components, not a metric returned by
CENFA itself.
The argument name sensitivity is retained for API compatibility. Its
values define the relative scale of climatic distance; they are not
physiological sensitivity estimates unless supplied from an independent
analysis.
A positive semi-definite matrix.
niche_metric(c(temperature = 2, salinity = 1, oxygen = 0.5))niche_metric(c(temperature = 2, salinity = 1, oxygen = 0.5))
Niche percentile shift
niche_percentile(psi_current, psi_future, occupied)niche_percentile(psi_current, psi_future, occupied)
psi_current |
Current squared niche distance for all cells. |
psi_future |
Future squared niche distance for all cells. |
occupied |
Current reference weights or indices used to define the reference CDF. |
Data frame with current, future, and delta percentiles.
Squared niche distance
niche_potential(x, center, A)niche_potential(x, center, A)
x |
Climate matrix in the fitted climate space. |
center |
Current niche reference centre. |
A |
Niche metric matrix. |
Numeric vector of squared distances from the current niche centre in the fitted climatic space.
Niche radius
niche_radius(psi)niche_radius(psi)
psi |
Numeric squared niche distance values. |
Numeric vector in the distance units of the fitted climatic metric.
Map Niche Boundary Exceedance through time
plot_climniche_departure_map( x, metric = c("first_boundary_exceedance", "boundary_exceedance_projection_fraction", "first_persistent_departure", "boundary_exceedance_time_fraction", "departure_time_fraction", "mean_relative_exceedance", "maximum_relative_exceedance", "model_agreement"), model = NULL, scenario = NULL, time = NULL, scope = c("current", "all"), persistence = 1L, boundary_exceedance_tolerance = NULL, title = NULL, legend_title = FALSE, limits = NULL, colours = NULL, ... )plot_climniche_departure_map( x, metric = c("first_boundary_exceedance", "boundary_exceedance_projection_fraction", "first_persistent_departure", "boundary_exceedance_time_fraction", "departure_time_fraction", "mean_relative_exceedance", "maximum_relative_exceedance", "model_agreement"), model = NULL, scenario = NULL, time = NULL, scope = c("current", "all"), persistence = 1L, boundary_exceedance_tolerance = NULL, title = NULL, legend_title = FALSE, limits = NULL, colours = NULL, ... )
x |
A spatial |
metric |
Temporal result field to map. Available fields include first
sampled boundary exceedance ( |
model, scenario, time
|
Optional projection selectors. A selector is required when more than one relevant value is present. |
scope, persistence, boundary_exceedance_tolerance
|
Arguments passed to
|
title |
Optional map title. Use |
legend_title |
Optional legend title. The default suppresses a title that would repeat the map title. |
limits, colours
|
Optional colour-scale limits and colours. |
... |
Additional arguments passed to |
A ggplot object.
Plot a climniche reported quantity distribution
plot_climniche_distribution( x, metric = c("niche_distance_change", "climate_change_amount", "niche_boundary_exceedance", "climate_reconfiguration", "outside_niche_exceedance", "composition_change"), scope = c("current", "all"), title = NULL )plot_climniche_distribution( x, metric = c("niche_distance_change", "climate_change_amount", "niche_boundary_exceedance", "climate_reconfiguration", "outside_niche_exceedance", "composition_change"), scope = c("current", "all"), title = NULL )
x |
A fitted climniche object. |
metric |
Quantity to plot. Accepted values are
|
scope |
|
title |
Optional plot title. |
A ggplot object.
Map dominant climatic contributions
plot_climniche_dominant_contribution( x, type = c("variable", "share", "both"), scope = c("current", "all"), variable_labels = NULL, colours = NULL, title = NULL, extent = NULL, degree_labels = c("auto", "none", "hemisphere"), study_region = NULL, legend_position = "bottom", legend_variables = NULL ) ## S3 method for class 'climniche_contribution' plot(x, ...)plot_climniche_dominant_contribution( x, type = c("variable", "share", "both"), scope = c("current", "all"), variable_labels = NULL, colours = NULL, title = NULL, extent = NULL, degree_labels = c("auto", "none", "hemisphere"), study_region = NULL, legend_position = "bottom", legend_variables = NULL ) ## S3 method for class 'climniche_contribution' plot(x, ...)
x |
A |
type |
Plot the dominant |
scope |
Scope used when |
variable_labels |
Optional named vector replacing climate variable names. |
colours |
Optional colours for the climate variables. A final colour may be supplied for tied contributions; otherwise ties are grey. |
title |
Optional overall title for a combined figure. |
extent |
Optional |
degree_labels |
Longitude-latitude label style. |
study_region |
Optional study-region boundary accepted by
|
legend_position |
Legend position. |
legend_variables |
Optional character vector of fitted variable names to retain in the legend, including variables that are not dominant in any mapped cell. The default shows only observed categories. |
... |
Additional arguments passed to
|
A ggplot object, a patchwork object, or a named list when patchwork is unavailable.
sim <- simulate_climniche(n = 300, p = 6, seed = 32) fit <- fit_climniche( sim[["current"]], sim[["future_away"]], occupied = sim[["occupied"]], sensitivity = sim[["sensitivity"]] ) contribution <- climniche_dominant_contribution(fit)sim <- simulate_climniche(n = 300, p = 6, seed = 32) fit <- fit_climniche( sim[["current"]], sim[["future_away"]], occupied = sim[["occupied"]], sensitivity = sim[["sensitivity"]] ) contribution <- climniche_dominant_contribution(fit)
Plot the climniche exposure plane
plot_climniche_exposure( x, scope = c("current", "all"), max_points = 6000, seed = 1, title = NULL, colour_by = "niche_boundary_exceedance" )plot_climniche_exposure( x, scope = c("current", "all"), max_points = 6000, seed = 1, title = NULL, colour_by = "niche_boundary_exceedance" )
x |
A fitted climniche object. |
scope |
|
max_points |
Maximum number of points to draw. |
seed |
Random seed used when subsampling. |
title |
Optional plot title. |
colour_by |
Quantity used for point colour. The current plotting method
uses |
A ggplot object.
Plot a climniche map
plot_climniche_map( x, metric = c("niche_distance_change", "niche_boundary_exceedance", "climate_change_amount", "climate_reconfiguration", "change_alignment", "outside_niche_exceedance", "composition_change"), occupied = NULL, occupied_only = FALSE, occupied_threshold = NULL, title = NULL, midpoint = 0, limits = NULL, breaks = NULL, colours = NULL, legend_title = FALSE, legend_position = "right", show_legend = TRUE, symmetric = NULL, extent = NULL, degree_labels = c("auto", "none", "hemisphere"), study_region = NULL, region_colour = "black", region_linewidth = 0.35, region_linetype = 1, colour_values = NULL, colour_transform = "identity" )plot_climniche_map( x, metric = c("niche_distance_change", "niche_boundary_exceedance", "climate_change_amount", "climate_reconfiguration", "change_alignment", "outside_niche_exceedance", "composition_change"), occupied = NULL, occupied_only = FALSE, occupied_threshold = NULL, title = NULL, midpoint = 0, limits = NULL, breaks = NULL, colours = NULL, legend_title = FALSE, legend_position = "right", show_legend = TRUE, symmetric = NULL, extent = NULL, degree_labels = c("auto", "none", "hemisphere"), study_region = NULL, region_colour = "black", region_linewidth = 0.35, region_linetype = 1, colour_values = NULL, colour_transform = "identity" )
x |
A fitted climniche object with raster outputs, a RasterLayer, or a terra SpatRaster. |
metric |
Quantity to plot. Accepted values are
|
occupied |
Optional current reference RasterLayer or terra SpatRaster used for masking or overlaying the current reference distribution. |
occupied_only |
If TRUE, mask the plotted raster to current occurrence or suitability cells with positive reference weight. |
occupied_threshold |
Threshold used when |
title |
Optional plot title. Use |
midpoint |
Midpoint for the Niche Distance Shift colour scale. |
limits |
Optional two-element colour scale limits. |
breaks |
Optional colour scale breaks. |
colours |
Optional colour vector replacing the metric palette. |
legend_title |
Optional colour legend title. The default, |
legend_position |
Position passed to the ggplot theme. Common values
are |
show_legend |
If FALSE, suppress the colour legend. |
symmetric |
If TRUE, use limits symmetric around |
extent |
Optional |
degree_labels |
|
study_region |
Optional study-region boundary supplied as an |
region_colour, region_linewidth, region_linetype
|
Appearance of the optional study-region boundary. |
colour_values |
Optional positions between zero and one for the colours on the transformed scale. |
colour_transform |
Colour transformation passed to ggplot2. The default
is |
A ggplot object.
Plot the four reported climniche quantities as maps
plot_climniche_maps( x, metrics = c("climate_change_amount", "niche_distance_change", "climate_reconfiguration", "niche_boundary_exceedance"), ncol = 2L, legend_title = FALSE, metric_options = NULL, ... )plot_climniche_maps( x, metrics = c("climate_change_amount", "niche_distance_change", "climate_reconfiguration", "niche_boundary_exceedance"), ncol = 2L, legend_title = FALSE, metric_options = NULL, ... )
x |
A fitted |
metrics |
Character vector of reported quantity field names. |
ncol |
Number of map columns when patchwork is available. |
legend_title |
Shared legend title. The default suppresses repeated quantity names because each panel is titled. |
metric_options |
Named list of per-metric options passed to
|
... |
Map options passed to |
A patchwork object when patchwork is installed, otherwise a named list of ggplot objects.
Plot ecological screening of climate exposure
plot_climniche_priority( x, type = c("plane", "map", "both"), map_value = c("pareto_depth_score", "pareto_rank", "relative_priority"), max_points = 6000L, seed = 1L, title = NULL, extent = NULL, degree_labels = c("auto", "none", "hemisphere"), study_region = NULL, legend_position = "bottom" ) ## S3 method for class 'climniche_priority' plot(x, ...)plot_climniche_priority( x, type = c("plane", "map", "both"), map_value = c("pareto_depth_score", "pareto_rank", "relative_priority"), max_points = 6000L, seed = 1L, title = NULL, extent = NULL, degree_labels = c("auto", "none", "hemisphere"), study_region = NULL, legend_position = "bottom" ) ## S3 method for class 'climniche_priority' plot(x, ...)
x |
A |
type |
|
map_value |
Map |
max_points |
Target maximum number of cells drawn in the decision plane. Pareto rank 1 is always retained. |
seed |
Random seed used when the decision plane is subsampled. |
title |
Optional overall title for a combined figure. |
extent |
Optional |
degree_labels |
Longitude-latitude label style. |
study_region |
Optional study-region boundary accepted by
|
legend_position |
Legend position for the map. |
... |
Additional arguments passed to |
A ggplot object, a patchwork object, or a named list of plots when
patchwork is unavailable.
sim <- simulate_climniche(n = 400, p = 6, seed = 21) fit <- fit_climniche( sim[["current"]], sim[["future_away"]], occupied = sim[["occupied"]], sensitivity = sim[["sensitivity"]] ) priority <- climniche_priority(fit) if (requireNamespace("ggplot2", quietly = TRUE)) { plot_climniche_priority(priority, type = "plane") }sim <- simulate_climniche(n = 400, p = 6, seed = 21) fit <- fit_climniche( sim[["current"]], sim[["future_away"]], occupied = sim[["occupied"]], sensitivity = sim[["sensitivity"]] ) priority <- climniche_priority(fit) if (requireNamespace("ggplot2", quietly = TRUE)) { plot_climniche_priority(priority, type = "plane") }
Plot a climniche report figure
plot_climniche_report(x, scope = c("current", "all"))plot_climniche_report(x, scope = c("current", "all"))
x |
A fitted climniche object. |
scope |
|
A patchwork object when patchwork is installed, otherwise a named
list of ggplot objects.
Plot the climniche summary figure
plot_climniche_summary_figure( x, scope = c("current", "all"), max_points = 6000L, seed = 1L, plane_bins = 35L, boundary_probs = seq(0.5, 0.99, 0.01), top_variables = 6L, variable_labels = NULL, title = NULL, include_contributions = FALSE )plot_climniche_summary_figure( x, scope = c("current", "all"), max_points = 6000L, seed = 1L, plane_bins = 35L, boundary_probs = seq(0.5, 0.99, 0.01), top_variables = 6L, variable_labels = NULL, title = NULL, include_contributions = FALSE )
x |
A fitted climniche object or data returned by
|
scope |
|
max_points |
Maximum number of rows retained in the auxiliary |
seed |
Random seed used when subsampling the auxiliary |
plane_bins |
Number of fixed bins used to summarize the exposure plane. |
boundary_probs |
Boundary quantiles retained in the auxiliary figure data. |
top_variables |
Number of variables to show. |
variable_labels |
Optional named vector replacing variable labels. |
title |
Optional overall title when |
include_contributions |
If TRUE, add the variable-contribution panel and use the four-panel layout. The default groups the two joint metric plots with their four metric distributions. |
A patchwork object when patchwork is installed, otherwise a named
list of ggplot objects.
Plot range summaries of Niche Boundary Exceedance through time
plot_climniche_time( x, metric = c("range_wide_relative_exceedance", "exposed_fraction", "conditional_relative_exceedance", "mean_niche_boundary_exceedance"), scope = c("current", "all"), aggregation_weight = NULL, area_weight = FALSE, boundary_exceedance_tolerance = NULL, interval = 0.8, show_models = TRUE, title = NULL, base_size = 9 )plot_climniche_time( x, metric = c("range_wide_relative_exceedance", "exposed_fraction", "conditional_relative_exceedance", "mean_niche_boundary_exceedance"), scope = c("current", "all"), aggregation_weight = NULL, area_weight = FALSE, boundary_exceedance_tolerance = NULL, interval = 0.8, show_models = TRUE, title = NULL, base_size = 9 )
x |
A |
metric |
Range summary field to display: |
scope, aggregation_weight, area_weight, boundary_exceedance_tolerance
|
Arguments passed to |
interval |
Central interval drawn across climate models. |
show_models |
If |
title |
Optional plot title. |
base_size |
Base font size. |
A ggplot object.
Plot mean climatic variable contribution
plot_climniche_variable_contribution( x, occupied_only = TRUE, variable_labels = NULL, title = NULL )plot_climniche_variable_contribution( x, occupied_only = TRUE, variable_labels = NULL, title = NULL )
x |
A |
occupied_only |
If TRUE, summarize occupied cells only. |
variable_labels |
Optional named vector replacing variable labels. |
title |
Optional plot title. Use |
A ggplot object.
Plot a fitted climniche quantity
## S3 method for class 'climniche_fit' plot( x, type = c("distance", "boundary", "amount", "reconfiguration"), scope = c("current", "all"), breaks = "Sturges", ... )## S3 method for class 'climniche_fit' plot( x, type = c("distance", "boundary", "amount", "reconfiguration"), scope = c("current", "all"), breaks = "Sturges", ... )
x |
A fitted |
type |
Quantity to draw. |
scope |
|
breaks |
Histogram breaks passed to |
... |
Additional arguments passed to the histogram plot. |
Invisibly returns x.
Prints the four continuous reported quantities.
## S3 method for class 'climniche_summary' print(x, ...)## S3 method for class 'climniche_summary' print(x, ...)
x |
An object returned by |
... |
Additional arguments passed to the data-frame print method. |
Invisibly returns x.
Project climatic conditions onto a fitted niche reference
project_climniche( reference, future, current = NULL, occupied = NULL, occupied_threshold = NULL, tolerance = NULL, tolerance_quantile = 0.1, boundary_exceedance_tolerance = 0 )project_climniche( reference, future, current = NULL, occupied = NULL, occupied_threshold = NULL, tolerance = NULL, tolerance_quantile = 0.1, boundary_exceedance_tolerance = 0 )
reference |
A |
future |
Numeric matrix or data frame of projected climatic conditions. |
current |
Optional current climatic conditions for the projected rows.
If omitted, the current rows stored in |
occupied |
Optional reference weights for summaries of the projected
rows. When |
occupied_threshold |
Optional cutoff for numeric |
tolerance |
Optional tolerance around zero for Niche Distance Shift. |
tolerance_quantile |
Quantile of absolute Niche Distance Shift used
when |
boundary_exceedance_tolerance |
Non-negative tolerance used by the boundary status descriptor. |
Let be the climatic weighting matrix and the fitted
reference centre. In the transformed climatic space, write the current and
future centred vectors as and , with lengths
and . When both lengths are positive, let be the angle
between those vectors. Climatic Reconfiguration satisfies
Different climatic combinations can have the same distance from the centre. In that case Niche Distance Shift is zero and Climatic Reconfiguration equals Climatic Displacement.
A climniche_fit object using the fixed reference.
sim <- simulate_climniche(n = 200, p = 6, seed = 4) reference <- fit_climniche_reference( sim$current, occupied = sim$occupied, sensitivity = sim$sensitivity ) fit <- project_climniche(reference, sim$future_away) climniche_summary(fit)sim <- simulate_climniche(n = 200, p = 6, seed = 4) reference <- fit_climniche_reference( sim$current, occupied = sim$occupied, sensitivity = sim$sensitivity ) fit <- project_climniche(reference, sim$future_away) climniche_summary(fit)
Simulate a minimal climatic niche exposure example
simulate_climniche( n = 2000, p = 6, seed = 1, rho = 0, prevalence = 0.3, shift = 0.4 )simulate_climniche( n = 2000, p = 6, seed = 1, rho = 0, prevalence = 0.3, shift = 0.4 )
n |
Number of climate cells. |
p |
Number of climate variables. |
seed |
Random seed. |
rho |
Pairwise correlation among simulated climate variables. |
prevalence |
Proportion of background cells treated as true current occurrence locations under the virtual niche. |
shift |
Climatic Displacement imposed in the closer to niche and farther from niche scenarios. |
A list with current, future_toward, future_away, occupied, center, sensitivity and A.
sim <- simulate_climniche(n = 200, p = 6, seed = 7) dim(sim$current) mean(sim$occupied)sim <- simulate_climniche(n = 200, p = 6, seed = 7) dim(sim$current) mean(sim$occupied)
Summarise a climniche fit
## S3 method for class 'climniche_fit' summary(object, scope = c("current", "all"), ...)## S3 method for class 'climniche_fit' summary(object, scope = c("current", "all"), ...)
object |
A fitted |
scope |
|
... |
Unused. |
A summary.climniche_fit object.
sim <- simulate_climniche(n = 200, p = 6, seed = 5) fit <- fit_climniche( sim$current, sim$future_away, occupied = sim$occupied, sensitivity = sim$sensitivity ) summary(fit)sim <- simulate_climniche(n = 200, p = 6, seed = 5) fit <- fit_climniche( sim$current, sim$future_away, occupied = sim$occupied, sensitivity = sim$sensitivity ) summary(fit)
Climatic variable contribution to squared niche distance change
variable_contribution(current, future, center, A)variable_contribution(current, future, center, A)
current |
Current climate matrix in the fitted climate space. |
future |
Future climate matrix in the fitted climate space. |
center |
Current niche reference centre. |
A |
Niche metric matrix. |
For centred current and future climatic vectors and
, the contribution of variable is
Consequently,
where and are current and future niche distances.
These values therefore decompose the squared-distance change underlying
Niche Distance Shift. They are not SDM variable importance or causal
effects.
Matrix whose rows sum to future minus current squared niche distance.
Write a climniche report to Markdown
write_climniche_report(report, file)write_climniche_report(report, file)
report |
An object returned by |
file |
Output Markdown file. |
Invisibly returns file.
Write a climniche time series report
write_climniche_series_report(report, file)write_climniche_series_report(report, file)
report |
A |
file |
Output Markdown file. |
The file path, invisibly.