[R-sig-eco] summing F stats and permutation
Jari Oksanen
jari.oksanen at oulu.fi
Thu Nov 29 16:43:14 CET 2012
Steve,
This is R, so it is not about whether this can be done, but how this can be done. Unfortunately, doing exactly this requires some fluency in R. Doing something similar is very simple.
The description of your problem sounds very much like the description of permutation test in redundancy analysis (RDA). The difference is that in RDA you sum up nominators and denominators before getting the ratio, but in your model you sum up the ratios. So in RDA test you have (num_1 + num_2 + ... + num_p)/(den_1 + den_2 + ... + den_p), and in your description you have num_1/den_1 + num_2/den_2 + ... + num_p/den_p. The former test in canned for instance in the vegan package, but the latter you must develop yourself (and the former method of summing variances instead of their ratios feels sounder). It would not be too many lines of code to fit your code, though. Please note that RDA works by fitting linear models for each species independently so that you can get all needed statistics from a fitted RDA in the vegan package (function rda). The following function extracts F-values by species from a fitted vegan:::rda() result object:
spF <-
function (object)
{
inherits(object, "rda") || stop("needs an rda() result object")
df1 <- object$CCA$qrank
df2 <- nrow(object$CA$Xbar) - df1 - 1
num <- colSums(predict(object, type="working", model="CCA")^2)
den <- colSums(predict(object, type="working", model="CA")^2)
(num/df1)/(den/df2)
}
HTH, Jari Oksanen
________________________________________
From: r-sig-ecology-bounces at r-project.org [r-sig-ecology-bounces at r-project.org] on behalf of Steve Brewer [jbrewer at olemiss.edu]
Sent: 29 November 2012 16:42
To: r-sig-ecology at r-project.org
Subject: [R-sig-eco] summing F stats and permutation
Dear Colleagues,
I'm wondering if anyone in this group has developed code for doing a sumF
test for examining community responses in an experiment. For those not
familiar, sumF is a simple univariate alternative to MANOVA and perMANOVA,
wherein univariate ANOVAs and their associated F statistics are calculated
for each species' abundance and then the F statistic for each effect is
summed over all species. The significance of the resulting summed F
statistic is then evaluated using random permutation. The summed F statistic
is interpreted as an overall community response to the treatments, whereas
the F statistic for each species provides a measure of the contribution that
species makes to treatment differences.
I could envision a variety of ways in which this could be done in R, but I'm
not adept enough in R to figure out how to do it myself. One possibility
might involve using permute or shuffle to get the randomized data matrices,
but it is not clear to me how one could simultaneously calculate the Anovas
for all species and sum the resulting F statistics for each random
permutation. There is no reason why traditional F statistics would have to
be used. Pseudo-F statistics based on distances for each species' abundance
could be calculated instead and then summed across species.
PLEASE NOTE THAT I AM ALREADY AWARE OF THE OBJECTIONS TO THIS APPROACH TO
COMMUNITY ANALYSIS. Nevertheless, I am interested in pursuing this using R,
if possible.
Any suggestions are welcomed.
Thanks,
Steve
J. Stephen Brewer
Professor
Department of Biology
PO Box 1848
University of Mississippi
University, Mississippi 38677-1848
Brewer web page - http://home.olemiss.edu/~jbrewer/
FAX - 662-915-5144 Phone - 662-915-1077
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
R-sig-ecology at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
More information about the R-sig-ecology
mailing list