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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Sep 26 09:07:57 CEST 2012


Author: jarioksa
Date: 2012-09-26 09:07:56 +0200 (Wed, 26 Sep 2012)
New Revision: 2296

Modified:
   pkg/vegan/NAMESPACE
   pkg/vegan/R/AIC.radfit.R
   pkg/vegan/R/coef.radfit.R
   pkg/vegan/R/radlattice.R
   pkg/vegan/inst/ChangeLog
Log:
fix the AIC mess made in r2295 and fix BIC of radlattice since r551 plus add coef.radfit.frame for consistence

Modified: pkg/vegan/NAMESPACE
===================================================================
--- pkg/vegan/NAMESPACE	2012-09-24 18:14:04 UTC (rev 2295)
+++ pkg/vegan/NAMESPACE	2012-09-26 07:07:56 UTC (rev 2296)
@@ -125,6 +125,7 @@
 # coef: stats
 S3method(coef, cca)
 S3method(coef, radfit)
+S3method(coef, radfit.frame)
 S3method(coef, rda)
 # confint: stats -- also uses MASS:::confint.glm & MASS:::profile.glm
 # does this work with namespaces??

Modified: pkg/vegan/R/AIC.radfit.R
===================================================================
--- pkg/vegan/R/AIC.radfit.R	2012-09-24 18:14:04 UTC (rev 2295)
+++ pkg/vegan/R/AIC.radfit.R	2012-09-26 07:07:56 UTC (rev 2296)
@@ -3,7 +3,7 @@
 ### object$models is a list of radline objects
 
 `AIC.radfit` <-
-    function (object, AIC = TRUE, k = 2, ...) 
+    function (object, k = 2, ...) 
 {
     sapply(object$models, AIC, k = k, ...)
 }
@@ -23,7 +23,7 @@
 ### Define also for radfit.frames which are lists of radfit objects
 
 `AIC.radfit.frame` <-
-    function(object, AIC = TRUE, k = 2, ...)
+    function(object, k = 2, ...)
 {
     sapply(object, AIC, k = k, ...)
 }

Modified: pkg/vegan/R/coef.radfit.R
===================================================================
--- pkg/vegan/R/coef.radfit.R	2012-09-24 18:14:04 UTC (rev 2295)
+++ pkg/vegan/R/coef.radfit.R	2012-09-26 07:07:56 UTC (rev 2296)
@@ -1,4 +1,4 @@
-"coef.radfit" <-
+`coef.radfit` <-
     function (object, ...) 
 {
     out <- sapply(object$models, function(x) if (length(coef(x)) < 
@@ -9,3 +9,9 @@
     colnames(out) <- paste("par", 1:3, sep = "")
     out
 }
+
+`coef.radfit.frame` <-
+    function(object, ...)
+{
+    lapply(object, coef, ...)
+}

Modified: pkg/vegan/R/radlattice.R
===================================================================
--- pkg/vegan/R/radlattice.R	2012-09-24 18:14:04 UTC (rev 2295)
+++ pkg/vegan/R/radlattice.R	2012-09-26 07:07:56 UTC (rev 2296)
@@ -1,6 +1,8 @@
 `radlattice` <-
     function(x, BIC = FALSE, ...)
 {
+    if (!inherits(x, "radfit"))
+        stop("function only works with 'radfit' results for single site")
     require(lattice) || stop("requires package 'lattice'")
     y <- x$y
     fv <- unlist(fitted(x))
@@ -10,7 +12,11 @@
     Abundance <- rep(y, p)
     Rank <- rep(1:n, p)
     Model <- factor(rep(mods, each=n), levels = mods)
-    aic <- AIC(x, AIC = BIC)
+    if (BIC)
+        k <- log(length(y))
+    else
+        k <- 2
+    aic <- AIC(x, k = k)
     col <- trellis.par.get("superpose.line")$col
     if (length(col) > 1)
         col <- col[2]

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2012-09-24 18:14:04 UTC (rev 2295)
+++ pkg/vegan/inst/ChangeLog	2012-09-26 07:07:56 UTC (rev 2296)
@@ -16,14 +16,18 @@
 	search order: stats function C() is found instead of variable 'C'
 	and this gives an error message "object is not a matrix".
 
-	* radfit: The single radline methods (rad.null() etc.) and
-	radfit() for single sites and data frames are more consistent and
-	usually have the same methods.  The common methods to all include
-	now AIC(), deviance(), logLik(), predict() and fitted(). The
-	radfit() objects gained points() and lines() methods. The data
-	frame method also works with matrices.  The predict() method
-	gained new argument to change the expected 'total' size of
-	communities. The fitted() returns now named vectors or matrices.
+	* radfit: The methods are now more consistent over different
+	levels of radfit models (radline, radfit, radfit.frame).  The
+	common methods to all include now AIC(), coef, deviance(),
+	logLik(), predict() and fitted(). The radfit() objects gained
+	points() and lines() methods. The data frame method also works
+	with matrices.  The predict() method gained new argument to change
+	the expected 'total' size of communities. The fitted() returns now
+	named vectors or matrices. It seems that radlattice() never
+	displayed BIC contrary to documentation and labelling in graph.
+	This has been wrong since the introduction of radlattice in r551
+	(2008-11-09).  Now radlattice also check that it gets the "radfit"
+	object it can handle.
 	
 Version 2.1-19 (closed September 16, 2012)
 



More information about the Vegan-commits mailing list