This function finds the labels of coefficients associated with interactions or main effects in the results of various model fitting functions.
a model object.
a character string (a coefficent label).
a character string vector giving the order of the
terms to be returned.
logical. Should the labels in
model is an object returned by a model fitting
The character string passed to
ef must not include the
"(Intercept)") since it cannot be part of an
interaction. All non-intercept labels of any order are allowed.
"higher", all terms of a higher order
are returned. If
"lower", all terms of a
lower order are returned. If
both terms of lower and higher order are returned. For example,
if a model fit has the terms
A:B:C, terms of
higher order relative to
A:B:C. Terms of lower order relative to
FALSE (the default), the term
ef is not part of the returned string vector.
asef returns vectors of character strings
terms for extracting model terms.
1 2 3 4 5 6 7 8 9 10 11 12 13
require(utils) data(iris) fit <- lm(Sepal.Length ~ Sepal.Width * Petal.Length * Petal.Width, data = iris) asef(fit, "Petal.Length:Petal.Width", order = "higher") asef(fit, "Sepal.Width:Petal.Length:Petal.Width", order = "lower") asef(fit, "Petal.Length:Petal.Width", order = "all") data(warpbreaks) fit2 <- lm(breaks ~ wool * tension, data = warpbreaks) # Since wool is a factor, the coefficient has another name, "woolB" asef(fit2, "woolB", order = "higher") asef(fit2, "woolB", order = "higher", include.base = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.