[Vegan-commits] r1260 - in branches/1.17: . R inst inst/doc man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Aug 17 14:11:05 CEST 2010


Author: jarioksa
Date: 2010-08-17 14:11:04 +0200 (Tue, 17 Aug 2010)
New Revision: 1260

Added:
   branches/1.17/R/MOStest.R
   branches/1.17/R/confint.MOStest.R
   branches/1.17/R/fieller.MOStest.R
   branches/1.17/R/plot.MOStest.R
   branches/1.17/R/print.MOStest.R
   branches/1.17/R/profile.MOStest.R
   branches/1.17/R/veganCovEllipse.R
   branches/1.17/man/MOStest.Rd
Modified:
   branches/1.17/DESCRIPTION
   branches/1.17/R/adonis.R
   branches/1.17/R/decorana.R
   branches/1.17/R/mrpp.R
   branches/1.17/R/msoplot.R
   branches/1.17/R/ordiellipse.R
   branches/1.17/R/ordigrid.R
   branches/1.17/R/predict.cca.R
   branches/1.17/R/predict.rda.R
   branches/1.17/R/print.adonis.R
   branches/1.17/R/summary.meandist.R
   branches/1.17/R/vegdist.R
   branches/1.17/inst/ChangeLog
   branches/1.17/inst/doc/FAQ-vegan.texi
   branches/1.17/inst/doc/intro-vegan.Rnw
   branches/1.17/man/adipart.Rd
   branches/1.17/man/contribdiv.Rd
   branches/1.17/man/decostand.Rd
   branches/1.17/man/dispindmorisita.Rd
   branches/1.17/man/mrpp.Rd
   branches/1.17/man/mso.Rd
   branches/1.17/man/multipart.Rd
   branches/1.17/man/ordihull.Rd
   branches/1.17/man/permCheck.Rd
   branches/1.17/man/permatfull.Rd
   branches/1.17/man/permuted.index2.Rd
   branches/1.17/man/predict.cca.Rd
   branches/1.17/man/radfit.Rd
   branches/1.17/man/specpool.Rd
   branches/1.17/man/tsallis.Rd
   branches/1.17/man/vegan-internal.Rd
   branches/1.17/man/vegdist.Rd
   branches/1.17/man/wcmdscale.Rd
Log:
merge rev1235:1259 (+ old pieces) for release 1.17-4

Modified: branches/1.17/DESCRIPTION
===================================================================
--- branches/1.17/DESCRIPTION	2010-08-17 11:42:09 UTC (rev 1259)
+++ branches/1.17/DESCRIPTION	2010-08-17 12:11:04 UTC (rev 1260)
@@ -1,7 +1,7 @@
 Package: vegan
 Title: Community Ecology Package
-Version: 1.17-3
-Date: June 16, 2010
+Version: 1.17-4
+Date: August 17, 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  

Copied: branches/1.17/R/MOStest.R (from rev 1258, pkg/vegan/R/MOStest.R)
===================================================================
--- branches/1.17/R/MOStest.R	                        (rev 0)
+++ branches/1.17/R/MOStest.R	2010-08-17 12:11:04 UTC (rev 1260)
@@ -0,0 +1,42 @@
+`MOStest` <-
+    function(x, y, interval, ...)
+{
+    if (!missing(interval))
+        interval <- sort(interval)
+    x <- eval(x)
+    m0 <- glm(y ~ x + I(x^2), ...)
+    k <- coef(m0)
+    isHump <- unname(k[3] < 0)
+    hn <- if(isHump) "hump" else "pit"
+    hump <- unname(-k[2]/2/k[3])
+    if (missing(interval))
+        p1 <- min(x)
+    else
+        p1 <- interval[1]
+    if (missing(interval))
+        p2 <- max(x)
+    else
+        p2 <- interval[2]
+    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)
+    stats <- rbind(stats, "Combined" = c(NA, NA, comb))
+    vec <- c(p1, p2, hump)
+    names(vec) <- c("min", "max", hn)
+    vec <- sort(vec)
+    isBracketed <- names(vec)[2] == hn
+    out <- list(isHump = isHump, isBracketed = isBracketed,
+                hump = vec, family = family(m0), coefficients = stats,
+                mod = m0)
+    class(out) <- "MOStest"
+    out
+}

Modified: branches/1.17/R/adonis.R
===================================================================
--- branches/1.17/R/adonis.R	2010-08-17 11:42:09 UTC (rev 1259)
+++ branches/1.17/R/adonis.R	2010-08-17 12:11:04 UTC (rev 1260)
@@ -98,6 +98,7 @@
     rownames(tab) <- c(attr(attr(rhs.frame, "terms"), "term.labels")[u.grps],
                        "Residuals", "Total")
     colnames(tab)[ncol(tab)] <- "Pr(>F)"
