[R-sig-eco] envfit and NMDS

2013-04-24 Thread Erin Nuccio
Hello list,

I commonly see envfit used for NMDS, and am curious if envfit is considered a 
non-metric vector fitting tool.  This question came up during a conversation 
with a colleague who only uses envfit with PCoA, because they are concerned 
that to do this would be problematic for the same reason you are not supposed 
to correlate environmental variables with NMDS axes (you can't correlate 
something that's non-metric with a metric variable).  To me, it seems like by 
projecting the metric variable into non-metric space, you're essentially making 
it non-metric, and the correlation would be fine.

If anyone could weigh in and clear up the confusion, that would be great.  
Thanks,
Erin
___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] envfit and NMDS

2013-04-24 Thread Erin Nuccio
Hi Jari,

Thanks for your response -- I will definitely be forwarding this on to my 
colleagues!

Cheers,
Erin






On Apr 24, 2013, at 2:47 AM, Jari Oksanen wrote:

 Howdy folks,
 
 This is the second time this week we have this issue. There are two (or 
 three) separate points:
 
 (1) You should not correlate environmental variables with axes in any 
 ordination method. This applies to PCoA, PCA, CA or anything else just as 
 well as to NMDS. You can see this by fitting the vectors: they are rarely 
 parallel to the axes. Even in CCA/RDA, the vectors for constraints are rarely 
 parallel to the axes.
 
 (2) The ordination space in NMDS is metric. The non-metric part is the 
 monotonic (non-metric) regression from metric ordination space to observed 
 dissimilarities. The observed dissimilarities between sampling units 
 (plots, sites) need not be metric, but they can be semimetric or 
 non-metric, but the ordination space derived from them is metric. 
 
 (3) As a separate issue, it is often better to use fitted surfaces than 
 fitted vectors. Fitted vectors are appropriate when the fitted surface is a 
 plane (first degree linear trend surface). This is rarely the case, and this 
 applies to all ordination methods: the fitted surfaces in CA, PCoA or PCA are 
 usually just as non-planar as in NMDS.
 
 For point 2: Look at the stressplot(NMDS-result). Here horizontal axis 
 gives Euclidean distances in NMDS space -- these are metric. The vertical 
 axis gives the observed dissimilarities -- these can be anything. The fit 
 lines gives the monotonic regression -- this is non-metric. 
 
 With vegan::metaMDS() the ordination space is not only metric, but it is 
 strictly Euclidean. We do and we can rotate the ordination space.
 
 As a historic note, the vector fitting code for vegan was based on a Bell 
 Labs document that describes vector fitting for their NMDS (KYST software). 
 The Bell folks invented NMDS, and they regarded vector fitting suitable for 
 NMDS from the very beginning. That is, form 1960s.
 
 Cheers, Jari Oksanen
 
 From: r-sig-ecology-boun...@r-project.org 
 [r-sig-ecology-boun...@r-project.org] on behalf of Erin Nuccio 
 [enuc...@gmail.com]
 Sent: 24 April 2013 12:30
 To: r-sig-ecology@r-project.org
 Subject: [R-sig-eco] envfit and NMDS
 
 Hello list,
 
 I commonly see envfit used for NMDS, and am curious if envfit is considered a 
 non-metric vector fitting tool.  This question came up during a conversation 
 with a colleague who only uses envfit with PCoA, because they are concerned 
 that to do this would be problematic for the same reason you are not supposed 
 to correlate environmental variables with NMDS axes (you can't correlate 
 something that's non-metric with a metric variable).  To me, it seems like by 
 projecting the metric variable into non-metric space, you're essentially 
 making it non-metric, and the correlation would be fine.
 
 If anyone could weigh in and clear up the confusion, that would be great.  
 Thanks,
 Erin
 ___
 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] Adonis and Random Effects

2013-03-27 Thread Erin Nuccio
Hi Steve,

You mentioned that nested.npmanova won't test GrasslandPlot correctly for a 
split-plot design.  However, does adonis test GrasslandPlot correctly, since 
it's using the split-plot error term to test all effects?  

