[R] modelling 4-parameter curve in R does not match data - how to proceed?
Luigi Marongiu
m@rong|u@|u|g| @end|ng |rom gm@||@com
Wed Mar 17 10:41:03 CET 2021
Hello,
I have a dataset from a polymerase chain reaction. I am using the
equation given by Rutledge
(https://pubmed.ncbi.nlm.nih.gov/15601990/) but the profile I get in R
does not match the data. I ran the same thing in Desmos and instead
the profile is correct (attached).
Why do I not get the same matching model as in Desmos? I believe the
formula in R is the same as the one in Desmos, and I am using the same
parameters.
Is there a procedure to debug models?
Thanks
Here is the code:
```
high <- c(120.64, 66.14, 34.87, 27.11, 8.87, -5.8, 4.52, -7.16, -17.39,
-14.29, -20.26, -14.99, -21.05, -20.64, -8.03, -21.56, -1.28, 15.01,
75.26, 191.76, 455.09, 985.96, 1825.59, 2908.08, 3993.18, 5059.94,
6071.93, 6986.32, 7796.01, 8502.25, 9111.46, 9638.01, 10077.19,
10452.02, 10751.81, 11017.49, 11240.37, 11427.47, 11570.07, 11684.96,
11781.77, 11863.35, 11927.44, 11980.81, 12021.88)
plot(1:45, high, type = "l")
rutledge <- function(p, x) {
m = p$half_fluorescence
s = p$slope
M = p$max_fluorescence
B = p$back_fluorescence
y = (M / ( 1 + exp(-(x-m)/s)) ) + B
return(y)
}
desmos <- rutledge(list(half_fluorescence = 27.1102, slope = 2.76798,
max_fluorescence = 11839.8, back_fluorescence
= -138.864) , high)
points(1:45, desmos, type="l", col="blue")
```
--
Best regards,
Luigi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: model.png
Type: image/png
Size: 74299 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20210317/f9a5d1d5/attachment.png>
More information about the R-help
mailing list