r - 使用 drc 包在 ggplot 中绘制剂量反应曲线时出错
问题描述
尝试使用 drc 包中的 ggplot 绘制剂量反应曲线时,我得到了一个半绘图图。我正在尝试遵循最近一篇关于剂量反应曲线的论文的补充信息中给出的程序。这是我的原始数据
请帮助我找到解决方案,谢谢!
# Fit a log-logistic model with lower and upper asymptotic limits fixed at respectively 0 and 100
mod.Pyr <- drm(gi ~ conc, data = my_data, fct = LL.4(fixed = c(NA, 0, 100, NA)))
# new dose levels as support for the line
newdata <- expand.grid(conc=exp(seq(log(0.5), log(3000), length=1000)))
# predictions and confidence intervals
pm <- predict(mod.Pyr, newdata=newdata, interval="confidence")
# new data with predictions
newdata$p <- pm[,1]
newdata$pmin <- pm[,2]
newdata$pmax <- pm[,3]
# need to shift conc == 0 a bit up, otherwise there are problems with coord_trans
my_data$conc0 <- my_data$conc
my_data$conc0[my_data$conc0 == 0] <- 0.5
# plotting the curve
ggplot(my_data, aes(x = conc0, y = gi)) +
geom_point() +
geom_ribbon(data=newdata, aes(x=conc, y=p, ymin=pmin, ymax=pmax), alpha=0.2) +
geom_line(data=newdata, aes(x=conc, y=p)) +
coord_trans(x="log") +
xlab("Concentration (mg/l)") + ylab("Growth inhibition")
解决方案
推荐阅读
- asp.net - Task Runner Explorer ASP.NET - 在严格模式之外尚不支持块范围声明
- swift - 使用 @escaping 处理程序调用异步函数时遇到问题
- redux - 尝试将 saveState 保存到 localStorage 时,我在商店中收到“不是函数”错误
- python - Python AES 加密程序返回内存错误
- java - 我们如何在Java中添加数组数字移位‽‽‽
- spring - 对 Spring mongoTemplate 的 Mongodb 查询
- python - 无法使用 Python Paramiko 执行带有重定向多行输入的 shell 命令
- angular - Angular HTML 模板 - 如何使用数字输入的当前值作为数组切片的上限?
- c - 为什么 C 语言既有逻辑运算符又有按位“或”运算符?
- assembly - 6502 randy hyde 子程序问题“JSR INCRTN”