剂量-效应曲线,ED50

huangapple go评论82阅读模式
英文:

Dose-response curve, ED50

问题

I used the following code to plot the dose-response curve and display the ED50 value. However, the ED50 value was displayed at a value other than 50 on the y-axis. I used the ED function to find the ED50 value, but why am I getting these results? Is there a way to plot the graph correctly?

library(drc)
library(tidyverse)

response_diuron <- as.numeric(c("6.666667", "10", "20", "23.33333", "100", "100"))
diuron <- as.numeric(c("0", "100", "500", "1000", "5000", "10000"))
df <- data.frame(diuron, response_diuron)
D <- drm(response_diuron ~ diuron, data = df, fct = LL.4())
newdat <- expand.grid(diuron = exp(seq(log(0.5), log(10000), length = 500)))
pm <- predict(D, newdata = newdat, interval = "confidence")
newdat$p <- pm[, 1]
newdat$pmin <- pm[, 2]
newdat$pmax <- pm[, 3]

df$diuron0 <- df$diuron
df$diuron0[df$diuron0 == 0] <- 0.5

ed50 <- ED(D, 50, logBase = exp(1), interval = "delta")
coefs <- setNames(coef(D), c("b", "c", "d", "e"))
y50 <- predict(D, newdata = data.frame(diuron = coefs["e"]))

ggplot(df, aes(x = diuron0, y = response_diuron)) +
  geom_point(shape = 21, size = 3, stroke = 1, colour = "#3C6255") +
  geom_line(data = newdat, aes(x = diuron, y = p), lwd = 1, color = "#3C6255") +
  coord_trans(x = "log") +
  geom_segment(aes(x = coefs["e"], y = 0, xend = coefs["e"], yend = y50),
    lty = 2, colour = "gray50"
  ) +
  geom_segment(aes(x = coefs["e"], y = y50, xend = 0, yend = y50),
    lty = 2, colour = "gray50"
  ) +
  scale_x_log10(
    limits = c(100, 10000), breaks = c(100, 500, 1000, 1780, 5000, 10000),
    labels = c(100, 500, 1000, 1780, 5000, 10000)
  ) +
  ggtitle("Diuron") +
  xlab("Diuron (ug/L)") +
  ylab("Mortality (%)") +
  theme(axis.text.x = element_text(angle = 90)) +
  theme_classic()
英文:

I used the following code to plot the dose-response curve and display the ED50 value. However, the ED50 value was displayed at a value other than 50 on the y-axis. I used the ED function to find the ED50 value, but why am I getting these results? Is there a way to plot the graph correctly?

library(drc)
library(tidyverse)
response_diuron <- as.numeric(c("6.666667", "10", "20", "23.33333", "100", "100"))
diuron <- as.numeric(c("0", "100", "500", "1000", "5000", "10000"))
df <- data.frame(diuron, response_diuron)
D <- drm(response_diuron ~ diuron, data = df, fct = LL.4())
newdat <- expand.grid(diuron = exp(seq(log(0.5), log(10000), length = 500)))
pm <- predict(D, newdata = newdat, interval = "confidence")
newdat$p <- pm[, 1]
newdat$pmin <- pm[, 2]
newdat$pmax <- pm[, 3]
df$diuron0 <- df$diuron
df$diuron0[df$diuron0 == 0] <- 0.5
ed50 <- ED(D, 50, logBase = exp(1), interval = "delta")
coefs <- setNames(coef(D), c("b", "c", "d", "e"))
y50 <- predict(D, newdata = data.frame(diuron = coefs["e"]))
ggplot(df, aes(x = diuron0, y = response_diuron)) +
geom_point(shape = 21, size = 3, stroke = 1, colour = "#3C6255") +
geom_line(data = newdat, aes(x = diuron, y = p), lwd = 1, color = "#3C6255") +
coord_trans(x = "log") +
geom_segment(aes(x = coefs["e"], y = 0, xend = coefs["e"], yend = y50),
lty = 2, colour = "gray50"
) +
geom_segment(aes(x = coefs["e"], y = y50, xend = 0, yend = y50),
lty = 2, colour = "gray50"
) +
scale_x_log10(
limits = c(100, 10000), breaks = c(100, 500, 1000, 1780, 5000, 10000),
labels = c(100, 500, 1000, 1780, 5000, 10000)
) +
ggtitle("Diuron") +
xlab("Diuron (ug/L)") +
ylab("Mortality (%)") +
theme(axis.text.x = element_text(angle = 90)) +
theme_classic()

