[R] Ordered probit using clm2

Rune Haubo rhbc at imm.dtu.dk
Wed Nov 7 07:53:43 CET 2012


Hi Alice,

A factor is a fairly basic R concept that you can read about in
http://cran.r-project.org/doc/manuals/R-intro.pdf on page 16. Now to
fit the CLM, you need to turn your response variable into a factor
with something like

datareg$Newpercentagecash <- factor(datareg$Newpercentagecash, ordered=TRUE)

after loading your data, but before fitting the model. I recommend
that you take a look at the variable to see that it has the levels
that you expect and that they are ordered appropriately.

And by the way, I recommend that you use clm() rather than clm2() if possible.

Hope this helps,
Rune

On 6 November 2012 23:00, Alice LAMBERTON <alice.lamberton at edhec.com> wrote:
> Hi,
>
> I am new in R. I would like to do a ordered probit regression using clm2 (in the ordinal package).
> My dependent variable y is the way of payment in M&A: y=0 if the deal is financed by stock only, y=1 if the deal is financed by a mix of cash and stock and y=2 if it is by cash only.
> My independent variables are CollateralB, Cashavailable and Leverage.
>
> This is the code I wrote:
>
>> library(ordinal)
>> datareg<-read.xls("C:/regression.xls")
>> myprobit<-clm2(Newpercentagecash ~ CollateralB + CashavailableB + LEVERAGEB, data = datareg, link = "probit")
> Error in clm2(Newpercentagecash ~ CollateralB + CashavailableB + LEVERAGEB,  :
>   response needs to be a factor
>
> I do not understand this error message. My "y" only equals 0, 1 or 2. I do not understand what a "factor" is.
> Could you help me please?
>
> Thank you in advance,
>
> Best regards,
>
> Alice
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org 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.



-- 
Rune H B Christensen, PhD
DTU Informatics, Section for Statistics
Technical University of Denmark, Build. 305, Room 122,
DK-2800 Kgs. Lyngby, Denmark
Phone: (+45) 45 25 33 63
Mobile: (+45) 30 26 45 54




More information about the R-help mailing list