Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of dichotomous models for binary/proportional response data #13

Open
sedavid01 opened this issue Aug 15, 2023 · 3 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@sedavid01
Copy link
Collaborator

ToxCast has several assays where the response is a 0/1 (alive/dead) recorded value. Currently, the modeling scheme for these is to obtain the proportion/percentage of the replicates in a given dose group that have an observed response then fit these with the current continuous dose-response models. However, this has several implications: (a) the baseline error estimation is difficult or intractable as many if not all observations are 0 - needs a pseudo error value and (b) the observed data does not actually meet the distributional assumptions of the continuous models.

Goal: Add the dichotomous models from BMDS to the tcplfit2 package as new fit_ functions. See section 11.0 (Dichotomous Endpoints) of the BMDS User Guide manual. (NOTE: I do not think we need the multistage tumor models at this time so we can ignore adding these for the time being.)

Consideration: Completion of this ticket does not necessarily mean or require that the functions are readily available to call from tcplfit2_core.

@sedavid01 sedavid01 added the enhancement New feature or request label Aug 15, 2023
@sedavid01
Copy link
Collaborator Author

Scope: Just create functions analogous to poly1 and fitpoly1 for each dichotomous model.

@sedavid01
Copy link
Collaborator Author

There are a couple of potential issues with the current implementation of dichotomous models. Suggest testing models with parameter bounds in BMDS for each of the respective models to ensure they are working appropriately (see an example below for weibull model). Note the testing should be done in a separate script/R markdown, but does not need to be a vignette for the package (at least at this time).

R package

devtools::load_all() # when in the Rproj for tcplfit2 load tcplfit2 functions
library(magrittr) # load magrittr to have access to 'pipes'

Dose Set-up

MYdoses <- seq(0,3,length.out = 100)

Weibull

Random parameter selection

Randomly select 3 parameters within the allowable parameter bounds

set.seed(922)
a <- runif(n = 3,min = 0,max = 18) %>% round(.,3)
b <- runif(n = 3,min = 0,max = 100) %>% round(.3)

Expand the grid for the randomly selected bounds

wparams <- expand.grid(a,b)

Generate fit and plot curve

for(i in 1:nrow(wparams)){
out <- weibull(ps = unlist(wparams[i,]),x = MYdoses)
plot(MYdoses,out,sub = paste(wparams[i,],collapse = ", "),type = "l")
}

Full parameter range

Use parameters across the range of allowable values for each parameter

a <- seq(0,18,length.out = 6)
b <- seq(0,100,length.out = 6)

Expand the grid for the randomly selected bounds

wparams <- expand.grid(a,b)

Generate the fit and plot the curve

for(i in 1:nrow(wparams)){
out <- weibull(ps = unlist(wparams[i,]),x = MYdoses)
if(i==1){
plot(MYdoses,out,type = "l",ylim = c(-0.1,1.1))
}else{
lines(MYdoses,out)
}
}

@gracezhihuizhao
Copy link
Contributor

I tested each of the models using the code provided to ensure they are working appropriately. Here attached is the test codes and pdf. ensure they are working appropriately
dichotomous_test.pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants