A non-text attachment was scrubbed... Name: not available Type: text Size: 1856 bytes Desc: not available Url : https://stat.ethz.ch/pipermail/r-help/attachments/19970430/db1498ee/attachment.pl
>>>>> Jim Lindsey writes:> Suggestions: > 1. d, p, q, and r functions for inverse Gauss and Laplace > distributions. > 2. Add a fifth function for continuous distributions, the hazard > function, h. For example, ht <- function(...) dt(...)/(1-pt(...)) > is the Student t hazard function. > For writing likelihood functions, these would be much faster in C than > R and some such as Weibull can be simplified. > 3. Add the five functions for three parameter distributions such as > generalized F, extreme value, etc., Box-Cox,... (I have the densities, > cumulative, and hazard as R functions.) > 4. Philippe Lambert and I have d and p functions working in R for the > four-parameter stable family by inverting the characteristic function > with a Fourier transform (requires C code). S-plus only has the r > function for stables.It would definitely be wonderful to have all these functions available. I am a bit worried about over-polluting the name space, though. (I was never too happy with pf and their likes.) -k =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-r-help 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-help-request at stat.math.ethz.ch =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The deriv() function does not set the class of the result to "expression". This means that eval() must be used twice to evaluate the function. Using the example on p436 of Chambers & Hastie:> deriv(formula,"alpha")->a > eval(a)expression({ .expr1 <- D * alpha .expr2 <- exp(.expr1) .expr3 <- 1 + .expr2 .value <- log(.expr3) - .expr1 .grad <- array(0, c(length(.value), 1), list(NULL, c("alpha"))) .grad[, "alpha"] <- .expr2 * D/.expr3 - D attr(.value, "gradient") <- .grad .value })> eval(eval(a))[1] 0.3132617 attr(,"gradient") alpha [1,] -0.2689414> class(a)<-"expression" > eval(a)[1] 0.3132617 attr(,"gradient") alpha [1,] -0.2689414 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-help 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-help-request at stat.math.ethz.ch =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=