Re: [R-sig-eco] interpreting ecological distance approaches (Bray Curtis after various data transformation)

2019-04-05 Thread Tania Bird
Not sure if its relevant, but this paper and associated function
*beta.div.comp* {adespatial}  may be of interest to disentangle between
richness and turnover in composition data
https://doi.org/10./geb.12207


Tania Bird MSc
*"There is a sufficiency in the world for man's need but not for man's
greed" ~ Mahatma Gandhi*

https://www.linkedin.com/in/taniabird





On Thu, 4 Apr 2019 at 10:28, Torsten Hauffe 
wrote:

> Great point David!
>
> Since Tim was referring to microbial communities, the gjam package is
> similar to mvabund, boral etc. and the microbial example discussed in the
> following paper might be of interest.
>
> https://esajournals.onlinelibrary.wiley.com/doi/full/10.1002/ecm.1241
>
> With that being about R itself, I may go a bit off topic:
> In all those multivariate GLM approaches, is there a way to disentangle
> richness differences (or nestedness) and turnover like we can do with
> pairwise distances?
> (See the inspiring discussion between Carvalho et al. and Baselga et al.;
> summarized in
> http://onlinelibrary.wiley.com/doi/10./geb.12207/abstract
> )
> Since different biological processes may cause these patterns, separating
> richness differences and species turnover is of interest. Maybe the the row
> effect in those multivariate GLMs could be estimated as response to
> environmental predictors?
>
> Cheers,
> Torsten
>
>
>
> On Thu, 4 Apr 2019 at 01:19, David Warton 
> wrote:
>
> > Hi Tim,
> > Yes you are right this is an issue, BC (and other distance metrics) are
> > sensitive to sampling intensity, which is often an artefact of the
> sampling
> > technique.  Transformation is not a great solution to the problem - it
> > works imperfectly and will have different effects depending on the
> > properties of your data.  There are lots of different types of datasets
> out
> > there, each with different properties, and different behaviours under
> > different transformation/standardisation strategies, so there is no
> > one-transformation-suits-all solution.  An illustration of this (in the
> > case of row standardisation) is in the below paper:
> >
> > https://besjournals.onlinelibrary.wiley.com/doi/10./2041-210X.12843
> >
> > The strategy I would advise here is to go a very different route and
> build
> > a statistical model for the data.  You can then include row effects in
> the
> > model to handle variation in sampling intensity across rows of data
> (along
> > the lines of equation 2 of the above paper).  Or if the magnitude of the
> > variation in sampling intensity is known (e.g. it is due to changes in
> > sizes of quadrats used for sampling, and quadrat size has been recorded),
> > then the standard approach to handle this is to add an offset to the
> > model.  There is plenty of software out there that can fit suitable
> > statistical models with row effects (and offsets) for this sort of data,
> > including the mvabund, HMSC, boral, and gllvm packages on R.
> Importantly,
> > these packages come with diagnostic tools to check that the analysis
> > approach adequately captures key properties of your data - an essential
> > step in any analysis.
> >
> > All the best
> > David
> >
> >
> > Professor David Warton
> > School of Mathematics and Statistics, Evolution & Ecology Research
> Centre,
> > Centre for Ecosystem Science
> > UNSW Sydney
> > NSW 2052 AUSTRALIA
> > phone +61(2) 9385 7031
> > fax +61(2) 9385 7123
> >
> > http://www.eco-stats.unsw.edu.au
> >
> >
> >
> > --
> >
> > Date: Tue, 2 Apr 2019 17:15:45 +0200
> > From: Tim Richter-Heitmann 
> > To: r-sig-ecology@r-project.org
> > Subject: [R-sig-eco] interpreting ecological distance approaches (Bray
> > Curtis after various data transformation)
> > Message-ID: <3834fea1-040a-12b5-c3a3-633e68dc6...@uni-bremen.de>
> > Content-Type: text/plain; charset="utf-8"; Format="flowed"
> >
> > Dear list,
> >
> > i am not an ecologist by training, so please bear with me.
> >
> > It is my understanding that Bray Curtis distances seem to be sensitive to
> > different community sizes. Thus, they seem to deliver inadequate results
> > when the different community sizes are the result of technical artifacts
> > rather than biology (see e.g. Weiss et al, 2017 on microbiome data).
> >
> > Therefore, i often see BC distances made on relative data (which seems to
> > be equivalent to the Manhattan distance) or on data which h

