Search code examples
interpolationdrc

Interpolations misalign with plotted curve from which they are derived from (drc package)


I am trying to determine the amount of protein (TIMP) against a four-parametric curve of od (optical density) vs. TIMP.

The issue here lies in that when I plot the interpolations on top of the same standard curve from which they were derived from (image), they do not align.

Misalligned interpolations-curve Has any one any suggestions, please?

Thank you.

##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")

Solution

  • I think the problem here is that in order to perform interpolations you need the inverse function of your LL.4 curve. Presently you are using the predict function which takes a x-axis value (TIMP) and predicts a y-value result (od). You are feeding predict() od values, which isn't what is intended.

    The function you are looking for to take y-axis values and convert them to x-axis value using the fitted function is drc.ED().

    If I replace one section of your code and use the ED function, it works as expected. if you still want error intervals, ED can provide that as well -- just look up the function documentation. Note that ED expects a percentage value as input and the extra math in that function is to convert the sample od to a percentage scale using the top & bottom limits of your fitted curve

    ##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##
    

    enter image description here