| Type: | Package |
| Title: | Robust Ecological and Fisheries Data Analysis and Visualization |
| Version: | 1.0.1 |
| Description: | A comprehensive statistical and visualization toolkit tailored for fisheries science, stock assessment workflows, and aquatic ecology. It provides streamlined wrappers for univariate and factorial ANOVA, ANCOVA, MANOVA, generalized linear models (GLMs) for count data, non-linear morphometric regressions, custom correlation heatmaps, and integrated Mantel test network linkages. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| LazyData: | true |
| RoxygenNote: | 7.3.2 |
| Imports: | RColorBrewer, dplyr, emmeans, ggplot2, ggpubr, multcomp, tidyr, stringr, MASS, vegan |
| Suggests: | knitr, multcompView, rmarkdown |
| VignetteBuilder: | knitr |
| Depends: | R (≥ 3.5.0) |
| NeedsCompilation: | no |
| Packaged: | 2026-08-29 20:52:15 UTC; User |
| Author: | Ataher Ali [aut, cre] |
| Maintainer: | Ataher Ali <ataher.cu.ms@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-09-10 09:30:15 UTC |
Analysis of Covariance (ANCOVA) with Adjusted Means Visualization
Description
This function performs an Analysis of Covariance to test group differences in a continuous response variable while controlling for a continuous covariate. It extracts the ANCOVA table, estimated marginal means (EMMs), and generates a publication-ready regression scatter plot with parallel trend lines.
Usage
ancova_analysis(
data,
response_var,
factor_var,
covariate_var,
factor_levels = NULL,
color_palette = "Set1"
)
Arguments
data |
A data frame in long format. |
response_var |
Character; the name of the continuous numeric response variable. |
factor_var |
Character; the name of the categorical independent variable (groups). |
covariate_var |
Character; the name of the continuous covariate variable. |
factor_levels |
Optional character vector; custom order for the factor levels. |
color_palette |
Character; name of a color palette from RColorBrewer. Default is "Set1". |
Value
A list containing the ANCOVA model summary, EMMs, and the ggplot object.
Flexible Correlation Matrix and Heatmap Generator
Description
Computes correlation matrices (Pearson, Spearman, or Kendall) and generates publication-ready heatmaps with customizable shapes (circles, squares), layout views (full, lower, upper), and optional text labels.
Usage
correlation_heatmap(
data,
numeric_vars = NULL,
method = "pearson",
shape = "circle",
view = "lower",
show_text = NULL,
color_palette = "RdBu"
)
Arguments
data |
A data frame containing numeric variables. |
numeric_vars |
Optional character vector of numeric column names to include. If NULL, all numeric columns are used. |
method |
Character; correlation method: "pearson", "spearman", or "kendall". Default is "pearson". |
shape |
Character; marker shape for the heatmap: "circle" or "square". Default is "circle". |
view |
Character; matrix display layout: "full", "lower", or "upper". Default is "lower". |
show_text |
Logical; whether to display numeric correlation values inside markers. Default is FALSE for circles and TRUE for squares. |
color_palette |
Character; name of a diverging color palette from RColorBrewer. Default is "RdBu". |
Value
A list containing the correlation matrix, p-value matrix, and the ggplot object.
Generalized Linear Models (GLMs) for Fisheries Count and Binary Data
Description
This function fits Generalized Linear Models (e.g., Poisson, Quasipoisson, Binomial) to non-normal ecological data, extracts model summaries, incident rate ratios (IRR) or odds ratios, and generates a publication-ready forest plot visualizing effect sizes.
Usage
glm_analysis(
data,
response_var,
predictor_vars,
family_type = "poisson",
color_palette = "Set1"
)
Arguments
data |
A data frame containing the variables. |
response_var |
Character; the name of the numeric count or binary response variable. |
predictor_vars |
Character vector; the names of the independent predictor variables. |
family_type |
Character; distribution family: "poisson", "quasipoisson", or "binomial". Default is "poisson". |
color_palette |
Character; name of a color palette from RColorBrewer. Default is "Set1". |
Value
A list containing the model summary, coefficient table, and the ggplot object.
Length-Weight ANCOVA Dataset for Hilsa Shad
Description
A simulated dataset containing body weight, total length, and habitat types of Hilsa shad (Tenualosa ilisha) to demonstrate Analysis of Covariance (ANCOVA).
Usage
hilsa_ancova
Format
A data frame with 90 rows and 3 variables:
- Habitat
A factor representing the environment (Marine, Estuary, River).
- Total_Length_cm
A numeric vector representing total fish length in centimeters (covariate).
- Weight_g
A numeric vector representing fish body weight in grams (response).
Catch Count Dataset for Hilsa Shad GLMs
Description
A simulated dataset containing catch counts, fishing effort, and environmental variables for Hilsa shad (Tenualosa ilisha) to demonstrate Generalized Linear Models (GLMs).
Usage
hilsa_catch
Format
A data frame with 120 rows and 4 variables:
- Habitat
A factor representing the environment (Marine, Estuary, River).
- Season
A factor representing the season (Monsoon, Dry).
- Fishing_Hours
A numeric vector representing fishing effort in hours.
- Catch_Count
An integer vector representing the number of fish caught (count response).
Environmental and Catch Parameters for Correlation Analysis
Description
A simulated dataset containing oceanographic measurements and catch weights to demonstrate customizable correlation matrix heatmaps.
Usage
hilsa_env
Format
A data frame with 100 rows and 6 variables:
- SST_C
Sea Surface Temperature in degrees Celsius.
- Salinity_ppt
Water salinity in parts per thousand.
- Depth_m
Water depth in meters.
- DO_mgL
Dissolved oxygen in milligrams per liter.
- Chlorophyll_a
Chlorophyll-a concentration.
- Catch_kg
Total fish catch in kilograms.
Morphometric Measurements of Hilsa Shad
Description
A simulated dataset containing multiple continuous morphological traits of Hilsa shad (Tenualosa ilisha) across different aquatic habitats to demonstrate Multivariate Analysis of Variance (MANOVA).
Usage
hilsa_morphology
Format
A data frame with 90 rows and 4 variables:
- Habitat
A factor representing the environment (Marine, Estuary, River).
- Body_Depth_cm
A numeric vector representing maximum body depth in centimeters.
- Head_Length_cm
A numeric vector representing head length in centimeters.
- Fin_Length_cm
A numeric vector representing pectoral fin length in centimeters.
Morphometric Regression Dataset for Hilsa Shad
Description
A simulated dataset containing length and weight measurements of Hilsa shad (Tenualosa ilisha) across various habitats for evaluating linear, logarithmic, and polynomial regression models.
Usage
hilsa_regression
Format
A data frame with 100 rows and 3 variables:
- Total_Length_cm
A numeric vector representing total fish length in centimeters.
- Weight_g
A numeric vector representing fish body weight in grams.
- Habitat
A factor representing the environment (River, Estuary, Marine).
Comprehensive Body Weights of Hilsa Shad (Three-Way)
Description
A simulated dataset containing body weights of Hilsa shad (Tenualosa ilisha) across multiple habitats, fishing seasons, and size classes to demonstrate three-way ANOVA interaction models and faceted visualization.
Usage
hilsa_three_way
Format
A data frame with 120 rows and 4 variables:
- Habitat
A factor representing the environment (Marine, Estuary, River).
- Season
A factor representing the season (Monsoon, Dry).
- Size_Class
A factor representing growth stage (Juvenile, Adult).
- Weight_g
A numeric vector representing fish body weight in grams.
Multi-Factor Body Weights of Hilsa Shad
Description
A simulated dataset containing the body weights of Hilsa shad (Tenualosa ilisha) across different habitats and fishing seasons to demonstrate two-way ANOVA interaction effects.
Usage
hilsa_two_way
Format
A data frame with 90 rows and 3 variables:
- Habitat
A factor representing the environment (Marine, Estuary, River).
- Season
A factor representing the season (Monsoon, Dry).
- Weight_g
A numeric vector representing fish body weight in grams.
Body Weights of Hilsa Shad Across Habitats
Description
A simulated dataset containing the body weights of Hilsa shad (Tenualosa ilisha) sampled from three distinct ecological environments: Marine, Estuary, and River. This dataset is designed to demonstrate one-way ANOVA and variance visualization.
Usage
hilsa_weight
Format
A data frame with 90 rows and 2 variables:
- Habitat
A factor representing the sampling environment (Marine, Estuary, River).
- Weight_g
A numeric vector representing the body weight of the fish in grams.
Multivariate Analysis of Variance (MANOVA) with Alternative Visualizations
Description
This function performs a one-way MANOVA across multiple continuous response variables grouped by a categorical factor, extracts multivariate test statistics, univariate ANOVA breakdowns, and generates either faceted boxplots or a Canonical Discriminant Analysis (LDA) multivariate scatter plot.
Usage
manova_analysis(
data,
response_vars,
factor_var,
factor_levels = NULL,
plot_type = "boxplot",
color_palette = "Set1"
)
Arguments
data |
A data frame in long format. |
response_vars |
Character vector; the names of the continuous numeric response variables. |
factor_var |
Character; the name of the categorical independent variable. |
factor_levels |
Optional character vector; custom order for the factor levels. |
plot_type |
Character; type of visualization: "boxplot" or "lda". Default is "boxplot". |
color_palette |
Character; name of a color palette from RColorBrewer. Default is "Set1". |
Value
A list containing the MANOVA test summary, univariate ANOVA summaries, and the ggplot object.
Integrated Mantel Test and Correlation Heatmap
Description
Computes internal correlations among environmental variables and performs Mantel tests linking community composition to environmental parameters using base vegan and ggplot2.
Usage
mantel_heatmap_analysis(
comm_data,
env_data,
method = "pearson",
spec_dist = "bray",
env_dist = "euclidean",
color_palette = "RdBu"
)
Arguments
comm_data |
A data frame containing community or species abundance data. |
env_data |
A data frame containing numeric environmental variables. |
method |
Character; correlation method: "pearson" or "spearman". Default is "pearson". |
spec_dist |
Character; distance metric for community data (e.g., "bray", "euclidean"). Default is "bray". |
env_dist |
Character; distance metric for environmental data. Default is "euclidean". |
color_palette |
Character; color palette for heatmap. Default is "RdBu". |
Value
A list containing the correlation matrix, Mantel test results, and the ggplot object.
One-Way Analysis of Variance (ANOVA) with Visualization
Description
This function performs a one-way ANOVA, calculates Tukey's HSD post-hoc test, extracts Estimated Marginal Means (EMMs), and generates a publication-ready plot.
Usage
one_way_anova(
data,
factor_var,
numeric_var,
factor_levels = NULL,
plot_type = "boxplot",
error_type = "se",
sig_display = "letters",
y_limits = NULL,
add_jitter = TRUE,
show_mean = TRUE,
mean_color = "darkred",
color_palette = "Set1"
)
Arguments
data |
A data frame in long format. |
factor_var |
Character; the name of the categorical independent variable. |
numeric_var |
Character; the name of the continuous response variable. |
factor_levels |
Optional character vector; specifies the exact order of the categorical levels on the x-axis. |
plot_type |
Character; type of plot: "boxplot", "barplot", or "pointrange". Default is "boxplot". |
error_type |
Character; error bar type for bar/pointrange plots: "se" (Standard Error) or "sd" (Standard Deviation). |
sig_display |
Character; display significance via "letters" (compact letter display) or "stars" (p-value brackets). |
y_limits |
Optional numeric vector of length 2; explicitly sets the Y-axis limits (e.g., c(0, 1500)). |
add_jitter |
Logical; if TRUE, adds jittered points to the boxplot. |
show_mean |
Logical; if TRUE, displays a mean point inside the boxplot. |
mean_color |
Character; color for the mean point in the boxplot. |
color_palette |
Character; name of a color palette from RColorBrewer. |
Value
A list containing the ANOVA summary, Tukey HSD results, EMMs, a clean summary table, and the ggplot object.
Flexible Regression Analysis with Shaded Confidence Intervals and Statistics
Description
This function fits linear, logarithmic, or polynomial regression models to data, calculates coefficients, R-squared, and p-values, and generates a publication-ready plot with confidence interval shading and equation annotations.
Usage
regression_analysis(
data,
x_var,
y_var,
fit_type = "linear",
group_var = NULL,
color_palette = "Set1"
)
Arguments
data |
A data frame containing the variables. |
x_var |
Character; the name of the independent variable (x-axis). |
y_var |
Character; the name of the dependent response variable (y-axis). |
fit_type |
Character; type of model: "linear", "logarithmic", or "polynomial". Default is "linear". |
group_var |
Optional character; the name of a categorical variable to group/color regressions by. |
color_palette |
Character; name of a color palette from RColorBrewer. Default is "Set1". |
Value
A list containing model summaries, regression parameters, and the ggplot object.
Three-Way Analysis of Variance (ANOVA) with Faceted Interaction Visualization
Description
This function performs a three-way ANOVA with full interaction effects, calculates Tukey's HSD post-hoc tests, extracts Estimated Marginal Means (EMMs), and generates faceted publication-ready interaction plots with compact letter displays.
Usage
three_way_anova(
data,
factor1_var,
factor2_var,
factor3_var,
numeric_var,
factor1_levels = NULL,
factor2_levels = NULL,
factor3_levels = NULL,
plot_type = "boxplot",
error_type = "se",
y_limits = NULL,
add_jitter = TRUE,
show_mean = TRUE,
mean_color = "darkred",
color_palette = "Set1"
)
Arguments
data |
A data frame in long format. |
factor1_var |
Character; the name of the first categorical independent variable (x-axis). |
factor2_var |
Character; the name of the second categorical independent variable (groups/fill). |
factor3_var |
Character; the name of the third categorical independent variable (facets). |
numeric_var |
Character; the name of the continuous response variable. |
factor1_levels |
Optional character vector; custom order for the first factor. |
factor2_levels |
Optional character vector; custom order for the second factor. |
factor3_levels |
Optional character vector; custom order for the third factor. |
plot_type |
Character; type of interaction plot: "boxplot", "barplot", or "pointrange". Default is "boxplot". |
error_type |
Character; error bar type for bar/pointrange plots: "se" or "sd". Default is "se". |
y_limits |
Optional numeric vector of length 2; explicitly sets the Y-axis limits. |
add_jitter |
Logical; if TRUE, adds jittered points to the boxplot. Default is TRUE. |
show_mean |
Logical; if TRUE, displays a mean point inside the boxplot. Default is TRUE. |
mean_color |
Character; color for the mean point in the boxplot. Default is "darkred". |
color_palette |
Character; name of a color palette from RColorBrewer. Default is "Set1". |
Value
A list containing the ANOVA summary, Tukey HSD results, EMMs, summary statistics table, and the ggplot object.
Two-Way Analysis of Variance (ANOVA) with Interaction Visualization
Description
This function performs a two-way ANOVA with interaction effects, calculates Tukey's HSD post-hoc tests, extracts Estimated Marginal Means (EMMs), and generates publication-ready interaction plots with compact letter displays.
Usage
two_way_anova(
data,
factor1_var,
factor2_var,
numeric_var,
factor1_levels = NULL,
factor2_levels = NULL,
plot_type = "boxplot",
error_type = "se",
y_limits = NULL,
add_jitter = TRUE,
show_mean = TRUE,
mean_color = "darkred",
color_palette = "Set1"
)
Arguments
data |
A data frame in long format. |
factor1_var |
Character; the name of the first categorical independent variable (x-axis). |
factor2_var |
Character; the name of the second categorical independent variable (groups/fill). |
numeric_var |
Character; the name of the continuous response variable. |
factor1_levels |
Optional character vector; custom order for the first factor levels. |
factor2_levels |
Optional character vector; custom order for the second factor levels. |
plot_type |
Character; type of interaction plot: "boxplot", "barplot", or "pointrange". Default is "boxplot". |
error_type |
Character; error bar type for bar/pointrange plots: "se" or "sd". Default is "se". |
y_limits |
Optional numeric vector of length 2; explicitly sets the Y-axis limits. |
add_jitter |
Logical; if TRUE, adds jittered points to the boxplot. Default is TRUE. |
show_mean |
Logical; if TRUE, displays a mean point inside the boxplot. Default is TRUE. |
mean_color |
Character; color for the mean point in the boxplot. Default is "darkred". |
color_palette |
Character; name of a color palette from RColorBrewer. Default is "Set1". |
Value
A list containing the ANOVA summary, Tukey HSD results, EMMs, summary statistics table, and the ggplot object.