Description Usage Arguments Value See Also Examples
This function takes a string and a linear model and either adds the predictor to the model, or removes it.
1 | fMaker(pred, fitCurrent, add = T)
|
pred |
the predictor to be added or removed from the current model |
fitCurrent |
the current model to be updated |
add |
by default adds the predictor to to the model. add=F removes the predictor from the model |
the updated model of type "lm"
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #Using the leafshape data set from the DAAG package
#Adding a predictor to a linear model
data(leafshape)
attach(leafshape)
currentModel <- lm(bladelen~bladewid + latitude, data = leafshape)
newModel <- fMaker("petiole", currentModel)
newModel$call
#lm(formula = bladelen ~ bladewid + latitude + petiole, data = leafshape)
#Removing a predictor from a linear model
currentModel <- lm(bladelen~bladewid + latitude, data = leafshape)
newModel <- fMaker("latitude", currentModel, add = FALSE)
newModel$call
#lm(formula = bladelen ~ bladewid, data = leafshape)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.