Re: [R-sig-eco] Adonis and Random Effects

2013-02-05 Thread Erin Nuccio
Thanks Steve and Jari for your responses.  I really do appreciate it -- trying 
to analyze this data has been a challenge! 

Based on both your responses, it seems like I won't be able to get adonis to do 
the appropriate tests for the Grassland effect (since I do not know how to 
design custom permutation matrices, as Jari mentioned).  Steve you're correct 
that I'm not using Euclidean distances (I'm using Unifrac distances).

Since I'm mainly interested in the amount of variance explained by each 
variable, would it be worthwhile to explore using varpart? I can convert 
Grassland into a distance matrix (pairwise distances between sites), and I 
would guess that I would have to turn Treatment into a dummy variable.  I also 
have additional environmental data that I ignored with my attempt at adonis.

Many thanks for your input,
Erin




On Feb 4, 2013, at 6:22 AM, Steve Brewer jbre...@olemiss.edu wrote:

 Erin,
 
 There have been a lot of similar queries (e.g., repeated measures, nested
 permanova). Jari can correct me if I am wrong, but as far as I know, no
 one has developed a way to define multiple error terms in adonis.
 
 
 You can use adonis, however, to get the split-plot effects. If you want to
 make a grassland a random effect, use the following statement
 
 adonis(formula = community_distance_matrix ~ Treatment + Grassland +
 GrasslandPlot, strata = GrasslandPlot)
 
 
 The treatment effect will be correct because the residual error term
 (which is equivalent to treatment x GrasslandPlot interaction nested
 within Grassland) is the correct error term. The Grassland effect,
 however, will not be tested correctly because it is using the residual
 error term when it should be using GrasslandPLot as the error term. You
 can determine what the F stat for Grassland should be, however, using the
 Ms Grassland and MS GrasslandPlot from the anova table to construct the F
 test. You just won't get a p-value for the test.
 
 If you want to treat Grassland as a fixed effect, the model is similar but
 defines the interaction
 
 adonis(formula = community_distance_matrix ~ Treatment*Grassland +
 GrasslandPlot, strata = GrasslandPlot)
 
 
 In this case, the treatment x grassland interaction will be tested
 correctly, as will the treatment effect, but not the Grassland effect.
 
 Unfortunately, you cannot just take averages of abundances across the
 treatment and control in each plot and then do a separate analysis of
 Grassland and GrasslandPLot (unless you're using Euclidean distances). I
 suspect you're not using Euclidean distances.
 
 Hope this helps some.
 
 Good luck,
 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
 
 
 
 
 On 2/4/13 1:14 AM, Erin Nuccio enuc...@gmail.com wrote:
 
 Hello List,
 
 Is adonis capable of modeling random effects?  I'm analyzing the impact
 of a treatment on the microbial community in a split-plot design (2
 treatments per plot, 4 plots per grassland, 3 grasslands total). I would
 like to quantify how much of the variance is due to the Treatment versus
 the Grassland.  It seems like Grassland should be a random effect, since
 there are thousands of grasslands, and I'm only looking at 3.
 
 I have tried to use the notation that works with lme4, and it's not
 working for me (see below for formula and error messages).  If adonis
 can't do random effects, are there any alternatives?  Or, considering my
 goal, are there any other programs I should look into?  Any suggestions
 would be highly appreciated!
 
 Thanks for your help,
 Erin
 
 
 
 Here's what I think I should run:
 adonis(formula = community_distance_matrix ~ Treatment + (1|Grassland) +
 (1|GrasslandPlot), strata = GrasslandPlot)
 
 Here are my factors:
 'data.frame':24 obs. of  4 variables:
 $ Treatment: Factor w/ 2 levels T1,T2: 1 1 1 1 1 2 2 2 1 1 ...
 $ Grassland: Factor w/ 3 levels G1,G2,G3: 3 3 1 1 1 2 2 1 2 2
 ...
 $ Plot : Factor w/ 4 levels P1,P2,P3,P4: 1 2 2 3 4 1 3 2
 1 2 ...
 $ GrasslandPlot: Factor w/ 12 levels G1:P1,G1:P2,G1:P3..: 9 10 2 3
 4 5 7 2 5 6 ...
 
 And here's the error message:
 Error in `contrasts-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) :
 contrasts can be applied only to factors with 2 or more levels
 In addition: Warning messages:
 1: In Ops.factor(1, Grassland) : | not meaningful for factors
 2: In Ops.factor(1, GrasslandPlot) : | not meaningful for factors
 
 ___
 R-sig-ecology mailing list
 R-sig-ecology@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
 
 

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] AICc calculation in AICcmodavg package

2013-02-05 Thread Drew Tyre
Hi Kristen

Just type
AICc.lme

at the command prompt. That shows the code that is used to build up the AIC
formula. In this case, the relevant bit looks like
if (identical(nobs, NULL)) {
n - nrow(mod$fitted)
}
else {
n - nobs
}
LL - logLik(mod)[1]
K - attr(logLik(mod), df)

So it uses the total number of observations, unless you specify the
argument nobs in the call to AICc.

hth


On Mon, Feb 4, 2013 at 7:38 PM, Kristen Gorman kgor...@sfu.ca wrote:

 Dear all,
 I am curious, how would I find out the exact equation used by the
 AICcmodavg package in R for calculating AICc with lme models? I understand
 what the AICc equation is from Burnham and Anderson (2002), but I am unsure
 as to how the package deals with the number of observations within lme
 class models given random effects.

 Thanks for any guidance,

 Kristen Gorman

 ___
 R-sig-ecology mailing list
 R-sig-ecology@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-sig-ecology




-- 
Drew Tyre

School of Natural Resources
University of Nebraska-Lincoln
416 Hardin Hall, East Campus
3310 Holdrege Street
Lincoln, NE 68583-0974

phone: +1 402 472 4054
fax: +1 402 472 2946
email: aty...@unl.edu
http://snr.unl.edu/tyre
http://aminpractice.blogspot.com
http://www.flickr.com/photos/atiretoo

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology