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](https://private-user-images.githubusercontent.com/78621036/290228663-b2a2566e-05a2-4717-bb1c-3b6fba81659c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU3MDEzODIsIm5iZiI6MTcyNTcwMTA4MiwicGF0aCI6Ii83ODYyMTAzNi8yOTAyMjg2NjMtYjJhMjU2NmUtMDVhMi00NzE3LWJiMWMtM2I2ZmJhODE2NTljLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTA3VDA5MjQ0MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTYxYmY4MjUwM2ZjOGRmZGUwY2Y3YTRkZjUyOThhOTVkYzkyZmQ1YjAwMzFjZGI1MzJiYzc3MDA5MzJlMTM4ZmImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.3wfcBx3PsnghgbH0LBwyEkce7rzpXHfsEPuCP6-vr6I)
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.