USEPA/CompTox-ToxCast-tcplFit2

Update the BMD Lower Boundary Censoring Code - min conc != 0 for lower threshold

Closed this issue · 1 comments

Goal: There is currently a bug in the code when a concentration series including the untreated control group (conc = 0) is passed to tcplfit2_core and tcplhit2_core. One can use tcplfit2 fitting functions with the full concentration-response series (though this is not common with the pipelines) and in this case there are issues with the lower boundary censoring of the BMD.

Code finding the bug:
X <- rep(seq(0,10,length.out = 10),each = 5)
set.seed(842)
Y <- tcplfit2::hillfn(ps = c(tp = 15,ga = 0.25,p = 0.15,er = 0.1),x = X) +
rt(n = length(X),df = 4)

tfit <- tcplfit2::tcplfit2_core(conc = X,resp = Y,
cutoff = 2,
force.fit = TRUE,
bidirectional = TRUE,
verbose = FALSE)
thit_nobounds <- tcplfit2::tcplhit2_core(tfit,conc = X,resp = Y,cutoff = 2,onesd = sd(Y[1:5]),bmr_scale = 1.349)
thit_bound <- tcplfit2::tcplhit2_core(tfit,conc = X,resp = Y,cutoff = 2,onesd = sd(Y[1:5]),bmr_scale = 1.349,bmd_low_bnd = 0.1,bmd_up_bnd = 10)
rbind.data.frame(No.Bounds = thit_nobounds,Bounds = thit_bound) # bmd, bmdu, and bmdl are exactly the same currently

image

Needs:

  • Change code such that the lower threshold is based on the lowest tested concentration - i.e. min(conc[conc!=0]). Note, this code may not the exact fix but gives a general starting point.

Other suggestions:

  • May be worth adding in a unit test and/or case in the vignette to ensure this behavior works appropriately after the update.

PR approved and branched merged into 'dev'. Closing out this ticket.