You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. I am trying to better understand what is going on under the hood with some of the functions offered by the drc package, particularly the drc::ED() function. I have implemented a weibull type 2 model using both nls and drc::drm. I get the the same parameter estimates between the two methods. But there is a difference in the standard errors as well as the variance-covariance matrix. That is actually not my main question, but may warrant an explaination. My main question is in regards to calculating the ECx value (in this case the EC50). I understand that you are performing an inverse regression problem to derive the estimate. But I am struggling to understand and reproduce how you are deriving the standard error. I know you are using the delta method. But are you deriving the gradient based on the inverse regression equation or the original regression equation? Likewise, are you standardizing by dividing sqrt(n)? Basically, should the below code produce the same standard error as what is produced by drc::ED? And if not, why?
library(drc)
library(msm)
nlsctrls <- nls.control(maxiter = 1000, tol = 1e-06)
mnls <- nls(y ~ c + (d-c)(1 - exp(-exp(b(log(dose) - log(e))))),
data = dat,
start = list(b = bstart, c = cstart, d = dstart, e = estart),
control = nlsctrls,
weights = NULL)
ecxm = as.numeric(coef(mnls)["d"](.5))
ecValue <- as.numeric(coef(mnls)["e"](-log(1 - ((ecxm - coef(mnls)["c"])/(coef(mnls)["d"] - coef(mnls)["c"])) ))^(1/coef(mnls)["b"]))
deltamethod(~ x4*(-log(1 - ((ecxm - x2)/(x3 - x2)) ))^(1/x1), coef(mnls), vcov(mnls))
#or is the delta method with respect to the original regression equation, in which case:
deltamethod(~ x2 + (x3-x2)(1 - exp(-exp(x1(log(ecValue) - log(x4))))), coef(mdrc), vcov(mdrc))
p.s. i tried attaching data, not sure if it worked. I have never posed a question on github before. example_data.csv
The text was updated successfully, but these errors were encountered:
Hello. I am trying to better understand what is going on under the hood with some of the functions offered by the drc package, particularly the drc::ED() function. I have implemented a weibull type 2 model using both nls and drc::drm. I get the the same parameter estimates between the two methods. But there is a difference in the standard errors as well as the variance-covariance matrix. That is actually not my main question, but may warrant an explaination. My main question is in regards to calculating the ECx value (in this case the EC50). I understand that you are performing an inverse regression problem to derive the estimate. But I am struggling to understand and reproduce how you are deriving the standard error. I know you are using the delta method. But are you deriving the gradient based on the inverse regression equation or the original regression equation? Likewise, are you standardizing by dividing sqrt(n)? Basically, should the below code produce the same standard error as what is produced by drc::ED? And if not, why?
library(drc)
library(msm)
nlsctrls <- nls.control(maxiter = 1000, tol = 1e-06)
mnls <- nls(y ~ c + (d-c)(1 - exp(-exp(b(log(dose) - log(e))))),
data = dat,
start = list(b = bstart, c = cstart, d = dstart, e = estart),
control = nlsctrls,
weights = NULL)
ecxm = as.numeric(coef(mnls)["d"](.5))
ecValue <- as.numeric(coef(mnls)["e"](-log(1 - ((ecxm - coef(mnls)["c"])/(coef(mnls)["d"] - coef(mnls)["c"])) ))^(1/coef(mnls)["b"]))
deltamethod(~ x4*(-log(1 - ((ecxm - x2)/(x3 - x2)) ))^(1/x1), coef(mnls), vcov(mnls))
#or is the delta method with respect to the original regression equation, in which case:
deltamethod(~ x2 + (x3-x2)(1 - exp(-exp(x1(log(ecValue) - log(x4))))), coef(mdrc), vcov(mdrc))
p.s. i tried attaching data, not sure if it worked. I have never posed a question on github before.
example_data.csv
The text was updated successfully, but these errors were encountered: