py4sci

Next topic

formula.convenience

This Page

formula.ancova

Implementation of R’s rules for design matrix creation

formula.ancova.concat(*ancovas)

Create a new ANCOVA formula by concatenating a sequence of ANCOVA formulae.

Note: this is not commutatitive because the order in which the (expr, [factors]) appear in the initiating sequence changes the resulting formula.

>>> x = Term('x'); f = Factor('f', range(3)); h = Factor('h', range(4))
>>> a1 = ANCOVA((x,f))
>>> a2 = ANCOVA((x,h))
>>> concat(a1,a2).formula
Formula([1, f_0*x, f_1*x, f_2*x, h_1*x, h_2*x, h_3*x])
>>> concat(a2,a1).formula
Formula([1, f_1*x, f_2*x, h_0*x, h_1*x, h_2*x, h_3*x])
formula.ancova.get_contributions(codings, sorted_factors, contrast='main_effect')

Determine which columns a subset of factors

formula.ancova.get_factor_codings(graded_subsets_of_factors)

Given a sequence of subsets of factors, determine which will be coded with all their degrees of freedom (“indicator”) and which will be coded as contrasts (“contrast”).

formula.ancova.is_ancova(obj)

Is obj an ANCOVA?

formula.ancova.maximal(ancova)

Return an ANCOVA formula with only the maximal elements for each expression.

formula.ancova.typeI(response, ancova, recarray)

Produce an ANCOVA table from a given ANCOVA formula with type I sums of squares where the order is based on the order of terms in the contrast_names of ancova.

formula.ancova.typeII(response, ancova, recarray)

Produce an ANCOVA table from a given ANCOVA formula with type II sums of squares.

formula.ancova.typeIII(response, ancova, recarray)

Produce an ANCOVA table with type III sum of squares from a given ANCOVA formula.