predData: Model predictions

View source: R/predData.R

predDataR Documentation

Model predictions

Description

Get data for model predictions and uncertainty varied over the range of variable while holding all other variables at their median values. Can support two-way interactions by specifying a variable name for vary.

Usage

predData(mod, df, variable, vary = NULL, dv, type = "logit")

Arguments

mod

A model whose coefficients and variance-covariance matrix will be used to do the predictions. Currently supports logistic regression (glm package) and hurdle models (pscl package).

df

A dataframe containing data to be used in prediction. Should contain values for all variables used in mod.

variable

A string specifying the variable that will be varied from its minimum to maximum values.

vary

An (optional) string specifying a variable to interact with variable in doing the predictions. Defaults to NULL.

dv

A string specifying which of the variables in df is the dependent variable in mod.

type

A string specifying the model type (either 'logit' or 'hurdle'). Defaults to 'logit'.

Value

A dataframe containing values of variable (as well as the name of the variable) and corresponding predicted values, as well as the values of the boundaries of 95 percent intervals. These values can easily be used to plot the substantive effect of variable (and vary, if applicable) on dv, according to the results of mod.


ballardao/abmisc documentation built on March 28, 2022, 6:40 a.m.