Compute Type III Sum of Squares

DESCRIPTION:

Computes the sum of squares used in unweighted means analysis, also known as Type III sum of squares.

USAGE:

ssType3.lm(object)
ssType3.aovlist(object)
ssType3.formula(formula, data=sys.parent(), ...)

REQUIRED ARGUMENTS:

object
a model object that inherits from the one of the classes "lm" or "aovlist".
formula
a formula describing the model.

OPTIONAL ARGUMENTS:

data
a data frame in which to interpret the variables named in the formula argument. If data is missing, the variables in the formula should be in the search list.
...
optional arguments to be used in a call to the function aov.

VALUE:

an object of class "ssType3", which is a structure with the following data members:
ANOVA
an object of class "anova" containing the Type III sum of squares for each effect.
est.fun
a list of length 3 containing information that pertains to the Type III sum of squares. The components of this list are named gen.form, over.par, and assign:
gen.form

a matrix containing the general form of the estimable functions.

over.par
a matrix containing the Type III estimable functions for the overparameterized model.

assign
a list of length equal to the number of terms in the model. The elements of the list identify the columns in the over.par matrix that correspond to each term in the model.

DETAILS:

The sum of squares for each term listed in the ANOVA table is adjusted for all other terms in the model. These sums of squares are independent of the order that the terms are specified in the model formula. If the data are balanced, the sequential sum of squares equals the Type III sum of squares. If the data are unbalanced but complete, then the Type III sums of squares are those obtained from Yates' weighted squares-of-means technique. In this case, the hypotheses tested by the Type III sums of squares for the main effects is that the levels of the unweighted means are equal.

Consider a linear function of the overparameterized model parameters t(h)%*%b, where h is the pxd matrix of hypotheses and b is a px1 vector of the parameter estimates. This function is estimable if there exists a qxd matrix of constants l such that L%*%l = h. Here, L is the pxq matrix containing the general form of the estimable functions found in est.fun$gen.form. The hypotheses tested by the Type III sum of squares, h, are contained in est.fun$over.par. The list est.fun$assign identifies the columns in est.fun$over.par that are associated with each term. The dimension d corresponds to the degrees of freedom of each term.

SEE ALSO:

, , , .

EXAMPLES:

# Create a sample data set.
bakers <- data.frame(
   Fat = factor(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 
                  2, 2, 2, 2, 2, 2, 2, 2, 2, 
                  3, 3, 3, 3, 3, 3, 3, 3)), 
   Surfactant = factor(c(
                  1, 1, 1, 2, 2, 2, 3, 3, 3, 
                  1, 1, 1, 2, 2, 3, 3, 3, 3, 
                  1, 1, 2, 2, 2, 2, 3, 3)), 
   Flour = factor(c(1, 2, 3, 1, 3, 4, 2, 3, 4, 2, 3, 4, 2, 
                    4, 1, 2, 3, 4, 1, 2, 1, 2, 3, 4, 2, 3)), 
   Volume = c(6.7, 4.3, 5.7, 7.1, 5.9, 5.6, 5.5, 6.4, 5.8, 
              5.9, 7.4, 7.1, 5.6, 6.8, 6.4, 5.1, 6.2, 6.3, 
              7.1, 5.9, 7.3, 6.6, 8.1, 6.8, 7.5, 9.1))

# Use the formula method.
ssType3(Volume ~ Fat*Surfactant + Flour, data = bakers)

# Define an aov model and use the lm method.
bakers.aov <- aov(Volume ~ Fat*Surfactant + Flour, 
   data = bakers, contrasts = list(Flour = contr.sum(4), 
   Fat = contr.sum(3), Surfactant = contr.sum(3)),
   na.action = na.exclude)
ssType3(bakers.aov)