Introducing jagsNEC – a Bayesian ‘No Effect Concentration’ package

Recently the Australian and New Zealand Water Quality Guidelines (ANZECC) have been updated (Warne et al 2018) and one significant change was the preference of ‘No Effect Concentrations (NECs)’ above other statistical estimates of toxicity such as EC10s and NOECs.

Here is a condensed list of the hierarchy from the Guidelines.

  1. NECs
  2. ECx where x is 10 or less
  3. BEC10s
  4. ECx where x is between 10 and 20
  5. NOECs
  6. NOECs estimated indirectly

Warne et al goes on to state ‘Although NECs are not regularly reported, they are considered the preferred measure of toxicity as they are more closely aligned with the objective of GVs [guideline values], that is, to protect aquatic ecosystems, as they are the concentrations that have no adverse effect on species. Reporting of NECs, and their subsequent use in GV derivation, is likely to increase in the future.

So what is a NEC? A NEC is a ‘no effect concentration’ estimate and is probably easiest to explain when compared to other statistical estimates. Below we have a NOEC calculated using a categorical analysis, an EC10 calculated from a logistic curve, and a NEC calculated from our package. The red indicates the statistical estimate or threshold. There are many problems with NOECs that have been thoroughly described, and which I won’t go into, but you can see it greatly underestimates the threshold. EC10s are better but the S-shape nature of the model means that estimates within 10% of the control often have large error, therefore researchers often report EC10s instead of EC0s. NECs on the other-hand use two models to work out where they best converge (segmented regression), leading to a cleaner estimate of the threshold.

As Warne et al states above, few researches use NECs, probably because they are not aware of them, or do not know how to code them. Our package builds on Pires et al (2002) and Fox (2010), introducing a large suite of probability distributions for many data types. And the whole process is simple, as it automatically detects the data-type you wish to model and selects an appropriate model. We have also included more traditional models such as four-parameter logistic curves and functions to extract ECx’s, even from segmented (NEC) models. And there are also functions to compare NECs or ECx’s of two models.

Below is a working example of how to run jagsNEC

Sys.setenv(“TAR” = “internal”)
devtools::install_github(“AIMS/NEC-estimation”) #
library(R2jags) <- read.table(“;, header= TRUE,dec=”,”) #bent.4$raw.x <- as.numeric(as.character($raw.x))
out <- fit.jagsNEC(,

Once the model has been selected, you will get a message identifying the distribution used “Response variable ‘suc’ modeled using a binomial distribution.”

Next you may want to do some model diagnostics using


All the output from the model is stored in the object ‘out’. To extract the NEC and EC50, and their 95% credible intervals we can use:

2.5% 50% 97.5%
4.391069 4.553966 4.686907

EC_50 EC_50_lw EC_50_up
6.819824 7.019522 7.239189

We can plot the data using:

plot_jagsNEC(out, log = ‘x’)

But you may want to customize the plot using the output. Below is an example of how this can be done.

p0= ggplot()
p0= p0+ geom_point(data =, aes(x = raw.x, y = suc/tot, alpha = 0.8), color = ‘steelblue’, size =$tot/max($tot)*3 , position=position_jitter(width = .01, height = .01))
p0= p0+ geom_line(aes(x = out$pred.vals$x, y = out$pred.vals$y), color = ‘grey30’, size=1)
p0= p0+ geom_ribbon(aes(x = out$pred.vals$x, ymin=out$pred.vals$lw, ymax=out$pred.vals$up), fill=’grey30′, alpha=0.2)
p0= p0+ geom_vline(xintercept = out$NEC[2], col = ‘red’, linetype=1)
p0= p0+ geom_vline(xintercept = out$NEC[1], col = ‘red’, linetype=2)
p0= p0+ geom_vline(xintercept = out$NEC[3], col = ‘red’, linetype=2)
p0= p0+ scale_x_log10()
p0 = p0+ labs(x=expression(XXX~(X~”cm”^{-2})),
p0= p0+ scale_y_continuous( limits = c(0, 1))
p0= p0+ theme_classic()
p0= p0+ theme(legend.position=”none”)

This package is still in beta-testing so you may notice some bugs. If you do, let us know and we may be able to help. Eventually the plan is to move the package to rstan in version 2.0, so look for updates.

If you want more information about the model behind the NEC, please see the description in:

Thomas MC, Flores F, Kaserzon S, Fisher R, Negri AP (2020) Toxicity of ten herbicides to the tropical marine microalgae Rhodomonas salina. Scientific reports 10:1-16.

And finally to cite our package use


To cite package ‘jagsNEC’ in publications use:

Rebecca Fisher, Gerard Ricardo and David Fox (2020). jagsNEC: A Bayesian No Effect Concentration (NEC) package. R package
version 1. R package version 1.0.


Warne M, Batley G, Van Dam R, Chapman J, Fox D, Hickey C, Stauber J (2018) Revised Method for Deriving Australian and New Zealand Water Quality Guideline Values for Toxicants. Prepared for the revision of the Australian and New Zealand Guidelines for Fresh and Marine Water Quality. Australian and New Zealand Governments and Australian state and territory governments, Canberra.

Pires AM, Branco JA, Picado A, Mendonça E (2002) Models for the estimation of a ‘no effect concentration’. Environmetrics: The official journal of the International Environmetrics Society 13:15-27

Fox DR (2010) A Bayesian approach for determining the no effect concentration and hazardous concentration in ecotoxicology. Ecotoxicol Environ Saf 73:123-131


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s