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

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
#> 
#> Call:
#> lm(formula = y ~ x + I(x^2))
#> 
#> Coefficients:
#> (Intercept)            x       I(x^2)  
#>       4.808       14.498       -3.098  
#> 

results$fitted_model_info
#>   modelcode        a        b         c  d  e response_geom_mean
#> 1   quad_w1 4.807887 14.49773 -3.097745 NA NA           13.56608
#>   correctn_factor predictor_min predictor_max response_min response_max
#> 1               1     0.3119437      1.527887            8           20
#>   residual_SE mean_SE adj_R2   n
#> 1      2.2047  4.7509 0.4278 133