insight (version 0.11.0)

get_response: Get the values from the response variable

Description

Returns the values the response variable(s) from a model object. If the model is a multivariate response model, a data frame with values from all response variables is returned.

Usage

get_response(x, select = NULL)

Arguments

x

A fitted model.

select

Optional name(s) of response variables for which to extract values. Can be used in case of regression models with multiple response variables.

Value

The values of the response variable, as vector, or a data frame if x has more than one defined response variable.

Examples

Run this code
# NOT RUN {
library(lme4)
data(cbpp)
data(mtcars)
cbpp$trials <- cbpp$size - cbpp$incidence

m <- glm(cbind(incidence, trials) ~ period, data = cbpp, family = binomial)
head(get_response(m))
get_response(m, select = "incidence")

m <- lm(mpg ~ wt + cyl + vs, data = mtcars)
get_response(m)
# }

Run the code above in your browser using DataCamp Workspace