Re: [R-sig-eco] repeated measures ANOVA and PERMANOVA (does it exist?)

2018-01-24 Thread Tania Bird
Principal response curves would be a good way to go if you have balanced
data.

My recent paper may be of interest:
Bird, TLF et al.. (2017) Shrub Encroachment Effects on Habitat
Heterogeneity and Beetle Diversity in a Mediterranean Coastal Dune System. Land
Degrad. Develop., 28: 2553–2562. doi: 10.1002/ldr.2807
<http://dx.doi.org/10.1002/ldr.2807>.

I used repeated measures PERMANOVA and ADONIS (a more robust alternative to
anosim) with an unbalanced dataset.
If this seems of interest I can share my code.

Tania

Tania Bird MSc
PhD Student: Multivariate approaches to conserve and restore multi-taxa coastal
dune biodiversity
Dept. of Geography & Environmental Development,
Ben Gurion University, Beer Sheva
https://www.linkedin.com/in/taniabird
bi...@post.bgu.ac.il


On 24 January 2018 at 16:51, Zoltan Botta-Dukat <
botta-dukat.zol...@okologia.mta.hu> wrote:

> Hi,
>
> You also try using principal response curves as suggested in this recent
> publication:
>
> dx.doi.org/10.1002/ecs2.2023
>
> Zoltan
>
>
> 2018.01.24. 15:28 keltezéssel, Pedro Pequeno írta:
> > Hi,
> >
> > you could ordinate your observations first (e.g. using NMDS or PCoA), and
> > then model the resulting scores using location and time as predictors (if
> > you are interested in estimating their independent effects), or using a
> > repeated-measures Anova or a GLMM with location as random factor  to
> > account for within-location autocorrelation.
> >
> > Just in case, Legendre & Gauthier (2014) discuss several approaches for
> > space-time analyses (
> > http://rspb.royalsocietypublishing.org/content/281/1778/20132728.short)
> >
> > Cheers,
> >
> > Pedro A. C. L. Pequeno
> >
> > Em terça-feira, 23 de janeiro de 2018, David Barfknecht <
> > dfbarfkne...@outlook.com> escreveu:
> >
> >> Hello all,
> >>
> >> I am currently working on a project that uses species occurrence data
> >> (0/1) to construct an NMDS ordination where some points are the same
> >> location but through time (10 locations X 3 survey times = 30
> >> observations). I want to use ANOSIM and PERMANOVA to look at both
> >> individual locations controlling for time and all survey periods
> >> controlling for location. Basically, I want to look at location and
> times
> >> as separate factors.  I am curious if anyone have ever had to write a
> >> script for repeated measures ANOSIM and/or PERMANOVA. I am aware of how
> to
> >> do the unrepeated measures version of these in the vegan package, but
> not
> >> repeated measures versions. Any suggestions?
> >>
> >> If not, are there other methods more appropriate to investigate this?
> >>
> >> Thank you in advance for any advice.
> >>
> >> Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for
> >> Windows 10
> >>
> >>
> >>  [[alternative HTML version deleted]]
> >>
> >> ___
> >> R-sig-ecology mailing list
> >> R-sig-ecology@r-project.org
> >> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
> >>
> >   [[alternative HTML version deleted]]
> >
> > ___
> > R-sig-ecology mailing list
> > R-sig-ecology@r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>
>
> --
>
> Botta-Dukát ZoltánZoltán BOTTA-Dukát
> 
> 
> Ökológiai és Botanikai IntézetInstitute of Ecology and
> Botany
> Magyar Tudományos AkadémiaHungarian Academy of
> Sciences
> Ökológiai Kutatóközpont   Centre for Ecological
> Research
> 
> 
> 2163. Vácrátót, Alkotmány u. 2-4. H-2163 Vácrátót,
> Alkomány u. 2-4.,HUNGARY
> tel: +36 28 360122/138Phone: +36 28 360122/138
> fax: +36 28 360110Fax +36 28 360110
> botta-dukat.zol...@okologia.mta.hu
> botta-dukat.zol...@okologia.mta.hu
> http://okologia.mta.hu/Botta-Dukat.Zoltan
> http://okologia.mta.hu/en/Zoltan.BOTTA-DUKAT
>
> *New book:*
> Theory-Based Ecology; A Darwinian approach
> Authors: Liz Pásztor, Zoltán Botta-Dukát, Gabriella Magyar, Tamás
> Czárán, and Géza Meszéna
> Available at Amazon
> <https://www.amazon.com/Theory-Based-Ecology-Darwinian-Liz-P
> asztor/dp/0199577862/ref=sr_1_1?s=books=

[R-sig-eco] Reordering dendogram

2017-10-10 Thread Tania Bird
I am trying to control the order and colour of a dendrogram. Obviously
the point of the dendorgram is to order by similarity, but within
branches I'd like to set an order that make sense
(alphabetical-numeric).

library(vegan)
library(stats)

x <-data.frame(data = c(1:10))
y = data.frame(type = c("A","B","C","A","C","D","A","B","C","B"),
site_name = c("A1","B1","C1","A2","C2","D1","A3","B2","C3","B3"))
row.names(x) = y$site_name
dis = vegdist(x)
hc <- hclust(dis)
dd <- as.dendrogram(hc)
plot(dd)

My data labels are text but they do have a set order listed in a variable

site_order = c("A1","A2","A3","B1","B2","B3","C1","C2","C3","D1")

1) I'd like to find a solution that sorts the dendogram according to
site_order within branches.

