Skip to contents

Calculates the changes in composition and dispersion based off a Bray-Curtis dissimilarity matrix. Composition change is the pairwise distance between centroids of compared time periods and ranges from 0-1, where identical communities give 0 and completely different communities give 1. Dispersion change is the difference between time periods in the dispersion of replicates, i.e. the average distance between a replicate and its centroid.

Usage

multivariate_change(
  df,
  time.var,
  species.var,
  abundance.var,
  replicate.var,
  treatment.var = NULL,
  reference.time = NULL
)

Arguments

df

A data frame containing time, species, abundance and replicate columns and an optional column of treatment.

time.var

The name of the time column.

species.var

The name of the species column.

abundance.var

The name of the abundance column.

replicate.var

The name of the replicate column. Replicate identifiers must be unique within the dataset and cannot be nested within treatments or blocks.

treatment.var

The name of the optional treatment column.

reference.time

The name of the optional time point that all other time points should be compared to (e.g. the first year of data). If not specified, each comparison is between consecutive time points (the first and second year, second and third year, etc.)

Value

The multivariate_change function returns a data frame with the following attributes: - **time.var**: A column with the specified time.var and a second column, with '2' appended to the name. Time is subtracted from time2 for dispersion change. - **composition_change**: A numeric column that is the distance between the centroids of two time points, or NA if a real distance could not be calculated. - **dispersion_change**: A numeric column that is the difference in the average dispersion of the replicates around the centroid for the two time periods. A negative value indicates replicates are converging over time (there is less dispersion at time period 2 than time period 1) and a positive value indicates replicates are diverging over time (there is more dispersion at time period 2 than time period 1. - **treatment.var**: A column that has same name and type as the treatment.var column, if treatment.var is specified.

References

Avolio et al. 2015; Avolio et al. Submitted, Marti Anderson et al. 2006.

Examples

data(pplots)
# With treatment
multivariate_change(pplots,
                    time.var="year",
                    replicate.var = "plot",
                    treatment.var = "treatment",
                    species.var = "species",
                    abundance.var = "relative_cover")
#> Composition and dispersion change calculation using 24 observations for N1P0
#> Composition and dispersion change calculation using 24 observations for N2P0
#> Composition and dispersion change calculation using 24 observations for N2P3
#>   year year2 treatment composition_change dispersion_change
#> 1 2002  2003      N1P0          0.1244439       0.038043443
#> 2 2003  2004      N1P0          0.2248058       0.082349537
#> 3 2004  2005      N1P0          0.2506627      -0.081295631
#> 4 2002  2003      N2P0          0.1524896       0.034989912
#> 5 2003  2004      N2P0          0.2164117       0.008107998
#> 6 2004  2005      N2P0          0.2651186      -0.008118759
#> 7 2002  2003      N2P3          0.2361431      -0.036763877
#> 8 2003  2004      N2P3          0.4048829       0.126104091
#> 9 2004  2005      N2P3          0.3386217      -0.023588840
# In each year there are 6 replicates and there are 4 years of data for 3
# time comparisons, thus 24 total observations in each treatment.

# With treatment and reference year
multivariate_change(pplots,
                    time.var="year",
                    replicate.var = "plot",
                    treatment.var = "treatment",
                    species.var = "species",
                    abundance.var = "relative_cover",
                    reference.time = 2002)
#> Composition and dispersion change calculation using 24 observations for N1P0
#> Composition and dispersion change calculation using 24 observations for N2P0
#> Composition and dispersion change calculation using 24 observations for N2P3
#>   year year2 treatment composition_change dispersion_change
#> 1 2002  2003      N1P0          0.1244439        0.03804344
#> 2 2002  2004      N1P0          0.1712022        0.12039298
#> 3 2002  2005      N1P0          0.1398648        0.03909735
#> 4 2002  2003      N2P0          0.1524896        0.03498991
#> 5 2002  2004      N2P0          0.1758564        0.04309791
#> 6 2002  2005      N2P0          0.2561213        0.03497915
#> 7 2002  2003      N2P3          0.2361431       -0.03676388
#> 8 2002  2004      N2P3          0.3132374        0.08934021
#> 9 2002  2005      N2P3          0.3558179        0.06575137
# In each year there are 6 replicates and there are 4 years of data for 3
# time comparisons, thus 24 total observations in each treatment.

# Without treatment
df <- subset(pplots, treatment == "N1P0")
multivariate_change(df,
                    time.var="year",
                    replicate.var = "plot",
                    species.var = "species",
                    abundance.var = "relative_cover")
#> Composition and dispersion change calculation using 24 observations.
#>    year year2 composition_change dispersion_change
#> 5  2002  2003          0.1244439        0.03804344
#> 10 2003  2004          0.2248058        0.08234954
#> 15 2004  2005          0.2506627       -0.08129563
# In each year there are 6 replicates and there are 4 years of data for 3
# time comparisons, thus 24 total observations.