visualisation_matrix {modelbased} | R Documentation |
Create a reference grid
Description
This function is an alias (another name) for the insight::get_datagrid()
function. Same arguments apply.
Usage
visualisation_matrix(x, ...)
## S3 method for class 'data.frame'
visualisation_matrix(
x,
by = "all",
target = NULL,
at = NULL,
factors = "reference",
numerics = "mean",
preserve_range = FALSE,
reference = x,
...
)
## S3 method for class 'numeric'
visualisation_matrix(x, ...)
## S3 method for class 'factor'
visualisation_matrix(x, ...)
Arguments
x |
An object from which to construct the reference grid. |
... |
Arguments passed to or from other methods (for instance, |
by |
Indicates the focal predictors (variables) for the reference grid
and at which values focal predictors should be represented. If not specified
otherwise, representative values for numeric variables or predictors are
evenly distributed from the minimum to the maximum, with a total number of
There is a special handling of assignments with brackets, i.e. values
defined inside
For factor variables, the value(s) inside the brackets should indicate
one or more factor levels, like The remaining variables not specified in |
target , at |
Deprecated name. Please use |
factors |
Type of summary for factors. Can be |
numerics |
Type of summary for numeric values. Can be |
preserve_range |
In the case of combinations between numeric variables
and factors, setting |
reference |
The reference vector from which to compute the mean and SD.
Used when standardizing or unstandardizing the grid using |
Value
Reference grid data frame.
Examples
library(modelbased)
# Add one row to change the "mode" of Species
data <- rbind(iris, iris[149, ], make.row.names = FALSE)
# Single variable is of interest; all others are "fixed"
visualisation_matrix(data, by = "Sepal.Length")
visualisation_matrix(data, by = "Sepal.Length", length = 3)
visualisation_matrix(data, by = "Sepal.Length", range = "ci", ci = 0.90)
visualisation_matrix(data, by = "Sepal.Length", factors = "mode")
# Multiple variables are of interest, creating a combination
visualisation_matrix(data, by = c("Sepal.Length", "Species"), length = 3)
visualisation_matrix(data, by = c(1, 3), length = 3)
visualisation_matrix(data, by = c("Sepal.Length", "Species"), preserve_range = TRUE)
visualisation_matrix(data, by = c("Sepal.Length", "Species"), numerics = 0)
visualisation_matrix(data, by = c("Sepal.Length = 3", "Species"))
visualisation_matrix(data, by = c("Sepal.Length = c(3, 1)", "Species = 'setosa'"))
# with list-style at-argument
visualisation_matrix(data, by = list(Sepal.Length = c(1, 3), Species = "setosa"))
# Standardize
vizdata <- visualisation_matrix(data, by = "Sepal.Length")
standardize(vizdata)