Skip to content

R-alpha: R <-> S compatibility; more demos -- using S-plus validate(..) ..

4 messages · Martin Maechler, Ross Ihaka, Thomas Lumley

#
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
5 days later
#
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#
Thomas Lumley writes:
 > 
 > D() doesn't handle exp() correctly:
 > 

Duh!  Back to first year calculus for me.  It's
NOT

	d/dx e^f(x) = f(x) * f'(x).

BUT

	d/dx e^f(x) = e^f(x) * f'(x).

Deep down in the C function "D" in deriv.c you will find the lines

                else if(CAR(expr) == ExpSymbol) {
                        ans = simplify(TimesSymbol,
                                CADR(expr),
                                PP(D(CADR(expr), var)));
                        UNPROTECT(1);
                }

These should in fact read

                else if(CAR(expr) == ExpSymbol) {
                        ans = simplify(TimesSymbol,
                                expr,
                                PP(D(CADR(expr), var)));
                        UNPROTECT(1);
                }

I.e. remove the CADR from around the "expr" in the call to simplify.

This has clearly not been tested by anyone with a firm grasp of the
Newton/Leibnitz version of the calculus.  Use with care ...
	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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#
R> D(expression(z * (log(z) /z)),"z")
Error: invalid form in unary minus check



 - thomas

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-