ss_modelfit: Fit data to a specified linear model for one species

View source: R/ss_modelfit.R

ss_modelfitR Documentation

Fit data to a specified linear model for one species

Description

Fit data to a specified allometric equation, for one species. Allometric equations that may be considered as an input to this function can be found in ?eqns_info and data(eqns_info).

Usage

ss_modelfit(data, modelcode, response = "height", predictor = "diameter")

Arguments

data

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

modelcode

Character string of the model code for the selected allometric equation. Refer to ?eqns_info and data(eqns_info) for more information.

response

Column name of the response variable. Defaults to height.

predictor

Column name of the predictor variable. Defaults to diameter.

Value

A list of 2 elements:

fitted_model

Resulting model object.

fitted_model_info

Table showing information on the resulting model.

fitted_model_info

A dataframe with the following variables:

modelcode

Model code for the allometric equation used.

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).

References

McPherson E. G., van Doorn N. S. & Peper P. J. (2016) Urban Tree Database and Allometric Equations. General Technical Report PSW-GTR-253, USDA Forest Service, 86.

See Also

ss_modelfit_multi() to fit specified models across multiple species.

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

ss_modelselect_multi() to select best-fit models across multiple species.

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

Examples

data(urbantrees)
Alb_sam <- urbantrees[urbantrees$species == 'Albizia saman', ]
results <- ss_modelfit(Alb_sam,
                       modelcode = 'quad_w1', # manually specify equation to use
                       response = 'height', predictor = 'diameter')

results$fitted_model

results$fitted_model_info


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