Tiny bug in lm()?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Tiny bug in lm()?

Brett Presnell-2

I suppose that this never affects anything, but in line 57 of lm.R,
where the coefficients are defined for an empty model, when y is a
matrix, shouldn't the value be matrix(,0,nrow(y)) rather than
matrix(,0,3)?

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Tiny bug in lm()?

Brett Presnell-2

I meant ncol(y) of course.

Brett Presnell <[hidden email]> writes:

> I suppose that this never affects anything, but in line 57 of lm.R,
> where the coefficients are defined for an empty model, when y is a
> matrix, shouldn't the value be matrix(,0,nrow(y)) rather than
> matrix(,0,3)?

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Tiny bug in lm()?

Martin Maechler
>>>>> Brett Presnell
>>>>>     on Sun, 24 Jun 2018 13:57:04 +0100 writes:

    > I meant ncol(y) of course.

    > Brett Presnell <[hidden email]> writes:

    >> I suppose that this never affects anything, but in line
    >> 57 of lm.R, where the coefficients are defined for an
    >> empty model, when y is a matrix, shouldn't the value be
    >> matrix(,0,nrow(y)) rather than matrix(,0,3)?

Yes ("ncol(y)") and actually it should be 'double', not
'logical'.

OTOH: Multivariate empty models are probably pretty rare, so no
      wonder this has never been reported the last 13.374 years
      this has been in the sources.

Of course, I will still fix it.  Thank you, Brett, for reporting!

Martin

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel