cell_means_q | R Documentation |
cell_means_q
calculates the predicted values at specific points,
given a fitted regression model (linear, generalized, or ANOVA).
cell_means_q(model, ...)
## S3 method for class 'lm'
cell_means_q(model, vars = NULL, levels = NULL, ...)
## S3 method for class 'aov'
cell_means_q(model, vars = NULL, levels = NULL, ...)
## S3 method for class 'glm'
cell_means_q(
model,
vars = NULL,
levels = NULL,
type = c("link", "response"),
...
)
model |
A fitted linear model of type 'lm', 'aov', or 'glm'. |
... |
Not currently implemented; used to ensure consistency with S3 generic. |
vars |
A vector or list with variable names to be added 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.
Note that in most cases it is easier to use cell_means
and
pass variable names in directly instead of strings of variable names.
cell_means_q
uses standard evaluation in cases where such evaluation
is easier.
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_q(lm)
: Estimated values for a linear model.
cell_means_q(aov)
: Estimated means for ANOVA.
cell_means_q(glm)
: Estimated values for a generalized linear model.
cell_means
# iris data
model <- lm(Sepal.Length ~ Petal.Length + Petal.Width, iris)
summary(model)
cell_means_q(model, 'Petal.Length')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.