Craft numerical functions to be used by mkterm to assemble
model terms involving factors.
mkrk.nominal(levels)
mkrk.ordinal(levels)A list of two elements.
Function definition.
Portable local constants derived from the arguments.
Levels of the factor.
For a nominal factor with levels \(1,2,\dots,k\), the level means \(f(i)\) will be shrunk towards each other through a penalty proportional to $$(f(1)-f(.))^2+\dots+(f(k)-f(.))^2$$ where \(f(.)=(f(1)+\dots+f(k))/k\).
For a ordinal factor with levels \(1<2<\dots<k\), the level means \(f(i)\) will be shrunk towards each other through a penalty proportional to $$(f(1)-f(2))^2+\dots+(f(k-1)-f(k))^2$$
mkterm, mkrk.cubic, and
mkrk.tp.