e.g. A1,B1,A2, C1,   C2,D2, A3,B2, B3,C3

I also want to colour and shape the labels using site_type e.g (A= red
circle , B= blue square , C= green triangle, D = yellow cross)

Is this possible?


Thanks

Tania Bird MSc
"There is a sufficiency in the world for man's need but not for man's
greed" ~ Mahatma Gandhi

https://www.linkedin.com/in/taniabird
https://taniabird.webs.com

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


[R-sig-eco] Thresholds of Synchrony in R

2017-08-02 Thread Tania Bird
Hi all,
Apologies if this is more a stats question than an R question but I do need
help with R for the solution.

I'm calculating the degree of synchrony of population fluctuations through
time in a community, based on Loreau & Mazencourt 2008 paper.
Loreau, Michel, and Claire de Mazancourt. (2008) "Species synchrony and its
drivers: Neutral and nonneutral community dynamics in fluctuating
environments." The American Naturalist 172, no. 2: E48-66.
doi:10.1086/589746.

I am using this code:

dat = cbind(sp1 = rnorm(100, 10, 2), sp2 = rnorm(100, 10, 2))
#Two species with random independent abundance sampled 100 times.
V = var(dat)   # variance-covariance matrix for all species
# calculate synchrony index from covariance matrix
synchrony = function(V) {
d = sqrt(diag(V))
sum(V) /sum(d%*%t(d))
}

S = synchrony(V)

S runs from 0 (total Asynchrony) to 1 (total Synchrony) with 0.5 = random
or no synchrony as described by the authors.

I am wondering if there is a to calculate a threshold or value of S at
which I can say that there is "significant Asynchrony in this community" or
 significant Synchrony in this community". For example is 0.3 asynchronous
or not really ?

