R/contr.orth.R

Defines functions contr.orth

Documented in contr.orth

contr.orth <-
  function( n )
  {
  if( is.numeric( n ) && length( n )==1 )
  levs <- 1:n
  else {
  levs <- n
  n <- length( n )
  }
  Z <- contr.sum( n )
  L <- 1:n - mean(1:n)
  contr <- Z - L%*%( ( t(L) %*% L )^(-1) ) %*% ( t(L) %*% Z )
  contr[,1:(n-2)]
  }

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.