| mix_simulate | R Documentation |
Wrapper function that runs mix_predict() on simulated data from generate_x().
Data is generated for each species based on their respective ranges of the
predictor variable, which can be extrapolated to values defined by the user.
The mixed-effects model is used to predict values for the response variable, as well as it's prediction interval.
Necessary bias-corrections are made if the mixed-effects model has a transformed response variable.
mix_simulate( data, modelselect, level = 0.95, extrapolate = NULL, length.out = 100, stat = "median", n.sims = 1000, response = "height", predictor = "diameter", species = "species", ... )
data |
Dataframe used to generate data and their predictions the using mixed-effects model. Columns should contain the species and variables of interest. Each row is a measurement for an individual tree. |
modelselect |
Output from the |
level |
Level of confidence for the prediction interval. Defaults to
|
extrapolate |
Numeric vector of 2 elements (e.g. |
length.out |
Number of new predictor values to generate for each species. Defaults to 100. Set a higher value for greater resolution at the cost of computational time. |
stat |
Specify whether the |
n.sims |
Number of bootstrapped simulations to generate the prediction intervals. Defaults to |
response |
Column name of the response variable in |
predictor |
Column name of the predictor variable in |
species |
Column name of the species variable in |
... |
Additional arguments passed to |
A dataframe with columns:
Name of tree species.
Variable used to make predictions.
Predicted value.
Lower bound of the prediction interval, based on the input argument level.
Upper bound of the prediction interval, based on the input argument level.
Indicates whether the predictions are based on extrapolated values. Either 'High', 'Low', or 'No' (not extrapolated).
generate_x() to generate new values for each species in a dataset.
mix_predict() to make predictions for all species in a dataset using linear mixed-effects model.
merTools::predictInterval() to make predictions from models fit with the lme4 package.
Other mixed-effects model functions:
mix_modelselect(),
mix_predict()
data(urbantrees) ## Not run: model <- mix_modelselect(urbantrees) results <- mix_simulate(data = urbantrees, modelselect = model) head(results) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.