R/ss_modelselect.R
ss_modelselect_multi.Rd
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)
.
ss_modelselect_multi(
data,
species = "species",
response = "height",
predictor = "diameter"
)
Dataframe that contains the variables of interest. Each row is a measurement for an individual tree of a particular species.
Column name of the species variable. Defaults to species
.
Column name of the response variable. Defaults to height
.
Column name of the predictor variable. Defaults to
diameter
.
A list of 3 elements:
List of tables showing each species' candidate models ranked by AICc value.
List of each species' best-fit model object.
Table showing each species' best-fit model information.
A dataframe with the following variables:
Name of tree species.
Model code for the best-fit equation.
Parameter estimates.
Geometric mean of the response variable used in calculation of AICc (only for transformed models).
Bias correction factor to use on model predictions (only for transformed models).
Range of the predictor variable within the data used to generate the model.
Range of the response variable within the data used to generate the model.
Residual standard error of the model.
Mean standard error of the model.
Adjusted \(R^2\) of the model.
Sample size (no. of trees used to fit model).
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()
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
#> df AICc model
#> 1 3 591.9422 lin_w1
#> 2 4 593.0074 quad_w1
#> 3 5 593.4045 cub_w1
#> 4 6 594.0030 quart_w1
#> 5 3 594.0139 lin_w2
#> 6 5 595.5983 cub_w2
results$ss_models[[1]] # model object for 1st species in list
#>
#> Call:
#> lm(formula = y ~ x)
#>
#> Coefficients:
#> (Intercept) x
#> 6.717 9.464
#>
results$ss_models_info # summary of best-fit models
#> species modelcode a b c d
#> 1 Albizia saman lin_w1 6.717431 9.4640964 NA NA
#> 2 Hopea odorata quart_w4 -1.149669 149.3178483 -1522.6122 7908.410
#> 3 Syzygium myrtifolium quart_w2 -4.614100 158.5128488 -748.2492 1638.676
#> 4 Terminalia mantaly expo_w1 1.241983 3.8600410 NA NA
#> 5 Xanthostemon chrysanthus loglog_w1 2.947907 0.5916555 NA NA
#> e response_geom_mean correctn_factor predictor_min predictor_max
#> 1 NA 13.566083 1.000000 0.31194369 1.5278875
#> 2 -14225.442 5.390829 1.000000 0.03183099 0.2928451
#> 3 -1321.221 7.735643 1.000000 0.04138029 0.5665916
#> 4 NA 7.596013 1.000533 0.03501409 0.5602254
#> 5 NA 5.041605 1.000883 0.02864789 0.3533240
#> response_min response_max residual_SE mean_SE adj_R2 n
#> 1 8 20 2.2050 4.7889 0.4276 133
#> 2 2 15 11.9430 2.6339 0.5460 483
#> 3 1 18 2.1674 2.2536 0.6662 353
#> 4 3 18 0.2493 0.0615 0.6702 197
#> 5 2 13 0.2123 0.0449 0.6137 418