Description Usage Arguments Value References Examples
View source: R/multivariate_change_and_difference.R
Calculates the difference in composition and dispersion between treatments based off a Bray-Curtis dissimilarity matrix at a single point in time. Composition difference is the pairwise distance between centroids of compared treatments and ranges from 0-1, where identical communities give 0 and completely different communities give 1. Dispersion difference is the difference between treatments in the dispersion of replicates, i.e. the average distance between a replicate and its centroid.
1 2 3 4 5 6 7 8 9 | multivariate_difference(
df,
time.var = NULL,
species.var,
abundance.var,
replicate.var,
treatment.var,
reference.treatment = NULL
)
|
df |
A data frame containing a species, abundance, replicate, and treatment columns and optional time column. |
time.var |
The name of the optional 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 treatment column. |
reference.treatment |
The name of the optional treatment that all other treatments will be compared to (e.g. only controls will be compared to all other treatments). If not specified all pairwise treatment comparisons will be made. |
The multivariate_difference function returns a data frame with the following attributes:
treatment.var: A column that has same name and type as the treatment.var column, if treatment.var is specified.
treatment.var2: A column that has the same type as the treatment.var column, and is named treatment.var with a 2 appended to it.
composition_diff: A numeric column that is the euclidean distance between the centroids of two treatments at a single point in time.
abs_dispersion_diff: A numeric column that is the absolute value of the difference in the average dispersion of the replicates around the centroid for the two treatments.
trt_greater_disp: A column that has same type as the treatment.var column, and specifies which of the two treatments has greater dispersion.
time.var: A characteristic column that has the same name and type as the time.var column, if specified.
Avolio et al. Submitted, Avolio et al. 2015, Marti Anderson et al. 2006
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | data(pplots)
# Without time
df <- subset(pplots, year == 2002)
multivariate_difference(df,
replicate.var = "plot",
treatment.var = "treatment",
species.var = "species",
abundance.var = "relative_cover")
# There are 6 replicates for each of three treatments, thus 18 total
# observations.
# Without time and with reference treatment
df <- subset(pplots, year == 2002)
multivariate_difference(df,
replicate.var = "plot",
treatment.var = "treatment",
species.var = "species",
abundance.var = "relative_cover",
reference.treatment = "N1P0")
# There are 6 replicates for each of three treatments, thus 18 total
# observations.
# With time
multivariate_difference(pplots,
time.var = "year",
replicate.var = "plot",
species.var = "species",
abundance.var = "relative_cover",
treatment.var = "treatment")
# In each year there are 6 replicates for each of three treatments, for a
# total of 18 observations.
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.