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

mismatch in SE calculation between msm::deltamethod() and drc::ED() #41

Open
stilianoudakis opened this issue Sep 24, 2024 · 0 comments

Comments

@stilianoudakis
Copy link

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

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

No branches or pull requests

1 participant