[Vegan-commits] r2630 - in pkg/vegan: R inst

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Sep 30 15:33:14 CEST 2013


Author: jarioksa
Date: 2013-09-30 15:33:14 +0200 (Mon, 30 Sep 2013)
New Revision: 2630

Modified:
   pkg/vegan/R/fisherfit.R
   pkg/vegan/inst/ChangeLog
Log:
analytic derivatives for fisherfit

Modified: pkg/vegan/R/fisherfit.R
===================================================================
--- pkg/vegan/R/fisherfit.R	2013-09-29 09:55:02 UTC (rev 2629)
+++ pkg/vegan/R/fisherfit.R	2013-09-30 13:33:14 UTC (rev 2630)
@@ -1,12 +1,12 @@
-"fisherfit" <-
+`fisherfit` <-
     function (x, ...) 
 {
     Dev.logseries <- function(n.r, p, N) {
         r <- as.numeric(names(n.r))
         x <- N/(N + p)
         logmu <- log(p) + log(x) * r - log(r)
-        lhood <- -sum(n.r * (logmu - log(n.r)) + 1) - p * log(1 - 
-                                                              x)
+        lhood <- -sum(n.r * (logmu - log(n.r)) + 1) - p * log(1-x)
+        attr(lhood, "gradient") <- -sum(n.r)/p - log(1-x)
         lhood
     }
     tmp <- as.rad(x)

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2013-09-29 09:55:02 UTC (rev 2629)
+++ pkg/vegan/inst/ChangeLog	2013-09-30 13:33:14 UTC (rev 2630)
@@ -21,6 +21,8 @@
 	treated differently in factorfit: now they support null
 	hypothesis, previously they decreased the P-values. 
 
+	* fisherfit: use analytic derivatives in non-linear minimizer nlm(). 
+
 	* nestednodf: matrix fill was wrongly calculated in weighted
 	analysis. The nominator was length of 'comm', and if input was a
 	data frame that was the number of columns instead of the number of



More information about the Vegan-commits mailing list