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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jan 12 14:16:19 CET 2010


Author: jarioksa
Date: 2010-01-12 14:16:19 +0100 (Tue, 12 Jan 2010)
New Revision: 1117

Modified:
   pkg/vegan/R/MOStest.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/MOStest.Rd
Log:
MOStest uses now ANODEV instead of Wald test (that is unreliable for non-guassian families)

Modified: pkg/vegan/R/MOStest.R
===================================================================
--- pkg/vegan/R/MOStest.R	2010-01-11 15:01:01 UTC (rev 1116)
+++ pkg/vegan/R/MOStest.R	2010-01-12 13:16:19 UTC (rev 1117)
@@ -17,11 +17,15 @@
         p2 <- max(x)
     else
         p2 <- interval[2]
-    tmp <- glm(y ~ I(x^2 - 2*x*p1) + x, ...)
-    statmin <- coef(summary(tmp))[3, 3:4]
-    tmp <- glm(y ~ I(x^2 - 2*x*p2) + x, ...)
-    statmax <- coef(summary(tmp))[3, 3:4]
+    test <- if (m0$family$family %in% c("binomial", "poisson")) "Chisq" else "F"
+    tmp <- glm(y ~ I(x^2 - 2*x*p1), ...)
+    ## Chisq test has one column less than F test: extract statistic
+    ## and its P value
+    statmin <- anova(tmp, m0, test = test)[2, (5:6) - (test == "Chisq")]
+    tmp <- glm(y ~ I(x^2 - 2*x*p2), ...)
+    statmax <- anova(tmp, m0, test = test)[2, (5:6) - (test == "Chisq")]
     comb <- 1 - (1-statmin[2])*(1-statmax[2])
+    comb <- unlist(comb)
     stats <- rbind(statmin, statmax)
     rownames(stats) <- paste(hn, c("at min", "at max"))
     stats <- cbind("min/max" = c(p1,p2), stats)

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2010-01-11 15:01:01 UTC (rev 1116)
+++ pkg/vegan/inst/ChangeLog	2010-01-12 13:16:19 UTC (rev 1117)
@@ -17,6 +17,15 @@
 	and therefore was doubled and gave much too wide (up to Infinite)
 	limits. 
 
+	* MOStest uses now ANODEV of free model and model where the
+	hump/pit is forced to a given location instead of the test based
+	on the Wald statistic (coefficient/sd) of the coefficient of the
+	linear term. The ANODEV and Wald statistic are equivalent in
+	Gaussian models, but in with other error families the ANODEV is
+	more correct. This fix removes the conflict between the basic
+	MOStest() and its profile() and confint() methods in non-Gaussian
+	families. 
+
 Version 1.16-34 (closed January 2, 2009) -- (codename: Lucia)
 
 	* twostagechao: deleted, because question regarding the

Modified: pkg/vegan/man/MOStest.Rd
===================================================================
--- pkg/vegan/man/MOStest.Rd	2010-01-11 15:01:01 UTC (rev 1116)
+++ pkg/vegan/man/MOStest.Rd	2010-01-12 13:16:19 UTC (rev 1117)
@@ -53,19 +53,25 @@
 
 \details{
 
-  The function fits a quadratic curve \eqn{\mu = b_0 + b_1 x + b_2 x^2}
-  with given \code{\link{family}} and link function.  If \eqn{b_2 < 0},
-  this defines a unimodal curve with highest point at
-  \eqn{u = -b_2/(2 b_3)} (ter Braak & Looman 1986). If \eqn{b_2 > 0},
-  the parabola has a minimum at \eqn{u} and the response is sometimes
+  The function fits a quadratic curve \eqn{\mu = b_0 + b_1 x + b_2
+  x^2} with given \code{\link{family}} and link function.  If \eqn{b_2
+  < 0}, this defines a unimodal curve with highest point at \eqn{u =
+  -b_2/(2 b_3)} (ter Braak & Looman 1986). If \eqn{b_2 > 0}, the
+  parabola has a minimum at \eqn{u} and the response is sometimes
   called \dQuote{bimodal}.  The null hypothesis is that the extreme
-  point \eqn{u} is located within the interval given by points \eqn{p_1} and
-  \eqn{p_2}. If the extreme point \eqn{u} is exactly at \eqn{p_1}, then
-  \eqn{b_1 = 0} on shifted axis \eqn{x - p_1}.  In the test, origin of
-  \code{x} is shifted to the values \eqn{p_1} and \eqn{p_2}, and the
-  test statistic is the value of the first degree coefficient with its
-  significance as estimated by the \code{\link{summary.glm}}
-  function (Mitchell-Olds & Shaw 1987). 
+  point \eqn{u} is located within the interval given by points
+  \eqn{p_1} and \eqn{p_2}. If the extreme point \eqn{u} is exactly at
+  \eqn{p_1}, then \eqn{b_1 = 0} on shifted axis \eqn{x - p_1}.  In the
+  test, origin of \code{x} is shifted to the values \eqn{p_1} and
+  \eqn{p_2}, and the test statistic is based on the differences of
+  deviances between the original model and model where the origin is
+  forced to the given location using the standard
+  \code{\link{anova.glm}} function (Oksanen et al. 2001).
+  Mitchell-Olds & Shaw (1987) used the first degree coefficient with
+  its significance as estimated by the \code{\link{summary.glm}}
+  function.  This give identical results with Normal error, but for
+  other error distributions it is preferable to use the test based on
+  differences in deviances in fitted models.
 
   The test is often presented as a general test for the location of the
   hump, but it really is dependent on the quadratic fitted curve. If the



More information about the Vegan-commits mailing list