[R] deviance in polr method
David Winsemius
dwinsemius at comcast.net
Tue Jan 13 16:26:04 CET 2009
I remember have the same consternation using GLIM with binomial models
on grouped and ungrouped data, but I was counseled by my betters only
to consider differences in models. The differences in deviance are the
same up to rounding error.
> 859.8018 - 711.3479
[1] 148.4539
> 168.8-20.3
[1] 148.5
So I would ask if these really are different answers?
--
David Winsemius
Heritage Labs
On Jan 13, 2009, at 10:06 AM, Prof Brian Ripley wrote:
> Withut looking up your reference, are you not comparing grouped and
> ungrouped deviances? And polr() does not say anything about
> accepting a model (or not), only about the comparison between two
> models.
>
> 'Deviances' are in comparison with some 'saturated' model, and I
> would say that M&N are comparing with a separate fit to each group,
> polr() with correctly predicting each observation. Both are valid,
> but refer to different questions.
>
> On Tue, 13 Jan 2009, Gerard M. Keogh wrote:
>
>>
>> Dear all,
>>
>>
>> I've replicated the cheese tasting example on p175 of GLM's by
>> McCullagh
>> and Nelder. This is a 4 treatment (rows) by 9 ordinal response (cols)
>> table.
>>
>> Here's my simple code:
>>
>> #### 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
>> )
>> # catgeory 4 is used as baseline
>> 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)
>>
>> This works and "summary" gives the correct parameter estimates but
>> I have a
>> problem with the deviance.
>> Anova gives
>> Likelihood ratio tests of ordinal regression models
>>
>> Response: ord.rp
>> Model Resid. df Resid. Dev Test Df LR stat. Pr(Chi)
>> 1 1 200 859.8018
>> 2 x1 + x2 + x3 197 711.3479 1 vs 2 3 148.4539 0
>>
>>
>> In McCullagh the deviance for the null model is given as 168.8 on
>> 24 d.f.
>> and the fitted model is 20.3 on 21 d.f.
>> This means the change in POLR and in the book is 148.5 on 3 d.f. so
>> the
>> model gives a significant improvement.
>>
>> But the model deviance from POLR is 711 vs. 20.3 from McCullagh.
>> Thus POLR says we should reject the model fit with chi-sq = 35 while
>> McCullagh say we should accept it
>>
>> Could someone explain what I should do when it comes to accepting or
>> rejecting the model fit itself in R?
>>
>> I'm using R 2.8.0.
>>
>> Thanks.
>>
>> Gerard
>>
>>
>> **********************************************************************************
>> 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.
>> ***********************************************************************************
>>
>>
>>
>> ______________________________________________
>> 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.
>>
>
> --
> Brian D. Ripley, ripley at stats.ox.ac.uk
> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel: +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UK Fax: +44 1865
> 272595______________________________________________
> 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.
More information about the R-help
mailing list