[R] retrieving weights from a polr object

Yihui Xie xieyihui at gmail.com
Sun Sep 28 07:33:02 CEST 2008


Hi John,

Aren't they in the component 'model' of the fitted object?

##
> options(contrasts = c("contr.treatment", "contr.poly"))
> house.plr <- polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing)
> head(house.plr$model)
     Sat   Infl  Type Cont (weights)
1    Low    Low Tower  Low        21
2 Medium    Low Tower  Low        21
3   High    Low Tower  Low        28
4    Low Medium Tower  Low        34
5 Medium Medium Tower  Low        22
6   High Medium Tower  Low        36
> house.plr$model$'(weights)'
 [1] 21 21 28 34 22 36 10 11 36 61 23 17 43 35 40 26 18 54 13  9 10  8
 8 12  6  7  9 18  6  7 15 13 13  7  5 11 14 19 37 17 23 40  3  5 23
78 46 43 48 45 86
[52] 15 25 62 20 23 20 10 22 24  7 10 21 57 23 13 31 21 13  5  6 13
##

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
Mobile: +86-15810805877
Homepage: http://www.yihui.name
School of Statistics, Room 1037, Mingde Main Building,
Renmin University of China, Beijing, 100872, China



On Sun, Sep 28, 2008 at 3:00 AM, John Fox <jfox at mcmaster.ca> wrote:
> Dear list members,
>
> The polr() function in the MASS package takes an optional weights argument
> for case weights. Is there any way to retrieve the case weights from the
> fitted "polr" object? Examining both the object and the code, I don't see
> how this can be done, but perhaps I've missed something.
>
> Any help would be appreciated.
>
> John
>
> ------------------------------
> John Fox, Professor
> Department of Sociology
> McMaster University
> Hamilton, Ontario, Canada
> web: socserv.mcmaster.ca/jfox
>
> ______________________________________________
> 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