Re: [R] Manually Calculating Odds from POLR Model

From: John Fox <jfox_at_mcmaster.ca>
Date: Tue 16 Aug 2005 - 08:30:58 EST


Dear Tate,

Your question pertains generally to the treatment of factors in model formulas and is not particular to polr(). For a brief explanation, see Section 11.1, "Defining statistical models; formulae," and in particular Section 11.1.1 on "Contrasts" in the manual An Introduction to R, which is distributed with R. More detailed explanations are in texts such as Venables and Ripley, Modern Applied Statistics With S, and my own, An R and S-PLUS Companion to Applied Regression.

I hope this helps,
 John



John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox

> -----Original Message-----
> From: Tate Avery [mailto:tate_sterling_avery@hotmail.com]
> Sent: Monday, August 15, 2005 3:58 PM
> To: jfox@mcmaster.ca
> Cc: r-help@stat.math.ethz.ch
> Subject: RE: [R] Manually Calculating Odds from POLR Model
>
> John,
>
> Thank you, the document was very helpful. I can now
> calculate the same values generated by predict() when I am
> using purely numeric input data.
>
> Another small question arises when I look at the example
> using 'housing' in the polr() documentation page:
>
> Running the example produces the following coefficients...
>
> Coefficients:
> InflMedium InflHigh TypeApartment TypeAtrium
> TypeTerrace
> ContHigh
> 0.5663924 1.2888218 -0.5723552 -0.3661912
> -1.0910195
> 0.3602834
>
> Now, if I am trying to perform a prediction and the value for
> INFL comes in as 'Medium' what is done? And, what is done for 'low'?
>
> That seems to be the last missing piece in my understanding
> of how to convert the model values into predictions.
>
> Thank you,
> Tate
>
> >From: "John Fox" <jfox@mcmaster.ca>
> >To: "'Tate Avery'" <tate_sterling_avery@hotmail.com>
> >CC: <r-help@stat.math.ethz.ch>
> >Subject: RE: [R] Manually Calculating Odds from POLR Model
> >Date: Fri, 12 Aug 2005 19:22:23 -0400
> >
> >Dear Tate,
> >
> >If I understand correctly what you're asking, the formulas
> are on p. 21
> >of the paper at
> ><http://socserv.socsci.mcmaster.ca/jfox/Papers/logit-effect-d
isplays.pdf>.
> >But why do you want to do this when you can get the fitted
> >probabilities from predict()?
> >
> >I hope this helps.
> > John
> >
> >--------------------------------
> >John Fox
> >Department of Sociology
> >McMaster University
> >Hamilton, Ontario
> >Canada L8S 4M4
> >905-525-9140x23604
> >http://socserv.mcmaster.ca/jfox
> >--------------------------------
> >
> > > -----Original Message-----
> > > From: r-help-bounces@stat.math.ethz.ch
> > > [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Tate Avery
> > > Sent: Friday, August 12, 2005 2:50 PM
> > > To: r-help@stat.math.ethz.ch
> > > Subject: [R] Manually Calculating Odds from POLR Model
> > >
> > > Hello,
> > >
> > > I am using polr(...) to generate a model. The summary shows the
> > > coefficients and the intercepts.
> > >
> > > For example:
> > >
> > > coefficient for x1 = c1
> > > coefficient for x2 = c2
> > >
> > > intercept A|B = i1
> > > intercept B|C = i2
> > >
> > > I can then run predict(..., type="p") with the model and see the
> > > odds for each factor.
> > >
> > > For example:
> > >
> > > A B C
> > > 1 0.3 0.5 0.2
> > > 2 0.4 0.1 0.5
> > >
> > > What I really want to be able to do is take the 2
> coefficients, the
> > > 2 intercepts, the x1 & x2 values and manually calculate the
> > > probabilities generated by predict().
> > >
> > > I have been searching quite extensively for the underlying
> > > calculations that transform the polr output and the input
> variables
> > > into the final output odds. I have tried a number of
> dead-end roads
> > > so far.
> > >
> > > So, if anyone has any information on how to do this or
> where I can
> > > find out, I would be extremely grateful.
> > >
> > > Thank you for your time,
> > > Tate Avery
> > >
> > > ______________________________________________
> > > 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
> >
>
>



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 Received on Tue Aug 16 08:37:25 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 15:21:50 EST