Here are the formulas again.
adonis(community_dist ~ Grassland*Treatment + GrasslandPlot, strata = 
GrasslandPlot)
nested.npmanova(community_dist ~ Grassland + GrasslandPlot)

Thank you,
Erin





On Mar 10, 2013, at 8:17 AM, JOHN S BREWER wrote:

 Erin,
 
 Please check the February 25 post I made called Permanova with nested data. 
 It explains how to test whole plot and split plot effects correctly in 
 adonis. But to answer your question, even if you treat Grassland as a 
 fixed-plot effect (which seems perfectly reasonable), Grassland is a 
 whole-plot effect. Using the model formula given and strata, adonis uses the 
 split-plot error term (i.e., the residual error term) to test all effects. 
 That's wrong because Grassland needs to be tested with the whole-plot error 
 term. In the post I referred to, I describe how you can do a separate test 
 for the whole plot using the BiodiversityR package and the nested.npmanova 
 function. In this case, you would only include Grassland and GrasslandPlot as 
 terms in the model. It's just doing a two-way nested manova. The whole-plot 
 effect of Grassland will be tested correctly using the GrasslandPlot term. 
 GrasslandPlot will be tested with the residual error term, which will be 
 wrong, but you can !
 ignore that. I've tried it with my own data and it works. One cautionary note. 
See the posts by Jari Oksanen and others about the versions of BiodiversityR 
and R used. 
 
 Hope this helps
 
 Steve
 
 From: Erin Nuccio [enuc...@gmail.com]
 Sent: Saturday, March 09, 2013 9:09 PM
 To: JOHN S BREWER
 Cc: r-sig-ecology@r-project.org
 Subject: Re: [R-sig-eco] Adonis and Random Effects
 
 Hi Steve and R list,
 
 I was hoping you could clarify something you mentioned in previous post.
 
 A quick recap...  I have a split-plot design where I determined the microbial 
 communities at 3 grasslands (see post script for design).  I am trying 
 quantify the how much of my community can be explained by Treatment or 
 Grassland effect.  After talking with a statistician, it seems like treating 
 Grassland as a Fixed effect would be reasonable (because I have such a small 
 number of grasslands).
 
 You mentioned that if I treat Grassland as a Fixed effect, and use the 
 following formula, the Grassland effect would not be tested correctly:
 
 adonis(formula = community_distance_matrix ~ Treatment*Grassland + 
 GrasslandPlot, strata = GrasslandPlot)
 
 Why is this?  Is there any way to remedy this?
 
 Thanks for your feedback,
 Erin
 
 
 Experimental design:
 4 split plots * 2 Treatments * 3 Grasslands = 24 observations
 Treatment: 2 levels (each within 1 split plot)
 Grassland: 3 levels
 GrasslandPlot: 12 levels (4 split plots nested in 3 Grasslands)
 
 
 
 
 
 On Feb 4, 2013, at 6:22 AM, Steve Brewer 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

Re: [R-sig-eco] nested.npmanova -- distance matrices as input?

2013-03-11 Thread Erin Nuccio
Hi Jari,

Yes, my distance matrix is of class dist, so it sounds like my unifrac 
dissimilarities were handled correctly.

Thank you!
Erin




