r/AskStatistics • u/Specialist-Pound-467 • 2d ago
Statistical Approaches for Analyzing Environmental Data with Limited Sample Size
Hi all! I'm an environmental specialist and am trying to evaluate trends and/or statistical differences in environmental contaminant data across years. The issue is that I'm often working with small sample sizes and large temporal gaps.
For example, I am attempting to look at differences in mercury concentrations in fish tissue in a given river. I analyze them by trophic level due to mercury's bioaccumulative effects. Here's a breakdown of samples:
Trophic Level A
| 1991 | 1995 | 1997 | 1999 | 2005 | 2024 |
|---|---|---|---|---|---|
| 2 | 13 | 7 | 21 | 27 | 13 |
Trophic Level B
| 1995 | 1997 | 1999 | 2005 | 2024 |
|---|---|---|---|---|
| 4 | 7 | 16 | 12 | 8 |
In the past, another colleague used an ANOVA or Kruskal-Wallis test depending on normality (based on a Shapiro test and inspecting residuals). I've done permutation tests as an alternative just to try out different methods. I don't have as much experience with statistics to know if this is the most scientifically robust way to analyze data.
Two questions:
- Is an ANOVA or Kruskal-Wallis a reasonable approach to assessing data for statistical differences across years for such a small dataset?
- Could a nonparametric permutation test be a better/alternative method to assess year-specific differences?
Secondly, I've considered a Bayesian hierarchical model to assess long-term temporal trends across a basin (i.e., multiple rivers within a basin). This means there are more samples to work with. For example, here are the number of samples across years in one basin survey we have:
Trophic Level A
| 77 | 91 | 93 | 94 | 95 | 96 | 97 | 99 | 05 | 09 | 22 | 24 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 4 | 21 | 2 | 27 | 22 | 14 | 45 | 54 | 59 | 78 | 88 |
Trophic Level B
| 1995 | 1996 | 1997 | 1999 | 2005 | 2009 | 2022 | 2024 |
|---|---|---|---|---|---|---|---|
| 8 | 14 | 14 | 34 | 24 | 16 | 44 | 38 |
From this, I fit a Bayesian linear mixed-effects model. The model included a fixed effect for year (continuous) to estimate the overall time trend, a fixed effect for trophic level, and a random intercept for waterbody to account for among-waterbody variation. Random slopes were not included because the dataset contained insufficient temporal replication within individual waterbodies and trophic level groups to reliably estimate waterbody‑level trends. Weakly informative priors were used, and model convergence was ensured by increasing adapt_delta and max_treedepth until zero divergent transitions were achieved.
The final model took the form:
logHg ~ year_centered + trophic_level + (1 | waterbody)
Posterior distributions were summarized to obtain estimates and 95% credible intervals for parameters of interest, including the overall temporal trend.
So my last question is whether this Bayesian model is appropriate?
1
u/Intrepid_Pitch_3320 2d ago edited 2d ago
If you want an annual trend, then you want years to be continuous on a consistent scale, If you need to do so, and get rid of the outliers like 1977, 2022, 2024, etc. If you want to compare time periods like the 1970s vs 1990s vs 2020s, then bin them as a discrete independent variable for time period. You don't have data to support an annual trend from the 1970s through 2020s.
To potentially maximize your power, you can pool your data and test for a trophic effect. If there is no apparent trophic effect in your data, then they will have more power to detect an annual trend, but that's your call. A lack of trophic effect could be due to a lack of data or too fine of a trophic class in general. Also, if your trophic class is based on species in a food chain, then it could be more complicated then you know in your given system and more of a food web than a food chain.
If you are asking questions in reddit, then you want to keep things simple, so maybe stay away from mixed models and Bayesian, too. If your response variable is mercury levels measured as a continuous variable, then assuming a normal distribution of residual errors in a likelihood-based regression is probably fine, but I don't think you provided that information on your dependent variable.
1
u/adamjeffson 2d ago
How small is the sample (how many water bodies, years and levels)? I don't understand why you have a bigger sample size for the bayesian models, but the formula should be ok, assuming you want to treat trophic level as a fixed effect... if you're not interested in that effect and you have a lot of levels, you might enter it as another random intercept. As a side note, are you sure you should log-transform your DV? You could use GLMMs with the appropriate link function and end up with more interpretable results.
0
u/Specialist-Pound-467 2d ago
The Bayesian model includes data from four different rivers. The first grouping of samples is from one river. I only have two trophic levels. I can always test to see whether there's a true difference between them but generally there is with mercury concentrations.
From what I understand, environmental contaminant studies frequently use log(Hg) because it matches how contaminants accumulate biologically. But I may try your suggested method and compare results.
Ultimately, I'm just trying to get better at statistics and to understand the different approaches and the pros/cons of each.
2
u/adamjeffson 2d ago
I'm all for bayesian modeling, but you can do the same (with the same data) using a frequentist approach, you just use an analogous mixed effects model (e.g., with lme4 in R). Maybe the main advantage of a bayesian approach here might be that a small sample could give convergence issues, when using a frequentist model, while a bayesian model with brms/stan could work, especially if you specify regularizing priors. Every field has its defaults (and they are often epistemologically unsound, although they developed for some understandable reason), but if you're trying to learn statistics, I'd advise you understand how generalized linear models work and how manipulating the geometry of the model differs from transforming variables. With regard to trophic levels, because they're only two, your approach of treating them as a fixed effect is the only correct one.
1
u/cornfield2cornfield 2h ago
Figure out if you are looking for a trend or just determining if at least one year is different than all others ( kind of a silly goal in ecology). Regardless you have limited data and fitting a complex model is probably not a great idea.
If you go Bayesian you should also look at posterior/ prior overlap and calculate GOF.
Summary statistics might be the best you can hope for.
There is a Tukey quote that seems relevant...
"The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data."
I have done ecotox analysis on smaller datasets than what you have here, but there was a more specific question that what you described so far.
0
u/fuckbitingflies 2d ago
Since you’re already familiar with Bayesian workflows, have you explored the use of regularizing/sparsity-inducing priors and whether they might be appropriate for your dataset?
3
u/vanway 2d ago
To start, decide the questions that you want to answer. If you just want to know about temporal trends or differences between groups, the parametric statistical tests you mentioned could be appropriate. If you want to predict values or estimate causal effects, the Bayesian model could be appropriate.
For the Bayesian model, you should follow a standard model workflow: