add_predicted_sims.psem | R Documentation |
Generate simulations
from a psem model incorporating either error in
predicted error. Simulations explore the possible space
of what a model might predict rather than an interval for use
in comparison to Bayesian posteriors for non-Bayesian models. The
output format and functions draw inspiration from the
tidybayes::tidybayes()
library and
merTools::predictInterval()
## S3 method for class 'psem' add_predicted_sims( newdata, mod, n_sims = 1000, seed = NULL, type = c("predict", "fit"), ... )
newdata |
a data.frame of new data to predict |
mod |
An |
n_sims |
number of simulation samples to construct |
seed |
numeric, optional argument to set seed for simulations |
type |
Character defining if we are looking at fit or predict intervals. |
... |
Unused dots for compatibility with generic functions. |
A tibble::tibble()
with information about simulate values.
Other psem:
add_fitted_sims.psem()
## Not run: library(piecewiseSEM) data(keeley) mod <- psem( lm(abiotic ~ distance, data=keeley), lm(rich ~ abiotic + hetero, data=keeley), lm(hetero ~ distance, data=keeley), data = keeley) newdat <- data.frame(distance=c(30, 50)) new_predicted_sims <- newdat %>% add_predicted_sims(mod) head(new_predicted_sims) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.