T Mu <muster <at> gmail.com> writes:
> 
> 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),

Yes.

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

I am sure those can help but you need to be carefull to "reorder" levels 
that the order is the same in SAS and R.

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

You can also set contrasts directly to factors via

contrasts(x) <- contr.SAS

where x is your factor. You can also set different contrasts to 
different factors.

Gregor

______________________________________________
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.

Reply via email to