USEPA / CompTox-ToxCast-tcplFit2

Performs basic concentration response curve fitting
https://cran.r-project.org/package=tcplfit2
Other
1 stars 0 forks source link

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

Closed sedavid01 closed 6 months ago

sedavid01 commented 6 months ago

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:

Other suggestions:

sedavid01 commented 6 months ago

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