+    class(tab) <- c("anova", class(tab))
     out <- list(aov.tab = tab, call = match.call(), 
                 coefficients = beta.spp, coef.sites = beta.sites,
                 f.perms = f.perms, model.matrix = rhs, terms = Terms)

Copied: branches/1.17/R/confint.MOStest.R (from rev 1258, pkg/vegan/R/confint.MOStest.R)
===================================================================
--- branches/1.17/R/confint.MOStest.R	                        (rev 0)
+++ branches/1.17/R/confint.MOStest.R	2010-08-17 12:11:04 UTC (rev 1260)
@@ -0,0 +1,6 @@
+`confint.MOStest` <-
+    function (object, parm = 1, level = 0.95, ...) 
+{
+    require(MASS) || stop("requires packages MASS")
+    confint(profile(object), level = level, ...)
+}

Modified: branches/1.17/R/decorana.R
===================================================================
--- branches/1.17/R/decorana.R	2010-08-17 11:42:09 UTC (rev 1259)
+++ branches/1.17/R/decorana.R	2010-08-17 12:11:04 UTC (rev 1260)
@@ -6,10 +6,10 @@
     Const2 <- 5
     Const3 <- 1e-11
     veg <- as.matrix(veg)
+    if (any(rowSums(veg) <= 0)) 
+        stop("All row sums must be >0 in the community matrix: remove empty sites.")
     if (any(veg < 0))
         stop("'decorana' cannot handle negative data entries")
-    if (any(rowSums(veg) <= 0)) 
-        stop("All row sums must be >0 in the community matrix: remove empty sites.")
     if (any(colSums(veg) <= 0)) 
         warning("Some species were removed because they were missing in the data.")
     nr <- nrow(veg)

Copied: branches/1.17/R/fieller.MOStest.R (from rev 1258, pkg/vegan/R/fieller.MOStest.R)
===================================================================
--- branches/1.17/R/fieller.MOStest.R	                        (rev 0)
+++ branches/1.17/R/fieller.MOStest.R	2010-08-17 12:11:04 UTC (rev 1260)
@@ -0,0 +1,31 @@
+`fieller.MOStest` <-
+    function (object, level = 0.95) 
+{
+    smodel <- summary(object$mod)
+    ## overdispersion included in cov.scaled
+    var <- smodel$cov.scaled
+    fam <- family(object$mod)
+    k <- coef(object$mod)
+    b2 <- -2 * k[3]
+    u <- -k[2]/2/k[3]
+    alpha <- (1-level)/2
+    limits <- numeric(2)
+    names(limits) <- paste(round(100*(c(alpha, 1-alpha)), 1), "%") 
+    wvar <- var[2,2] 
+    uvar <- 4 * var[3,3] 
+    vvar <- -2 * var[2,3]
+    z <- qnorm(1 - alpha)
+    g <- z^2 * uvar/b2^2
+    if (g >= 1) {
+        limits <- c(NA, NA)
+    }
+    else {
+        x <- u - g * vvar/uvar
+        f <- z/b2
+        s <- sqrt(wvar - 2 * u * vvar + u^2 * uvar - g * (wvar - 
+                                                          vvar^2/uvar))
+        limits[1] <- (x - f * s)/(1 - g)
+        limits[2] <- (x + f * s)/(1 - g)
+    }
+    limits
+}

Modified: branches/1.17/R/mrpp.R
===================================================================
--- branches/1.17/R/mrpp.R	2010-08-17 11:42:09 UTC (rev 1259)
+++ branches/1.17/R/mrpp.R	2010-08-17 12:11:04 UTC (rev 1260)
@@ -30,12 +30,11 @@
     names(classdel) <- names(ncl) <- indls
     del <- weighted.mean(classdel, w = w, na.rm = TRUE)
     E.del <- mean(dmat, na.rm = TRUE)
