View source: R/util.r View source: R/contrast.r
contrast | R Documentation |
Return a matrix of contrasts for constraints about the mean.
contr.mean(n, contrasts = TRUE)
n |
A vector of levels for a factor or the number of levels. |
contrasts |
A logical value indicating whether or not contrasts should be computed. |
This function corrects contr.sum
to display labels properly.
A matrix of computed contrasts with n
rows and k
columns, with k=n-1
if contrasts
is TRUE
and
k=n
if contrasts
is FALSE
. The columns of the
resulting matrices contain contrasts which can be used for coding a
factor with n
levels.
contrasts
, C
,
and contr.sum
.
oldop <- options(contrasts=c("contr.sum","contra.poly")) y <- rnorm(30) x <- gl(3,10,labels=c("First","Second","Third")) glm(y~x) options(contrasts=c("contr.mean","contra.poly")) x <- gl(3,10,labels=c("First","Second","Third")) glm(y~x) options(oldop)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.