From p.dalgaard@biostat.ku.dk  Sun Aug 13 22:59:44 2000
From: p.dalgaard@biostat.ku.dk (Peter Dalgaard BSA)
Date: 13 Aug 2000 23:59:44 +0200
Subject: [Rd] Possible bug (PR#633)
In-Reply-To: agusalon@mcr.ucm.es's message of "Sun, 13 Aug 2000 20:59:22 +0200 (MET DST)"
References: <200008131859.UAA15816@pubhealth.ku.dk>
Message-ID: <x2r97shlf3.fsf@blueberry.kubism.ku.dk>

agusalon@mcr.ucm.es writes:

>     Rail^0  Rail^1       Rail^2   Rail^3   Rail^4       Rail^5
>     66.5    54.303    -4.692    -2.658    -0.567    11.192
> which do not seem correct.
> 
> Those reported in the book are:
> 
>     Rail2    Rail5    Rail1    Rail6       Rail3    Rail4
>     31.667    50      54        82.667    84.667    96

This is a matter of differing conventions in handling

lm(travel ~ Rail - 1, data = Rail)

when Rail is an ordered factor. R uses polynomial contrasts in the
no-intercept case as it does when the intercept is present, whereas
Splus treats the ordered factor as if it were an unordered factor. If
you do something like the below, you get your coefficients.

I suspect that this could indeed be argued to be a bug in R, but
others may know better.

> lm(travel ~ factor(Rail,ordered=F)-1, data = Rail)

Call:
lm(formula = travel ~ factor(Rail, ordered = F) - 1, data = Rail)

Coefficients:
factor(Rail, ordered = F)2  factor(Rail, ordered = F)5  
                     31.67                       50.00  
factor(Rail, ordered = F)1  factor(Rail, ordered = F)6  
                     54.00                       82.67  
factor(Rail, ordered = F)3  factor(Rail, ordered = F)4  
                     84.67                       96.00  



-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] Possible bug (PR#633)
Peter Dalgaard BSA