[Rd] Problem with proj

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri May 20 13:56:34 CEST 2005


I think the qr object is correct.  The problem is in proj.aovlist, and I 
have now fixed it.

Answering something like this is as much work as dealing with a bug 
report, since we need to dig in (to find that is the aovlist method, for 
example) and to recall how it works (it is about 7 years since I wrote 
it).

On Fri, 20 May 2005, Simon Wotherspoon wrote:

> Hi all,
>   Perhaps this in an inappropriate post, but I've found a bug in proj I'd 
> like to track down a bit further before making a formal bug report.  The 
> example below shows the problem, if you change the rownames proj fails. The 
> problem seems to be that there is a mismatch in the rownames in the qr 
> objects constructed by aov and the rownames that proj is expecting them to 
> have.  My question is - should I be trying to
>
> 1. correct the rownames of the qr object that aov makes, or is this likely to 
> create other problems
> 2. change the way proj does its subsetting?
>
> Or is this something that is likely to be quite tricky and better left to 
> those that know?
>
> Simon.
>
>
>
>
> ##
> ## Example from help("proj")
> ##
>
> N <- c(0,1,0,1,1,1,0,0,0,1,1,0,1,1,0,0,1,0,1,0,1,1,0,0)
> P <- c(1,1,0,0,0,1,0,1,1,1,0,0,0,1,0,1,1,0,0,1,0,1,1,0)
> K <- c(1,0,0,1,0,1,1,0,0,1,0,1,0,1,1,0,0,0,1,1,1,0,1,0)
> yield <- c(49.5,62.8,46.8,57.0,59.8,58.5,55.5,56.0,62.8,55.8,69.5,
>          55.0, 62.0,48.8,45.5,44.2,52.0,51.5,49.8,48.8,57.2,59.0,53.2,56.0)
>
> npk <- data.frame(block=gl(6,4), N=factor(N), P=factor(P),
>                 K=factor(K), yield=yield)
> npk.aov <- aov(yield ~ block + N*P*K, npk)
> proj(npk.aov)
>
> ## as a test, not particularly sensible
> options(contrasts=c("contr.helmert", "contr.treatment"))
> npk.aovE <- aov(yield ~  N*P*K + Error(block), npk)
> proj(npk.aovE)
>
>
> ##
> ## Change the rownames and it fails
> ##
> rownames(npk) <- 2:25
> npk.aovE <- aov(yield ~  N*P*K + Error(block), npk)
> proj(npk.aovE)
>
> ______________________________________________
> R-devel at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

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



More information about the R-devel mailing list