describeISE: Ion selective electrode characterisation

View source: R/describeISE.R

describeISER Documentation

Ion selective electrode characterisation

Description

Use Bayesian calibration to estimate parameters for y = a + b log(x + c) + error, where error follows a nomral distribution with mean 0 and standard deviation sigma. The limit of detection is also estimated.

Usage

describeISE(data, model.path=NA, model.name = NA, Z=NA, temperature = 21, 
	burnin=25000, iters = 50000, chains=4, thin = 1,
	a.init= NA, b.init=NA, cstar.init=NA, 
	logc.limits = c(-8.9, -1.9), sigma.upper = 5, diagnostic.print=FALSE, offset = 1, 
	alpha = 0.05, beta = 0.05, SN = NA, 
	keep.coda=TRUE, coda.n=1000, program="OpenBUGS")

Arguments

data

Calibration data (of class 'ISEdata'; see loadISEdata)

model.path

The directory where the BUGS model is located (defaults to 'models' sub-directory under the location of ISEtools package, e.g. '.../ISEtools/models')

model.name

The name of the BUGS model (e.g. 'Single_ISE_model.txt') (defaults are located in ISEtools package)

Z

Ionic valence (e.g. for lead, Z = 2)

temperature

temperature in degrees C

burnin

Initial number of Monte Carlo simulations to discard.

iters

Total number of iterations.

chains

Number of parallel MCMC chains

thin

Thinning rate, equal to 1/Proportion of simulations saved (e.g. thin = 10 records every tenth iteration).

a.init

Initial value for parameter a

b.init

Initial value for parameter b

cstar.init

Initial value for parameter cstar (c = cstar^10)

logc.limits

Upper and lower limits for log c initial values

sigma.upper

Upper limit for initial value of sigma

diagnostic.print

logical flag indicating whether a diagnostic printout is desired (default is FALSE)

offset

The initial value for the slope is based on the last data point as sorted by concentration (i.e. the Nth point) and the (N - offset) data point. The default is offset = 1, corresponding to the last and second to last data points.

alpha

False positive rate used for detection threshold (not output) to calculate LOD(alpha, beta) only returned if SN = NA

beta

False negative rate used to calculate LOD(alpha, beta) only returned if SN = NA

SN

Desired signal-to-noise ratio for LOD(S/N) calculations (default is to calculate the S/N equivalent based on alpha, beta)

keep.coda

Logical flag indicating whether the MCMC simulations should be returned (keep.coda = TRUE) or not (keep.coda = FALSE)

coda.n

Indicates how many simulations to return (sampled with replacement). If coda.n >= the total, all are returned.

program

Choice of "OpenBUGS" (default and recommended for Windows or Linux) or "jags" (for macOS, see manual for warnings).

Value

describeISE returns a list of class 'ISEdescription'. Individual components are:

ahat

Estimated value for a (from the median of the posterior distribution)

bhat

Estimated value for b (from the median of the posterior distribution)

chat

Estimated value for c (from the median of the posterior distribution)

cstarhat

Estimated value for cstar (c to the 0.1 power) (from the median of the posterior distribution)

sigmahat

Estimated value for cstar (from the median of the posterior distribution)

LOD.info

List describing LOD method (alpha, beta or S/N) and corresponding values (alpha, beta, SN)

LOD.hat

Estimated value for the limit of detection (from the median of the posterior distribution)

<parametername>.lcl

Lower limit for the above parameters (e.g. ahat.lcl, bhat.lcl, ...) (from the 2.5th percentile of the posterior distribution)

<parametername>.ucl

Upper limit for the above parameters (from the 95.5th percentile of the posterior distribution)

LOD.Q1

25th percentile estimated value of the limit of detection

LOD.Q3

75th percentile estimated value of the limit of detection

If keep.coda = TRUE, then these additional items are returned:

ahat.coda

Random sample (without replacement) of length coda.n from the Markov Chain Monte Carlo simulations for a

bhat.coda

Random sample (without replacement) of length coda.n from the Markov Chain Monte Carlo simulations for b

chat.coda

Random sample (without replacement) of length coda.n from the Markov Chain Monte Carlo simulations for c

sigmahat.coda

Random sample (without replacement) of length coda.n from the Markov Chain Monte Carlo simulations for sigma

cstarhat.coda

Random sample (without replacement) of length coda.n from the Markov Chain Monte Carlo simulations for cstar

LOD.coda

Random sample (without replacement) of length coda.n from the Markov Chain Monte Carlo simulations for LOD

Author(s)

Peter Dillingham, peter.dillingham@otago.ac.nz

References

Dillingham, P.W., Radu, T., Diamond, D., Radu, A. and McGraw, C.M. (2012). Bayesian Methods for Ion Selective Electrodes. Electroanalysis, 24, 316-324.

Dillingham, P.W., Alsaedi, B.S.O. and McGraw, C.M. (2017). Characterising uncertainty in instrumental limits of detection when sensor response is non-linear. 2017 IEEE SENSORS, Glasgow, United Kingdom, pp. 1-3. <doi:10.1109/ICSENS.2017.8233898>

Dillingham, P.W., Alsaedi, B.S.O., Radu, A., and McGraw, C.M. (2019). Semi-automated data analysis for ion-selective electrodes and arrays using the R package ISEtools. Sensors 19(20), 4544. <doi: 10.3390/s19204544>

Dillingham, P.W., Alsaedi, B.S.O., Granados-Focil, S., Radu, A., and McGraw, C.M. (2020). Establishing meaningful Limits of Detection for ion-selective electrodes and other nonlinear sensors ACS Sensors, 5, 250-257. <doi:10.1021/acssensors.9b02133>

Examples

# Fast-running example with only 100 MCMC iterations for testing:
data(carbonate)
example3test = describeISE(carbonate, Z = -2, SN = 3.6, 
 burnin=100, iters=200, chains=1, 
 a.init= c(-50,180,140,65,100,170,100,130), 
 b.init=rep(-20,8), cstar.init=rep(0.2, 8), program="jags")
print(example3test)
summary(example3test)
plot(example3test)

# Full example with 100,000 iterations (25,000 by 4 chains):
data(carbonate)
example3 = describeISE(carbonate, Z = -2, SN = 3.6)
print(example3)
summary(example3)
plot(example3)


ISEtools documentation built on Oct. 19, 2022, 5:29 p.m.