Extract Original Coefficients from a Linear Model - Generic Function

DESCRIPTION:

Extracts coefficients in terms of the original dummy variable coding of factors for linear models.

This function is an S Version 3 generic (see Methods); method functions can be written to handle specific S Version 3 classes of data. Classes which already have methods for this function include:
lm , aovlist

USAGE:

dummy.coef(object) 

REQUIRED ARGUMENTS:

object
any object of class lm or aovlist, or one that inherits from these classes.

VALUE:

a list of coefficient vectors, with an element for each term in the model.

DETAILS:

The coefficients returned by coefficients(object) for factor terms in an lm object are coefficients for the contrast variables derived for those factors. By default these are helmert contrasts for unordered factors and polynomial for ordered. For a main effect term, there are typically K-1 coefficients for a K level factor.

dummy.coef returns K coefficients for a K level factor, and these coefficients will satisfy the constraints implied by the choice of contrasts. For example if the default or "contr.sum" contrast functions are used to code a K-level factor, K coefficients will be returned by dummy.coef for this term, and if there was an intercept in the model, they will sum to 0. Similarly K . L coefficients are returned for an interaction term between a K level and a L level factor, with the appropriate constraints honored. Coefficients for numeric variables and matrices are returned as well, but these are the same as those on object, unless they are crossed with factor terms.

SEE ALSO:

, , , , , .

EXAMPLES:

myfit <- lm(Yield ~ Temp + Cat + Temp:Cat, data = catalyst) 
myfit 
# produces the following output: 
# Call: 
# lm(formula = Yield ~ Temp + Cat + Temp:Cat, data = catalyst) 
# Coefficients: 
#  (Intercept) Temp  Cat Temp:Cat  
#        64.25 11.5 0.75        5 
# Degrees of freedom: 8 total; 4 residual 
# Residual standard error: 3.708099  
  
dummy.coef(myfit) 
# produces the following output: 
# $"(Intercept)": 
#  (Intercept)  
#        64.25 
# $Temp: 
#    160  180  
#  -11.5 11.5 
# $Cat: 
#      A    B  
#  -0.75 0.75 
# $"Temp:Cat": 
#  160A 180A 160B 180B  
#     5   -5   -5    5