-    ## 'Classification strength' if weight.type == 3
-    if (weight.type == 3) {
-        CS <- N*(N-1)/2*(E.del - del)/(N*(N-1)/2 - sum(w))
-    } else {
-        CS <- NA
-    }
+    ## 'Classification strength' if weight.type == 1
+    ## Do not calculate classification strength because there is no
+    ## significance test for it. Keep the item in reserve for
+    ## possible later re-inclusion.
+    CS <- NA
     if (missing(strata)) 
         strata <- NULL
     perms <- sapply(1:permutations, function(x) grouping[permuted.index(N, 

Modified: branches/1.17/R/msoplot.R
===================================================================
--- branches/1.17/R/msoplot.R	2010-08-17 11:42:09 UTC (rev 1259)
+++ branches/1.17/R/msoplot.R	2010-08-17 12:11:04 UTC (rev 1260)
@@ -35,7 +35,7 @@
             lines(vario$Dist, vario$Sum, type = "b", lty = 2, 
                   pch = 3, ...)
             ## Legend
-            legend("topleft", c(label[c(2,b:3)+3], ci.lab, sign.lab),
+            legend("topleft", c(label[c(2,3:b)+3], ci.lab, sign.lab),
                    lty=c(c(1,2,1,1,1)[2:b], 1, if(hasSig) NA),
                    pch=c(3, (6:(b+3))-6, NA, if(hasSig) 15)
                    )

Modified: branches/1.17/R/ordiellipse.R
===================================================================
--- branches/1.17/R/ordiellipse.R	2010-08-17 11:42:09 UTC (rev 1259)
+++ branches/1.17/R/ordiellipse.R	2010-08-17 12:11:04 UTC (rev 1260)
@@ -4,9 +4,6 @@
               w = weights(ord, display),
               show.groups, label = FALSE,  ...)
 {
-    ## Define Circle for an ellipse: taken from the 'car' package
-    theta <- (0:51) * 2 * pi/51
-    Circle <- cbind(cos(theta), sin(theta))
     weights.default <- function(object, ...) NULL
     kind <- match.arg(kind)
     draw <- match.arg(draw)
@@ -31,6 +28,8 @@
     out <- seq(along = groups)
     inds <- names(table(groups))
     res <- list()
+    if (label)
+        cntrs <- names <- NULL
     for (is in inds) {
         gr <- out[groups == is]
         if (length(gr) > 2) {
@@ -42,18 +41,26 @@
             if (missing(conf))
                 t <- 1
             else t <- sqrt(qchisq(conf, 2))
-            xy <- t(mat$center + t * t(Circle %*% chol(mat$cov)))
+            xy <- veganCovEllipse(mat$cov, mat$center, t)
             if (draw == "lines")
                 ordiArgAbsorber(xy, FUN = lines, ...)
             else if (draw == "polygon") 
                 ordiArgAbsorber(xy[, 1], xy[, 2], FUN = polygon, ...)
-            if (label && draw != "none")
-                ordiArgAbsorber(mat$center[1], mat$center[2], labels=is,
-                               FUN = text, ...)
+            if (label && draw != "none") {
+                cntrs <- rbind(cntrs, mat$center)
+                names <- c(names, is)
+            }
             mat$scale <- t
             res[[is]] <- mat
         }
     }
+    if (label && draw != "none") {
+        if (draw == "lines")
+            ordiArgAbsorber(cntrs[,1], cntrs[,2], labels=names, 
+                            FUN = text, ...)
+        else
+            ordiArgAbsorber(cntrs, labels = names, FUN = ordilabel, ...)
+    }
     class(res) <- "ordiellipse"
     invisible(res)
 }

Modified: branches/1.17/R/ordigrid.R
===================================================================
--- branches/1.17/R/ordigrid.R	2010-08-17 11:42:09 UTC (rev 1259)
+++ branches/1.17/R/ordigrid.R	2010-08-17 12:11:04 UTC (rev 1260)
@@ -1,11 +1,14 @@
 "ordigrid" <-
-    function (ord, levels, replicates, display = "sites", ...) 
+    function (ord, levels, replicates, display = "sites", lty=c(1,1), col=c(1,1),
+              lwd = c(1,1), ...) 
 {
     pts <- scores(ord, display = display, ...)
     npoints <- nrow(pts)
     gr <- gl(levels, replicates, npoints)
-    ordisegments(pts, groups = gr, ...)
+    ordisegments(pts, groups = gr,  lty = lty[1], col = col[1],
+                 lwd = lwd[1], ...)
     gr <- gl(replicates, 1, npoints)
-    ordisegments(pts, groups = gr, ...)
+    ordisegments(pts, groups = gr, lty = lty[2], col = col[2],
+                 lwd = lwd[2], ...)
     invisible()
 }

Copied: branches/1.17/R/plot.MOStest.R (from rev 1258, pkg/vegan/R/plot.MOStest.R)
===================================================================
--- branches/1.17/R/plot.MOStest.R	                        (rev 0)
+++ branches/1.17/R/plot.MOStest.R	2010-08-17 12:11:04 UTC (rev 1260)
@@ -0,0 +1,45 @@
+`plot.MOStest` <-
+    function(x, which = c(1,2,3,6),  ...)
+{
+
+    show <- rep(FALSE, 8)
+    show[which] <- TRUE
+    if (show[1]) {
+        X <- x$mod$model$x
+        Y <- x$mod$y
+        xx <- seq(min(X), max(X), len=101)
+        pre <- predict(x$mod, newdata=list(x = xx), se=TRUE)
+        g <- x$mod$family$linkinv
+        fv <- g(pre$fit)
+        hi <- g(pre$fit + 2*pre$se)
+        lo <- g(pre$fit - 2*pre$se)
+        plot(X, Y, ...)
+        matlines(xx, cbind(fv, hi, lo), lty=c(1, 2, 2), lwd=c(2, 1, 1), col=1, ...)
+    }
+    if (show[2]) {
+        ## 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], ...)
+        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)])
+        plot(x$mod, which = still, ...)
+    }
+    invisible()
+}

