Fits tree growth or mortality models using neighborhood metrics based on differing neighborhood sizes, calculating mean square error of each model, and thereby providing useful data on the appropriate neighborhood size for analysis. It is strongly recommended that this sensitivity analysis or a similar one is used to select a neighborhood size for modeling because the appropriate neighborhood size varies between study systems and ecological processes.

select_nbhd_size(
  radii,
  map_data,
  model_process,
  tree_data,
  abiotic_data = NULL,
  focal_sps,
  dens_type,
  edge_handling = F,
  max_x,
  max_y,
  rare_sps = 100
)

Arguments

radii

Vector of the neighborhood radii to try.

map_data

Data frame containing tree coordinates.

model_process

Character determining type of process to be modeled (i.e. "growth" or "mortality").

tree_data

Tree measurement data frame containing size or mortality data for trees in map_data (see built-in dataset tree for an example). If model_process = "mortality", tree_data must contain a mort column where 1 and 0 values indicate dead and alive respectively. If model_process = "growth", tree_data must contain repeated DBH measurements in a dbh column. Additional columns are permitted.

abiotic_data

Data frame containing abiotic data for each of the stands in map_data. Must contain a stand_id column. All other columns will be included as explanatory variables in the fitted models. This argument is optional.

focal_sps

Vector of species names (i.e. character strings) for which a neighborhood size should be selected.

dens_type

Method for calculating tree densities in each neighborhood. Must take one of the values: "raw", "proportional", or "angular". See ?neighborhood_summary for details.

edge_handling

Boolean indicating whether trees whose neighborhood overlaps the stand boundary should have their neighborhood metrics adjusted to account for the unsampled portion of their neighborhood. If FALSE, these trees will be excluded from the analysis as focals.

max_x

Maximum expected x coordinate (i.e. should be 100 if the stands are 100 x 100 m).

max_y

Maximum expected y coordinate.

rare_sps

Minimum number of interactions a competitor species must appear in to remain separate from the "RARE" category in the models (see ?growth_model or ?mortality_model for details). If not specified, this argument will default to a value of 100 interactions.

Value

A list containing a number of named elements (exact number will be the number of focal_sps plus one:

  • mse_vals is a data frame containing the mean square error of the fitted model for each focal_sps using each neighborhood size listed in radii.

  • each additional element of the list will be a plot of model mean square error vs. neighborhood size for one of the focal_sps.

Details

This function uses a data frame of tree coordinates (map_data) to calculate a series of metrics to describe the neighborhoods around each tree. It does this by applying the neighborhoods and then the neighborhood_summary functions. It is therefore necessary to provide, under the argument dens_type, instruction for the method that neighborhood_summary should use to calculate densities. It is also possible to conduct edge handling by setting edge_handling = T. This process is repeated for each of the neighborhood sizes specified by the argument radii. If edge_handling = F, trees whose neighborhood overlaps the stand boundary will be excluded from modeling. Boundary overlap is determined using the largest neighborhood size in radii to ensure the number of focal trees is constant across neighborhood sizes.

The neighborhood metrics are then combined with the growth rates or mortality status of their focal tree. If model_process = "growth" the size_corr_growth output by growth_summary will be used as the dependent variable (any trees with illogical negative annual growth rates are excluded as focal trees). If the user also provides abiotic data for the stands using the argument abiotic_data, these are also joined to the neighborhood metric and growth/mortality data. The result is a design matrix that is given to the growth_model or mortality_model function, depending on the value of model_process. This entire process is repeated for each neighborhood size (radii) and focal_sps, with the mean square error of each resulting model being recorded. The function outputs a list containing a data frame of all mean square error values and a plot of mean square error vs. neighborhood size for each focal_sps.

Examples

# See vignette "Selecting neighborhood size"