fit.jagsNEC: fit.jagsNEC

Description Usage Arguments Details Value

View source: R/Fit_jagsNEC.R

Description

Fits an NEC model as per Fox 2010, using jags and R2jags

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
fit.jagsNEC(
  data,
  x.var,
  y.var,
  trials.var = NA,
  x.type = NA,
  y.type = NA,
  burnin = 10000,
  n.iter = burnin + 500,
  n.iter.update = 10000,
  n.tries = 3,
  params = c("top", "beta", "NEC", "SS", "SSsim"),
  over.disp = FALSE,
  model = "NEC3param",
  init.value.warning = FALSE,
  added.model = FALSE,
  sig.val = 0.01,
  ...
)

Arguments

data

a data.frame containing the data to use for the model

x.var

the column heading indicating the concentration (x) variable

y.var

the column heading indicating the response (y) variable

trials.var

the column heading indicating the column for the number of "trials" for binomial response data. If not supplied, the model may run but will not be the model you intended!

x.type

the statistical distribution to use for the x (concentration) data. This will be guess based on the characteristic of the input data if not supplied.

y.type

the statistical distribution to use for the y (response) data. This may currently be one of 'binomial', 'poisson',' 'gaussian', 'beta', 'negbin' or 'gamma'. Others can be added as required, please contact the package maintainer. If not supplied, the appropriate distribution will be guessed based on the distribution of the input data.

burnin

the number of iterations to use as burnin.

n.iter

the number of iterations to run following burnin for the initial jags fit. Defaults to 500 + burnin,

n.tries

the number of tries to attempt to fit the model and attain good chain mixing. See details below.

params

a vector of names indicating the parameters to trace during the jags fit.

model

the type of model to be fit. Currently takes values of "NEC3param", "NEC4param", "NECsigmoidal", "NECHormesis", "ECx4param", "ECxExp", "ECxLinear", "ECxsigmoidal", "ECxWeibull1", or "ECxWeibull2".

init.value.warning

indicates if a warning should be given if the init.fun generated fails.

sig.val

probability value to use as the lower quantile to test significance of the predictor posterior values against the control, to estimate NSEC as an interpolated NOEC value from smooth ECx curves.

n.iter.burnin

the number of iterations to run overall. This should be large. Defaults to 10000.

over.disp.

if an overdispersed model should be used. Only changes the model fit for poisson and binomial y.type data. For poisson a negative binomial model will be fit. For binomial a beta model will be fit.

Details

As some concentration-response data will use zero concentration, and there is no distribution on the continuous scale from 0 to in (ie tweedie) available in jags, a small offset is added (1/10^3 of the next lowest value) to zero values of concentration where x.var are gamma distributed.

If the initial model fit fails because it cannot be fit by jags (miss-specified priors, invalid initial values), or because there is poor chain mixing fit.jagsNEC will try n.tries many times using the init.fun defined by the write model function. If all those attempts fail, fit.jagsNEC will then try using default values provided by jags. The function will only return an error if all n.tries fail.

All models other than "NEC3param" (which is that defined by Fox 2010) are currently undergoing beta testing and are experimental. Comments and feedback are welcome, especially reproducible examples of issues, as well as example test cases.

All models provide an estimate for NEC. For model types with "NEC" as a prefix, NEC is directly estimated as a parameter in the model. Models with "ECx" as a prefix are continuous curve models, typically used for extracting ECx values from concentration response data. In this instance the NEC value is approximated as an NSEC, defined as the concentration at which there is 90 percent certainty (based on the Bayesian posterior estimate) that the response falls below the estimated value of the upper assymptote (top) of the response (i.e the response value is significantly lower than that expected in the case of no exposure). This percentage certainty can be controlled using the argument *sig.val*.

Value

The $BUGSoutput element of fitted jags model, including an estimate of the NEC value. A posterior sample of the NEC is also available under $sims.list.


AIMS/NEC-estimation documentation built on Dec. 7, 2020, 10:44 a.m.