答案1

得分: 1

I have checked your code, the parameter given in geom_segment() (both the horizontal and vertical lines) is y50, which has a value of 56.6. That's why the value is not displayed as 50 on the y-axis.

Edit 15 June 2023:

With reference to this post (https://stackoverflow.com/questions/57568882/wrong-ed50-with-dose-response-model-using-drm), I have edited your code to get the intended results. As I am not familiar with pharmacology, I am not entirely sure of what the numbers represent though, i.e., whether they really refer to the number that you are looking for that makes scientific sense.

ed50 <- ED(D, 50, type = "absolute", interval = "delta")
coefs <- setNames(ed50[1], "e")
y50 <- predict(D, newdata = data.frame(diuron = ed50))

ggplot(df, aes(x = diuron0, y = response_diuron)) +
geom_point(shape = 21, size = 3, stroke = 1, colour = "#3C6255") +
geom_line(data = newdat, aes(x = diuron, y = p), lwd = 1, color = "#3C6255") +
coord_trans(x = "log") +
geom_segment(aes(x = coefs["e"], y = 0, xend = coefs["e"], yend = y50),
lty = 2, colour = "gray50"
) +
geom_segment(aes(x = coefs["e"], y = y50, xend = 0, yend = y50),
lty = 2, colour = "gray50"
) +
scale_x_log10(
limits = c(100, 10000), breaks = c(100, 500, 1000, round(coefs["e"]), 5000, 10000),
labels = c(100, 500, 1000, round(coefs["e"]), 5000, 10000)
) +
ggtitle("Diuron") +
xlab("Diuron (ug/L)") +
ylab("Mortality (%)") +
theme(axis.text.x = element_text(angle = 90)) +
theme_classic()

英文:

I have checked your code, the parameter given in geom_segment() (both the horizontal and vertical lines) is y50, which has a value of 56.6. That's why the value is not displayed as 50 on the y-axis.

Edit 15 June 2023:

With reference to this post (https://stackoverflow.com/questions/57568882/wrong-ed50-with-dose-response-model-using-drm), I have edited your code to get the intended results. As I am not familiar with pharmacology, I am not entirely sure of what the numbers represent though, i.e., whether they really refer to the number that you are looking for that makes scientific sense.

ed50 &lt;- ED(D, 50, type = &quot;absolute&quot;, interval = &quot;delta&quot;)
coefs &lt;- setNames(ed50[1], &quot;e&quot;)
y50 &lt;- predict(D, newdata = data.frame(diuron = ed50))
ggplot(df, aes(x = diuron0, y = response_diuron)) +
geom_point(shape = 21, size = 3, stroke = 1, colour = &quot;#3C6255&quot;) +
geom_line(data = newdat, aes(x = diuron, y = p), lwd = 1, color = &quot;#3C6255&quot;) +
coord_trans(x = &quot;log&quot;) +
geom_segment(aes(x = coefs[&quot;e&quot;], y = 0, xend = coefs[&quot;e&quot;], yend = y50),
lty = 2, colour = &quot;gray50&quot;
) +
geom_segment(aes(x = coefs[&quot;e&quot;], y = y50, xend = 0, yend = y50),
lty = 2, colour = &quot;gray50&quot;
) +
scale_x_log10(
limits = c(100, 10000), breaks = c(100, 500, 1000, round(coefs[&quot;e&quot;]), 5000, 10000),
labels = c(100, 500, 1000, round(coefs[&quot;e&quot;]), 5000, 10000)
) +
ggtitle(&quot;Diuron&quot;) +
xlab(&quot;Diuron (ug/L)&quot;) +
ylab(&quot;Mortality (%)&quot;) +
theme(axis.text.x = element_text(angle = 90)) +
theme_classic()

huangapple
  • 本文由 发表于 2023年6月13日 17:09:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/76463326.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定