插值与从中得出的绘制曲线不对齐(drc 包)
Interpolations misalign with plotted curve from which they are derived from (drc package)
我正在尝试根据 od(光密度)与 TIMP 的四参数曲线确定蛋白质 (TIMP) 的量。
这里的问题在于,当我在相同的标准曲线上绘制插值时(图片),它们没有对齐。
Misalligned interpolations-curve
请问大家有什么建议吗?
谢谢。
##STANDARDS##
standards <- structure(list(con = c(0, 0, 0.156, 0.156, 0.313, 0.313, 0.625,
0.625, 1.25, 1.25, 2.5, 2.5, 5, 5, 10, 10), od = c(-0.00685,
0.00685, 0.05815, 0.03115, 0.12765, 0.09485, 0.25565, 0.25095,
0.46445, 0.46025, 0.88975, 0.85755, 1.46505, 1.47125, 2.26535,
2.26825)), .Names = c("con", "od"), row.names = c(NA, -16L), class = "data.frame")
##SAMPLES##
samples <- structure(list(od = c(0.47245, 0.47575, 0.39635, 0.37135, 0.47035,
0.33475, 0.39015, 0.59625, 0.46845, 0.45445, 0.53675, 0.51535,
0.64445, 0.57795, 0.56465, 0.44885, 0.22765, 0.53815, 0.71625,
0.38825, 0.56725, 0.61435, 0.42545, 0.47425, 0.70235, 0.63505,
0.44465, 0.60505, 0.59225, 0.57745, 0.57045, 0.60595, 0.62535,
0.66605, 0.60975, 0.53545, 0.56875, 0.54615, 0.67745, 0.57335,
0.55105, 0.71065, 0.55485, 0.50155, 0.71855, 0.52895, 0.62795,
0.54925, 0.66415, 0.58685, 0.59635, 0.70295, 0.64475, 0.61755,
0.90005, 0.53665, 0.52895, 0.60235, 0.61115, 0.59805, 0.67595,
0.61325, 0.50865, 0.74375, 0.46195, 0.55665, 0.60625, 0.64635,
0.62795, 0.76855, 0.57335, 0.54755, 0.62415, 0.67895, 0.68035,
0.78525, 0.49425, 0.62505, 0.59085, 0.58355)), .Names = "od", row.names = c(NA,
80L), class = "data.frame")
##MODELFOUR-PARAMTERIC CURVE##
library("drc")
fourpl <- drm(od~con,data=standards,fct=LL.4(names=c("Slope","Lower limit","Upper limit","ED50")))
##INTERPOLATE SAMPLES FROM FOUR-PARAMETRIC CURVE##
interpol <- cbind(samples,predict(fourpl,
samples,
se.fit=FALSE,
interval="confidence",
level=0.95,
na.action=na.pass,
od=FALSE)) #SUCCESS#
colnames(interpol) <-c("od","TIMP","lower","upper")
##PLOT FOUR-PARAMETRIC CURVE AND INTEPROALTIONS##
plot(fourpl,
log="x",
xlab="TIMP1 (ng mL-2)",
ylab="Optical density")
points(interpol$TIMP,interpol$od,col="blue")
我认为这里的问题是,为了执行插值,您需要 LL.4 曲线的反函数。目前,您正在使用预测函数,该函数采用 x 轴值 (TIMP) 并预测 y 值结果 (od)。您正在提供 predict() od 值,这不是预期的。
您正在寻找的函数是 drc.ED()。
如果我替换你的代码的一部分并使用 ED 函数,它会按预期工作。如果您仍然需要错误间隔,ED 也可以提供——只需查看函数文档即可。请注意,ED 需要一个百分比值作为输入,并且该函数中的额外数学是使用拟合曲线的上限和下限将样本 od 转换为百分比刻度
##INTERPOLATE SAMPLES FROM FOUR-PARAMETRIC CURVE##
interpol <- cbind(samples,ED(fourpl,(samples$od-coef(fourpl)[2])/coef(fourpl)[3]*100))
colnames(interpol) <-c("od","TIMP")
##PLOT FOUR-PARAMETRIC CURVE AND INTEPROALTIONS##
我正在尝试根据 od(光密度)与 TIMP 的四参数曲线确定蛋白质 (TIMP) 的量。
这里的问题在于,当我在相同的标准曲线上绘制插值时(图片),它们没有对齐。
Misalligned interpolations-curve 请问大家有什么建议吗?
谢谢。
##STANDARDS##
standards <- structure(list(con = c(0, 0, 0.156, 0.156, 0.313, 0.313, 0.625,
0.625, 1.25, 1.25, 2.5, 2.5, 5, 5, 10, 10), od = c(-0.00685,
0.00685, 0.05815, 0.03115, 0.12765, 0.09485, 0.25565, 0.25095,
0.46445, 0.46025, 0.88975, 0.85755, 1.46505, 1.47125, 2.26535,
2.26825)), .Names = c("con", "od"), row.names = c(NA, -16L), class = "data.frame")
##SAMPLES##
samples <- structure(list(od = c(0.47245, 0.47575, 0.39635, 0.37135, 0.47035,
0.33475, 0.39015, 0.59625, 0.46845, 0.45445, 0.53675, 0.51535,
0.64445, 0.57795, 0.56465, 0.44885, 0.22765, 0.53815, 0.71625,
0.38825, 0.56725, 0.61435, 0.42545, 0.47425, 0.70235, 0.63505,
0.44465, 0.60505, 0.59225, 0.57745, 0.57045, 0.60595, 0.62535,
0.66605, 0.60975, 0.53545, 0.56875, 0.54615, 0.67745, 0.57335,
0.55105, 0.71065, 0.55485, 0.50155, 0.71855, 0.52895, 0.62795,
0.54925, 0.66415, 0.58685, 0.59635, 0.70295, 0.64475, 0.61755,
0.90005, 0.53665, 0.52895, 0.60235, 0.61115, 0.59805, 0.67595,
0.61325, 0.50865, 0.74375, 0.46195, 0.55665, 0.60625, 0.64635,
0.62795, 0.76855, 0.57335, 0.54755, 0.62415, 0.67895, 0.68035,
0.78525, 0.49425, 0.62505, 0.59085, 0.58355)), .Names = "od", row.names = c(NA,
80L), class = "data.frame")
##MODELFOUR-PARAMTERIC CURVE##
library("drc")
fourpl <- drm(od~con,data=standards,fct=LL.4(names=c("Slope","Lower limit","Upper limit","ED50")))
##INTERPOLATE SAMPLES FROM FOUR-PARAMETRIC CURVE##
interpol <- cbind(samples,predict(fourpl,
samples,
se.fit=FALSE,
interval="confidence",
level=0.95,
na.action=na.pass,
od=FALSE)) #SUCCESS#
colnames(interpol) <-c("od","TIMP","lower","upper")
##PLOT FOUR-PARAMETRIC CURVE AND INTEPROALTIONS##
plot(fourpl,
log="x",
xlab="TIMP1 (ng mL-2)",
ylab="Optical density")
points(interpol$TIMP,interpol$od,col="blue")
我认为这里的问题是,为了执行插值,您需要 LL.4 曲线的反函数。目前,您正在使用预测函数,该函数采用 x 轴值 (TIMP) 并预测 y 值结果 (od)。您正在提供 predict() od 值,这不是预期的。
您正在寻找的函数是 drc.ED()。
如果我替换你的代码的一部分并使用 ED 函数,它会按预期工作。如果您仍然需要错误间隔,ED 也可以提供——只需查看函数文档即可。请注意,ED 需要一个百分比值作为输入,并且该函数中的额外数学是使用拟合曲线的上限和下限将样本 od 转换为百分比刻度
##INTERPOLATE SAMPLES FROM FOUR-PARAMETRIC CURVE##
interpol <- cbind(samples,ED(fourpl,(samples$od-coef(fourpl)[2])/coef(fourpl)[3]*100))
colnames(interpol) <-c("od","TIMP")
##PLOT FOUR-PARAMETRIC CURVE AND INTEPROALTIONS##