mkrk.nominal: Crafting Building Blocks for Discrete Splines

View source: R/mkfun.factor.R

mkrk.nominalR Documentation

Crafting Building Blocks for Discrete Splines

Description

Craft numerical functions to be used by mkterm to assemble model terms involving factors.

Usage

mkrk.nominal(levels)
mkrk.ordinal(levels)

Arguments

levels

Levels of the factor.

Details

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

Value

A list of two elements.

fun

Function definition.

env

Portable local constants derived from the arguments.

Note

mkrk.x create a bivariate function fun(x,y,env,outer=FALSE), where x, y are real arguments and local constants can be passed in through env.

See Also

mkterm, mkrk.cubic, and mkrk.tp.


gss documentation built on Aug. 16, 2023, 9:07 a.m.

Related to mkrk.nominal in gss...