coef2term: Extract the term names of coefficients of a model.

Description Usage Arguments Details Value See Also Examples

View source: R/coef2term.R

Description

The function returns the labels of the terms of the model Note. The terms are not identical to the coefficients.

Usage

1
coef2term(model, ef)

Arguments

model

a model object.

ef

a character vector of coefficient labels.

Details

model is an object returned by a model fitting function (e.g., lm, aov).

The character string passed to ef must not include the intercept ("(Intercept)"). All non-intercept labels of any order are allowed.

Value

a character vector of term labels (one element for each element in ef).

See Also

term2coef for the inverse function.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
require(utils)
 
data(iris)
fit <- lm(Sepal.Length ~ poly(Sepal.Width, 3), data = iris)
summary(fit)
coef2term(fit, "poly(Sepal.Width, 3)2")
 
data(warpbreaks)
fit2 <- lm(breaks ~ wool * tension, data = warpbreaks)
summary(fit2)
coef2term(fit2, c("woolB", "tensionH"))
coef2term(fit2, c("woolB:tensionM"))

hohenstein/remef documentation built on Jan. 26, 2020, 12:57 a.m.