Skip to main content
5 events
when toggle format what by license comment
Sep 28, 2018 at 20:08 comment added Pier-Eric Chamberland Another shortcut for quadratic and cubic terms for continuous variables is to insert poly(var, 3) in your formula, which simplified how many interaction terms you have to specify! You are welcome, as so are upvotes ; )
Sep 28, 2018 at 20:06 comment added Pier-Eric Chamberland No problem. It is actually straightforward and there are a few helper functions beyond specifying your own with n-1 vectors grouped with cbind. The "ordered" class has built in contrasts: var <- ordered(var). Get them with contrasts(var), which you can also use to update the contrasts. Default of ordered categorical is contr.poly, i.e. polynomial (quadratic, cubic and so on until n - 1) and there is some kind of weighting. You can specify helmert: constrasts(var) <- contr.helmert(n) or contr.SAS or contr.sum
Sep 28, 2018 at 19:32 vote accept vzste
Sep 28, 2018 at 19:32 comment added vzste Thanks! That make sense. I actually prefer R, but have only ever done contrasts in SAS and was just avoiding learning how to do it in R.
Sep 28, 2018 at 2:28 history answered Pier-Eric Chamberland CC BY-SA 4.0