makegrid | R Documentation |
Cartesian product of levels of predictor values in a model with the option to specify desired values for some terms of the model
makegrid(fit, ...)
fit |
a model for which |
... |
predictors in the model for which a different set of values will be used. |
fit <- lm(mathach ~ ses * Sector, hs)
dd <- makegrid(fit, ses = seq(-2,2,.1))
library(car)
fit <- lm(income ~ type * education, Prestige)
dd <- makegrid(fit, type = 'prof', education = 6:18)
# note that dd$type will have the correct form,
# i.e. a factor with the same three levels as those in
# the original data set.
levels(dd$type)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.