R/contr.2nd.R

Defines functions contr.2nd

Documented in contr.2nd

contr.2nd <-
function( n )
{
if( is.numeric(n) && length(n) == 1 )
  levs<- 1:n
else {
  levs <- n
  n <- length(n)
}
if( n<3 ) stop( "Contrasts not defined for ", n-2, " degrees of freedom" )
outer( 1:n, 3:n-1, FUN=function(x,y) pmax( x-y, 0 ) )
}

Try the Epi package in your browser

Any scripts or data that you put into this service are public.

Epi documentation built on April 25, 2023, 9:09 a.m.