On Mar 11, 2013, at 12:57 AM, Jari Oksanen wrote:

 Erin,
 
 R is open source: you can see the source code if in doubt. 
 
 Looking at the source code, the situation is a bit unclear and depends on the 
 details of your data that I don't know. It seems that nested.npmanova() 
 accepst R distances structures of class dist. If your Unifrac distances 
 inherit from dist class, nested.npmanova(), they will be handled correctly 
 in nested.npmanova. If they are, like your write, distance matrices, then 
 they will be handled incorrectly: they are accepted silently but treated like 
 they were raw data matrices. You should get an error message from vegdist() 
 in that case, as it knows no method = FALSE, so it may be that your 
 dissimilarities were correctly handled. However, we don't know as we even do 
 not know what software (R package, external software) you used in calculating 
 unifrac dissimilarities. 
 
 If 'd' are your distances, see what does class(d) say. If says dist 
 (possibly with some other alternatives), you are safe. If your 'd' are not of 
 class dist, you can try if as.dist(d) changes them to dist.
 
 Cheers, Jari Oksanen
 
 From: r-sig-ecology-boun...@r-project.org 
 [r-sig-ecology-boun...@r-project.org] on behalf of Erin Nuccio 
 [enuc...@gmail.com]
 Sent: 11 March 2013 07:08
 To: r-sig-ecology@r-project.org
 Subject: [R-sig-eco] nested.npmanova -- distance matrices as input?
 
 Hello list,
 
 Does anyone know nested.npmanova can take distance matrices as input?   When 
 I read the helpfile, it specifies that the input for nested.npmanova is a 
 data frame, and sounds like distance matrices can only be used for 
 nested.anova.dbrda (see below).  However, if I try inputting a Unifrac 
 distance matrix, and make method = FALSE, it completes without any errors.  
 Did this complete correctly?
 
 formulaFormula with a community data frame (with sites as rows, species 
 as columns and species abundance as cell values) or (for nested.anova.dbrda 
 only) distance matrix on the left-hand side and two categorical variables on 
 the right-hand side (with the second variable assumed to be nested within the 
 first).
 
 Thank you,
 Erin
 ___
 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] Adonis and Random Effects

2013-03-10 Thread Erin Nuccio
Thanks Steve, that is helpful.

However, I've run into a small problem with nested.npmanova.  It appears that I 
cannot supply my own distance matrix, and need to supply the raw species data.  
I am using Unifrac distances, which is not an option for vegdist.  Anyone know 
if there is a workaround here?

I did compare nested.npmanova to adonis with bray distance using the same model 
(community_data ~ Grassland + GrasslandPlot), and it looks like the F values 
are similar for Grassland (F values: 3.6 vs. 3.3), and the same for 
GrasslandPlot.  The R2 values seem to stay the same no matter what I do in 
adonis, and the p values are all ~ 0.001.

So, in case there is no way to use Unifrac distances with nested.npmanova, my 
backup plan would be to perform two adonis functions, and use the second 
function to get the approximate F value for Grassland and correct F value for 
GrasslandPlot:
adonis(community_data ~ Treatment*Grassland + GrasslandPlot, 
strata=GrasslandPlot)
adonis(community_data ~ Grassland + GrasslandPlot, strata=GrasslandPlot)

Does this seem reasonable?  Of course, the best thing would be to use the 
Unifrac distances with nested.npmanova if it's possible.

Thank you,
Erin





On Mar 10, 2013, at 8:17 AM, JOHN S BREWER wrote:

 Erin,
 
 Please check the February 25 post I made called Permanova with nested data. 
 It explains how to test whole plot and split plot effects correctly in 
 adonis. But to answer your question, even if you treat Grassland as a 
 fixed-plot effect (which seems perfectly reasonable), Grassland is a 
 whole-plot effect. Using the model formula given and strata, adonis uses the 
 split-plot error term (i.e., the residual error term) to test all effects. 
 That's wrong because Grassland needs to be tested with the whole-plot error 
 term. In the post I referred to, I describe how you can do a separate test 
 for the whole plot using the BiodiversityR package and the nested.npmanova 
 function. In this case, you would only include Grassland and GrasslandPlot as 
 terms in the model. It's just doing a two-way nested manova. The whole-plot 
 effect of Grassland will be tested correctly using the GrasslandPlot term. 
 GrasslandPlot will be tested with the residual error term, which will be 
 wrong, but you can !
 ignore that. I've tried it with my own data and it works. One cautionary note. 
See the posts by Jari Oksanen and others about the versions of BiodiversityR 
and R used. 
 
 Hope this helps
 
 Steve
 
 From: Erin Nuccio [enuc...@gmail.com]
 Sent: Saturday, March 09, 2013 9:09 PM
 To: JOHN S BREWER
 Cc: r-sig-ecology@r-project.org
 Subject: Re: [R-sig-eco] Adonis and Random Effects
 
 Hi Steve and R list,
 
 I was hoping you could clarify something you mentioned in previous post.
 
 A quick recap...  I have a split-plot design where I determined the microbial 
 communities at 3 grasslands (see post script for design).  I am trying 
 quantify the how much of my community can be explained by Treatment or 
 Grassland effect.  After talking with a statistician, it seems like treating 
 Grassland as a Fixed effect would be reasonable (because I have such a small 
 number of grasslands).
 
 You mentioned that if I treat Grassland as a Fixed effect, and use the 
 following formula, the Grassland effect would not be tested correctly:
 
 adonis(formula = community_distance_matrix ~ Treatment*Grassland + 
 GrasslandPlot, strata = GrasslandPlot)
 
 Why is this?  Is there any way to remedy this?
 
 Thanks for your feedback,
 Erin
 
 
 Experimental design:
 4 split plots * 2 Treatments * 3 Grasslands = 24 observations
 Treatment: 2 levels (each within 1 split plot)
 Grassland: 3 levels
 GrasslandPlot: 12 levels (4 split plots nested in 3 Grasslands)
 
 
 
 
 
 On Feb 4, 2013, at 6:22 AM, Steve Brewer 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

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

2013-03-10 Thread Erin Nuccio
Hi again,

OK, figuring out if it's possible to use Unifrac with nested.npmanova may be 
necessary

I just realized my test comparing nested.npmanova and adonis on the same model 
had no strata for adonis.  When I add the strata GrasslandPlot to adonis, my p 
values are equal to 1.  So adonis with no strata gives me similar values to 
nested.npmanova for the following model:  community_data ~ Grassland + 
GrasslandPlot.

So, (community_data ~ Grassland + GrasslandPlot) approximates the correct 
statistics, but since this ignores all strata, I'm not sure if it's justified.  
Thoughts?

Thanks,
Erin




On Mar 10, 2013, at 3:42 PM, Erin Nuccio wrote:

 Thanks Steve, that is helpful.
 
 However, I've run into a small problem with nested.npmanova.  It appears that 
 I cannot supply my own distance matrix, and need to supply the raw species 
 data.  I am using Unifrac distances, which is not an option for vegdist.  
 Anyone know if there is a workaround here?
 
 I did compare nested.npmanova to adonis with bray distance using the same 
 model (community_data ~ Grassland + GrasslandPlot), and it looks like the F 
 values are similar for Grassland (F values: 3.6 vs. 3.3), and the same for 
 GrasslandPlot.  The R2 values seem to stay the same no matter what I do in 
 adonis, and the p values are all ~ 0.001.
 
 So, in case there is no way to use Unifrac distances with nested.npmanova, my 
 backup plan would be to perform two adonis functions, and use the second 
 function to get the approximate F value for Grassland and correct F value for 
 GrasslandPlot:
 adonis(community_data ~ Treatment*Grassland + GrasslandPlot, 
 strata=GrasslandPlot)
 adonis(community_data ~ Grassland + GrasslandPlot, strata=GrasslandPlot)
 
 Does this seem reasonable?  Of course, the best thing would be to use the 
 Unifrac distances with nested.npmanova if it's possible.
 
 Thank you,
 Erin
 
 
 
 
 
 On Mar 10, 2013, at 8:17 AM, JOHN S BREWER wrote:
 
 Erin,
 
 Please check the February 25 post I made called Permanova with nested 
 data. It explains how to test whole plot and split plot effects correctly 
 in adonis. But to answer your question, even if you treat Grassland as a 
 fixed-plot effect (which seems perfectly reasonable), Grassland is a 
 whole-plot effect. Using the model formula given and strata, adonis uses the 
 split-plot error term (i.e., the residual error term) to test all effects. 
 That's wrong because Grassland needs to be tested with the whole-plot error 
 term. In the post I referred to, I describe how you can do a separate test 
 for the whole plot using the BiodiversityR package and the nested.npmanova 
 function. In this case, you would only include Grassland and GrasslandPlot 
 as terms in the model. It's just doing a two-way nested manova. The 
 whole-plot effect of Grassland will be tested correctly using the 
 GrasslandPlot term. GrasslandPlot will be tested with the residual error 
 term, which will be wrong, but you can!
  ignore that. I've tried it with my own data and it works. One cautionary 
