cell_means | R Documentation |
cell_means
calculates the predicted values at specific points, given
a fitted regression model (linear, generalized, or ANOVA).
cell_means(model, ...)
## S3 method for class 'lm'
cell_means(model, ..., levels = NULL)
## S3 method for class 'aov'
cell_means(model, ..., levels = NULL)
## S3 method for class 'glm'
cell_means(model, ..., levels = NULL, type = c("link", "response"))
model |
A fitted linear model of type 'lm', 'aov', or '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
|
By default, this function will provide means at -1 SD, the mean, and +1 SD
for continuous variables, and at each level 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.
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.
cell_means(lm)
: Estimated values for a linear model.
cell_means(aov)
: Estimated means for ANOVA.
cell_means(glm)
: Estimated values for a generalized linear model.
# iris data
model <- lm(Sepal.Length ~ Petal.Length + Petal.Width, iris)
summary(model)
cell_means(model, Petal.Length)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.