[R-sig-eco] Specifying contrasts for an interaction in mvabund/manyglm

David Warton d@v|d@w@rton @end|ng |rom un@w@edu@@u
Wed Sep 23 02:49:24 CEST 2020


Hi Kyle,
Sorry there is no way in mvabund at the moment to do specific planned multiple comparisons.  As a workaround you could fit separate models for each season and do multiple comparisons for sites.  Assuming data are independent across seasons you could add a Bonferroni correction to this...

On Diogo's comment, gllvm is great for ordination and predictive modelling but it looks like you are after multivariate significance testing, which is what mvabund was specifically designed for.

All the best
David



-----Original Message-----
From: R-sig-ecology <r-sig-ecology-bounces using r-project.org> On Behalf Of r-sig-ecology-request using r-project.org
Sent: Tuesday, 22 September 2020 8:00 PM
To: r-sig-ecology using r-project.org
Subject: R-sig-ecology Digest, Vol 150, Issue 2

Send R-sig-ecology mailing list submissions to
	r-sig-ecology using r-project.org

To subscribe or unsubscribe via the World Wide Web, visit
	https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
or, via email, send a message with subject or body 'help' to
	r-sig-ecology-request using r-project.org

You can reach the person managing the list at
	r-sig-ecology-owner using r-project.org

When replying, please edit your Subject line so it is more specific than "Re: Contents of R-sig-ecology digest..."


Today's Topics:

   1. Specifying contrasts for an interaction in mvabund/manyglm
      (Kyle Tyler)
   2. Error in Maxent (dismo package) (Irene Rojo)
   3. Re: Error in Maxent (dismo package) (Torsten Hauffe)
   4. Re: Error in Maxent (dismo package) (Irene Rojo)

----------------------------------------------------------------------

Message: 1
Date: Tue, 22 Sep 2020 01:37:31 +0000
From: Kyle Tyler <kyle.tyler using cdu.edu.au>
To: "r-sig-ecology using r-project.org" <r-sig-ecology using r-project.org>
Subject: [R-sig-eco] Specifying contrasts for an interaction in
	mvabund/manyglm
Message-ID:
	<MEAPR01MB3832BD320B076C42C6988806AB3B0 using MEAPR01MB3832.ausprd01.prod.outlook.com>
	
Content-Type: text/plain; charset="utf-8"

Dear list;

I am investigating how species assemblages of fish vary over space and time. I am performing a multivariate analysis using manyglm in mvabund, with the factors Site, Season and their interaction. Site has eight levels and Season 4. Each Site was sampled multiple times within each Season.

My model is:

full_mod <- manyglm(spp ~ Site + Season + Site:Season, offset=(log(Shot_L)), family="negative_binomial", data = Catch)

The offset is due to the linear length of each sampled  transect  varying between samples.

Using  anova.manyglm(full_mod, p.uni="adjusted"), I find that each factor, and the interaction, is highly significant. The next step is to then look at which pairs of factor levels differ. For the factors on their own, this is straightforward by again using  anova.manyglm  again, but with the  pairwise.comp =  specified for each factor.

In the case of the interaction, I do this with:

Catch$SiteSeason <- paste(Catch$SiteSeason, Catch$SiteSeason, sep= _ )

