我一直在尝试将非线性回归线拟合到我的标准曲线中。然而,我得到了以下错误:
主要的问题是,对于线性回归线,我可以使用一个简单的命令,比如:
stat_cor(label.y = c(825),
label.x = c(0.88),
aes(label = paste(..rr.label.., ..p.label.., sep = "~`,`~")))+
stat_regline_equation(label.x=0.88, label.y=750)+
出现了具有a
和b
值的线性回归线的方程。在这种情况下,使用以下内容后:
stat_smooth(method= "nlm",
formula = y~a*x/(b+x),
method.args = list( start = c(a = 3.8, b = 1457.2)),
se=FALSE)+
我得到了上面的错误。你可能会问我从哪里得到a
和b
的值?我从得到的
nls(y~a*x/(b+x))
这表明:
我不知道我在哪里犯错误。
这是我的图形的全部代码
library(tidyverse)
library(tidyr)
library(dplyr)
library(readr)
library(ggplot2)
library(ggpubr)
ggplot(data = STD, aes(x = Absorbance, y = STD)) +
labs(title = "Quantifying PGD2 in cell culture lysates and its enzymatic reactions ",
caption = "PGD2 ELISA")+
geom_point(colour = "#69b3a2")+
stat_smooth(method= "nlm",
formula = y~a*x/(b+x),
method.args = list( start = c(a = 3.8, b = 1457.2)),
se=FALSE)+
xlab(expression(paste("%B/"~B[0])))+
ylab(expression(paste("Prostaglandin"~ D[2], ~~ " MOX Concentration (pg/ml) ")))+
theme(plot.background = element_rect(fill = "transparent"),
panel.background = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.line = element_line(colour = "black"))+
theme(legend.spacing.y = unit(0.01, "cm"))+
theme(legend.position = c(0.77, .91),
legend.background = element_rect(colour = NA, fill = NA))+
theme(plot.title = element_text(size = 12, face = "bold.italic"),
plot.caption = element_text(hjust = 0))
这给出了以下结果
这是DataUsed
所以,我想我已经找到了解决问题的方法。我安装了install.packages(drc)
,其中包含四参数函数。我设置了我的数据model <- drm(STD ~ Absorbance, fct = LL.4(), data = STD)
,然后是plot(model)
,我得到了
我知道这需要一些改变才能让它看起来更专业,但这只是一件装饰性的事情,我应该做得很好。谢谢@stefan抽出时间。