| model-class | R Documentation |
To work with many model types simultaneously, multimedia uses a model class with the necessary mediation model functionality that wraps any specific implementation. The slots below define the generally required functionality for any specific implementation.
estimatorA function that takes a formula, input data frame X, and an
response data.frame $Y$ and returns a model. For example, for the random
forest model, this is created by wrapping parallelize() on the ranger()
function for random forest estimation function using the 'ranger' package.
estimatesA list containing the estimated model.
samplerA function that supports sampling new responses from the estimated model.
model_typeA string specifying the type of model associated with the class. For example, "rf_model()" denotes a random forest model.
predictorA function that returns fitted predictions given new inputs. For example, this can be the original predict() method for a multivariate response model, or it can be a loop over predicts for each feature in the mediation or outcome model.
m <- lm_model()
estimator(m)(mpg ~ hp + wt, data = mtcars)
m <- rf_model()
estimator(m)(mpg ~ hp + wt, data = mtcars)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.