[Vegan-commits] r1354 - pkg/vegan/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Nov 9 09:44:13 CET 2010


Author: jarioksa
Date: 2010-11-09 09:44:12 +0100 (Tue, 09 Nov 2010)
New Revision: 1354

Modified:
   pkg/vegan/R/SSlomolino.R
Log:
improved starting values: work in 80% in fitspecaccum(BCI, lomo, algo=port) -- xmid still needs a better start

Modified: pkg/vegan/R/SSlomolino.R
===================================================================
--- pkg/vegan/R/SSlomolino.R	2010-11-07 07:25:19 UTC (rev 1353)
+++ pkg/vegan/R/SSlomolino.R	2010-11-09 08:44:12 UTC (rev 1354)
@@ -14,8 +14,10 @@
     .xmid <- -(.p[2])/2/.p[3] - sqrt(abs(1/2/.p[3]))
      ## estimate slope assuming Asym and xmid are known
     .z <- log(.xmid/xy[["x"]])
-    .b <- exp(coef(lm(.y ~ .z - 1)))
-    value <- c(.S, .xmid, .b)
+    .b <- coef(lm(.y ~ .z))
+    ## Adjust Asym: half of y = Asym/2 at xmid
+    .S <- .S * exp(-0.5 * (.b[1]))
+    value <- c(.S, .xmid, exp(.b[2]))
     names(value) <- mCall[c("Asym","xmid", "slope")]
     value
 },



More information about the Vegan-commits mailing list