From Waclaw.Marcin.Kusnierczyk at idi.ntnu.no  Wed Apr  1 10:39:53 2009
From: Waclaw.Marcin.Kusnierczyk at idi.ntnu.no (Wacek Kusnierczyk)
Date: Wed, 01 Apr 2009 10:39:53 +0200
Subject: [Rd] [R] variance/mean
In-Reply-To: <18899.8509.745114.348086@lynne.math.ethz.ch>
References: <20090322041729.6LTZR.3025252.root@mp11>	<49C601BD.3080506@idi.ntnu.no>	<001201c9abd1$4e04c5e0$3a0b2c0a@gne.windows.gene.com>	<49C81DCE.1030901@idi.ntnu.no>
	<18899.8509.745114.348086@lynne.math.ethz.ch>
Message-ID: <49D32859.4050206@idi.ntnu.no>

Martin Maechler wrote:
>
> Your patch is basically only affecting the default  
> method = "pearson". For (most) other cases, 'y = NULL' would
> still remain  *the* way to save computations, unless we'd start
> to use an R-level equivalent [which I think does not exist] of
> your C  trick   (DATAPTR(x) == DATAPTR(y)).
>
>   

yes, my patch was constrained to the c code, but i don't think it would
be particularly difficult to fix the relevant r-level code as well.  i
did think about it, but didn't want to invest more time in this until
(or unless) someone would respond.  (thanks for the response.)

> Also, for S- and R- backcompatibility reasons, we'd need to
> continue allowing  y = NULL (as your patch would, too), 

only in its current for -- indeed, the (unimplemented) intention was to
detach from the old misdesign, and fix everything so that y=x by default
anywhere.

> so
> currently I think this whole idea -- as slick as it is, I
> learned something!  --  
> does not make sense applying here.
>   

i think it does, because the current state is somewhat funny, including
both the difference in performance between var(x) and var(x,x) (with x
being a matrix), and the respective comment in ?var.

>     > the attached patch suggests modifications to src/main/cov.c and
>     > src/library/stats/man/cor.Rd.
>
> BTW: since you didn't (and shouldn't , because of method != "pearson" !) 
>  change the R code, 

i would suggest it be done, though.

> the docs  \usage{.} part should not have been
>  changed either ! 
>   

indeed, the change in the docs didn't match what i *have* actually fixed
in the code.

>  and as I mentioned: using 'y = NULL' in the function call must
>   

*MUST* ?

>  continue to work, hence should also be documented as
>  possibility
>  ==>  the docs would not really become more clear, I think 
>   

no, of course, without the change in r code having the docs say y=x by
default would be a nonsense.  but again, this was a start, not a
complete modification (and i admit i failed to acknowledge this).

vQ



[Rd] [R] variance/mean
Wacek Kusnierczyk