Martin Maechler
1997-Apr-09 09:17 UTC
R-alpha: R <-> S compatibility; more demos -- using S-plus validate(..) ..
Look at the result of (in S-plus:) validate(verbose=TRUE, outfile="......./validate-3.4.out") which gives (for me, S-plus 3.4 on Solaris 2.5) 2106 Lines of output. It's full of tests using "standard data sets". (--> 'demos' available!) Basically, at the end of each example, there are statements which should return TRUE if the 'validation test' is passed, e.g., all(c(b.test$statistic == 1, abs(b.test$p.value - 0.1562) < tol, b.test$alternative == "two.sided")) One bigger job would be to run these through R and analyze the results... -- any volunteers ? ((I could even send you the file if don't have S-plus available...)) -- Martin =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
D() doesn't handle exp() correctly: R> D(expression(exp(sin(x))),"x") sin(x) * cos(x) R> D(expression(exp(x)),"x") x Thomas Lumley ------------------------------------------------------+------ Biostatistics : "Never attribute to malice what : Uni of Washington : can be adequately explained by : Box 357232 : incompetence" - Hanlon's Razor : Seattle WA 98195-7232 : : ------------------------------------------------------------ =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
R> D(expression(z * (log(z) /z)),"z")
Error: invalid form in unary minus check
Yep. this is the result of an implete "if" statement in the C function
"isUminus" in deriv.c. The function should read
static int isUminus(SEXP s)
{
if(TYPEOF(s) == LANGSXP && CAR(s) == MinusSymbol) {
switch(length(s)) {
case 2:
return 1;
case 3:
if(CADDR(s) == R_MissingArg)
return 1;
else return 0;
default:
error("invalid form in unary minus check\n");
}
}
else return 0;
}
This now gives
> D(expression(z * (log(z) /z)),"z")
(log(z)/z) + z * (1/z/z - log(z)/z^2)
which I thought was pretty ugly, but
S-PLUS : Copyright (c) 1988, 1996 MathSoft, Inc.
S : Copyright AT&T.
Version 3.4 Release 1 for Sun SPARC, SunOS 4.1.3_U1 : 1996
Working data will be in .Data
> D(expression(z * (log(z) /z)),"z")
(log(z)/z) + z * (1/z/z - log(z)/z^2)
So we are no worse than S.
And shame on you for trying to fool such a dumb bit of software :-).
Ross
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To:
r-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-