gpt4 book ai didi

r - 使用 drc 包计算绝对 EC50 值时出现 "NaNs produced"警告

转载 作者:行者123 更新时间:2023-12-01 12:03:17 24 4
gpt4 key购买 nike

我正在尝试弄清楚如何使用 drc 包中的 LL.3 和 LL.4(3 和 4 参数)剂量 react 模型计算绝对 EC50 值,但我不断收到“警告消息: In log(exp(-tempVal/parmVec[5]) - 1) : NaNs produced"和 EC50 值为“NA”。

这是我尝试运行的代码示例

###use rygrass dataset in drc

gr.LL.3 <- drm(ryegrass$rootl ~ ryegrass$conc, fct = LL.3()) # 3 parameter log-logistic model
gr.LL.4 <- drm(ryegrass$rootl ~ ryegrass$conc, fct = LL.4()) # 4 parameter log-logistic model

plot(gr.LL.3) #graph looks fine
plot(gr.LL.4) #graph looks fine

ED (gr.LL.3, respLev = c(50), type = "relative") # this works fine
ED (gr.LL.4, respLev = c(50), type = "relative") # this works fine

ED (gr.LL.3, respLev = c(50), type = "absolute") # this gives me "NA" for EC50 along with warning message
ED (gr.LL.4, respLev = c(50), type = "absolute") # this gives me "NA" for EC50 along with warning message

这不是因为浓度为 0

### It's not due to 0 values for concentrations
# ryegrass dataset with 0 value concentrations and corresponding rootl removed

rootlength <- c(8.3555556, 6.9142857, 7.75, 6.8714286, 6.45, 5.9222222, 1.925, 2.8857143, 4.2333333, 1.1875, 0.8571429, 1.0571429, 0.6875, 0.525, 0.825, 0.25, 0.22, 0.44)
conc.wo.0 <- c(0.94, 0.94, 0.94, 1.88, 1.88, 1.88, 3.75, 3.75, 3.75, 7.5, 7.5, 7.5, 15, 15, 15, 30, 30, 30)

gro.LL.3 <- drm(rootlength ~ conc.wo.0, fct = LL.3())

plot(gro.LL.3) #graph looks fine

ED (gro.LL.3, respLev = c(50), type = "relative") # this works fine
ED (gro.LL.3, respLev = c(50), type = "absolute") # once again, this gives me "NA" for EC50 along with warning message

这也不是因为响应是绝对的还是相对的

### It's also not due to the response being in absolute vs relative terms
# ryegrass dataset with response relative to average response with 0 concentration (sorry, I did the absolute to relative conversion in excel, I'm still learning r)

rel.rootl <- c(0.98, 1.03, 1.07, 0.94, 0.95, 1.03, 1.08, 0.89, 1.00, 0.89, 0.83, 0.76, 0.25, 0.37, 0.55, 0.15, 0.11, 0.14, 0.09, 0.07, 0.11, 0.03, 0.03, 0.06)
concentration <- c(0, 0, 0, 0, 0, 0, 0.94, 0.94, 0.94, 1.88, 1.88, 1.88, 3.75, 3.75, 3.75, 7.5, 7.5, 7.5, 15, 15, 15, 30, 30, 30)

rel.gro.LL.3 <- drm(rel.rootl ~ concentration, fct = LL.3())

plot(rel.gro.LL.3) #graph looks fine

ED (rel.gro.LL.3, respLev = c(50), type = "relative") # this works fine
ED (rel.gro.LL.3, respLev = c(50), type = "absolute") # once again, this gives me "NA" for EC50 along with warning message

我是新手,所以感谢任何帮助。

最佳答案

rel.rootl <- c(0.98, 1.03, 1.07, 0.94, 0.95, 1.03, 1.08, 0.89, 1.00, 0.89, 0.83, 0.76, 0.25, 0.37, 0.55, 0.15, 0.11, 0.14, 0.09, 0.07, 0.11, 0.03, 0.03, 0.06)
concentration <- c(0, 0, 0, 0, 0, 0, 0.94, 0.94, 0.94, 1.88, 1.88, 1.88, 3.75, 3.75, 3.75, 7.5, 7.5, 7.5, 15, 15, 15, 30, 30, 30)

rel.gro.LL.3 <- drm(rel.rootl ~ concentration, fct = LL.3())

plot(rel.gro.LL.3) #graph looks fine

ED (rel.gro.LL.3, respLev = c(50), type = "relative") # this works fine
ED (rel.gro.LL.3, respLev = c(50), type = "absolute") # once again, this gives me "NA" for EC50 along with warning message

问题是因为当您尝试估计绝对 EC50 时,ED 函数求解曲线上您想要的点(即 respLev 参数),因此如果您的相对响应水平在 y- axis 它会遇到错误,因为你的 y 轴是比例。

要解决此问题,请将您的标准化响应乘以 100 以将其转换为百分比相对响应

rel.gro.LL.3.percent <- drm(rel.rootl*100 ~ concentration, fct = LL.3())

ED (rel.gro.LL.3.percent, respLev = c(50), type = "relative") # same result as above

Estimated effective doses

Estimate Std. Error
e:1:50 3.26520 0.19915

ED (rel.gro.LL.3.percent, respLev = c(50), type = "absolute") # very similar to relative EC50

Estimated effective doses

Estimate Std. Error
e:1:50 3.30154 0.20104

或者,您可以将原始模型中的 respLev 更改为 0.5。

ED (rel.gro.LL.3, respLev = c(50), type = "relative") # this still works fine

Estimated effective doses

Estimate Std. Error
e:1:50 3.26520 0.19915

ED (rel.gro.LL.3, respLev = c(0.5), type = "absolute") # Now this works and is the same as we got before with response multiplied by 100

Estimated effective doses

Estimate Std. Error
e:1:0.5 3.30154 0.20104

关于r - 使用 drc 包计算绝对 EC50 值时出现 "NaNs produced"警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59975512/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com