ss_modelselect_multi: Select best-fit linear models across multiple species

View source: R/ss_modelselect.R

ss_modelselect_multiR Documentation

Select best-fit linear models across multiple species

Description

Wrapper function that runs ss_modelselect() across multiple species in a dataframe. A single best-fit equation is selected per species, based on the lowest AICc value. All allometric equations considered (and ranked) can be found in ?eqns_info and data(eqns_info).

Usage

ss_modelselect_multi(
  data,
  species = "species",
  response = "height",
  predictor = "diameter"
)

Arguments

data

Dataframe that contains the variables of interest. Each row is a measurement for an individual tree of a particular species.

species

Column name of the species variable. Defaults to species.

response

Column name of the response variable. Defaults to height.

predictor

Column name of the predictor variable. Defaults to diameter.

Value

A list of 3 elements:

ss_models_rank

List of tables showing each species' candidate models ranked by AICc value.

ss_models

List of each species' best-fit model object.

ss_models_info

Table showing each species' best-fit model information.

ss_models_info

A dataframe with the following variables:

species

Name of tree species.

modelcode

Model code for the best-fit equation.

a, b, c, d, e

Parameter estimates.

response_geom_mean

Geometric mean of the response variable used in calculation of AICc (only for transformed models).

correctn_factor

Bias correction factor to use on model predictions (only for transformed models).

predictor_min, predictor_max

Range of the predictor variable within the data used to generate the model.

response_min, response_max

Range of the response variable within the data used to generate the model.

residual_SE

Residual standard error of the model.

mean_SE

Mean standard error of the model.

adj_R2

Adjusted R^2 of the model.

n

Sample size (no. of trees used to fit model).

See Also

ss_modelselect() to select a best-fit model for one species.

ss_modelfit() to fit a pre-selected model for one species.

ss_modelfit_multi() to fit pre-selected models across multiple species.

Other single-species model functions: ss_modelfit_multi(), ss_modelfit(), ss_modelselect(), ss_predict(), ss_simulate()

Examples

data(urbantrees)
results <- ss_modelselect_multi(urbantrees, species = 'species',
                                response = 'height', predictor = 'diameter')

head(results$ss_models_rank[[1]]) # Highly-ranked models for 1st species in list

results$ss_models[[1]] # model object for 1st species in list

results$ss_models_info # summary of best-fit models


xp-song/allometree documentation built on March 28, 2022, 4:36 a.m.