[R] Setting contrasts for polr() to get same result of SAS

From: T Mu <muster_at_gmail.com>
Date: Thu 17 Aug 2006 - 11:08:35 EST


Hi all,

I am trying to do a ordered probit regression using polr(), replicating a result from SAS.

>polr(y ~ x, dat, method='probit')

suppose the model is y ~ x, where y is a factor with 3 levels and x is a factor with 5 levels,

To get coefficients, SAS by default use the last level as reference, R by default use the first level (correct me if I was wrong),

The result I got is a mixture, using first and last for different variables.

I tried relevel, reorder, contrasts, but no success. I found what really matters is

>options(contrasts = c("contr.treatment", "contr.poly"))

or

>options(contrasts = c("contr.SAS", "contr.poly"))

so I guess I can set "contrasts= a list of contrasts" for each variables in polr(), but I cannot successfuly set the contrasts, what is the syntax?

Is there a better way to do this?

Thank you very much,
Tian

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu Aug 17 11:12:08 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 17 Aug 2006 - 18:41:28 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.