Modified: branches/1.17/R/predict.cca.R
===================================================================
--- branches/1.17/R/predict.cca.R	2010-08-17 11:42:09 UTC (rev 1259)
+++ branches/1.17/R/predict.cca.R	2010-08-17 12:11:04 UTC (rev 1260)
@@ -20,6 +20,9 @@
     slam <- diag(sqrt(object[[model]]$eig[1:take]), nrow = take)
     if (type %in%  c("response", "working")) {
         Xbar <- 0
+        if (!missing(newdata))
+            u <- predict(object, type = if(model == "CCA") "lc" else "wa",
+                         newdata = newdata, rank = take)
         if (take > 0) 
             Xbar <- u %*% slam %*% t(v)
         if (!is.null(object$pCCA)) 

Modified: branches/1.17/R/predict.rda.R
===================================================================
--- branches/1.17/R/predict.rda.R	2010-08-17 11:42:09 UTC (rev 1259)
+++ branches/1.17/R/predict.rda.R	2010-08-17 12:11:04 UTC (rev 1260)
@@ -25,6 +25,10 @@
     if (type %in% c("response", "working")) {
         if (!is.null(object$pCCA)) 
             warning("Conditional ('partial') component ignored")
+        if (!missing(newdata)) {
+            u <- predict(object, type = if(model == "CCA") "lc" else "wa",
+                         newdata = newdata, rank = take)
+        }
         if (inherits(object, "capscale")) {
             if (take > 0)
                 out <- dist(u %*% slam/sqrt(nr))

Copied: branches/1.17/R/print.MOStest.R (from rev 1258, pkg/vegan/R/print.MOStest.R)
===================================================================
--- branches/1.17/R/print.MOStest.R	                        (rev 0)
+++ branches/1.17/R/print.MOStest.R	2010-08-17 12:11:04 UTC (rev 1260)
@@ -0,0 +1,13 @@
+`print.MOStest` <-
+    function(x, ...)
+{
+    cat("\nMitchell-Olds and Shaw test\n")
+    cat("Null: hump of a quadratic linear predictor is at min or max\n")
+    print(x$family)
+    print(x$hump)
+    if (!x$isBracketed)
+        cat("***** Caution: hump/pit not bracketed by the data ******\n")
+    cat("\n")
+    printCoefmat(coef(x), has.P=TRUE, na.print="")
+    invisible(x)
+}

Modified: branches/1.17/R/print.adonis.R
===================================================================
--- branches/1.17/R/print.adonis.R	2010-08-17 11:42:09 UTC (rev 1259)
+++ branches/1.17/R/print.adonis.R	2010-08-17 12:11:04 UTC (rev 1260)
@@ -3,6 +3,6 @@
 {
     cat("\nCall:\n")
     cat(deparse(x$call), "\n\n")
-    printCoefmat(x$aov.tab,  na.print = "")
+    print(x$aov.tab)
     invisible(x)
 }

Copied: branches/1.17/R/profile.MOStest.R (from rev 1258, pkg/vegan/R/profile.MOStest.R)
===================================================================
--- branches/1.17/R/profile.MOStest.R	                        (rev 0)
+++ branches/1.17/R/profile.MOStest.R	2010-08-17 12:11:04 UTC (rev 1260)
@@ -0,0 +1,55 @@
+`profile.MOStest` <-
+    function(fitted, alpha = 0.01, maxsteps = 10, del = zmax/5, ...)
+{
+    Pnam <- if(fitted$isHump) "hump" else "pit"
+    k <- coef(fitted$mod)
+    u <- -k[2]/2/k[3]
+    n <- length(residuals(fitted$mod))
+    std.error <- fieller.MOStest(fitted, level=0.6)
+    std.error <- u - std.error[1]
+    if (is.na(std.error))
+        std.error <- diff(range(model.matrix(fitted$mod)[,2]))
+    OrigDev <- deviance(fitted$mod)
+    summ <- summary(fitted$mod)
+    DispPar <- summ$dispersion
+    fam <- family(fitted$mod)
+    Y <- fitted$mod$y
+    X <- model.matrix(fitted$mod)[,-3]
+    Xi <- X
+    if (fam$family %in% c("poisson", "binomial", "Negative Binomial")) {
+        zmax <- sqrt(qchisq(1 - alpha/2, 1))
+        profName <- "z"
+    } else {
+        zmax <- sqrt(qf(1 - alpha/2, 1, n - 1))
+        profName <- "tau"
+    }
+    zi <- 0
+    prof <- vector("list", length=1)
+    names(prof) <- Pnam
+    uvi <- u
+    for (sgn in c(-1, 1)) {
+        step <- 0
+        z <- 0
+        while((step <- step + 1) < maxsteps && abs(z) < zmax) {
+            ui <- u + sgn * step * del * std.error
+            Xi[,2] <- (X[,2] - ui)^2
+            fm <- glm.fit(x = Xi, y = Y, family=fam,
+                          control = fitted$mod$control)
+            uvi <- c(uvi, ui)
+            zz <- (fm$deviance - OrigDev)/DispPar
+            z <- sgn * sqrt(zz)
+            zi <- c(zi, z)
+        }
+        si <- order(zi)
+        prof[[Pnam]] <- structure(data.frame(zi[si]), names=profName)
+        uvi <- as.matrix(uvi)
+        colnames(uvi) <- Pnam
+        prof[[Pnam]]$par.vals <- uvi[si, , drop=FALSE]
+    }
+    of <- list()
+    of$coefficients <- structure(Pnam, names=Pnam)
+    val <- structure(prof, original.fit = of, summary = summ)
+    class(val) <- c("profile.MOStest", "profile.glm", "profile")
+    val
+}
+

Modified: branches/1.17/R/summary.meandist.R
===================================================================
--- branches/1.17/R/summary.meandist.R	2010-08-17 11:42:09 UTC (rev 1259)
+++ branches/1.17/R/summary.meandist.R	2010-08-17 12:11:04 UTC (rev 1260)
@@ -14,7 +14,7 @@
     A2 <- weighted.mean(diag(object), w = n - 1, na.rm = TRUE)
     A3 <- weighted.mean(diag(object), w = n * (n - 1), na.rm = TRUE)
     ##
-    out <- list(W = W, B = B, D = D, CS = B-W,
+    out <- list(W = W, B = B, D = D, CS = B-A1,
                 A1 = 1 - A1/D, A2 = 1 - A2/D, A3 = 1 - A3/D)
     class(out) <- "summary.meandist"
     out

Copied: branches/1.17/R/veganCovEllipse.R (from rev 1258, pkg/vegan/R/veganCovEllipse.R)
===================================================================
--- branches/1.17/R/veganCovEllipse.R	                        (rev 0)
+++ branches/1.17/R/veganCovEllipse.R	2010-08-17 12:11:04 UTC (rev 1260)
@@ -0,0 +1,9 @@
+`veganCovEllipse` <-
+    function(cov, center = c(0,0), scale = 1, npoints = 100)
+{
+    ## Basically taken from the 'car' package: The Cirlce
+    theta <- (0:npoints) * 2 * pi/npoints
+    Circle <- cbind(cos(theta), sin(theta))
+    ## scale, center and cov must be calculated separately
+    t(center + scale * t(Circle %*% chol(cov)))
+}

Modified: branches/1.17/R/vegdist.R
===================================================================
--- branches/1.17/R/vegdist.R	2010-08-17 11:42:09 UTC (rev 1259)
+++ branches/1.17/R/vegdist.R	2010-08-17 12:11:04 UTC (rev 1260)
@@ -20,7 +20,7 @@
         warning("results may be meaningless because data have negative entries in method ", inm,"\n")
     if (method == 11 && any(colSums(x) == 0)) 
         warning("data have empty species which influence the results im method ", inm, "\n")
-    if (method %in% c(6, 14)) 
+    if (method == 6) # gower, but no altGower
         x <- decostand(x, "range", 2, na.rm = TRUE, ...)
     if (binary) 
         x <- decostand(x, "pa")

Modified: branches/1.17/inst/ChangeLog
===================================================================
--- branches/1.17/inst/ChangeLog	2010-08-17 11:42:09 UTC (rev 1259)
+++ branches/1.17/inst/ChangeLog	2010-08-17 12:11:04 UTC (rev 1260)
@@ -2,6 +2,41 @@
 
 VEGAN RELEASE VERSIONS at http://cran.r-project.org/
 
+Version 1.17-4 (released August 17, 2010)
+
+	* merged changes 1235:1260 from the main devel branch plus copied
+	MOStest and support and predict.cca7rda update from earlier
+	revisions. Changed procedures include:
+
+	* decorana order of input check (r1243)
+
+	* predict.cca/rda: 'newdata' with types "response" and "working"
+	(r1180). 
+
+	* MOStest: copied from pkg/vegan.
+
+	* ordigrid: two line types (r1246)
+
+	* veganCovEllipse: copied from pkg/vegan.
+
+	* msoplot: legend fix (r1250). Reported by Daniel Borcard.
+
+	* adonis: cleaner print (r1247)
+
+	* mrpp bug fix: remove CS from mrpp, and correct weight type of CS
+	in meandist. Reported by John Van Sickle (US EPA, Corvallis OR). 
+
+	* ordiellipse: internal changes (r1237) and fix labels on filled
+	polygons (r1242).
+
+	* vegdist: fix Anderson variant of Gower ("altGower"). Reported as
+	bug #1002 by Sergio Garcia.
+
+	* Rd files cleanup, mainly removing visible backslash \ (r1253,
+	1254, 1257).
+
+	* vignettes updated (r1239, 1244, 1245, 1259).
+
 Version 1.17-3 (released June 16, 2010)
 
 	* copied permutations.Rd from devel version (added there in r1229

Modified: branches/1.17/inst/doc/FAQ-vegan.texi
===================================================================
--- branches/1.17/inst/doc/FAQ-vegan.texi	2010-08-17 11:42:09 UTC (rev 1259)
+++ branches/1.17/inst/doc/FAQ-vegan.texi	2010-08-17 12:11:04 UTC (rev 1260)
@@ -3,7 +3,7 @@
 @setfilename FAQ-vegan.info
 @settitle vegan FAQ
 @setchapternewpage on
- at set FAQ_YEAR 2008
+ at set FAQ_YEAR 2010
 @afourpaper
 @c %**end of header
 
@@ -309,6 +309,7 @@
 @chapter Ordination
 
 @menu
+* I have only numeric and positive data but vegan still complaints::  
 * Can you analyse binary or cover class data?::  
 * Why dissimilarities in vegan differ from other sources?::  
 * Zero dissimilarities in isoMDS::  
@@ -323,7 +324,17 @@
 * How to avoid cluttered ordination graphs?::  
 @end menu
 
- at node Can you analyse binary or cover class data?, Why dissimilarities in vegan differ from other sources?, Ordination, Ordination
+ at node  I have only numeric and positive data but vegan still complaints, Can you analyse binary or cover class data?, Ordination, Ordination
+ at comment  node-name,  next,  previous,  up
+ at section I have only numeric and positive data but vegan still complaints
+
+You are wrong! Computers are painfully pedantic, and if they find
+non-numeric ore negative data entries, you really have them. Check your
+data. Most common reasons for non-numeric data are that row names were
+read as a non-numeric variable instead of being used as row
+names. Another is that you had empty cells in your input data.
+
+ at node Can you analyse binary or cover class data?, Why dissimilarities in vegan differ from other sources?, I have only numeric and positive data but vegan still complaints, Ordination
 @section Can you analyse binary or cover class data?
 
 Yes. Most vegan methods can handle binary data or cover abundance data.
@@ -391,11 +402,14 @@
 @item Eigenvector methods:
 Functions @code{rda}, @code{cca} and @code{capscale} give the variation
 of conditional (partialled), constrained (canonical) and residual
-components, but you must calculate the proportions by hand. The
- at code{summary} gives the contributions of the axes. 
-Function @code{goodness} gives the same statistics for individual
-species or sites (species are unavailable with @code{capscale}). In
-addition, there is a special function 
+components, but you must calculate the proportions by hand.  Function
+ at code{eigenvals} extracts the eigenvalues, and
+ at code{eigenvals(summary(ord))} reports the proportions explained in the
+result object @code{ord}.  Function @code{RsquareAdj} gives the
+R-squared and adjusted R-squared (if available) for constrained
+components.  Function @code{goodness} gives the same statistics for
+individual species or sites (species are unavailable with
+ at code{capscale}). In addition, there is a special function
 @code{varpart} for unbiased partitioning of variance between up to four
 separate components in redundancy analysis.
 

Modified: branches/1.17/inst/doc/intro-vegan.Rnw
===================================================================
--- branches/1.17/inst/doc/intro-vegan.Rnw	2010-08-17 11:42:09 UTC (rev 1259)
+++ branches/1.17/inst/doc/intro-vegan.Rnw	2010-08-17 12:11:04 UTC (rev 1260)
@@ -190,9 +190,9 @@
 \texttt{Vegan} has a group of functions for adding information about
 classification or grouping of points onto ordination diagrams.
 Function \texttt{ordihull} adds convex hulls, \texttt{ordiellipse}
-(which needs package \texttt{ellipse}) adds ellipses of standard
-deviation, standard error or confidence areas, and \texttt{ordispider}
-combines items to their centroid (Fig. \ref{fig:ordihull}):
+adds ellipses of standard deviation, standard error or confidence
+areas, and \texttt{ordispider} combines items to their centroid
+(Fig. \ref{fig:ordihull}):
 <<>>=
 data(dune.env)
 attach(dune.env)
@@ -201,7 +201,7 @@
 plot(ord, disp="sites", type="n")
 ordihull(ord, Management, col="blue")
 ordiellipse(ord, Management, col=3,lwd=2)
-ordispider(ord, Management, col="red")
+ordispider(ord, Management, col="red", label = TRUE)
 points(ord, disp="sites", pch=21, col="red", bg="yellow", cex=1.3)
 @
 \begin{SCfigure}

Copied: branches/1.17/man/MOStest.Rd (from rev 1258, pkg/vegan/man/MOStest.Rd)
===================================================================
--- branches/1.17/man/MOStest.Rd	                        (rev 0)
+++ branches/1.17/man/MOStest.Rd	2010-08-17 12:11:04 UTC (rev 1260)
@@ -0,0 +1,178 @@
+\encoding{UTF-8}
+\name{MOStest}
+\alias{MOStest}
+\alias{print.MOStest}
+\alias{plot.MOStest}
+\alias{fieller.MOStest}
+\alias{profile.MOStest}
+\alias{confint.MOStest}
+
+\title{ Mitchell-Olds \& Shaw Test for the Location of Quadratic Extreme }
+\description{
+  Mitchell-Olds & Shaw test concerns the location of the highest (hump)
+  or lowest (pit) value of a quadratic curve at given points. Typically,
+  it is used to study whether the quadratic hump or pit is located
+  within a studied interval. The current test is generalized so that it
+  applies generalized linear models (\code{\link{glm}}) with link
+  function instead of simple quadratic curve.  The test was popularized
+  in ecology for the analysis of humped species richness patterns
+  (Mittelbach et al. 2001), but it is more general. With logarithmic
+  link function, the quadratic response defines the Gaussian response
+  model of ecological gradients (ter Braak & Looman 1986), and the test
+  can be used for inspecting the location of Gaussian optimum within a
+  given range of the gradient. It can also be used to replace Tokeshi's
+  test of \dQuote{bimodal} species frequency distribution. 
+}
+\usage{
+MOStest(x, y, interval, ...)
+\method{plot}{MOStest}(x, which = c(1,2,3,6), ...)
+fieller.MOStest(object, level = 0.95)
+\method{profile}{MOStest}(fitted, alpha = 0.01, maxsteps = 10, del = zmax/5, ...)
+\method{confint}{MOStest}(object, parm = 1, level = 0.95, ...)
+}
+
+\arguments{
+  \item{x}{The independent variable or plotting object in \code{plot}. }
+  \item{y}{The dependent variable. }
+  \item{interval}{The two points at which the test statistic is
+    evaluated. If missing, the extremes of \code{x} are used. }
+  \item{which}{Subset of plots produced. Values \code{which=1} and
+    \code{2} define plots specific to \code{MOStest} (see Details), and
+    larger values select graphs of \code{\link{plot.lm}} (minus 2). }
+  \item{object, fitted}{A result object from \code{MOStest}.}
+  \item{level}{The confidence level required.}
+  \item{alpha}{Maximum significance level allowed.}
+  \item{maxsteps}{Maximum number of steps in the profile.}
+  \item{del}{A step length parameter for the profile (see code).}
+  \item{parm}{Ignored.}
+  \item{\dots}{ Other variables passed to functions. Function
+    \code{MOStest} passes these to \code{\link{glm}} so that
+    these can include \code{\link{family}}. The other functions pass
+    these to underlying graphical functions. }
+}
+
+\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
+  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 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
+  hump is of different form than quadratic, the test may be
+  insignificant.
+
+  Because of strong assumptions in the test, you should use the support
+  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} 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 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}}.
+
+  Function \code{fieller.MOStest} approximates the confidence limits
+  of the location of the extreme point (hump or pit) using Fieller's
+  theorem following ter Braak & Looman (1986). The test is based on
+  quasideviance except if the \code{\link{family}} is \code{poisson}
+  or \code{binomial}. Function \code{profile} evaluates the profile
+  deviance of the fitted model, and \code{confint} finds the profile
+  based confidence limits following Oksanen et al. (2001).
+
+  The test is typically used in assessing the significance of diversity
+  hump against productivity gradient (Mittelbach et al. 2001). It also
+  can be used for the location of the pit (deepest points) instead of
+  the Tokeshi test. Further, it can be used to test the location of the
+  the Gaussian optimum in ecological gradient analysis (ter Braak &
+  Looman 1986, Oksanen et al. 2001).
+}
+
+\value{
+  The function is based on \code{\link{glm}}, and it returns the result
+  of object of \code{glm} amended with the result of the test. The new
+  items in the \code{MOStest} are: 
+  \item{isHump }{\code{TRUE} if the response is a
+    hump.}
+  \item{isBracketed}{\code{TRUE} if the hump or the pit is bracketed by
+    the evaluated points.} 
+  \item{hump}{Sorted vector of location of the hump or the pit and the
+    points where the test was evaluated.}
+  \item{coefficients}{Table of test statistics and their significances.}
+}
+
+\references{
+Mitchell-Olds, T. & Shaw, R.G. 1987. Regression analysis of natural
+selection: statistical inference and biological
+interpretation. \emph{Evolution} 41, 1149--1161.
+
+Mittelbach, G.C. Steiner, C.F., Scheiner, S.M., Gross, K.L., Reynolds,
+H.L., Waide, R.B., Willig, R.M., Dodson, S.I. & Gough, L. 2001. What is
+the observed relationship between species richness and productivity?
+\emph{Ecology} 82, 2381--2396.
+
+Oksanen, J., Läärä, E., Tolonen, K. & Warner, B.G. 2001. Confidence
+intervals for the optimum in the Gaussian response
+function. \emph{Ecology} 82, 1191--1197.
+
+ter Braak, C.J.F & Looman, C.W.N 1986. Weighted averaging, logistic
+regression and the Gaussian response model. \emph{Vegetatio} 65,
+3--11. 
+}
+\author{Jari Oksanen }
+
+\note{ 
+Function \code{fieller.MOStest} is based on package \pkg{optgrad} in
+the Ecological Archives
+(\url{http://www.esapubs.org/archive/ecol/E082/015/default.htm})
+accompanying Oksanen et al. (2001). The Ecological Archive package
+\pkg{optgrad} also contains profile deviance method for the location
+of the hump or pit, but the current implementation of \code{profile}
+and \code{confint} rather follow the example of
+\code{\link[MASS]{profile.glm}} and \code{\link[MASS]{confint.glm}} in
+the \pkg{MASS} package.
+}
+
+\seealso{The no-interaction model can be fitted with \code{\link{humpfit}}. }
+\examples{
+## The Al-Mufti data analysed in humpfit():
+mass <- c(140,230,310,310,400,510,610,670,860,900,1050,1160,1900,2480)
+spno <- c(1,  4,  3,  9, 18, 30, 20, 14,  3,  2,  3,  2,  5,  2)
+mod <- MOStest(mass, spno)
+## Insignificant
+mod
+## ... but inadequate shape of the curve
+op <- par(mfrow=c(2,2), mar=c(4,4,1,1)+.1)
+plot(mod)
+## Looks rather like log-link with Poisson error and logarithmic biomass
+mod <- MOStest(log(mass), spno, family=quasipoisson)
+mod
+plot(mod)
+par(op)
+## Confidence Limits
+fieller.MOStest(mod)
+confint(mod)
+plot(profile(mod))
+}
+
+\keyword{ models }
+\keyword{ regression }

Modified: branches/1.17/man/adipart.Rd
===================================================================
--- branches/1.17/man/adipart.Rd	2010-08-17 11:42:09 UTC (rev 1259)
+++ branches/1.17/man/adipart.Rd	2010-08-17 12:11:04 UTC (rev 1260)
@@ -100,7 +100,7 @@
 \emph{Oikos}, \bold{76}, 5--13.
 }
 
-\author{\enc{P\'eter S\'olymos}{Peter Solymos}, \email{solymos at ualberta.ca}}
+\author{\enc{Péter Sólymos}{Peter Solymos}, \email{solymos at ualberta.ca}}
 \seealso{See \code{\link{oecosimu}} for permutation settings and calculating \eqn{p}-values.}
 \examples{
 data(mite)

Modified: branches/1.17/man/contribdiv.Rd
===================================================================
--- branches/1.17/man/contribdiv.Rd	2010-08-17 11:42:09 UTC (rev 1259)
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/vegan -r 1260


More information about the Vegan-commits mailing list