[R] how can I ordinal regression??

Gerard M. Keogh GMKeogh at justice.ie
Wed Jun 3 11:42:17 CEST 2009


Here's some code to implement the cheese data  table using the proportinal
odds model given in Generalised Linear Models by McCullagh & Nelder (Ch5).
You will have to adapt this to handle your case data - but i'll give you
something to go on.


   #### cheese
   library(MASS)
   options(contrasts = c("contr.treatment", "contr.poly"))
   y = c(0,0, 1, 7, 8,8,19, 8,1, 6,9,12,11, 7,6, 1, 0,0, 1,1, 6, 8,23,7, 5,
   1,0, 0,0, 0, 1, 3,7,14,16,11)
   p =
   c(1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9)
   x1 =
   c(1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
   x2 =
   c(0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
   x3 =
   c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0)

   ord.rp = ordered(p)
   fit0.polr = polr(ord.rp ~ 1, weights=y)
   fit1.polr = polr(ord.rp ~ x1 + x2+x3, weights=y)
   summary(fit1.polr)
   anova(fit0.polr,fit1.polr)


gerard



                                                                           
             yongkook Kwon                                                 
             <yongkookkwon at gma                                             
             il.com>                                                    To 
             Sent by:                  R-help at r-project.org                
             r-help-bounces at r-                                          cc 
             project.org                                                   
                                                                   Subject 
                                       [R] how can I ordinal regression??  
             03/06/2009 08:10                                              
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




What function and package I use to conduct ordinal regression??

My data is composed 2colums and 180rows.

The first colum indicate level of mass and second colum is intensity.

So, I want to calculate how much intensity are related mass.

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



**********************************************************************************
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.  It is the policy of the Department of Justice, Equality and Law Reform and the Agencies and Offices using its IT services to disallow the sending of offensive material.
Should you consider that the material contained in this message is offensive you should contact the sender immediately and also mailminder[at]justice.ie.

Is le haghaidh an duine nó an eintitis ar a bhfuil sí dírithe, agus le haghaidh an duine nó an eintitis sin amháin, a bheartaítear an fhaisnéis a tarchuireadh agus féadfaidh sé go bhfuil ábhar faoi rún agus/nó faoi phribhléid inti. Toirmisctear aon athbhreithniú, atarchur nó leathadh a dhéanamh ar an bhfaisnéis seo, aon úsáid eile a bhaint aisti nó aon ghníomh a dhéanamh ar a hiontaoibh, ag daoine nó ag eintitis seachas an faighteoir beartaithe. Má fuair tú é seo trí dhearmad, téigh i dteagmháil leis an seoltóir, le do thoil, agus scrios an t-ábhar as aon ríomhaire. Is é beartas na Roinne Dlí agus Cirt, Comhionannais agus Athchóirithe Dlí, agus na nOifígí agus na nGníomhaireachtaí a úsáideann seirbhísí TF na Roinne, seoladh ábhair cholúil a dhícheadú.
Más rud é go measann tú gur ábhar colúil atá san ábhar atá sa teachtaireacht seo is ceart duit dul i dteagmháil leis an seoltóir láithreach agus le mailminder[ag]justice.ie chomh maith. 
***********************************************************************************






More information about the R-help mailing list