| Title: | PERMANOVA using the F2 Statistic |
| Version: | 0.1.1 |
| Language: | en-US |
| Description: | Implements the F2 statistic of Anderson et al. (2017) <doi:10.1111/anzs.12176> for permutational multivariate analysis of variance (PERMANOVA) on dissimilarity matrices. The F2 statistic uses group-specific dispersion estimates, so group centroids can be compared when dispersions differ and group sizes are unequal. P-values are obtained by permutation, bootstrap, or bias-adjusted bootstrap. The formula interface follows 'adonis2()' in the 'vegan' package. |
| License: | GPL-2 |
| Encoding: | UTF-8 |
| Imports: | stats, vegan (≥ 2.7-3) |
| RoxygenNote: | 7.3.3 |
| Depends: | R (≥ 4.1.0) |
| LazyData: | true |
| Suggests: | knitr, rmarkdown, dplyr, ggplot2, onewaytests, yarrr, combinat, kableExtra, testthat (≥ 3.0.0) |
| VignetteBuilder: | knitr |
| URL: | https://github.com/LakviruPerera/F2Adonis2 |
| BugReports: | https://github.com/LakviruPerera/F2Adonis2/issues |
| Config/testthat/edition: | 3 |
| NeedsCompilation: | no |
| Packaged: | 2026-10-22 16:37:49 UTC; lakud |
| Author: | Lakviru Perera |
| Maintainer: | Lakviru Perera <korathotagelaperera@montana.edu> |
| Repository: | CRAN |
| Date/Publication: | 2026-11-04 22:20:02 UTC |
Permutational Multivariate Analysis of Variance Using the F2 Statistic
Description
Analysis of variance using distance matrices for partitioning variation among sources. Unlike standard PERMANOVA, this function uses the F2 statistic (Anderson 2017) which accounts for heterogeneous dispersions (Behrens-Fisher problem).
Usage
F2_adonis2(
formula,
data,
permutations = 999,
method = "euclidean",
sqrt.dist = FALSE,
add = FALSE,
by = NULL,
parallel = getOption("mc.cores"),
na.action = na.fail,
strata = NULL,
bootstrap = FALSE,
bias.adjust = FALSE,
plot.dist = TRUE,
...
)
Arguments
formula |
Model formula. The LHS must be a community data matrix or a dissimilarity matrix. The RHS must define a single factor predictor. |
data |
A data frame containing the independent variables. |
permutations |
Number of permutations for the test, or a permutation matrix. |
method |
Pairwise distance method used in |
sqrt.dist |
Logical; take square root of dissimilarities to "euclidify" them. |
add |
Add a constant to dissimilarities to avoid negative eigenvalues. Options are "lingoes" or "cailliez". |
by |
Validation restricted to |
parallel |
Number of parallel processes to use. |
na.action |
Handling of missing values on the RHS. |
strata |
Groups within which to constrain permutations. |
bootstrap |
Logical; perform separate-sample residual bootstrapping in dissimilarity space (Anderson 2017). |
bias.adjust |
Logical; apply empirical bias correction to bootstrap variances. |
plot.dist |
Logical; if TRUE (default), plot the permutation distribution of the F2 statistic. |
... |
Other arguments passed to |
Details
F2_adonis2 implements the multivariate F2 statistic and the
matrix-based bootstrap procedure derived in Anderson et al. (2017).
Value
An object of classes F2_adonis2, anova.cca,
anova and data.frame: an ANOVA-style table with rows
Model, Residual and Total, and columns Df,
SumOfSqs, F2 and Pr(>F2). If bootstrap = TRUE,
the column Pr(>F2.boot) is added, and if bias.adjust = TRUE,
Pr(>F2.ba) as well. The permutation values of the F2 statistic are
stored in the attribute F.perm.
Author(s)
Lakviru Perera (based on logic by Marti J. Anderson)
References
Anderson, M. J., Walsh, D. C., Clarke, K. R., Gorley, R. N., & Guerra-Castro, E. (2017). Some solutions to the multivariate Behrens–Fisher problem for dissimilarity-based analyses. Australian & New Zealand Journal of Statistics.
Examples
# Load internal package data objects
data("pkd_metadata", package = "F2Adonis2")
data("pkd_metabolites", package = "F2Adonis2")
# Set up a data frame for the group factor
pkd_meta <- data.frame(Group = factor(pkd_metadata$Group))
# Example using 99 permutations
fit <- F2_adonis2(
formula = as.matrix(pkd_metabolites) ~ Group,
data = pkd_meta,
method = "euclidean",
permutations = 99,
plot.dist = FALSE
)
print(fit)
Norway Benthic Macrofauna Metadata
Description
Metadata containing geographical location assignments for the 101 sampled sites in the Norway benthic community dataset.
Usage
norway_metadata
Format
A data frame with 101 rows and 1 column:
- Area
A grouping factor with 5 levels indicating the specific geographical region.
Source
Ellingsen, K.E. and Gray, J.S. (2002), Journal of Animal Ecology, 71(3), 373-389, doi:10.1046/j.1365-2656.2002.00606.x. Data as provided with Anderson et al. (2017), doi:10.1111/anzs.12176 (Data S1).
Norway Benthic Macrofauna Presence-Absence Data
Description
A presence-absence matrix for 809 marine macrofauna species across 101 sites, utilized as a baseline biological validation dataset.
Usage
norway_pa
Format
A matrix with 101 rows (sites) and 809 columns (species).
Source
Ellingsen, K.E. and Gray, J.S. (2002), Journal of Animal Ecology, 71(3), 373-389, doi:10.1046/j.1365-2656.2002.00606.x. Data as provided with Anderson et al. (2017), doi:10.1111/anzs.12176 (Data S1).
Polycystic Kidney Disease (PKD) Metabolites
Description
An auto-scaled, log-transformed intensity matrix of urinary profiles (metabolites) from early-stage Polycystic Kidney Disease patients and healthy controls.
Usage
pkd_metabolites
Format
A matrix with 95 rows (samples) and 1554 columns (metabolites).
Source
Derived from the urinary metabolomics cohort in Houske et al. (2023), American Journal of Physiology-Renal Physiology, 324(6), F590-F602, doi:10.1152/ajprenal.00301.2022.
Polycystic Kidney Disease (PKD) Metadata
Description
A dataset containing group categories for the Polycystic Kidney Disease (PKD) cohort, used to demonstrate multivariate testing under biological heterogeneity.
Usage
pkd_metadata
Format
A data frame with 95 rows (samples) and 1 column:
- Group
A factor indicating disease classification status (Ctrl vs PKD).
Source
Derived from the urinary metabolomics cohort in Houske et al. (2023), American Journal of Physiology-Renal Physiology, 324(6), F590-F602, doi:10.1152/ajprenal.00301.2022.