[Esm-commits] r42 - in pkg/ESM: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jan 14 17:59:55 CET 2011


Author: timotheepoisot
Date: 2011-01-14 17:59:54 +0100 (Fri, 14 Jan 2011)
New Revision: 42

Modified:
   pkg/ESM/DESCRIPTION
   pkg/ESM/R/functions.r
Log:
V2.0

Modified: pkg/ESM/DESCRIPTION
===================================================================
--- pkg/ESM/DESCRIPTION	2011-01-14 11:15:47 UTC (rev 41)
+++ pkg/ESM/DESCRIPTION	2011-01-14 16:59:54 UTC (rev 42)
@@ -1,6 +1,6 @@
 Package: ESM
-Version: 1.4.0-02
-Date: 2010-08-29
+Version: 2.0.0-01
+Date: 2011-01-14
 Title: Ecological Specificity Measures
 Author: Timothee Poisot <tpoisot at um2.fr>
 Maintainer: Timothee Poisot <tpoisot at um2.fr>

Modified: pkg/ESM/R/functions.r
===================================================================
--- pkg/ESM/R/functions.r	2011-01-14 11:15:47 UTC (rev 41)
+++ pkg/ESM/R/functions.r	2011-01-14 16:59:54 UTC (rev 42)
@@ -38,17 +38,18 @@
 	return(1-shannon)
 }
 
-ssi <- function(fit)
-{
-	if(length(fit)==1){return(1)}
-	score <- NULL
+ssi = function(fit)
+{ # Normalized and using quantitative data
+	if (length(fit) == 1) {
+        return(1)
+    }
+	n <- length(fit)
 	fit <- as.vector(fit)
-	h <- sum(fit>0)
-	H <- length(fit)
-	SSI <- sqrt((H/h-1)/(H-1))
-	return(SSI)
+	S <- sqrt(sum((fit-mean(fit))^2))
+	return((S/mean(fit))/(n*sqrt((n-1)/n)))
 }
 
+
 getspe <- function(mat,measure=pdi,normal='species',...)
 {
 	mat <- fixmat(mat)



More information about the Esm-commits mailing list