Should this threshold based on the data range or the variation itself?
In which case how would I code this calculation?

Or should I just say that anything <0.25 is significantly/very
Asynchronous?
In which case how can I generate a column to say
 if S <0.25 its asynchronous or if its >0.75 its synchronous?

Thanks for your feedback
Tania


Tania Bird MSc
PhD Student,
Geo Ecology Lab
Ben Gurion University

[[alternative HTML version deleted]]

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


Re: [R-sig-eco] correlating three time-series in R

2017-07-26 Thread Tania Bird
Thanks Bob
This is great,

The correlation does jump out when I plot it- I am just looking for a
quantified way of testing what I see. If there is a more appropriate test
I'd be happy to learn.

Many thanks



Tania Bird MSc
*"There is a sufficiency in the world for man's need but not for man's
greed" ~ Mahatma Gandhi*

https://www.linkedin.com/in/taniabird
https://taniabird.webs.com



On 26 July 2017 at 12:51, Bob O'Hara <boh...@senckenberg.de> wrote:

> You can pass the columns to ccf() directly:
>
> df <- data.frame(x=rnorm(6), y=rnorm(6))
> ccf(df$x, df$y)
> print(ccf(df$x, df$y))
>
> You should probably also check the time series task view: <
> https://cran.r-project.org/web/views/TimeSeries.html>, in particular the
> zoo package, to see what can be done with irregular time series.
>
> But with 6 data points I'd be surprised if you have the power to detect
> anything that doesn't jump out when you simply plot the data.
>
> Bob
>
>
> On 26/07/17 11:07, Tania Bird wrote:
>
>> I have three data sets of abundances through time for plants, insects and
>> reptiles.
>> There are 6 samples over a ten year period (all taxa sampled at the same
>> time).
>> I recognise this is a small data set for time series.
>>
>> I would like to correlate the time series to see if
>> a) increases in abundance of one taxon are correlated to another, and
>> b) to see if the correlation between plants:insects is greater than
>> plants:reptiles.
>>
>> I thought to use the cross-correlation function in R
>> e.g.  ccf(insects, reptiles)
>>
>> Currently the data is in one dataframe with time as one column and
>> abundance of each taxa is the next three columns.
>>
>> How do I convert the data to a time.series format as given in the R
>> example?
>>
>> How can I compare the two ccf outputs?
>>
>> Thanks
>>
>> Tania
>>
>>
>> Tania Bird MSc
>> *"There is a sufficiency in the world for man's need but not for man's
>> greed" ~ Mahatma Gandhi*
>>
>> [[alternative HTML version deleted]]
>>
>> ___
>> R-sig-ecology mailing list
>> R-sig-ecology@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>>
>>
>
> --
> Bob O'Hara
> NOTE: this email will die at some point, so please update you records to
> bob.oh...@ntnu.no
>
> Institutt for matematiske fag
> NTNU
> 7491 Trondheim
> Norway
>
> Mobile: +49 1515 888 5440
> Journal of Negative Results - EEB: www.jnr-eeb.org
>
> ___
> R-sig-ecology mailing list
> R-sig-ecology@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>

[[alternative HTML version deleted]]

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


[R-sig-eco] correlating three time-series in R

2017-07-26 Thread Tania Bird
I have three data sets of abundances through time for plants, insects and
reptiles.
There are 6 samples over a ten year period (all taxa sampled at the same
time).
I recognise this is a small data set for time series.

I would like to correlate the time series to see if
a) increases in abundance of one taxon are correlated to another, and
b) to see if the correlation between plants:insects is greater than
plants:reptiles.

I thought to use the cross-correlation function in R
e.g.  ccf(insects, reptiles)

Currently the data is in one dataframe with time as one column and
abundance of each taxa is the next three columns.

How do I convert the data to a time.series format as given in the R
example?

How can I compare the two ccf outputs?

Thanks

Tania


