| ss_predict | R Documentation |
Make predictions across rows in a dataset that may contain multiple species. The model associated with each species is used to predict values for the response variable, as well as it's prediction interval. Necessary bias-corrections are made for species with models that have a transformed response variable.
ss_predict( data, models, ref_table, level = 0.95, species = "species", predictor = "diameter", cf = "correctn_factor", geom_mean = "response_geom_mean" )
data |
Dataframe with columns containing the species and variables of
interest. Species names in the |
models |
A named list of each species' linear regression models.
|
ref_table |
Dataframe containing information to correct bias introduced
in models with a transformed response variable. It should include columns
for |
level |
Level of confidence for the prediction interval. Defaults to
|
species |
Column name of the species variable in |
predictor |
Column name of the predictor variable in |
cf |
Column name of the bias correction factor in |
geom_mean |
Column name of the geometric mean of response variable in
|
Dataframe of input data with columns appended:
Predicted value for the response variable.
Lower
bound of the prediction interval, based on the input argument level.
Upper bound of the prediction interval, based on the input
argument level.
ss_simulate() to run ss_predict() on simulated data.
Other single-species model functions:
ss_modelfit_multi(),
ss_modelfit(),
ss_modelselect_multi(),
ss_modelselect(),
ss_simulate()
# first select best-fit model
data(urbantrees)
Alb_sam <- urbantrees[urbantrees$species == 'Albizia saman', ] # we use one species as an example
results <- ss_modelselect_multi(Alb_sam,
response = 'height',
predictor = 'diameter')
# generate data for subsequent predictions
newdata <- generate_x(Alb_sam,
response = "height", predictor = "diameter")
# run function
predictions <- ss_predict(newdata,
models = results$ss_models,
ref_table = results$ss_models_info,
predictor = "predictor")
head(predictions)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.