aba_build_model {lidaRtRee}R Documentation

Calibrates and validates area-based models

Description

The function can first apply a Box-Cox transformation to the dependent variable, in order to normalize its distribution, or a log transformation to the whole dataset. Then it uses regsubsets to find the 20 linear regressions with the best adjusted-R2 among combinations of at most nmax independent variables. Each model can then be tested regarding the following linear model assumptions are checked:

The model with the highest adjusted-R2 among those fulfilling the required conditions is selected. A leave-one-out cross validation (LOO CV) is performed by fitting the model coefficients using all observations except one and applying the resulting model to predict the value for the remaining observation. In case a transformation was performed beforehand, a bias correction is applied. LOO CV statistics are then computed.

Usage

aba_build_model(
  variable,
  predictors,
  transform = "none",
  nmax = 3,
  test = c("partial_p", "vif", "gvlma"),
  xy = NULL,
  threshold = NULL
)

Arguments

variable

vector. dependent variable values

predictors

data.frame. independent variables (columns: metrics, lines: observations). Row names are used for the output predicted values

transform

string. transformation to be applied to data ("none", "boxcox": Box-Cox transformation applied only to the dependent variable, "log": log transformation applied to both dependent and independent variables)

nmax

numeric. maximum number of independent variables in the model

test

vector. which tests should be satisfied by the models, one to three in "partial_p", "vif", "gvlma"

xy

data.frame or matrix of easting and northing coordinates of observations: not used in the function but exported in the result for use in further inference functions

threshold

vector of length two. minimum and maximum values of threshold to apply to predicted values

Value

a list with three elements

See Also

aba_combine_strata for combining models calibrated on different strata, aba_plot for plotting model cross-validation results, regsubsets for variable selection, lma_check for linear model assumptions check, boxcox_itr_bias_cor for reverse Box-Cox transformation with bias correction.

Examples

data(quatre_montagnes)
# build ABA model for basal area, with all metrics as predictors
model_aba <- aba_build_model(quatre_montagnes$G_m2_ha, quatre_montagnes[, 9:76],
  transform = "boxcox", nmax = 3
)
# summary of regression model
summary(model_aba$model)
# validation statistics
model_aba$stats
# observed and predicted values
summary(model_aba$values)

# plot field values VS predictions in cross-validation
aba_plot(model_aba, main = "Basal area")

[Package lidaRtRee version 4.0.5 Index]