Learn R Programming

reghelper (version 0.3.3)

cell_means.glm: Estimated values of a general linear model.

Description

cell_means.glm calculates the predicted values at specific points, given a fitted general linear model.

Usage

# S3 method for glm
cell_means(model, ..., levels = NULL, type = c("link",
  "response"))

Arguments

model

A fitted linear model of type 'glm'.

...

Pass through variable names to add them to the table.

levels

A list with element names corresponding to some or all of the variables in the model. Each list element should be a vector with the names of factor levels (for categorical variables) or numeric points (for continuous variables) at which to test that variable.

type

The type of prediction required. The default 'link' is on the scale of the linear predictors; the alternative 'response' is on the scale of the response variable. For more information, see predict.glm.

Value

A data frame with a row for each predicted value. The first few columns identify the level at which each variable in your model was set. After columns for each variable, the data frame has columns for the predicted value, the standard error of the predicted mean, and the 95 confidence interval.

Details

By default, this function will provide means at -1SD, the mean, and +1SD for continuous variables, and at each levele of categorical variables. This can be overridden with the levels parameter.

If there are additional covariates in the model other than what are selected in the function call, these variables will be set to their respective means. In the case of a categorical covariate, the results will be averaged across all its levels.

See Also

cell_means.lm

Examples

Run this code
# NOT RUN {
# iris data
model <- lm(Sepal.Length ~ Petal.Length + Petal.Width, iris)
summary(model)
cell_means(model, Petal.Length)
# }

Run the code above in your browser using DataLab