[Vegan-commits] r1323 - in pkg/vegan: R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Oct 3 14:28:45 CEST 2010
Author: jarioksa
Date: 2010-10-03 14:28:45 +0200 (Sun, 03 Oct 2010)
New Revision: 1323
Added:
pkg/vegan/R/fitspecaccum.R
Modified:
pkg/vegan/inst/ChangeLog
pkg/vegan/man/specaccum.Rd
Log:
Add fitting specaccum models as Michaelis-Menten models (Stephen Sefick's idea)
Added: pkg/vegan/R/fitspecaccum.R
===================================================================
--- pkg/vegan/R/fitspecaccum.R (rev 0)
+++ pkg/vegan/R/fitspecaccum.R 2010-10-03 12:28:45 UTC (rev 1323)
@@ -0,0 +1,23 @@
+fitspecaccum <- function(object, model = "michaelis-menten", method = "random", ...)
+{
+ model <- match.arg(model)
+ if (!inherits(object, "specaccum"))
+ object <- specaccum(object, method = method, ...)
+ if (is.null(object$perm))
+ SpeciesRichness <- as.matrix(object$richness)
+ else
+ SpeciesRichness <- object$perm
+ if (!is.null(object$inviduals))
+ x <- object$individuals
+ else
+ x <- object$sites
+ ## Only Michaelis-Menten implemented now: no need to switch() yet.
+ mods <- apply(SpeciesRichness, 2, function(y) nls(y ~ SSmicmen(x, Vm, K)))
+ object$fitted <- drop(sapply(mods, fitted))
+ object$residuals <- drop(sapply(mods, residuals))
+ object$coefficients <- drop(sapply(mods, coef))
+ object$models <- mods
+ object$call <- match.call()
+ class(object) <- c("fitspecaccum", class(object))
+ object
+}
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2010-10-03 12:23:53 UTC (rev 1322)
+++ pkg/vegan/inst/ChangeLog 2010-10-03 12:28:45 UTC (rev 1323)
@@ -4,6 +4,11 @@
Version 1.18-13 (opened September 26, 2010)
+ * fitspecaccum: Stephen Sefick suggested adding Michaelis-Menten
+ fit to random species accumulation and sent his model function.
+ These ideas were used to add a new more general function. No
+ documentation yet: needs work.
+
* decorana: gives warning if residual is bigger than tolerance.
Version 1.18-12 (closed September 26, 2010)
Modified: pkg/vegan/man/specaccum.Rd
===================================================================
--- pkg/vegan/man/specaccum.Rd 2010-10-03 12:23:53 UTC (rev 1322)
+++ pkg/vegan/man/specaccum.Rd 2010-10-03 12:28:45 UTC (rev 1323)
@@ -4,6 +4,7 @@
\alias{summary.specaccum}
\alias{plot.specaccum}
\alias{boxplot.specaccum}
+\alias{fitspecaccum}
\title{Species Accumulation Curves }
\description{
More information about the Vegan-commits
mailing list