Tania Bird MSc
*"There is a sufficiency in the world for man's need but not for man's
greed" ~ Mahatma Gandhi*

[[alternative HTML version deleted]]

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


[R-sig-eco] Dissimilarity measure for rank data

2017-06-08 Thread Tania Bird
I have species data that I would like to use for ordination. With
regular abundance data I would apply a Hellinger Transformation and
then use the Bray-Curtis distance.

Since the data are ranked (0 to 5) I will not transform it. But what
dissimilarity measure should I use instead of Bray-Curtis?

Thanks


Tania Bird MSc
"There is a sufficiency in the world for man's need but not for man's
greed" ~ Mahatma Gandhi

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


[R-sig-eco] Dissimilarity for ordination of rank data

2017-05-31 Thread Tania Bird
Hi all,

I have a data set of species data in different sites but instead of
abundances, the presence has been converted to a rank score
site-species matrix. The ranks are calculated based on max-scores that
have been log transformed ln(x+1).
0 = absent and 5 = highest abundance for that species relative to
other sites and other species.

I would like to carry out multivariate analyses on this data such as
PCA / PCoA  RDA/Variation partitioning.
I assume no transformation is needed for this data since they are already ranks.

My questions are :
1) What is the best dissimilarity measure to use for this rank data?
I read that Gower's distance gowdis() in {FD} or daisy() in {cluster}
may be good choices?

2) Is it appropriate to conduct RDA on rank data?
Is an there a better alternative?

As a bonus question - can I treat these data the same as I would
abundance data in more advanced analyses such as beta-diversity
analyses (e.g. betadisper() in {vegan} ) or  spatial eigenvector
mapping (e.g. dbMEM / AEM in {adespatial} )?


Many thanks

Tania

Tania Bird MSc
PhD Student: Coastal dune biodiversity conservation in Nizzanim LTER
Dept. of Geography & Environmental Development,
Ben Gurion University, Beer Sheva
https://www.linkedin.com/in/taniabird

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


[R-sig-eco] Dissimilarity for ordination of rank data

2017-05-31 Thread Tania Bird
Hi all,

I have a data set of species data in different sites but instead of
abundances, the presence has been converted to a rank score site-species
matrix. The ranks are calculated based on max-scores that have been log
transformed ln(x+1).
0 = absent and 5 = highest abundance for that species relative to other
sites and other species.

I would like to carry out multivariate analyses on this data such as PCA /
PCoA  RDA/Variation partitioning.
I assume no transformation is needed for this data since they are already
ranks.

My questions are :
*1) What is the best dissimilarity measure to use for this rank data?*
I read that Gower's distance *gowdis()* in {FD} or *daisy()* in {cluster}
 may be good choices?

*2) Is it appropriate to conduct RDA on rank data? *
Is an there a better alternative?

As a bonus question - can I treat these data the same as I would abundance
data in more advanced analyses such as beta-diversity analyses (e.g.*
betadisper()
in {vegan} ) *or  spatial eigenvector mapping (e.g. *dbMEM / AEM in
{adespatial}* )?


Many thanks

Tania

Tania Bird MSc
PhD Student: Coastal dune biodiversity conservation in Nizzanim LTER
Dept. of Geography & Environmental Development,
Ben Gurion University, Beer Sheva
https://www.linkedin.com/in/taniabird

[[alternative HTML version deleted]]

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


Re: [R-sig-eco] Mixed models and multivariate methods for temporal-spatial nested data

