expand.formula {AlgDesign}R Documentation

Expanding a formula


Formulas are expanded to accommodate special functions for continuous and mixture variables.





A formula starting with ~ in the usual way.


A list of variable names to be used when a dot is used as shorthand for “all variables.”


If FALSE, the constant will be suppressed.


A vector the same length as varNames, with TRUE for corresponding numeric variables. If missing, all variables will be assumed to be numeric.


This function expands formulas to accommodate polynomial models for which R has minimal support. Assuming for illustration that there are three variables, A, B, and C, the following expressions may be used. In addition, a dot may be used to indicate that all variables in varNames are to be used.

All agruments to quad(), cubic(), and cubicS() must be numeric.

The cubicS() function produces a non-singular representation of a cubic model, when the variables are mixture variables, that is when the rows of data sum to a constant value, usually 1.0. Because of the mixture constraint, models containing mixture variables should not have a constant term. The linear and quadratic models for mixture variables A, B, and C are given by -1+(A+B+C) and -1+(A+B+C)^2 respectively. See Gorman and Hinman [1962] for details.


An expanded formula is returned.


expand.formula() is called by model.matrix() through the method call model.matix.formula(), thus one may use the above special functions with model.matrix().


Bob Wheeler bwheelerg@gmail.com

Please cite this program as follows:

Wheeler, R.E. (2004). expand.formula. AlgDesign. The R project for statistical computing https://www.r-project.org/


Gorman, J.W. and Hinman, J.E. (1962). Simplex lattice designs for multicomponent systems. Technometrics. 4-4. 463-487.

[Package AlgDesign version 1.2.0 Index]