Return a matrix of mean difference contrasts.
This is an adjustment to the `contr.orthonormal`

that ascertains that the prior
distributions on difference between the gran mean and factor level are identical independent
of the number of factor levels (which does not hold for the orthonormal contrast). Furthermore,
the contrast is re-scaled so the specified prior distribution exactly corresponds to the prior
distribution on difference between each factor level and the grand mean -- this is approximately
twice the scale of `contr.orthonormal`

.

`contr.meandif(n, contrasts = TRUE)`

## Arguments

- n
a vector of levels for a factor, or the number of levels

- contrasts
logical indicating whether contrasts should be computed

## Value

A matrix with n rows and k columns, with k = n - 1 if `contrasts = TRUE`

and k = n
if `contrasts = FALSE`

.

## References

There are no references for Rd macro `\insertAllCites`

on this help page.

## Examples

```
contr.meandif(c(1, 2))
#> [,1]
#> [1,] -1
#> [2,] 1
contr.meandif(c(1, 2, 3))
#> [,1] [,2]
#> [1,] 0.0000000 1.0
#> [2,] -0.8660254 -0.5
#> [3,] 0.8660254 -0.5
```