USEPA / CompTox-ToxCast-tcplFit2

A Concentration-Response Modeling Utility
https://usepa.github.io/CompTox-ToxCast-tcplFit2/
Other
1 stars 0 forks source link

26 update plotting functionality within tcplfit2 r package #77

Closed gracezhihuizhao closed 7 months ago

gracezhihuizhao commented 8 months ago

This PR includes:

gracezhihuizhao commented 8 months ago

The plot_allcurves function errors if not all of the models are able to be fit. This should not occur - that is, at least display the models that do fit and throw a warning message with the models that are not included in the plot. image

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")

The plot_allcurves function now should be able to warn the user if any curves from the output failed and plot rest of the successful curve fits. Testing with your codes will result in this warning message and a plot of rest of the curves:

output <- tcplfit2_core(X, Y, cutoff=2) plot_allcurves(output, X, Y)

image