R/model_tbl.R
predict_allo.RdA frequent pattern in forest inventory anaylsis is the need to produce
predictions of models with the same functional form, but using different
models. predict_allo enables this by allowing the user to pass a
list-column of models as an argument, along with the associated covariates.
This pattern plays well with dplyr functions such as dplyr::mutate().
predict_allo(model_list, ...)A list-column of models
Additional arguments passed to each model's predict_fn
A vector of predictions
tree_data <- tibble::tibble(
dbh = c(10, 20), ht = c(50, 75), model = c(list(brackett_rubra), list(brackett_acer))
)
tree_data %>%
dplyr::mutate(vol = predict_allo(model, dbh, ht))
#> # A tibble: 2 × 4
#> dbh ht model vol
#> <dbl> <dbl> <list> [ft^3]
#> 1 10 50 <FxdEffcM> 11.8
#> 2 20 75 <FxdEffcM> 69.2