mid.conditional() creates an object to draw ICE curves of a MID model.
mid.conditional(
object,
variable,
data = NULL,
keep.effects = TRUE,
n.samples = 100L,
max.nrow = 100000L,
type = c("response", "link")
)# S3 method for mid.conditional
print(x, digits = max(3L, getOption("digits") - 2L), ...)
mid.conditional() returns an object of class "mid.conditional" with the following components:
the character vector of relevant terms.
the data frame of the actual observations and the corresponding predictions.
the data frame of the hypothetical observations and the corresponding predictions.
the sample points of the variable.
a "mid" object.
a character string or expression specifying the variable for the ICE calculation.
a data frame containing observations for which ICE values are calculated. If not passed, data is extracted from parent.env() based on the function call of the "mid" object.
logical. If TRUE, the effects of component functions are stored in the output object.
integer. The number of sample points for the calculation.
an integer specifying the maximum number of rows of the output data frames.
the type of prediction required. The default is "response". "link" is possible if the MID model uses a link function.
a "mid.conditional" object to be printed.
an integer specifying the minimum number of significant digits to be printed.
additional parameters to be passed to print.default() to print the sample point vector.
mid.conditional() obtains predictions for hypothetical observations from a MID model and returns a "mid.conditional" object.
The graphing functions ggmid() and plot() can be used to generate the ICE curve plots.
data(airquality, package = "datasets")
mid <- interpret(Ozone ~ .^2, airquality, lambda = 1)
mc <- mid.conditional(mid, "Wind", airquality)
mc
Run the code above in your browser using DataLab