USEPA / CompTox-ToxCast-tcplFit2

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

Poly2 Biphasic Modeling Updates & Testing #69

Closed sedavid01 closed 3 months ago

sedavid01 commented 7 months ago

Goal: Implement updates to the tcplfit2 code to allow for biphasic curves with the polynomial 2 model.

sedavid01 commented 7 months ago

Code to test the new logical argument to turn the biphasic modeling on and off:

load the current updates on the branch

devtools::load_all()

simulated experimental dose groups

X <- rep(seq(from = 0,to = 10,length.out = 10),each = 3)

Parameters

alpha <- (-17.31) beta <- (-11.54)

beta_1 <- alpha/beta beta_2 <- alpha/(beta)^2

simulated experimental observed response data

set.seed(425) Y <- alpha*(X/beta +(X/beta)^2) + rt(df = 5,n = length(X))

true simulated curve

XC <- seq(from = 0,to = 10,length.out = 100) YC <- alpha*(XC/beta +(XC/beta)^2)

plot the simulated data

plot(X,Y,xlab = "dose",ylab = "response") abline(v = 0,h = 0,col = "red") abline(v = 5.77,col = "gray",lty = "dashed") lines(XC,YC,col = "black")

fit with tcplfit2 - obtain just the poly2 (no biphasic modeling)

TF.mono <- tcplfit2::tcplfit2_core(conc = X,resp = Y, force.fit = TRUE, bidirectional = TRUE, cutoff = 100, poly2.biphasic = FALSE)

fit with tcplfit2 - obtain just the poly2 (biphasic modeling)

TF.biph <- tcplfit2::tcplfit2_core(conc = X,resp = Y, force.fit = TRUE, bidirectional = TRUE, cutoff = 100, poly2.biphasic = TRUE)

plot the simulated data

plot(X,Y,xlab = "dose",ylab = "response") abline(v = 0,h = 0,col = "red") abline(v = 5.77,col = "gray",lty = "dashed") lines(XC,YC,col = "black") lines(XC,poly2(ps = unlist(TF.mono$poly2[c("a","b","er")]),XC),col = "blue") lines(XC,poly2(ps = unlist(TF.biph$poly2[c("a","b","er")]),XC),col = "magenta") legend("topleft",c("Underlying Model", "tcplfit2 - Poly2 (Mono)", "tcplfit2 - Poly2 (Bi-phasic)"), col = c("black","blue","magenta"),lty = "solid")

sedavid01 commented 3 months ago

Pull request was approved by @madison-feshuk and has now been merged into 'dev'. Any follow-on issues should be created in a new ticket.