How to create a (total) Ghrelin calibration curve?
- Version 10
- by (unknown)
- Version 23
- by (unknown)
Deletions or items before changed
Additions or items after changed
1 | == Computing Ghrelin calibration curve using R == | |||
---|---|---|---|---|
2 | - | ||cell1||cell2||
|
||
3 | - | ||cell3||cell4||
|
||
4 | ||||
5 | + | ===This article describes creating calibration curve, and measuring the total-ghrelin concentration ===
|
||
6 | ||||
7 | The calibration curve can be created using R, and libracy "drc". Optionally, one can use library "sfmisc" for formatting of the labels on plot axis. | |||
8 | + | |||
9 | + | We will assume a 4-parameter log-logistic model:
|
||
10 | + | |||
11 | + | [[Image(LL4.png, 300px)]]
|
||
12 | + | |||
13 | The R code is attached below. | |||
14 | ||||
15 | The example assumes the data to be available in file "ghrelin_conc std_a std_b avg.csv" | |||
16 | ||||
17 | The measured data: | |||
18 | ||||
19 | - | || |
+ | || '''Ghrelin (ng/ml)''' || '''Standard a''' || '''Standard b''' ||
|
20 | - | + | || 1000000 ||-0.040596823||-0.052699697 ||
|
|
21 | - | | |
+ | || 100000 ||0.136105144||0.119766263 ||
|
22 | - | |1000000||-0.040596823||-0.052699697
|
+ | || 10000 ||0.61356354||0.606906959 ||
|
23 | - | | |
+ | || 1000 ||0.846543873||0.839887292 ||
|
24 | - | |100000||0.136105144||0.119766263
|
+ | || 100 ||0.887693646||0.88345764 ||
|
25 | - | | |
+ | ||0||0.896770802||0.896165658 ||
|
26 | - | |10000||0.61356354||0.606906959
|
+ | |
27 | - | | |
+ | |
28 | - | |1000||0.846543873||0.839887292
|
+ | |
29 | - | | |
+ | |
30 | - | |100||0.887693646||0.88345764
|
+ | |
31 | - | | |
+ | |
32 | - | |0||0.896770802||0.896165658
|
+ | |
33 | - | ||
|
+ | |
34 | ||||
35 | {{{ | |||
36 | ||||
37 | ##### Install libraries | |||
38 | install.packages("drc") | |||
39 | install.packages("sfsmisc") | |||
40 | require(drc) | |||
41 | library(sfsmisc) | |||
42 | ||||
43 | ##### Read the data | |||
44 | hormone.data <- read.csv("ghrelin_conc std_a std_b avg.csv") | |||
45 | hormone.data <- hormone.data[,1:3] | |||
46 | colnames(hormone.data)[1:3] <- c("Concentration","Response_1", "Response_2") | |||
47 | ||||
48 | ##### Reorganize the data | |||
49 | hormone.data <- reshape(hormone.data, varying=c("Response_1","Response_2"), direction="long", v.names=c("Response")) | |||
50 | hormone.data <- hormone.data[,c("Concentration", "Response")] | |||
51 | ||||
52 | ##### Fitting the model (4-parameter log-logistic function) | |||
53 | hormone.data.model <- drm(Response ~ Concentration, data = hormone.data, fct = LL.4()) | |||
54 | summary(hormone.data.model) | |||
55 | ||||
56 | + | }}}
|
||
57 | + | |||
58 | + | The resultant parameters of a log-logistic equation are:
|
||
59 | + | |||
60 | + | {{{
|
||
61 | + | Model fitted: Log-logistic (ED50 as parameter) (4 parms)
|
||
62 | + | Parameter estimates:
|
||
63 | + | Estimate Std. Error t-value p-value
|
||
64 | + | b:(Intercept) 9.5057e-01 2.2294e-02 4.2638e+01 0
|
||
65 | + | c:(Intercept) -7.6010e-02 6.9075e-03 -1.1004e+01 0
|
||
66 | + | d:(Intercept) 8.9163e-01 3.3216e-03 2.6843e+02 0
|
||
67 | + | e:(Intercept) 2.5221e+04 7.7727e+02 3.2448e+01 0
|
||
68 | }}} | |||
69 | ||||
70 | The calibration curve can be plotted using the commands below: | |||
71 | ||||
72 | {{{ | |||
73 | ##### Plotting a nice plot | |||
74 | par(pty="s", mar=c(5,5,1,1)) | |||
75 | plot(hormone.data.model, type="confidence", cex.lab=2, axes=F, xlim=c(-10,10^6)) | |||
76 | axis(side=1, at=hormone.data[1:6,1], labels=pretty10exp(hormone.data[1:6,1]), cex.axis=1.2) | |||
77 | axis(side=2, at=seq(0,1,0.2), labels=seq(0,1,0.2)) | |||
78 | plot(hormone.data.model, type="all", add=T, pch=21, col="red", lwd=1, cex=2, bg="green") | |||
79 | }}} | |||
80 | ||||
81 | + | [[Image(Ghrelin.png)]]
|
||
82 | ||||
83 | + | The parameters of the eqution can be plugged into the formula below (an inverse of the model), and used in Excel, or other spreadsheet program.
|
||
84 | ||||
85 | + | [[Image(LL4-inv.png, 230px)]]
|
||
86 | ||||
87 | + | However, the concentration can be also easily estimated in R using "ED" function of the "drc" library. The code below demonstrates the concentration estimated from the response of 0.1, assuming alpha=0.05. The code returns the estimation, the error, and the condfidence interval.
|
||
88 | + | |||
89 | + | {{{
|
||
90 | ##### Computing the concentration from the response, for instance for a response=0.1, and alpha=1-0.95 | |||
91 | - | ED(hormone.data.model, respLev=0.1, interval="delta", type="absolute", level=0.95) |
+ | ED(hormone.data.model, respLev=0.1, interval="delta", type="absolute", level=0.95)
|
92 | + | }}} |