Return a matrix of contrasts used in `bayesglm`

.

1 2 | ```
contr.bayes.unordered(n, base = 1, contrasts = TRUE)
contr.bayes.ordered (n, scores = 1:n, contrasts = TRUE)
``` |

`n` |
a vector of levels for a factor, or the number of levels. |

`base` |
an integer specifying which group is considered the baseline
group. Ignored if |

`contrasts` |
a logical indicating whether contrasts should be computed. |

`scores` |
the set of values over which orthogonal polynomials are to be computed. |

These functions are adapted from `contr.treatment`

and `contr.poly`

in `stats`

package. The purpose for these functions are to keep
the baseline levels of categorical variables and thus to suit the use of
`bayesglm`

.

`contr.bayes.unordered`

is equivalent to `contr.treatment`

whereas
`contr.bayes.ordered`

is equivalent to `contr.poly`

.

Yu-Sung Su suyusung@tsinghua.edu.cn

`C`

,
`contr.helmert`

,
`contr.poly`

,
`contr.sum`

,
`contr.treatment`

;
`glm`

,
`aov`

,
`lm`

,
`bayesglm`

.

1 2 3 4 5 | ```
cat.var <- rep(1:3, 5)
dim(contr.bayes.unordered(cat.var))
# 15*15 baseline level kept!
dim(contr.treatment(cat.var))
# 15*14
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.