Learn R Programming

marginaleffects (version 0.4.1)

get_predict: Get predicted values from a model object (internal function)

Description

Get predicted values from a model object (internal function)

Usage

get_predict(model, newdata, type, ...)

# S3 method for default get_predict( model, newdata = insight::get_data(model), type = "response", conf.level = NULL, ... )

# S3 method for polr get_predict( model, newdata = insight::get_data(model), type = "probs", conf.level = NULL, ... )

# S3 method for glmmPQL get_predict( model, newdata = insight::get_data(model), type = "response", conf.level = NULL, ... )

# S3 method for glimML get_predict(model, newdata = insight::get_data(model), type = "response", ...)

# S3 method for multinom get_predict(model, newdata = insight::get_data(model), type = "probs", ...)

# S3 method for brmultinom get_predict(model, newdata = insight::get_data(model), type = "probs", ...)

# S3 method for brmsfit get_predict(model, newdata = insight::get_data(model), type = "response", ...)

# S3 method for crch get_predict(model, newdata = NULL, type = "location", ...)

# S3 method for fixest get_predict( model, newdata = insight::get_data(model), type = "response", conf.level = NULL, ... )

# S3 method for merMod get_predict( model, newdata = insight::get_data(model), type = "response", conf.level = NULL, ... )

# S3 method for lmerModLmerTest get_predict( model, newdata = insight::get_data(model), type = "response", conf.level = NULL, ... )

# S3 method for lmerMod get_predict( model, newdata = insight::get_data(model), type = "response", conf.level = NULL, ... )

# S3 method for mblogit get_predict(model, newdata = insight::get_data(model), type = "probs", ...)

# S3 method for clm get_predict(model, newdata = insight::get_data(model), type = "response", ...)

# S3 method for rq get_predict( model, newdata = insight::get_data(model), type = NULL, conf.level = NULL, ... )

# S3 method for rlmerMod get_predict(model, newdata = insight::get_data(model), ...)

# S3 method for stanreg get_predict(model, newdata = insight::get_data(model), type = "response", ...)

# S3 method for coxph get_predict( model, newdata = insight::get_data(model), type = "lp", conf.level = NULL, ... )

Arguments

model

Model object

newdata

A dataset over which to compute marginal effects. NULL uses the original data used to fit the model.

type

Type(s) of prediction as string or character vector. This can differ based on the model type, but will typically be a string such as: "response", "link", "probs", or "zero".

...

Additional arguments are passed to the predict() method used to compute adjusted predictions. These arguments are particularly useful for mixed-effects or bayesian models (see the online vignettes on the marginaleffects website). Available arguments can vary from model to model, depending on the range of supported arguments by each modeling package. See the "Model-Specific Arguments" section of the ?marginaleffects document for a non-exhaustive list of available arguments.

Value

A vector of predicted values of length equal to the number of rows in newdata. For models with multi-level outcomes (e.g., multinomial logit), this function returns a matrix of predicted values with column names equal to each of the levels/groups.