anova.manyglm(full_mod, p.uni="adjusted , pairwise.comp = Catch$SiteSeason)

However, for the interaction in my model, the number of comparisons really blows up and becomes impractical to manage, and even non-sensical in a lot of cases. This is because anova.manyglm will compare every possible combination, which in my case results in 496 comparisons for this interaction. This causes problems first due to so much multiple testing going on, but also because not all comparisons make sense, or at least I am not interested in them.

Ideally, I would like to restrict the contrasts to be only between seasons within each site, and between sites within a season, as these are the comparisons I am interested in. I don t really care to know if the assemblage at site 1 in season 1 is different from that at site 8 in season 4 etc. In mvabund, is there a way to specify/restrict the contrasts to only those that I am interested in?

Thanks a lot for any help!
Kyle

Kyle J. Tyler
PhD Candidate   Aquatic Ecology
Charles Darwin University, Australia

	[[alternative HTML version deleted]]




------------------------------

Message: 2
Date: Tue, 22 Sep 2020 10:07:45 +0200
From: Irene Rojo <ire.rojo using gmail.com>
To: r-sig-ecology using r-project.org
Subject: [R-sig-eco] Error in Maxent (dismo package)
Message-ID:
	<CAGJ2grYCN0cPgEkkGoh-eMKJh0tKhbJd65xsERU2xZ7+wyLB+Q using mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Dear all,

I am fitting maxent models within the dismo package but I have some doubts regarding the number of categorical variables (factors) that I can include in the model. All my variables are raster (.asc).

When I perform the model with just one factor (me <- maxent(predictors, occtrain, factors="bion")) it runs and everything works fine, but when I try to add more factors (me <- maxent(predictors, occtrain, factors="bion", "morfo", "sed")) I get the following error:

Error in .getMatrix(a) :
  data should be  a matrix, data.frame, or SpatialPoints* object

When I just include one factor (whatever the variable is) it works, so I don't know if it is a syntax problem and I am not including the rest of the factors in a proper way (separated by commas), or if it is not possible to add more than one factor.

Any advice will be much appreciated!

Thanks in advance,

Irene

	[[alternative HTML version deleted]]




------------------------------

Message: 3
Date: Tue, 22 Sep 2020 10:14:14 +0200
From: Torsten Hauffe <torsten.hauffe using gmail.com>
To: Irene Rojo <ire.rojo using gmail.com>
Cc: r-sig-ecology using r-project.org
Subject: Re: [R-sig-eco] Error in Maxent (dismo package)
Message-ID:
	<CAGCrCxZB9ZyeH-Ybb3BAFL12KP6qw2jKfmhpXDW79wqoFhC+TQ using mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hi,

I can't try it but maybe you need a vector with all factorial predictors.
Hence, put them all in c().

me <- maxent(predictors, occtrain, factors=c("bion","morfo", "sed"))

On Tue, Sep 22, 2020 at 10:08 AM Irene Rojo <ire.rojo using gmail.com> wrote:

> Dear all,
>
> I am fitting maxent models within the dismo package but I have some 
> doubts regarding the number of categorical variables (factors) that I 
> can include in the model. All my variables are raster (.asc).
>
> When I perform the model with just one factor (me <- 
> maxent(predictors, occtrain, factors="bion")) it runs and everything 
> works fine, but when I try to add more factors (me <- 
> maxent(predictors, occtrain, factors="bion", "morfo", "sed")) I get the following error:
>
> Error in .getMatrix(a) :
>   data should be  a matrix, data.frame, or SpatialPoints* object
>
> When I just include one factor (whatever the variable is) it works, so 
> I don't know if it is a syntax problem and I am not including the rest 
> of the factors in a proper way (separated by commas), or if it is not 
> possible to add more than one factor.
>
> Any advice will be much appreciated!
>
> Thanks in advance,
>
> Irene
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>

	[[alternative HTML version deleted]]




------------------------------

Message: 4
Date: Tue, 22 Sep 2020 10:28:50 +0200
From: Irene Rojo <ire.rojo using gmail.com>
To: Torsten Hauffe <torsten.hauffe using gmail.com>
Cc: r-sig-ecology using r-project.org
Subject: Re: [R-sig-eco] Error in Maxent (dismo package)
Message-ID:
	<CAGJ2grbPL_YjOC+5UMi4qEpTpJ4ibQ48A8+Vfgv+U3EY485Weg using mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Dear Torsten,

It works now, you were right. Thanks a lot!!

Irene


El mar., 22 sept. 2020 a las 10:14, Torsten Hauffe (<
torsten.hauffe using gmail.com>) escribió:

> Hi,
>
> I can't try it but maybe you need a vector with all factorial predictors.
> Hence, put them all in c().
>
> me <- maxent(predictors, occtrain, factors=c("bion","morfo", "sed"))
>
> On Tue, Sep 22, 2020 at 10:08 AM Irene Rojo <ire.rojo using gmail.com> wrote:
>
>> Dear all,
>>
>> I am fitting maxent models within the dismo package but I have some 
>> doubts regarding the number of categorical variables (factors) that I 
>> can include in the model. All my variables are raster (.asc).
>>
>> When I perform the model with just one factor (me <- 
>> maxent(predictors, occtrain, factors="bion")) it runs and everything 
>> works fine, but when I try to add more factors (me <- 
>> maxent(predictors, occtrain, factors="bion", "morfo", "sed")) I get 
>> the following error:
>>
>> Error in .getMatrix(a) :
>>   data should be  a matrix, data.frame, or SpatialPoints* object
>>
>> When I just include one factor (whatever the variable is) it works, 
>> so I don't know if it is a syntax problem and I am not including the 
>> rest of the factors in a proper way (separated by commas), or if it 
>> is not possible to add more than one factor.
>>
>> Any advice will be much appreciated!
>>
>> Thanks in advance,
>>
>> Irene
>>
>>         [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-ecology mailing list
>> R-sig-ecology using r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>>
>

	[[alternative HTML version deleted]]




------------------------------

Subject: Digest Footer

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


------------------------------

End of R-sig-ecology Digest, Vol 150, Issue 2
*********************************************


More information about the R-sig-ecology mailing list