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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jul 19 13:07:41 CEST 2010


Author: jarioksa
Date: 2010-07-19 13:07:41 +0200 (Mon, 19 Jul 2010)
New Revision: 1240

Modified:
   pkg/vegan/DESCRIPTION
   pkg/vegan/R/plot.MOStest.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/MOStest.Rd
Log:
plot.MOStest uses veganCovEllipse instead of ellipse:::ellipse.glm

Modified: pkg/vegan/DESCRIPTION
===================================================================
--- pkg/vegan/DESCRIPTION	2010-07-19 11:06:59 UTC (rev 1239)
+++ pkg/vegan/DESCRIPTION	2010-07-19 11:07:41 UTC (rev 1240)
@@ -1,13 +1,12 @@
 Package: vegan
 Title: Community Ecology Package
-Version: 1.18-7
-Date: June 16, 2010
+Version: 1.18-8
+Date: July 19, 2010
 Author: Jari Oksanen, F. Guillaume Blanchet, Roeland Kindt, Pierre Legendre, 
    R. B. O'Hara, Gavin L. Simpson, Peter Solymos, M. Henry H. Stevens, 
    Helene Wagner  
 Maintainer: Jari Oksanen <jari.oksanen at oulu.fi>
-Suggests: MASS, mgcv, lattice, cluster, scatterplot3d, rgl, ellipse,
-  tcltk 
+Suggests: MASS, mgcv, lattice, cluster, scatterplot3d, rgl, tcltk 
 Description: Ordination methods, diversity analysis and other
   functions for community and vegetation ecologists.
 License: GPL-2 

Modified: pkg/vegan/R/plot.MOStest.R
===================================================================
--- pkg/vegan/R/plot.MOStest.R	2010-07-19 11:06:59 UTC (rev 1239)
+++ pkg/vegan/R/plot.MOStest.R	2010-07-19 11:07:41 UTC (rev 1240)
@@ -17,17 +17,25 @@
         matlines(xx, cbind(fv, hi, lo), lty=c(1, 2, 2), lwd=c(2, 1, 1), col=1, ...)
     }
     if (show[2]) {
-        require(ellipse) || stop("requires package 'ellipse'")
-        ci <- ellipse(x$mod, which=c(2,3))
+        ## Covariance ellipse for the coefficients
+        s <- summary(x$mod)
+        k <- coef(s)[2:3, 1:2]
+        ## Fix level to 0.95 (should be changed to an argument?)
+        level = 0.95
+        if (family(x$mod)$family %in% c("poisson", "binomial"))
+            scale <- sqrt(qchisq(level, 2))
+        else
+            scale <- sqrt(2 * qf(level, 2, s$df[2])) 
+        ci <- veganCovEllipse(s$cov.scaled[2:3, 2:3], k[,1], scale)
         plot(ci, type="l", lwd=2, xlim=range(ci[,1],0), ylim=range(ci[,2],0), ...)
         abline(h=0, lty=2, ...)
         par <- x$hump[c("min", "max")]
         par[par==0] <- sqrt(.Machine$double.eps)
         abline(0, -1/2/par[1], ...)
         abline(0, -1/2/par[2], ...)
-        k <- coef(summary(x$mod))[2:3, 1:2]
-        segments(k[1,1] - k[1,2]*2, k[2,1], k[1,1]+k[1,2]*2, k[2,1], lty=3)
-        segments(k[1,1], k[2,1]-k[2,2]*2, k[1,1], k[2,1]+k[2,2]*2, lty=3)
+        mul <- qnorm(1 - (1 - level)/2)
+        segments(k[1,1] - k[1,2]*mul, k[2,1], k[1,1]+k[1,2]*mul, k[2,1], lty=3)
+        segments(k[1,1], k[2,1]-k[2,2]*mul, k[1,1], k[2,1]+k[2,2]*mul, lty=3)
     }
     if (any(show[-c(1,2)])) {
         still <- which(show[-c(1,2)])

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2010-07-19 11:06:59 UTC (rev 1239)
+++ pkg/vegan/inst/ChangeLog	2010-07-19 11:07:41 UTC (rev 1240)
@@ -2,8 +2,15 @@
 
 VEGAN DEVEL VERSIONS at http://r-forge.r-project.org/
 
-Version 1.18-7 (opened June 16, 2010)
+Version 1.18-8 (opened July 19, 2010)
 
+	DEPENDENCE: does not suggest package 'ellipse'.
+
+	plot.MOStest: uses veganCovEllipse instead of
+	ellipse:::ellipse.glm. 
+
+Version 1.18-7 (closed July 19, 2010)
+
 	* new version opened with the release of vegan_1.17-3.
 
 	* veganCovEllipse: new internal for drawing covariance ellipses

Modified: pkg/vegan/man/MOStest.Rd
===================================================================
--- pkg/vegan/man/MOStest.Rd	2010-07-19 11:06:59 UTC (rev 1239)
+++ pkg/vegan/man/MOStest.Rd	2010-07-19 11:07:41 UTC (rev 1240)
@@ -82,12 +82,11 @@
   functions to inspect the fit. Function \code{plot(..., which=1)}
   displays the data points, fitted quadratic model, and its approximate
   95\% confidence intervals (2 times SE). Function \code{plot} with
-  \code{which = 2} (requires \code{\link[ellipse]{ellipse.glm}} in
-  package \pkg{ellipse}) displays the approximate confidence interval of
+  \code{which = 2} displays the approximate confidence interval of
   the polynomial coefficients, together with two lines indicating the
   combinations of the coefficients that produce the evaluated points of
   \code{x}. Moreover, the cross-hair shows the approximate confidence
-  intervals (2 times SE) for the polynomial coefficients ignoring their
+  intervals for the polynomial coefficients ignoring their
   correlations. Higher values of \code{which} produce corresponding
   graphs from \code{\link{plot.lm}}. That is, you must add 2 to the
   value of \code{which} in \code{\link{plot.lm}}.



More information about the Vegan-commits mailing list