of max (X_i, Y_i) (X Y
vectors)
Greetings.
For R gurus this may be a no brainer, but I could not find pointers to
efficient computation of this beast in past help files.
Background - I wish to implement a Cramer-von Mises type test statistic
which involves double sums of max(X_i,Y_j) where
with efficient double sum of max (X_i, Y_i) (X Y
vectors)
Greetings.
For R gurus this may be a no brainer, but I could not find pointers to
efficient computation of this beast in past help files.
Background - I wish to implement a Cramer-von Mises type test statistic
which involves double sums
Greetings.
For R gurus this may be a no brainer, but I could not find pointers to
efficient computation of this beast in past help files.
Background - I wish to implement a Cramer-von Mises type test statistic
which involves double sums of max(X_i,Y_j) where X and Y are vectors of
differing
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jeffrey Racine
Sent: Thursday, February 01, 2007 1:18 PM
To: r-help@stat.math.ethz.ch
Subject: [R] Help with efficient double sum of max (X_i, Y_i) (X Y
vectors)
Greetings.
For R gurus this may
Well, a reproducible example would be nice =)
not tested:
x = rnorm(10)
y = rnorm(20)
mymax - function(t1, t2) apply(cbind(t1, t2), 1, max)
sum(outer(x, y, mymax))
is this sth like what you need?
b
On Feb 1, 2007, at 1:18 PM, Jeffrey Racine wrote:
Greetings.
For R gurus this may be a no
Jeff,
you can do
sum1: \sum_i\sum_j max(X_i,X_j)
sum2: \sum_i\sum_j max(Y_i,Y_j)
sum(x * (2 * rank(x) - 1))
sum3: \sum_i\sum_j max(X_i,Y_j)
sum(outer(x, y, pmax))
Probably, the latter can be speeded up even more...
Z
__
R-help@stat.math.ethz.ch