[Rd] buglet in weighted.residuals(mlmObject)
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Jan 20 08:29:19 CET 2011
Thanks: changed in R-patched.
On Wed, 19 Jan 2011, William Dunlap wrote:
> When weighted.residuals() is given a fitted model
> object with several responses (class mlm) and some
> zero weights it returns a vector instead of a matrix.
> It looks like it is doing
> resids[ weights != 0 ]
> instead of
> resids[ weights != 0, , drop=FALSE]
> in the multi-response case.
>
> E.g.,
>
>> d4 <- data.frame(y1=1:4, y2=2^(0:3), wt=log(1:4),
> fac=LETTERS[c(1,1,2,2)])
>> fit <- lm(data=d4, cbind(y1,y2)~fac, weights=wt)
>> weighted.residuals(fit) # expect 3x2 matrix
> [1] 1.407294e-16 -5.847465e-01 5.205496e-01 5.950102e-16
> -2.338986e+00
> [6] 2.082198e+00
>> weighted.residuals(fit, drop0=FALSE)
> y1 y2
> 1 0.000000e+00 0.000000e+00
> 2 1.407294e-16 5.950102e-16
> 3 -5.847465e-01 -2.338986e+00
> 4 5.205496e-01 2.082198e+00
>
> This is in R 2.12.0. I haven't upgraded yet.
>
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
>
> ______________________________________________
> R-devel at r-project.org 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