Re: [R] Comparison of the amount of computation

From: Petr Savicky <savicky_at_praha1.ff.cuni.cz>
Date: Thu, 14 Apr 2011 15:51:24 +0200

On Thu, Apr 14, 2011 at 12:40:53AM -0700, helin_susam wrote:
> Hi Petr,
>
> Your idea looks like logically. So, can we say this with your idea; the
> expected number of computation in unique(sample(...)) is fewer than
> sample(...). Because, the expected length is 63.39677 in unique case, while
> the expected length is 100 in non-unique case ?

Hi Helin:

The number of operations "in unique(sample(...))" sounds like you mean the operations needed to compute unique(sample(...)). Your previous question suggests that you mean something different, namely to compare computing mean(data1) and mean(data2), when

  data1 <- sample(...)
  data2 <- unique(sample(...))

If you only want to confirm that the number of operations needed to compute mean(data2) is on average smaller than the number of operations needed to compute mean(data1), then yes, it is.

However, it is not a way to make some computation more efficient, since mean(data2) is something different from mean(data1).

Petr.



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 14 Apr 2011 - 13:55:00 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 14 Apr 2011 - 16:00:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive