Species Sensitivity Distribution revisited: a Bayesian nonparametric approach Abstract We present a novel approach to ecological risk assessment by recasting the Species Sensitivity Distribution (SSD) method within a Bayesian nonparametric (BNP) framework. Widely mandated by environmental regulatory bodies globally, SSD has faced criticism due to its historical reliance on parametric assumptions when modeling species variability. By adopting nonparametric mixture models, we address this limitation, establishing a statistically robust foundation for SSD. Our BNP approach offers several advantages, including its efficacy in handling small datasets or censored data, which are common in ecological risk assessment, and its ability to provide principled uncertainty quantification alongside simultaneous density estimation and clustering. We utilize a specific nonparametric prior as the mixing measure, chosen for its robust clustering properties, a crucial consideration given the lack of strong prior beliefs about the number of components. Through simulation studies and analysis of real datasets, we demonstrate the superiority of our BNP-SSD over classical SSD methods. We also provide a BNP-SSD Shiny application, making our methodology available to the Ecotoxicology community. Moreover, we exploit the inherent clustering structure of the mixture model to explore patterns in species sensitivity. Our findings underscore the effectiveness of the proposed approach in improving ecological risk assessment methodologies. Louise Alamichel 1 1 1 1 Corresponding author: louise.alamichel@unibocconi.it , Julyan Arbel 2 , Guillaume Kon Kam King 3 , Igor Prünster 1 1 Bocconi Institute for Data Science & Analytics, Bocconi University, 20136 Milano, Italy 2 Univ. Grenoble Alpes, CNRS, Inria, Grenoble INP, LJK, 38000 Grenoble, France 3 Université Paris-Saclay, INRAE, MaIAGE, 78350 Jouy-en-Josas, France Keywords: Bayesian Nonparametrics, Critical Effect Concentration, Ecological Risk Assessment, Ecotoxicology, Hazardous Concentration, Mixture Models. 1 Introduction Ecotoxicological context. Assessing the response of a community of species to environmental stress is critical for ecological risk assessment. Methods developed for this purpose vary greatly in levels of complexity and realism. Species Sensitivity Distribution (SSD) represents an intermediate tier method, more refined than rudimentary assessment factors ( 49 ) but practical enough to be used routinely by environmental managers and regulators in most developed countries (Australia and New Zealand, 4 , Canada, 13 , China, 45 , EU, 22 , South Africa, 54 , USA, 59 ). The SSD approach is intended to provide, for a given contaminant, a description of the tolerance of all species possibly exposed using information collected on a sample of species. This information consists of Critical Effect Concentrations (CECs) , a concentration specific to a species that marks a limit over which the species suffers a critical level of effect. Such levels of effect are, for instance, the concentration at which 50\% of the tested organisms died ( Lethal Concentration 50\% ( \mathrm{LC}_{50} ) ), or the concentration which inhibited growth or reproduction by 50\% compared to the control ( Effect Concentration 50\% ( \mathrm{EC}_{50} ) ). Each CEC is the summary of costly bioassay experiments for a single species, so data is usually in short supply. The European Chemical Agency (ECHA) sets the minimal data requirement to a sample size of 10, preferably 15 ( 22 ) . Limitations of existing parametric approaches. To describe the tolerance of all species to be protected, the distribution of the CECs is estimated from the sample of tested species. In practice, a parametric distributional assumption is often adopted ( 24 ) : the CECs are assumed to follow a log-normal ( 63 ; 2 ) , log-logistic ( 3 ; 39 ) , triangular ( 61 ; 70 ) or BurrIII ( 55 ) distribution. Once the response of the community is characterized, a safe concentration is defined, typically the Hazardous Concentration for 5\% of the Species ( \mathrm{HC}_{5} ) , the 5th percentile of the distribution. Instead of the raw estimate, practitioners often use the lower extreme of a confidence interval, further corrected by a safety factor. The difficulty of justifying the choice of a single parametric distribution has sparked a lot of research into distributional comparisons ( 67 ; 30 ; 32 ; 61 ; 66 ; 70 ) . The general consensus emerging from these works is that no single distribution provides a uniformly superior fit across datasets, and that the most appropriate model is strongly dataset dependent ( 24 ) . Moreover, because goodness-of-fit tests tend to have low statistical power when sample sizes are small, practical considerations often dominate theoretical ones. In this context, the log-normal distribution has emerged as the conventional choice, primarily due to its mathematical simplicity, interpretability, and the convenience it offers for estimating confidence intervals of the \mathrm{HC}_{5} . Alternatives and the need for flexibility. Another research direction has aimed at avoiding parametric assumptions altogether, using distribution-free approaches such as the empirical distribution function ( 57 ; 33 ) , rank-based methods ( 60 ; 14 ) , bootstrap resampling ( 32 ; 29 ; 64 ) or nonparametric kernel density estimation ( 65 ) . However, these methods require large sample sizes, in contradiction to the scarcity of ecotoxicological data and to the ethical aim of reducing animal testing. This limitation highlights a persistent trade-off between model generality and data availability: while flexible, nonparametric methods are attractive in principle, their reliability diminishes sharply when data are sparse or noisy. A further line of work considers that the distribution of CECs might not be homogeneous but instead composed of several subgroups, each with its own distributional shape ( 69 ; 35 ; 17 ) . This is ecologically realistic: taxonomy, habitat, or mode of action of contaminants may induce multimodality, especially for compounds targeting specific taxonomic groups (e.g. certain pesticides). Yet current official recommendations when multimodality is suspected are to retain only the most sensitive group ( 22 ; 69 ) , a pragmatic but information-wasting strategy that oversimplifies ecological variability. These considerations reinforce the need for methods that can adapt flexibly to complex, multimodal, and data-poor settings, capturing heterogeneous sensitivity patterns without imposing restrictive distributional assumptions. Rationale for Bayesian nonparametrics. Given the uncertainty on determinants of species sensitivity, there is little prior knowledge on group structure, which calls for a nonparametric approach. In such ecological settings, the relationships among species and their sensitivities are complex and often cannot be captured by fixed parametric forms. Bayesian nonparametric (BNP) models are particularly appealing because they allow the data to reveal the underlying structure without imposing restrictive assumptions on the number or shape of sensitivity groups. Existing frequentist nonparametric methods rely on asymptotic guarantees and thus may perform poorly with small datasets. BNP mixture models offer an effective solution for both large and small samples, because the complexity of the mixture adapts to the available data. BNP models allow the number of mixture components to be learned from the data rather than fixed in advance, avoiding arbitrary assumptions that are hard to justify in ecological applications. They also naturally quantify uncertainty on key regulatory quantities such as the \mathrm{HC}_{5} , providing full posterior distributions instead of point estimates. Compared to kernel density methods, they reduce overfitting risks and offer principled uncertainty quantification ( 8 ) . Importantly, the low information in small datasets can be complemented by informative priors, leveraging external knowledge from other species or contaminants ( 7 ; 17 ; 16 ) . In this way, BNP mixture models reconcile ecological realism (through flexible multimodal structures) with regulatory needs (through reliable uncertainty quantification), making them particularly well suited for SSD applications. Objectives and outline. In Section 2 we present a Bayesian nonparametric approach to SSD based on a nonparametric mixture model. We show that our BNP - SSD approach can include censored data, which are common in ecotoxicology ( 38 ) , and that it provides a rigorous description of the uncertainty on the variable of interest, the \mathrm{HC}_{5} . We showcase the value of our approach by comparing the BNP - SSD with the most standard normal- SSD approach ( 1 ) and with a nonparametric SSD method based on Kernel Density Estimate (KDE) ( 65 ) . The comparison is performed on simulated data in Section 3 , to demonstrate the higher accuracy of the BNP - SSD , and we study real censored and noncensored datasets in Section 4 highlighting the robustness of our method. Additionally, we perform an exploratory analysis 2 2 2 The code is available on GitHub at https://github.com/alamichL/BNP_SSD/ . to describe what biological insight we can gain with BNP - SSD by studying patterns of species or contaminants induced by the clustering in Section 5 . Finally, we conclude and describe further research directions in Section 6 . 2 Methods Due to the wide spectrum of variation of SSD concentrations and to their positivity, it is common practice to work on log-transformed concentrations. We consider a sample of n log-concentrations that we denote by \boldsymbol{X}=(X_{1},\ldots,X_{n}) , that typically represents the CEC for a collection of n species tested with a given contaminant. Moreover, the data are standardized: observations are centered and rescaled to have a variance of one. After the inference, all estimations are transformed back to the original scales. We carry out density estimation for the SSD based on a sample \boldsymbol{X} using Bayesian nonparametric mixtures. The method of mixtures of probability density kernels with a nonparametric prior as mixing measure is due to 46 , where Dirichlet process mixtures (DPM) is introduced. Generalizations of the DPM correspond to allowing the mixing distribution to be any discrete nonparametric prior. A large class of such prior distributions is obtained by normalizing random measures known as completely random measures ( 36 ) . The normalization step gives rise to so-called normalized measures with independent increments (NRMI) as defined by 52 . See 44 ; 34 ; 8 for reviews. More details on specific choices of the NRMI prior and their inferential impact are provided in the sequel. An NRMI mixture model is defined as \displaystyle X_{i}\mid\tilde{P} \displaystyle\stackrel{{\scriptstyle\mathrm{i.i.d.}}}{{\sim}}\tilde{f}(x)=\int k(x\mid\theta)\tilde{P}(\mathrm{d}\theta), (1) \displaystyle\tilde{P} \displaystyle\sim\text{NRMI} where k is a probability density kernel parametrized by some \theta\in\Theta and \tilde{P} is a random probability on \Theta whose distribution is an NRMI . Alternatively, the mixture model can also be formulated hierarchically as \displaystyle X_{i}\mid\theta_{i} \displaystyle\stackrel{{\scriptstyle\mathrm{ind}}}{{\sim}}k(x\mid\theta_{i}),\quad i=1,\ldots,n, \displaystyle\theta_{i}\mid\tilde{P} \displaystyle\stackrel{{\scriptstyle\mathrm{i.i.d.}}}{{\sim}}\tilde{P},\quad i=1,\ldots,n, (2) \displaystyle\tilde{P} \displaystyle\sim\text{NRMI}. Specifically, we consider location-scale mixtures and denote by \theta_{i}=(\mu_{i},\sigma_{i}) the vectors of individual means and standard deviations, \theta_{i}\in\mathbb{R}\times\mathbb{R}_{+} . As discussed in the Introduction, log-concentrations are commonly fitted with a normal distribution, or with mixtures of such distributions. Our aim is to move from these parametric models to the nonparametric specification in ( 2 ), and in order to allow for comparisons with competing approaches, we stick to the normal specification for k on the log-concentrations \boldsymbol{X} , k(x\mid\mu,\sigma)=\mathcal{N}(x\mid\mu,\sigma^{2}) . Within this framework, density estimation is carried out by evaluating the posterior mean \hat{f}(x\mid\boldsymbol{X})=\mathbb{E}\bigl(\tilde{f}(x)\mid X_{1},\ldots,X_{n}\bigr) (3) for any x in \mathbb{R} . For posterior sampling, we use BNPdensity 3 3 3 Available at https://CRAN.R-project.org/package=BNPdensity . , an R package which performs BNP density estimation and clustering under a general specification of NRMI prior based on generalized gamma processes ( 8 ; 5 , see) . BNPdensity leverages the popular Ferguson and Klass algorithm ( 23 ) , extended with a Metropolis–Hastings-within-Gibbs scheme. We compare the proposed BNP - SSD to two competitors. First, the most commonly used model for the SSD, the normal distribution ( 1 ) , with estimated density \hat{f}_{\mathcal{N}}(x)=\mathcal{N}(x\mid\hat{\mu},\hat{\sigma}^{2}) where \hat{\mu} and \hat{\sigma} are the data empirical mean and standard deviation. Second, the frequentist nonparametric kernel density method recently applied to the SSD by 65 , with estimated density \hat{f}_{\mathrm{KDE}}(x)=\frac{1}{n}\sum_{i=1}^{n}\mathcal{N}(x\mid X_{i},h_{n}^{2}) where h_{n}=1.06\hat{\sigma}n^{-\frac{1}{5}} is the asymptotically optimal default bandwidth recommendation of 56 , also used by 65 . 2.1 Censored data 38 explained how to use censored data with the normal SSD , and showcased the drawbacks of the common approach, which consists of transforming or discarding censored data in SSD . It is similarly possible to incorporate censored data into the BNP - SSD . Indeed, only the first line of the hierarchical model defined in ( 2 ) needs to be suitably adapted, while the other levels in the hierarchy remain unchanged. More specifically, denote by F the cumulative density function of the kernel k , then: k(x\mid\theta) has to be replaced by F(x\mid\theta) for a left-censored observation, by 1-F(x\mid\theta) for a right-censored observation, and by F(x_{r}\mid\theta)-F(x_{l}\mid\theta) for an interval-censored observation [x_{l},x_{r}] . This approach can be used for the standard normal SSD and any likelihood-based inference, but there is no widely available tool to perform KDE on all types of censored data: the R package ICE does not handle left/right censored data (not maintained anymore on CRAN); R packages muhaz or Kernelheaping can deal with right or interval-censored data respectively, but there does not seem to be an available implementation for all three types of censored data. In this paper, we illustrate the differences among the various approaches on a censored dataset and, for comparison purposes, we study censored and non-censored versions of the dataset. To obtain a non-censored dataset from a censored dataset, we follow the customary approach, which consists of discarding left and right censored data and replacing interval-censored data with the central value of the interval. 2.2 Prior specification The class of NRMI priors is very broad and we refer the reader to 44 for an extensive review. Here we focus on a specific member of the class known as the normalized stable process ( 37 ) , which as argued in 8 represents a natural default choice. It is specified in terms of a stability parameter \gamma\in(0,1) and a base measure P_{0} , which corresponds to the expectation of the random probability measure. The stability parameter \gamma controls the variability of the prior distribution on the number of clusters: heuristically, a small \gamma corresponds to an informative prior, while a large \gamma indicates a vague prior. Large values of \gamma can require expensive computations to preserve the quality of the posterior sampling. We chose \gamma=0.4 as a compromise between the flexibility of the model and the computational requirements. See 42 ; 8 for details. A sensitivity analysis of the model regarding the choice of \gamma is available in Figure 22 . As mentioned previously, we shall consider location-scale mixtures, meaning that the NRMI prior should be defined on \mathbb{R}\times\mathbb{R}_{+} , the space of locations and scales. Thus the base measure P_{0} is defined on \mathbb{R}\times\mathbb{R}_{+} , and we denote by f_{0} its density with respect to the Lebesgue measure on \mathbb{R}\times\mathbb{R}_{+} . We assume that the locations \mu and scales \sigma are a priori independent. Thus, we use the notation f_{0}(\mu,\sigma)=f_{0}^{1}(\mu)f_{0}^{2}(\sigma) with possible hyperparameters for f_{0}^{1} and f_{0}^{2} . The possibility to specify independent priors for \mu and \sigma is a beneficial feature of NRMIs , which does not require any conjugacy structure in the prior. Therefore, the prior specification can be derived in a straightforward way. The specific choice of distribution on the location parameters of the clusters \mu is a normal distribution f_{0}^{1}(\mu)=\mathcal{N}(\mu\mid\varphi_{1},\varphi_{2}^{-1}) where mean \varphi_{1} and precision \varphi_{2} are assigned a normal-gamma conjugate hyperprior. This corresponds to a vague prior for the location of the clusters, which can just as well be at the center of the dataset or at the borders. Regarding the scale parameter \sigma of the clusters, given the standardization of the data during the pre-processing where the variance is set to one, \sigma should be smaller than one, approaching one only in cases of unimodality. Moreover, \sigma should also be a priori bounded from below since numerous extremely small clusters do not make biological sense regarding species sensitivity distributions. Therefore, we choose a uniform prior f_{0}^{2}(\sigma)=\text{Unif}_{[0.1,1.5]}(\sigma) , leaving room around the upper bound of one to allow for potential unimodality. We studied the sensitivity with respect to this prior specification by varying its extreme points and also with respect to a left-truncated normal prior of mean 0.5 , variance 1 , and lower bound 0.1 . Note that the latter has approximately 3/4 of its mass within the support of the \text{Unif}_{[0.1,1.5]} distribution. The sensitivity analyses (available in Figure 23 ) showed little variation to moderate changes in the parameters of these two prior distributions. 2.3 Estimation of the \mathrm{HC}_{5} The main quantity of interest for ecological risk assessment is the \mathrm{HC}_{5} , which corresponds to the 5th percentile of the SSD distribution. In our BNP framework, we rely on the posterior expectation. The posterior distribution induced on the \mathrm{HC}_{5} is obtained by considering the (random) cumulative distribution function \tilde{F}(x)=\int F_{k}(x|\theta)\tilde{P}(d\theta) , where F_{k} denotes the cumulative distribution function of kernel k . The inverse of the cumulative distribution function is the quantile function, so \text{HC}_{5}=\tilde{F}^{-1}(0.05) . This inversion is performed at each iteration, that is for each realization of \tilde{F} , of the MCMC chain, giving us access to the posterior distribution of the \mathrm{HC}_{5} . The 95\% credible bands are formed by the 2.5\% and 97.5\% quantiles of the \mathrm{HC}_{5} posterior distribution. In practice, our method resorts to numerical inversion of the realizations of the cumulative distribution function, based on a truncation approximation of the mixing measure \tilde{P} . The truncation of \tilde{P} results in a finite mixture. Hence, its cumulative distribution can be readily evaluated and it is amenable to numerical inversion. The truncation method is a dynamic approximation designed to preserve the moments of the infinite-dimensional mixing measure ( 6 ) . Similarly, the 5th percentile of the KDE can be obtained by numerical inversion of the cumulative distribution function, and the confidence intervals using nonparametric bootstrap. The 5th percentile of the normal SSD and its confidence intervals were obtained following the classical method by 1 . 2.4 Robustness comparison using Leave-One-Out cross validation We compare the robustness of the three SSD methods using a predictive performance measure, Leave-One-Out (LOO) cross-validation. We compute the LOO for each method as: \text{LOO}_{i}=\hat{f}(X_{i}\mid\boldsymbol{X}_{-i}), (4) where \hat{f}(\,\cdot\mid\boldsymbol{X}_{-i}) is the density estimate based on \boldsymbol{X} with X_{i} left out for each of the three methods. LOO cross-validation evaluates the robustness of a method by assessing how well it predicts each observation when that observation is excluded from the dataset. Overfitting methods tend to produce predictions that vary significantly with the inclusion or exclusion of specific points, leading to poor LOO performance. In contrast, robust methods should exhibit stable predictions regardless of the removal of individual points, resulting in better LOO performance. For the BNP models, LOOs are referred to as conditional predictive ordinates (CPOs) statistics. They are commonly used in applications, see for instance 28 . A CPO statistic is defined for each data point X_{i} as \operatorname{CPO}_{i}=\hat{f}(X_{i}\mid\boldsymbol{X}_{-i})=\int k(X_{i}\mid\theta)\pi(\mathrm{d}\theta\mid\boldsymbol{X}_{-i}), where \pi(\mathrm{d}\theta\mid\boldsymbol{X}_{-i}) is the posterior distribution associated to \boldsymbol{X}_{-i} and \hat{f}(\,\cdot\mid\boldsymbol{X}_{-i}) is the (cross-validated) posterior predictive distribution of ( 3 ). CPOs can be easily approximated by Monte Carlo as \widehat{\operatorname{CPO}_{i}}=\Biggl(\frac{1}{T}\sum_{t=1}^{T}\frac{1}{k(X_{i}\mid\theta^{(t)})}\Biggr)^{-1}, where \{\theta^{(t)},t=1,2,\ldots,T\} is an MCMC sample obtained through the BNPdensity R package. For the two frequentist models, the LOOs can be computed by fitting them directly on the leave-one-out data \boldsymbol{X}_{-i} for each i . 2.5 Clustering estimation The question of how to estimate data clustering based on an MCMC posterior sample is a long-standing problem in Bayesian statistics ( 19 ; 40 , see) . Estimating a clustering structure is computationally expensive, owing to the extremely rapid growth in the cardinality of the partition space with the sample size n , known as the Bell number of order n . Enumeration of all partitions is infeasible in practice; thus, one typically resorts to approximations. Many ad-hoc procedures have been devised in the literature. However, as noted by 19 , it seems counter-intuitive to apply an ad-hoc clustering method on top of a model that itself produces clusterings. We adopt instead a fully Bayesian route by undertaking clustering on decision-theoretic grounds. We consider a loss function \mathcal{L} and propose a Bayesian point estimator \hat{c} for a clustering structure obtained as an argument that minimizes the posterior expected loss given the data \boldsymbol{X} \displaystyle\hat{c}\in\argmin_{c^{\prime}}\sum_{c}\mathcal{L}(c^{\prime},c)\pi(c\mid\boldsymbol{X}), (5) where the summation over c is over all possible clusterings, and where \pi(c\mid\boldsymbol{X}) denotes the posterior distribution of clustering c . The maximum a posteriori (MAP), often considered in the literature, is an example of such a Bayesian estimator, based on the very crude 0-1 loss function \mathcal{L}_{0-1} . However when n is large, a posterior sample generally hardly visits twice the same clustering, thus making the empirical MAP of the MCMC output very sensitive to the initialization of the chain and of very limited validity in practice. Manifestly, many other loss functions can be considered and expected to perform better than \mathcal{L}_{0-1} . One particular choice of a loss function stands out from these in best estimating the number of groups in a clustering. It is known as the variation of information, denoted by \mathcal{VI} , which is a loss function firmly established in information theory ( 47 ; 62 ) . The variation of information between two clusterings is defined as the sum of their information (their Shannon entropies) minus twice the information they share. Simulations indicate that the variation of information is a sensible choice: when other losses such as the Binder loss ( 9 ) typically tend to overestimate the number of clusters, the variation of information instead seems to effectively recover it (see for instance the simulated examples, and more specifically Figures 6–8, of 62 ). A merit of the approach presented in 62 is that it rests on a greedy search algorithm to determine the minimum loss clustering of ( 5 ). Starting from the MCMC output, this greedy approach explores the space of partitions not restricted to those visited by the MCMC chain to find the optimum. Different efficient implementations were proposed, e.g. in 51 and 18 . In this work, we chose to use the algorithm proposed by 18 . Results in 18 indicate that this algorithm achieves superior performance and greater computational efficiency compared with other implementations. 3 Simulation study In order to compare the performance of BNP - SSD , the normal- SSD ( 1 ) and the nonparametric KDE - SSD ( 65 ) , we perform a simulation study with synthetic datasets corresponding to different scenarios. 3.1 Simulated data We consider three distinct simulated data scenarios corresponding to various situations: (a) a standard normal distribution: this is a situation where the normal assumption made for SSD is justified; (b) a t -distribution with three degrees of freedom and noncentrality parameter equal to -2 : this is a situation where some species are relatively more sensitive, creating a heavier tail on the left of the distribution; (c) a bimodal distribution corresponding to a mixture of normals \nicefrac{{1}}{{3}}\,\mathcal{N}(-2,1)+\nicefrac{{2}}{{3}}\,\mathcal{N}(5,1) : this is a situation where a group of species is much more sensitive than all the others, typical of some pesticides which disproportionately affect the target species. These three scenarios represent the diversity of empirical distributions found in real data such as the National Institute for Public Health and the Environment (RIVM) database ( 21 ) . For all settings, we sampled independently S=40 datasets of sizes 10, 20, 50, 100. These sizes are representative of the dataset sizes in the field, as described in the Introduction. Figure 1 depicts the data generating densities and the different estimates obtained from the three different approaches with datasets of size 20. Figure 1: Three simulation scenarios: data generating density (solid line) and density estimates for each model based on datasets of size n=20 (dashed lines). Orange ( ) for the BNP model, blue ( ) for the normal model, and green ( ) for the KDE model. 3.2 Performance comparison of the three approaches For each sampled dataset i\in\{1,\ldots,S\} and each model considered, we estimate the data generating density f by a density denoted \hat{f}_{i} , and compute the associated 5th percentile \hat{q}_{i} , which is used as an estimate of the true \mathrm{HC}_{5} denoted by q_{0} . We denote by (\hat{l}_{i},\hat{u}_{i}) a 95\% confidence/credible interval for \hat{q}_{i} , and by \hat{\ell}_{i}=\hat{u}_{i}-\hat{l}_{i} its length. To account for sampling variation, we compute averaged summaries (using the notation \big\langle\,\cdot\,\big\rangle_{S} to denote averaging over the S independent samples). We compute two performance indicators, the mean absolute error \text{MAE}=\big\langle|\hat{q}_{i}-q_{0}|\big\rangle_{S} , and the mean integrated squared error \text{MISE}=\big\langle\int(\hat{f}_{i}-f)^{2}\big\rangle_{S} . Moreover, we compute the mean confidence/credible interval length \text{MCIL}=\big\langle\hat{\ell}_{i}\big\rangle_{S} as a measure of uncertainty: as the BNP model captures model uncertainty, we expect it to give a more conservative estimate of uncertainty than the other models. However, we would not want to be conservative to the point that the estimates are useless for the practical purpose of estimating an \mathrm{HC}_{5} . The density estimates give a first intuition of the superiority of the BNP - SSD over the other two models in recovering the true density (Figure 1 ). The results from the simulation study are presented in Figure 2 , which we describe from top to bottom and left to right. On the normal simulated data, the well-specified normal model obviously performs best. However, the mean absolute error on the \mathrm{HC}_{5} of the BNP is very similar to that of the normal. For small sample sizes, the MISE of the BNP is almost the same as that of the normal. This illustrates the fact that the BNP model complexity scales with the amount of data and that in data-poor contexts, it essentially reduces to a normal model. For small dataset sizes, the mean CI length is larger for the BNP model than for the normal, reflecting the model uncertainty built into the BNP model, which is a sign of its potential to flexibly adapt in case of deviations as more data become available. For larger sizes, the model uncertainty decreases and the BNP and normal model coincide. For the t-Student simulated data, the BNP model outperforms the other two. The normal and BNP have a smaller mean absolute error than the KDE , the BNP and KDE have a smaller MISE and the mean CI length for the normal model is misleadingly small. Finally, for the multimodal simulated data, the BNP model is clearly superior to the other two models in terms of mean absolute error and MISE. The mean CI length is relatively larger than the other two models for small dataset sizes and smaller for larger dataset sizes. Figure 2: Normal, t-Student, and normal mixture simulation scenarios (from left to right); mean absolute error (MAE), mean integrated squared error (MISE), and mean confidence/credible interval length (MCIL) as a function of the dataset size (from top to bottom). Uncertainty estimated from the S=40 simulations is reported via error bars. Orange ( ) for the BNP model, blue ( ) for the normal model, and green ( ) for the KDE model. 4 Analysis of contaminant-wise clustering 4.1 Real data description We illustrate the advantages of the proposed Bayesian nonparametric approach by means of a selection of contaminants extracted from a large database collected by the RIVM and first presented in 21 . We study the dataset already curated by 31 with the same restrictions concerning data quality and homogeneity. We consider both the censored and the non-censored versions of the dataset, the non-censored version being obtained by following the traditional approach of discarding left and right-censored data and taking the central value of interval-censored data. The dataset is an aquatic ecotoxicity research database, with 1,557 species and 3,448 distinct chemicals. Specifically, the dataset records the following covariates: species, chemical, and concentration. To deal with the presence of multiple CECs values for one species, we used the classical approach to replace these values by the geometric mean of the values as a surrogate ( 22 ) for non-censored data, and followed 38 in the case of censored data. 4.2 Density, quantiles and \mathrm{HC}_{5} estimation For illustration purposes, we present three categories of contaminants: contaminants with large datasets, consisting of more than 50 values, medium datasets, with around 25 values, and small datasets, with a little over 10 values. For each of these categories, we select datasets, associated with a contaminant, exhibiting approximately unimodal, skewed, and bimodal behavior, as in the simulation study. This selection was performed for uncensored datasets. The three models ( BNP , KDE , and normal) were fitted on each dataset and we studied the estimate of the \mathrm{HC}_{5} and its credible interval, the LOO error, and the shape of the estimated density compared to the histogram. The censored version of the same datasets was also studied with the BNP and normal model, while there does not seem to exist any implementation of the KDE model for censored data (see Section 2.1 ). The results are displayed in Appendix A , see Figure 7 to Figure 12 . The BNP model is both more flexible than the KDE model, as apparent from the density estimates for the bimodal datasets, and comparably, or even more, robust. The length of the confidence/credible intervals does not exhibit substantial differences among the three methods. This represents strong evidence in favor of the claim that being less restrictive (in terms of distributional assumptions) than the normal model does not result in over-conservative estimates of the \mathrm{HC}_{5} . This is of great importance since over-conservative estimates would seriously compromise a wide adoption of the BNP - SSD approach. More precisely, in the case of the roughly normal datasets, the BNP method results in an estimate for the \mathrm{HC}_{5} comparable to that of the normal model. When the datasets strongly deviate from the normal model, the \mathrm{HC}_{5} estimates from the normal and BNP model differ substantially and strongly support the use of the more flexible BNP model over the normal. 4.3 Contaminant-wise clustering We have so far demonstrated the advantages of the BNP method over the existing approaches to SSD for density estimation and for the determination of the \mathrm{HC}_{5} . There is an additional benefit connected to the BNP - SSD : the mixture model induces a clustering of the species, which conveys interesting information from the biological point of view. Indeed, one of the long-standing questions around SSD , and ecotoxicology in general, is to understand what drives the sensitivity of species to a contaminant. 17 assumes that taxonomy is a driving factor and effectively imposes a clustering based on taxonomic units. 21 investigates the influence of habitat by comparing freshwater and saltwater species, while 35 study the variations in sensitivity in different regions of the world. All these approaches start from a possible clustering structure and test for a significant difference among cluster units. The BNP - SSD takes the opposite path by endogenizing the clustering in a probabilistically principled way. Indeed, it allows the clustering structure to emerge from the data, and, by using meta-data about the species, this structure can be examined a posteriori to verify whether it matches certain scientific hypotheses about the driving forces behind species sensitivity. The clustering induced by the BNP model may or may not coincide with particular information about the species, which can challenge or support existing theories about the determinants of species sensitivity. Figure 3 compares the cumulative distribution functions, along with credible bands, as well as the estimated clustering structure for Carbaryl and a quasi-taxonomic grouping expected to be relevant for species sensitivity in 21 . Two clusters emerge, one predominantly composed of crustaceans and containing all crustaceans but one, and another predominantly composed of fishes, containing all fishes but one, and all the mollusks. The three insects are scattered over the two clusters; the only annelid is grouped with the crustaceans, while the only amphibian is grouped with the fishes. Thus, for Carbaryl, the estimated clustering structure seems strongly associated with the quasi-taxonomic grouping and supports the theory that species sensitivity is dependent on taxonomy, with fish forming a cluster relatively resilient to Carbaryl while crustaceans form a more sensitive cluster. However, this parallel between taxonomy and sensitivity is not observed for every contaminant; indeed, it is possible to identify contaminants for which the estimated clustering does not match the quasi-taxonomic grouping. A general tendency observed over many contaminants is that fishes tend to group in a single cluster. This insight could be used to argue for reducing the number of fish species to be tested, as their contribution to the complete SSD could be emulated by giving a higher weight to a few representative species, as done in 26 . Figure 3: SSD for Carbaryl (CAS: 63-25-2) with the quasi-taxonomic group of each species overlaid on the estimate of the cumulative distribution function (solid line). Left: Species coloured by quasi-taxonomic group. Right: Species coloured by cluster membership in the BNP model. Light grey denotes 95\% -pointwise credible bands computed from the posterior distribution of the BNP model. 4.4 BNP-SSD Shiny application The method described above can be used directly with the BNPdensity package, but this requires a certain level of fluency in the R language. Thus, we developed a Shiny application, named BNP-SSD, tailored to SSD problems and based on the functions of the package BNPdensity , available at https://alamichl.shinyapps.io/BNP_SSD/ . This application is inspired by the application shinyssdtools of 20 . In this application, the BNP model described in Section 2 is fitted to censored or uncensored data. Before fitting the model, the concentration data are cleaned, dealing with the possible presence of multiple CECs values for one species, transformed using a \log -scale, and centered-scaled. For greater flexibility, some options are left to the user, such as the number of iterations of the MCMC algorithm. Once the model has been fitted, the estimated density is plotted, along with some goodness-of-fit graphs. In another panel, an estimate of \mathrm{HC}_{5} is made using the posterior distribution over quantiles. It is also possible to estimate a percentile of the distribution other than the 5 th percentile. The credible bands of this estimate are also computed. Finally, in the last panel, the induced optimal clustering is computed and plotted. 5 Cross-contaminant clustering It would be highly interesting to establish whether similar patterns occur commonly for contaminants by studying the clustering structure for all contaminants in the dataset. A complete clustering analysis would require a hierarchical model with a contaminant effect, which is beyond the scope of the present paper and will be the object of future work. Here we approach the issue in a simple yet insightful way by fitting the model independently for all contaminants. Consequently, we present a post-processing of the clustering structure estimated for each contaminant. The general idea is, over all contaminants, to assess how often each pair of species is grouped. This defines sensitivity communities of species, which we compare to the quasi-taxonomic grouping. We restrict ourselves to contaminants tested by at least eight species, which is a little below the minimum threshold recommended for fitting a Species Sensitivity Distribution ( 22 ) . Our original dataset, described in section 4.1 , contains more than 3,000 contaminants. Of these contaminants, after excluding those that have been tested on fewer than eight species, only 179 remain. We first fit the model on all such contaminants. We then combine the information from the clustering for each contaminant to understand if some common patterns may be observed. To extract information from the clustering structure for each contaminant, we transform each estimated clustering into an association matrix. Stacking all the association matrices on top of each other forms a three-dimensional array, also called a tensor, each slice corresponding to a contaminant. One difficulty is that contaminants are tested on different sets of species, with potentially little overlap. This results in a large proportion of missing values (pairs of contaminants-species that have not been tested) that need to be dealt with. 5.1 Non-negative tensor factorization We perform non-negative three-way tensor factorization ( 15 ) , which is a tensor generalization of principal component analysis. It is a dimension-reduction technique that decomposes the association tensor into a sum of R rank-one tensors. Developed in Chemometrics, this technique has also been employed in Biostatistics, Signal Processing, Linguistics, and Machine Learning ( 27 ) . The technique also allows the imputation of missing values. We use a Parallel Factors Analysis (PARAFAC), also referred to as Canonical Decomposition (CANDECOMP) factorization; Section D in the Supplement provides details on this technique and background on tensor properties. Denoting by \mathbf{Y} the tensor of the data described previously, we have that \mathbf{Y}\in\mathbb{R}^{n_{S}\times n_{S}\times n_{C}} is a symmetric tensor in the first two dimensions, where n_{S} and n_{C} , respectively, denote the number of species and contaminants. The general PARAFAC factorization for some tensor \hat{\mathbf{Y}}\in\mathbb{R}^{I\times J\times K} is denoted by \hat{\mathbf{Y}}=[\![A,B,C]\!]=\sum_{r=1}^{R}a_{r}\circ b_{r}\circ c_{r}, where A=[a_{1},\ldots,a_{R}]\in\mathbb{R}^{I\times R} , B=[b_{1},\ldots,b_{R}]\in\mathbb{R}^{J\times R} and C=[c_{1},\ldots,c_{R}]\in\mathbb{R}^{K\times R} are three components or factors matrices, and \circ stands for the vector outer product. For the considered data, the symmetry of the tensor \mathbf{Y} in the first two dimensions implies that the PARAFAC factorization can be simplified as \mathbf{Y}=[\![A,A,C]\!] , where A=[a_{1},\ldots,a_{R}]\in\mathbb{R}^{n_{S}\times R} and C=[c_{1},\ldots,c_{R}]\in\mathbb{R}^{n_{C}\times R} . Note that the factorization is only an approximation and incurs in some additive error \mathbf{E} in the form of \mathbf{Y}=[\![A,A,C]\!]+\mathbf{E} . To give physical meaning to the different components found, we use the non-negative PARAFAC factorization ( 68 ) from the multiway R package ( 41 ) . This adds non-negativity constraints on the component matrices a_{ir}\in\mathbb{R}_{+} and c_{jr}\in\mathbb{R}_{+} for all i\in\{1,\ldots,n_{S}\} , j\in\{1,\ldots,n_{C}\} and r\in\{1,\ldots,R\} . A popular heuristic to determine the number of components R is the core-consistency diagnostic ( 10 ) . This diagnostic requires the imputation of the missing values for efficient computation. As the number of missing values in our type of data is large, we used instead a cross-validation method. The cross-validation consists of removing a chosen proportion of the tensor non-missing values, performing the decomposition for different ranks, and then evaluating the reconstruction error on the removed values, a type of K-fold cross-validation. We measure the reconstruction error using the Frobenius distance between this tensor and the original one on the non-missing values (see Figure 24 ). The decomposition can be performed once the rank of the decomposition is chosen. The result of the three-way decomposition consists of three factor matrices, two of which with dimension n_{S}\times R , and one with dimension n_{C}\times R . The first two encode the degree of membership of each species to each component of the decomposition and are equal by construction. The third matrix encodes, for each contaminant, its degree of membership to each component. To facilitate the interpretation of the results, we threshold the membership degrees and decide whether each species and contaminant belongs to a component or not. To do this, we use K-means clustering on the degree of membership vectors to adaptively threshold the membership degrees. Species and contaminants may be allocated to 0 or several components (see Figure 25 and Figure 26 ). This algorithmic approach is chosen for its ability to handle missing data. In tensor factorization, various contributions ( 50 , e.g.) propose a model-based approach that avoids the problem of choosing the rank of the factorization. However, in practice, when the proportion of missing data is very high, as in our case, these methods fail. 5.2 Results Figure 4: Left: Quasi-taxonomic composition of the species in the part of the data considered. The groups are defined according to the classification in 21 . Right: (Top) Number of contaminants tested for each species in the data considered (at least 13 contaminants by species). (Bottom) Number of species tested for each contaminant. We used this methodology on a part of the dataset described in Section 4.1 (see Figure 4 for a description of the restricted dataset). To lower the proportion of missing data, we arbitrarily considered only species for which at least 13 contaminants were tested; with this restriction, 95% of the data is missing. The tensor on which the factorization is performed has dimensions 179\times 71\times 71 , so we have 179 co-clustering matrices of 71 species, one matrix for each contaminant. Using the cross-validation approach, the rank 41 was selected (see Figure 24 ). We obtained 41 components of the contaminants and the species. We present seven components among these, selecting those with the highest contrast using Figure 25 and Figure 26 , deciding to only select the well-separated components in the sense of K-means clustering. These seven components are analyzed in Figure 5 and Figure 6 . Figure 5 presents the quasi-taxonomic composition of the seven components in count (left) and in relative proportion (right). Figure 30 and Figure 29 present the same result for other taxonomic ranks. We cannot observe a clear difference in composition among the different components. This suggests that quasi-taxonomy does not appear to be the main driver for species to be co-clustered, or in other words, quasi-taxonomy does not appear to strongly determine species sensitivity. This observation should be modulated by the fact that, as we see in Figure 4 , fish species are over-represented in the dataset, so they form a substantial part of every cluster. Figure 5: Quasi taxonomic composition of the components. The groups are defined according to the classification in 21 . Left: Number of species in each component. Right: Proportion of species compared to the distribution of species in the whole data in each component. Figure 6 presents the weights of each contaminant in the various components. We can observe that only one contaminant (Pentachlorophenol) has a significant weight in component E. In components C, D, and G, the most weighted contaminants are mostly pesticides. More precisely, component C is composed of two insecticides. Component D contains two neurotoxic insecticides and potassium dichromate, which is an oxidizing agent used in various reactions in laboratories and industry. Component G contains seven insecticides, including five organophosphate insecticides and two carbamate insecticides, along with sodium dichromate, which is mainly used as an intermediate in the production of other chromium compounds. In component A, the four most weighted contaminants are inorganic compounds: two chlorinated compounds and two sulfated compounds. Finally, components B and F are composed of contaminants with different properties or usages. Component B includes mostly pesticides, with six insecticides and one ectoparasiticide, but also four compounds with various uses, such as a flame retardant or a reactant in chemical synthesis. Component F is composed of two pesticides, including one insecticide and one piscicide, and sodium cyanide, which is mainly used in gold extraction but was also historically applied as an insecticide. Together, these observations suggest that components are associated to contaminants of a similar type, or, in other words, that species which respond similarly to one type of contaminant could tend to respond similarly to another contaminant of the same type. This could be seen as providing support to the idea that species sensitivity across contaminants may be correlated, which has been used for instance in 7 . Figure 6: Weight of each contaminant in the various components. The size of the point is proportional to the intensity of the activity of the contaminants. 6 Discussion and future research We presented a novel approach to SSD based on a Bayesian nonparametric mixture model. We performed an extensive comparison to the current SSD models both on simulated and on real datasets, to demonstrate the added value of the proposed approach. The BNP - SSD performs particularly well when the dataset deviates from a log-normal distribution, which allows to leverage its great flexibility in describing the data. At the same time, the proposed approach turns out to be relatively robust and does not seem prone to over-fitting. The BNP - SSD can be thought of as an intermediate model between the single component log-normal- SSD , and the KDE with as many components as there are species. Indeed, in all practical cases of the RIVM dataset, the number of clusters necessary to describe the data was no greater than 3. The BNP - SSD provides several benefits for risk assessment: it is an effective and robust standard model that adapts to many datasets. As such, the BNP - SSD represents a safe tool to remove one of the arbitrary parametric assumptions of SSD ( 24 ) . Moreover, as a Bayesian method, it readily provides credible intervals. The traditional approach to SSD is to consider contaminants independently. In a context of data scarcity, only exacerbated by the drive to reduce animal testing, it would be desirable to leverage the long history of ecotoxicity testing to borrow information from experiments regarding different contaminants. Large databases are already available. We can hope that the ongoing discussion about transparency on the regulation of chemicals will even push towards greater public availability of data. Therefore, it is a timely effort to develop models that harness all the information already available about species’ sensitivity to other contaminants. This is, in essence, the proposal brought forward by 7 and 17 which use taxonomic information to predict the sensitivity of unknown species to a contaminant. An important by-product of the BNP - SSD approach is that it provides interesting opportunities for subsequent cluster analysis. We presented such an example of a post-processing analysis using non-negative tensor factorization, summarizing insights over 179 contaminants, which suggested some regularities in species sensitivity based on contaminant type. However, we did not observe a strong relation between taxonomy and species sensitivity across contaminants. As such, we may hypothesize that there could be structures other than taxonomic which would be relevant to species sensitivity, such as ecological niche. This idea motivates a natural extension of the present work: the BNP-SSD approach could be expanded to model inter-contaminant variation by leveraging a dependent BNP model. This is particularly relevant because some contaminants can exhibit very similar toxicity, often due to belonging to the same chemical class. There exists a rich variety of dependent BNP models that employ different mechanisms to induce dependence, including hierarchical ( 58 ; 12 ) , additive ( 48 ; 43 ) , nested ( 53 ; 11 ) , or combinations thereof. These have recently been unified within a general framework in 25 . Future work will focus on an in-depth investigation to determine which dependence structure, and corresponding sharing of information, is most appropriate for the SSD context. Moreover, as discussed when studying the species clustering, the groups could be specified either based on the known chemical nature of the contaminants or learned in a flexible manner using a Bayesian nonparametric approach. This would open the door to a principled investigation of similarities among potentially very different contaminants. Additionally, one would also like to move forward from summarizing the sensitivity of species by a single value. Ecotoxicological tests are usually analyzed by fitting a dose-response model which describes several aspects of the species’ response to a contaminant, such as the time between exposure and effect. Using all parameters from the dose-response model would imply performing the clustering in a higher dimensional space, increasing the discriminating power between groups and ultimately resulting in more meaningful clusters. Supplementary material This supplementary material is organized as follows: Section A provides additional results on real data, Section B presents convergence diagnostics for the results on real data, Section C discusses a sensitivity analysis of the model parameters, Section D contains details on the non-negative tensor factorization, and Section E displays additional figures related to Section 5 of the main document. Appendix A Results on real data This section illustrates the results stated in Section 4.2 . We present the comparison of the three models ( BNP , KDE and normal) on real data. We consider three categories of contaminants: contaminants with large datasets, consisting of more than 60 values, medium datasets, with around 25 values, and small datasets, with a little over 10 values. The three models were fitted on each dataset and we studied the estimate of the \mathrm{HC}_{5} and its credible interval, the LOO error and the shape of the estimated density compared to the histogram. The censored version of the same datasets was also studied with the BNP and normal model. A.1 Model comparison on non-censored data We present the results for the non-censored version of the datasets. A.1.1 Large non-censored datasets Density estimates HC 5 CPO Figure 7: Density estimates, \mathrm{HC}_{5} and CPO for three large non-censored datasets. Red ( ) for the BNP model, blue ( ) for the normal model, and green ( ) for the KDE model. From top to bottom: Cadmium chloride, Potassium Dichromate, and Carbaryl. A.1.2 Medium non-censored datasets Density estimates HC 5 CPO Figure 8: Density estimates, \mathrm{HC}_{5} and CPO for three medium non-censored datasets. Red ( ) for the BNP model, blue ( ) for the normal model, and green ( ) for the KDE model. From top to bottom: 2,4-D Acid, Trichlorfon, Parathion. A.1.3 Small non-censored datasets Density estimates HC 5 CPO Figure 9: Density estimates, \mathrm{HC}_{5} and CPO for three small non-censored datasets. Red ( ) for the BNP model, blue ( ) for the normal model, and green ( ) for the KDE model. From top to bottom: Phosmet, Naled, Sodium dichromate. A.2 Model comparison on censored datasets Here we present the results for the censored version of the datasets. As extensions for kernel density estimators with censored data are not available (see Section 2.1 ), we only compare the normal and BNP models. A.2.1 Large censored datasets Density estimates HC 5 CPO Figure 10: Density estimates, \mathrm{HC}_{5} and CPO for three large censored datasets. Red ( ) for the BNP model, blue ( ) for the normal model (KDE not implemented for censored data). From top to bottom: Cadmium chloride, Potassium Dichromate, and Carbaryl. A.2.2 Medium censored datasets Density estimates HC 5 CPO Figure 11: Density estimates, \mathrm{HC}_{5} and CPO for three medium censored datasets. Red ( ) for the BNP model, blue ( ) for the normal model (KDE not implemented for censored data). From top to bottom: 2,4-D Acid, Trichlorfon, Parathion. A.2.3 Small censored datasets Density estimates HC 5 CPO Figure 12: Density estimates, \mathrm{HC}_{5} and CPO for three small censored datasets. Red ( ) for the BNP model, blue ( ) for the normal model (KDE not implemented for censored data). From top to bottom: Phosmet, Naled, Sodium dichromate. Appendix B Convergence diagnostics for real data analysis in A The results presented below have been performed on the non-censored datasets. The traceplots are similar for the censored version of the datasets. B.1 Large datasets Figure 13: Traceplots obtained with BNPdensity and coda packages for Cadmium chloride. Figure 14: Traceplots for Potassium Dichromate. Figure 15: Traceplots for Carbaryl. ESS (ncomp) ESS (Latent_variable) ESS (log_likelihood) Cadmium chloride 171 341 43 Potassium Dichromate 71 121 59 Carbaryl 242 400 37 Table 1: Effective sample size of the parameters for the different datasets. B.2 Medium datasets Figure 16: Traceplots for 2,4-D Acid. Figure 17: Traceplots for Trichlorfon. Figure 18: Traceplots for Parathion (Ethyl). ESS (ncomp) ESS (Latent_variable) ESS (log_likelihood) 2,4-D Acid 201 316 213 Trichlorfon 276 404 37 Parathion (Ethyl) 190 501 41 Table 2: Effective sample size of the parameters for the different datasets. B.3 Small datasets Figure 19: Traceplots for Phosmet. Figure 20: Traceplots for Naled. Figure 21: Traceplots for Sodium dichromate. ESS (ncomp) ESS (Latent_variable) ESS (log_likelihood) Phosmet 286 585 153 Naled 433 624 318 Sodium dichromate 350 590 77 Table 3: Effective sample size of the parameters for the different datasets. Appendix C Sensitivity analysis of the model C.1 Parameter \gamma An experiment was conducted to test the robustness of the model described in Section 2 with respect to the choice of parameter \gamma . We used our model to estimate the density of a toy dataset. We took the toy dataset named acidity from the BNPdensity package. We tested different values of the parameter \gamma\in(0,1) . These values of \gamma induce different a priori behaviors. Our results are summarized in Figure 22 . Figure 22: Study of the sensitivity of the model to the parameter \gamma . A toy dataset (acidity from BNPdensity ) has been considered here. The values of \gamma are chosen in order to have different prior behaviors. In this figure, we can see that the different densities estimated for models with different values of \gamma are very similar. This results supports the choice of a fixed value for \gamma . In this paper we consider \gamma=0.4 . C.2 Parameter \sigma We conducted a similar analysis concerning the choice of the prior distribution for the parameter \sigma . Various prior distributions can be considered, in particular a uniform distribution and a truncated normal distribution. The results presented in the paper are obtained considering a uniform prior distribution on the set [0,1,1,5] . We studied the sensitivity of the model with respect to this prior specification by varying its extreme points, as well as with respect to a left-truncated normal prior distribution with mean 0.5 , variance 1 , and lower bound 0.1 . Our results are presented in Figure 23 . Figure 23: Study of the sensitivity of the model to the choice of the prior for the parameter \sigma . A toy dataset (acidity from BNPdensity ) has been considered here. Different priors for \sigma have been considered such as an uniform with different bounds and truncated normal. For the uniform prior distribution, the results presented here only concern the case where the lower bound is modified, but we also took the upper bound into account and obtained similar results. In light of these results, we concluded that the model is robust with regard to the choice of prior distribution on \sigma . Note that we could consider other prior distributions, but we want \sigma to have certain properties, as described in section 2 , which explains the choice to consider only uniform and truncated normal distributions. Appendix D Details on the non-negative tensor factorization In this paper, a tensor is a high-dimensional form of matrices. We consider only three-order tensors, it means any tensor with three dimensions: \mathbf{Y}\in\mathbb{R}^{I\times J\times K} where I,J,K\in\mathbb{N} . We introduce one useful product for tensor factorization or decomposition, the outer product. The outer product of two vectors a\in\mathbb{R}^{I} and b\in\mathbb{R}^{J} , denoted by \circ , yields a matrix A\in\mathbb{R}^{I\times J} , A=a\circ b=ab^{T}. The outer product of three vectors a\in\mathbb{R}^{I} , b\in\mathbb{R}^{J} and c\in\mathbb{R}^{K} yields a third-order tensor \mathbf{Y}\in\mathbb{R}^{I\times J\times K} , \mathbf{Y}=a\circ b\circ c,\qquad\text{with }y_{ijk}=a_{i}b_{j}c_{k}. A three-order tensor defined as the outer product of three vectors is called a rank-one tensor. The rank of a tensor \mathbf{Y} if defined as the minimal number R of rank-one tensors \mathbf{Y}_{1},\ldots,\mathbf{Y}_{R} such that \mathbf{Y}=\sum_{r=1}^{R}\mathbf{Y}_{r} . The tensor factorization generalizes the matrix factorization techniques. The different matrix factorizations are useful notably for feature selection or dimensionality reduction. The tensor or multi-way array factorization allows to consider applications where the data contains high-order structures. One of the most popular models for the factorization of high-order tensors is the PARAFAC model. In the following, we will describe the decomposition for a third-order tensor, but the model can be extended to decompose a higher-order tensor. D.1 PARAFAC factorization We recall the Parallel Factors Analysis (PARAFAC) described in Section 5 . Given a tensor \mathbf{Y}\in\mathbb{R}^{I\times J\times K} , the PARAFAC factorization is denoted by \mathbf{Y}=[\![A,B,C]\!] where A=[a_{1},\ldots,a_{R}]\in\mathbb{R}^{I\times R} , B=[b_{1},\ldots,b_{R}]\in\mathbb{R}^{J\times R} and C=[c_{1},\ldots,c_{R}]\in\mathbb{R}^{K\times R} are three components matrices. More formally, \mathbf{Y}=\sum_{r=1}^{R}a_{j}\circ b_{j}\circ c_{j}+\mathbf{E}=[\![A,B,C]\!]+\mathbf{E}, where the tensor \mathbf{E}\in\mathbb{R}^{I\times J\times K} represents the approximation error. A difficult problem for the PARAFAC model is to choose the appropriate number of components R . This problem is equivalent to determining the rank of a tensor, in the sense that the rank of a tensor is the smallest number of R components in an exact PARAFAC decomposition, i.e. with a null approximation error tensor \mathbf{E} . Determining the rank of a given tensor is known to be a NP-hard problem. In the ideal case, there is no noise in the data, so we can fit the PARAFAC model for different values of R until we have an exact decomposition. This assumes a perfect procedure for fitting the PARAFAC model, which is not the case in practice. Furthermore, in a more realistic case, the data is noisy and the procedure described is no longer applicable. There are different proposed methods to solve this problem, such as core consistency diagnostic, residual analysis, visual appearance of loadings (also called factors represented by the components matrices), or cross-validation. The method we used in this paper is the cross-validation as described in Section 5 . D.2 Non-negative tensor factorization On the PARAFAC model presented previously, it is possible to impose some non-negativity constraints. The non-negativity constraints allow to give physical meaning to the different components found. In practice, adding constraints on the PARAFAC model leads to solving an optimization problem under constraints. Indeed, finding the PARAFAC factorization means solving the following optimization problem, \min_{A,B,C}\left\|\mathbf{Y}-[\![A,B,C]\!]\right\|_{F}^{2}, where \|\cdot\|_{F} denotes the tensor Frobenius norm defined by \|\mathbf{Y}\|_{F}^{2}=\sum_{i=1}^{I}\sum_{j=1}^{J}\sum_{k=1}^{K}y_{ijk}^{2} . The non-negative PARAFAC factorization is a PARAFAC factorization with the following non-negative constraints \min_{A,B,C\text{ s.t. }a_{ir},\,b_{jr},\,c_{kr}\in\mathbb{R}_{+}}\left\|\mathbf{Y}-[\![A,B,C]\!]\right\|_{F}^{2}. Appendix E Additional figures for Section 5 We now present some additional figures illustrating the results presented in Section 5 . Figure 24 illustrates the choice of the rank decomposition using the cross-validation method. Figure 24: Cross-validation results for the tensor decomposition. Left: Frobenius distance mean of the 30-fold cross-validation with a confidence interval at 95\% around each point with the rank varying between 1 and 47. Right: Frobenius distance for each of the 30 folds. The rank of the decomposition is chosen by taking the lowest rank (here 39) contained in the confidence interval from the rank minimizing the error (here 45). Figure 25 and Figure 26 illustrate the K-means clustering used on each components resulting from the tensor decomposition. The 7 components considered in Section 5 , components A, B, C, D, E, F and G, are chosen using the K-means clustering and are the only ones well-separated in the K-means clustering considering both the contaminants and species. These chosen components are the 2nd, 4th, 12th, 14th, 20th, 30th and 34th components in the decomposition. Figure 25: Distribution of the contaminant weight in each component. The presence of two well-separated groups in the distribution suggests separating the contaminants that belong to the component and those that do not. The clustering is performed using the K-means method. In Section 5 only the components where there is no overlap between the red part and the blue part, components A, B, C, D, E, F, and G are considered while components H and I are not. Figure 26: Distribution of the species weight in each component. The presence of two well-separated groups in the distribution suggests separating the contaminants that belong to the component and those that do not. The clustering is performed using the K-means method. Figure 27 presents the heatmap of the components and the species, and Figure 28 presents the heatmap of the components and the contaminants. The heatmaps indicate which contaminants or species have more weights in a component. This is another way to illustrate the composition of the components. Figure 27: Heatmap of all the species and components. Figure 28: Heatmap of all the contaminants and components. Figure 30 and 29 present the taxonomic composition of the seven components previously selected at two different taxonomic ranks. These two figures support the idea that the taxonomy does not seem to strongly determine species sensitivity. Figure 29: Taxonomic composition of the selected components at the Phylum level. Figure 30: Taxonomic composition of the selected components at the major level.