note. See the posts by Jari Oksanen and others about the versions of 
BiodiversityR and R used. 
 
 Hope this helps
 
 Steve
 
 From: Erin Nuccio [enuc...@gmail.com]
 Sent: Saturday, March 09, 2013 9:09 PM
 To: JOHN S BREWER
 Cc: r-sig-ecology@r-project.org
 Subject: Re: [R-sig-eco] Adonis and Random Effects
 
 Hi Steve and R list,
 
 I was hoping you could clarify something you mentioned in previous post.
 
 A quick recap...  I have a split-plot design where I determined the 
 microbial communities at 3 grasslands (see post script for design).  I am 
 trying quantify the how much of my community can be explained by Treatment 
 or Grassland effect.  After talking with a statistician, it seems like 
 treating Grassland as a Fixed effect would be reasonable (because I have 
 such a small number of grasslands).
 
 You mentioned that if I treat Grassland as a Fixed effect, and use the 
 following formula, the Grassland effect would not be tested correctly:
 
 adonis(formula = community_distance_matrix ~ Treatment*Grassland + 
 GrasslandPlot, strata = GrasslandPlot)
 
 Why is this?  Is there any way to remedy this?
 
 Thanks for your feedback,
 Erin
 
 
 Experimental design:
 4 split plots * 2 Treatments * 3 Grasslands = 24 observations
 Treatment: 2 levels (each within 1 split plot)
 Grassland: 3 levels
 GrasslandPlot: 12 levels (4 split plots nested in 3 Grasslands)
 
 
 
 
 
 On Feb 4, 2013, at 6:22 AM, Steve Brewer 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

[R-sig-eco] nested.npmanova -- distance matrices as input?

2013-03-10 Thread Erin Nuccio
Hello list,

Does anyone know nested.npmanova can take distance matrices as input?   When I 
read the helpfile, it specifies that the input for nested.npmanova is a data 
frame, and sounds like distance matrices can only be used for 
nested.anova.dbrda (see below).  However, if I try inputting a Unifrac distance 
matrix, and make method = FALSE, it completes without any errors.  Did this 
complete correctly?

formulaFormula with a community data frame (with sites as rows, species as 
columns and species abundance as cell values) or (for nested.anova.dbrda only) 
distance matrix on the left-hand side and two categorical variables on the 
right-hand side (with the second variable assumed to be nested within the 
first).

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


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

2013-03-09 Thread Erin Nuccio
Hi Steve and R list,

I was hoping you could clarify something you mentioned in previous post.

A quick recap...  I have a split-plot design where I determined the microbial 
communities at 3 grasslands (see post script for design).  I am trying quantify 
the how much of my community can be explained by Treatment or Grassland effect. 
 After talking with a statistician, it seems like treating Grassland as a Fixed 
effect would be reasonable (because I have such a small number of grasslands).

You mentioned that if I treat Grassland as a Fixed effect, and use the 
following formula, the Grassland effect would not be tested correctly:

adonis(formula = community_distance_matrix ~ Treatment*Grassland + 
GrasslandPlot, strata = GrasslandPlot)

Why is this?  Is there any way to remedy this?  

Thanks for your feedback,
Erin


Experimental design:
4 split plots * 2 Treatments * 3 Grasslands = 24 observations
Treatment: 2 levels (each within 1 split plot)
Grassland: 3 levels
GrasslandPlot: 12 levels (4 split plots nested in 3 Grasslands)





On Feb 4, 2013, at 6:22 AM, Steve Brewer 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.
 
 Thanks for your help,
 Erin
 
 
 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] 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


[R-sig-eco] Adonis and Random Effects

2013-02-03 Thread Erin Nuccio
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