makegrid: Cartesian product of model predictors

View source: R/makegrid.R

makegridR Documentation

Cartesian product of model predictors

Description

Cartesian product of levels of predictor values in a model with the option to specify desired values for some terms of the model

Usage

makegrid(fit, ...)

Arguments

fit

a model for which getD returns the model frame, assuming that the response is in the first column

...

predictors in the model for which a different set of values will be used.

Examples

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)
       

gmonette/spida2 documentation built on June 12, 2025, 9:44 p.m.