2017-02-27 Thread Tania Bird
Many thanks for your useful advice Bob!
Unfortunately I did try to use my University's statistical consulting
department, but they were not able to provide advice at this level for
either the multivariate or mixed effect models. :(
I would be happy to consult with someone else if anyone if offering
such a service?

Tania Bird


On 27 February 2017 at 18:14, Bob OHara <boh...@senckenberg.de> wrote:
> Hm, this is a big job. The optimal solution is to see if your university
> offers a statistical consulting service. I don't see any big conceptual
> problems, but getting a good analysis will take a bit of time and
> exploration. I think you can probably 'just' use a GLMM, but getting the
> right GLMM and deciding what a good model is will take time and some poking
> of the data.
>
> Anyway, some answers below, which may (or may not) help.
>
>
> On 02/27/2017 04:27 PM, Tania Bird wrote:
>>
>> Hi all,
>>
>> I am seeking advice on how to analyse my unbalanced, multi-nested
>> multivariate data set. I realise there are many questions in this
>> email and I would be willing to consult with someone privately on this
>> if it is an option.
>>
>> I am using abundance data for insect species (I have the same
>> experimental design for reptiles, and annual plants as well). I use
>> Simpson's diversity as a univariate response and species composition
>> as a multivariate response.
>>
>> Experimental Design:
>> Plots are divided into three habitat types A, B, C based on vegetation.
>> Each habitat has 3 or 4 replicate control plots that are repeat
>> sampled (one sample a year always in spring).
>> In addition B and C have 3 or 4 treatment (vegetation removal) plots.
>>   'S' plots are disturbed( trampling and off-road vehicles) but the
>> disturbance is unquantified and I don't know the pre-disturbance
>> habitat type.
>>
>> The total data set is across a 12 year period, but the sampling was
>> unbalanced for various reasons. I attach a png of the metadata of the
>> plots over time to show the unbalanced sampling.
>> https://www.dropbox.com/s/7vxvo3x9lnywdbm/insects_years.gif?dl=0
>>
>> Each year the sampling across plots was conducted at the same time,
>> and so plots are comparable within a year.
>> In general, As were sampled every year and are considered the 'target'
>> habitat. B's were sampled in the earlier years and C's later on, and
>> in the last couple of years all three types were sampled together.
>>
>> The treatments on B & C were conducted using different methods and in
>> different years, so in principle I should probably test each
>> separately just against their own control pairs. However the
>> hypothesis for both treatments is that treated plots will be more
>> similar in composition to A plots than the paired control plots (if
>> possible I want to check if they become more or less similar to A over
>> time).
>>
>> So in that regard I thought there might be a way to include all
>> habitat types in one analysis? Perhaps using time as "number of years
>> since treatment" rather than a date? (Although I have no environmental
>> data with which to standardise).  S dunes have no "pre-treatment"  but
>> the hypothesis is that S plots will be most similar to A compared to
>> all other (treated and control) plot types.  I am not sure how to
>> include these plots in a testable model.
>>
>> Questions regarding the design:
>>
>>>> Can I use all the habitat types in one model (preferable!) or can I only
>>>> test B treated against B control etc?
>
> Yes you can. you obviously need a Treatment effect, and you should expect to
> have a Treatment by Habitat interaction.
>
> There may also be some sort of interaction with time (either as Time, or
> Time Since Treatment)
>
>>>> Must I remove data to create blocks of sampled or is 'all data useful'?
>>
>> e.g. A's were the only plots sampled in 2010- should I remove that
>> year completely?
>> e.g. C1 & C5 were sampled in 2005 while the rest were not until 2011,-
>> should I only include data from 2011 onwards for all C's?
>> e.g. Should I remove A4 completely since its only sampled in the last
>> few years or its still useable?
>
> No, you should be able to use all of the data, you just have to be a bit
> careful about how you model Time.
>>>>
>>>> Can I include S in the analyses in order to compare them with B and C
>>>> treated plots in relation to A plots?
>
> Yes, in principal. It just doesn't have a Habitat:Treatment interaction.
>
>>

[R-sig-eco] Mixed models and multivariate methods for temporal-spatial nested data

2017-02-27 Thread Tania Bird
Hi all,

I am seeking advice on how to analyse my unbalanced, multi-nested
multivariate data set. I realise there are many questions in this
email and I would be willing to consult with someone privately on this
if it is an option.

