Dataset Overview

Crab Morphological Dataset

This analysis examines the physical measurements of 200 crabs in the dataset: MASS::crabs. It identifies the patterns in body size, shape, species, and sex.

Data Source: MASS package in R

Key Variables:

  • sp: Crab species(blue or orange)
  • sex: Male or female
  • FL: Frontal lobe size(mm)
  • RW: Rear width(mm)
  • CL: Carapace length(mm)
  • CW: Carapace width(mm)
  • BD: Body depth(mm)

R Code for Data Preparation

This is the code that was used to load/prepare the dataset:

library(ggplot2)
library(plotly)
library(dplyr)
library(MASS)

data(crabs, package = "MASS")

crabs_df = crabs %>%
  mutate(
    sex = factor(sex, levels = c("M", "F"), 
                 labels = c("Male", "Female")),
    sp = factor(sp, levels = c("B", "O"), 
                labels = c("Blue", "Orange"))
  )

3d Plotly: FL, RW, and CL

3D Plot Analysis

Key Observations:

  • Strong Size Clustering: The points form size based clusters, suggesting that crabs with a larger frontal lobe size also tend to have a larger rear width and carapace length.

  • Species Separation: While blue and orange crabs overlap, there is a clear grouping between the two, suggesting the two species might have slightly different body proportions.

  • Sex Difference: The different symbol shapes show that male and female crabs are mixed throughout the plot, however more separation seems to occur in the larger body measurements.

Plotly Scatter: Carapace Length v Width

Ggplot Boxplot: Carapace Width by Sex and Species

Ggplot Bar Chart: Avg Body Depth by Group

Statistical Analysis: Summary Stats

crab_sex_sum
## # A tibble: 2 × 6
##   sex    count CW_mean CW_median CW_sd BD_mean
##   <fct>  <int>   <dbl>     <dbl> <dbl>   <dbl>
## 1 Male     100    37        37.1  8.33    14.3
## 2 Female   100    35.8      36.4  7.38    13.7

Summary Stats: Interpretation

Findings:

  • Balanced Groups: The dataset contains an equal amount of male and female crabs, making sex comparisons more straightforward and easy to interpret.

  • Avg Width Diff: The mean carapace width differs between male and female crabs, which suggests that body size may vary by sex.

  • Body Depth Pattern: Average body depth changes by group as well, suggesting that crab morphology is not determined by a single measurement alone.

  • Consistent Variation: The standard deviation values show a moderate spread, which means that there is variation within the groups, but there is still enough structure to identify overall trends.

Statistical Analysis: T-test

data.frame(
  t_stat = sex_ttest$statistic,
  p_val = sex_ttest$p.value,
  confidence_lowerbound = sex_ttest$conf.int[1],
  confidence_upperbound = sex_ttest$conf.int[2]
)
##     t_stat     p_val confidence_lowerbound confidence_upperbound
## t 1.050339 0.2948611                -1.026                 3.364

T-test Interpretation:

Analysis:

  • Purpose: Compares the average carapace width between male and female crabs to see whether the observed difference is statistically significant.

  • Significance Check: Since the p-val is higher than 0.05, the difference in average carapace width between male and female crabs is not statistically significant.

  • Practical Meaning: Since it is not statistically significant, this suggests that the observed difference in mean carapace width could be due to random sample variation, meaning sex itself does not explain crab width very well.

Statistical Analysis: Regression

crab_table
##      variable     Estimate Std. Error      t value     Pr(>|t|)
## 1 (Intercept)  0.296689960 0.18083073   1.64070546 1.024873e-01
## 2          FL  0.190832727 0.08022601   2.37868895 1.835010e-02
## 3          RW  0.234066043 0.05393616   4.33968667 2.299507e-05
## 4          CL  0.961928995 0.05347460  17.98852130 3.951846e-43
## 5          BD  0.003578755 0.08384511   0.04268293 9.659984e-01
## 6   sexFemale -0.025335474 0.12585142  -0.20131258 8.406662e-01
## 7    spOrange -1.516683934 0.13941289 -10.87907996 8.360826e-22

Conclusions

Major Findings:

  • Crab body measurements are strongly related to one another, especially carapace length, width, and rear width, as they indicate an overall size pattern across the sample.

  • Species and sex add useful context as the plots show that body shape is not just explained by one factor.

  • The combination of the interactive plots and formal stats provide a more clear picture than just a single graph could do.

Study Notes and Future Directions

Practical Applications:

These measurements can help researchers compare physical differences across different crap groups and understand how the body dimensions vary in biological data.

Study Limits:

The dataset is relatively small and contains a limited amount of variables, so results might not show causation and instead association.

Future Research Directions:

  • Study other species to see if similar measurement patterns occur
  • Compare body measurements across other regions

Thank you

Dataset Source: MASS::crabs

Tools Used:

  • R

  • ggplot2

  • plotly

  • dplyr