Running MANCOVA in R

classic Classic list List threaded Threaded
2 messages Options
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Running MANCOVA in R

Livingston, Laura
Hello everyone,


I am a new user on the r-sig-ecology group. I have been working a community dataset that contains 257 invertebrate genera sampled across 3 categories of streams and a variety of stream temperatures. My committee member recommended that I run a MANCOVA on the dataset to see whether there was a difference among the 3 categories of streams using stream temperature as a co-variate. However, I have been searching on how to run a MANCOVA in R without much luck. Has anyone come across this problem before?


The closest example that I have been able to find is at this link: https://stat.ethz.ch/pipermail/r-sig-ecology/2011-November/002553.html.


Using my test data and following that example I wrote:


library(vegan)

library(car)

library(dplyr)


Data <- read.csv("MANCOVA_testData.csv")

Community <- Data %>% dplyr::select(-VisitID:StreamTemp)

Community_dissimilarity <- vegan::vegdist(Community,method="bray")


MANCOVA <- car::ANOVA(lm(as.matrix(Community_dissimilarity) ~ Data$Category + Data$StreamTemp))

summary(MANCOVA)


When I run this code, I get an error. Thoughts?

[R-sig-eco] MANCOVA in R - SfS – Seminar for Statistics<https://stat.ethz.ch/pipermail/r-sig-ecology/2011-November/002553.html>
stat.ethz.ch
On Fri, 2011-11-25 at 10:47 +0100, marcelino.delacruz at upm.es wrote: > Hi, > > maybe adonis? e.g., > > library(vegan) > adonis(Y~Lat+Lat2+Year+Lat:Year+Lat2:Year ...




Sincerely,

Laura

M.S. student, Environmental Science
_______________________________________________
R-sig-ecology mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Running MANCOVA in R

Adam Zeilinger
Hi Laura,

It would be helpful if you provided a reproducible example with a small
data set and copy and paste the error message you are getting.

Advice on making a reproducible example in R is here:
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

Adam

On Mon, Feb 6, 2017 at 10:31 PM, Livingston, Laura <[hidden email]
> wrote:

> Hello everyone,
>
>
> I am a new user on the r-sig-ecology group. I have been working a
> community dataset that contains 257 invertebrate genera sampled across 3
> categories of streams and a variety of stream temperatures. My committee
> member recommended that I run a MANCOVA on the dataset to see whether there
> was a difference among the 3 categories of streams using stream temperature
> as a co-variate. However, I have been searching on how to run a MANCOVA in
> R without much luck. Has anyone come across this problem before?
>
>
> The closest example that I have been able to find is at this link:
> https://stat.ethz.ch/pipermail/r-sig-ecology/2011-November/002553.html.
>
>
> Using my test data and following that example I wrote:
>
>
> library(vegan)
>
> library(car)
>
> library(dplyr)
>
>
> Data <- read.csv("MANCOVA_testData.csv")
>
> Community <- Data %>% dplyr::select(-VisitID:StreamTemp)
>
> Community_dissimilarity <- vegan::vegdist(Community,method="bray")
>
>
> MANCOVA <- car::ANOVA(lm(as.matrix(Community_dissimilarity) ~
> Data$Category + Data$StreamTemp))
>
> summary(MANCOVA)
>
>
> When I run this code, I get an error. Thoughts?
>
> [R-sig-eco] MANCOVA in R - SfS – Seminar for Statistics<https://stat.ethz.
> ch/pipermail/r-sig-ecology/2011-November/002553.html>
> stat.ethz.ch
> On Fri, 2011-11-25 at 10:47 +0100, marcelino.delacruz at upm.es wrote: >
> Hi, > > maybe adonis? e.g., > > library(vegan) > adonis(Y~Lat+Lat2+Year+Lat:Year+Lat2:Year
> ...
>
>
>
>
> Sincerely,
>
> Laura
>
> M.S. student, Environmental Science
> _______________________________________________
> R-sig-ecology mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>



--
Adam Zeilinger

Postdoctoral Scholar
Department of Environmental Science, Policy, and Management
University of California Berkeley
[hidden email]

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-ecology mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Loading...