I am using abundance data for insect species (I have the same
experimental design for reptiles, and annual plants as well). I use
Simpson's diversity as a univariate response and species composition
as a multivariate response.

Experimental Design:
Plots are divided into three habitat types A, B, C based on vegetation.
Each habitat has 3 or 4 replicate control plots that are repeat
sampled (one sample a year always in spring).
In addition B and C have 3 or 4 treatment (vegetation removal) plots.
 'S' plots are disturbed( trampling and off-road vehicles) but the
disturbance is unquantified and I don't know the pre-disturbance
habitat type.

The total data set is across a 12 year period, but the sampling was
unbalanced for various reasons. I attach a png of the metadata of the
plots over time to show the unbalanced sampling.
https://www.dropbox.com/s/7vxvo3x9lnywdbm/insects_years.gif?dl=0

Each year the sampling across plots was conducted at the same time,
and so plots are comparable within a year.
In general, As were sampled every year and are considered the 'target'
habitat. B's were sampled in the earlier years and C's later on, and
in the last couple of years all three types were sampled together.

The treatments on B & C were conducted using different methods and in
different years, so in principle I should probably test each
separately just against their own control pairs. However the
hypothesis for both treatments is that treated plots will be more
similar in composition to A plots than the paired control plots (if
possible I want to check if they become more or less similar to A over
time).

So in that regard I thought there might be a way to include all
habitat types in one analysis? Perhaps using time as "number of years
since treatment" rather than a date? (Although I have no environmental
data with which to standardise).  S dunes have no "pre-treatment"  but
the hypothesis is that S plots will be most similar to A compared to
all other (treated and control) plot types.  I am not sure how to
include these plots in a testable model.

Questions regarding the design:

>> Can I use all the habitat types in one model (preferable!) or can I only 
>> test B treated against B control etc?

>>Must I remove data to create blocks of sampled or is 'all data useful'?
e.g. A's were the only plots sampled in 2010- should I remove that
year completely?
e.g. C1 & C5 were sampled in 2005 while the rest were not until 2011,-
should I only include data from 2011 onwards for all C's?
e.g. Should I remove A4 completely since its only sampled in the last
few years or its still useable?

>> Can I include S in the analyses in order to compare them with B and C 
>> treated plots in relation to A plots?

I have already analysed my first research question
Q1) To understanding the differences in diversity and composition
across control habitats, irrelevant of time.

The analysis approach I used for this is:
i) Mixed effect model:  GLMM PQL (Penalised Quasi-Likelihood) using
MASS R package.
Diversity ~   fixed effect = habitat type + random effect = year ,
Family = poisson

ii) Pairwise permutational multivariate analysis of variance (MANOVA)
with R code based on the adonis2 function, to determine if the
composition among habitats (visualised in NMDS) were significantly
different from each other.

iii) RDA with habitat as explanatory and year as covariate to test
explained variance.

Now I am trying to expand this analysis to include a temporal element
to answer Q2 & Q3
Q2) to understand the trends in diversity and composition over time in
control habitats
Q3) to understand the impact of treatment on diversity and composition
(over time if possible?)

The addition of time into the analyses is a bit difficult for me to
work out, due to the multi-nested and unbalanced design of the data; I
am not sure what methods to use to include time as a variable for
looking at a) diversity and b) composition

Questions regarding analyses:
>1> Is there an appropriate mixed effect model I can use to look at differences 
>in diversity on different control plots and include time as a factor (rather 
>than as a random effect)?

>2> How can I appropriately test if different habitats exhibit different trends 
>in composition over time (ie. a multivariate approach). For example, I might 
>expect that A's will remain relatively stable over time, while C's will 
>exhibit high turnover (fluctuation) across years, or that B's will slowly 
>shift composition to be more similar to C. How can I test these directional 
>hypotheses?

I thought to create a Principle Response Curve to see relative
differences over time, but as far as I understand, I cannot use a
permutation test here due to the unbalance design. I also