How to create a (total) Ghrelin calibration curve?
- Version 8
- by (unknown)
- Version 9
- 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 | ||||
6 | 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. | |||
7 | The R code is attached below. | |||
8 | ||||
9 | The example assumes the data to be available in file "ghrelin_conc std_a std_b avg.csv" | |||
10 | ||||
11 | The measured data: | |||
12 | - | {|
|
+ | |
13 | - | ! Ghrelin (ng/ml) |
+ | {| border="1" class="sortable"
|
14 | + | !Ghrelin (ng/ml)!!Standard a!!Standard b
|
||
15 | |- | |||
16 | - | | 1000000 || -0.040596823 || -0.052699697
|
+ | |1000000||-0.040596823||-0.052699697
|
17 | |- | |||
18 | - | | 100000 || 0.136105144 || 0.119766263
|
+ | |100000||0.136105144||0.119766263
|
19 | |- | |||
20 | - | | 10000 || 0.61356354 || 0.606906959
|
+ | |10000||0.61356354||0.606906959
|
21 | |- | |||
22 | - | | 1000 || 0.846543873 || 0.839887292
|
+ | |1000||0.846543873||0.839887292
|
23 | |- | |||
24 | - | | 100 || 0.887693646 || 0.88345764
|
+ | |100||0.887693646||0.88345764
|
25 | |- | |||
26 | - | | 0 || 0.896770802 || 0.896165658
|
+ | |0||0.896770802||0.896165658
|
27 | |} | |||
28 | - | |||
29 | ||||
30 | {{{ | |||
31 | ||||
32 | ##### Install libraries | |||
33 | install.packages("drc") | |||
34 | install.packages("sfsmisc") | |||
35 | require(drc) | |||
36 | library(sfsmisc) | |||
37 | ||||
38 | ##### Read the data | |||
39 | hormone.data <- read.csv("ghrelin_conc std_a std_b avg.csv") | |||
40 | hormone.data <- hormone.data[,1:3] | |||
41 | colnames(hormone.data)[1:3] <- c("Concentration","Response_1", "Response_2") | |||
42 | ||||
43 | ##### Reorganize the data | |||
44 | hormone.data <- reshape(hormone.data, varying=c("Response_1","Response_2"), direction="long", v.names=c("Response")) | |||
45 | hormone.data <- hormone.data[,c("Concentration", "Response")] | |||
46 | ||||
47 | ##### Fitting the model (4-parameter log-logistic function) | |||
48 | hormone.data.model <- drm(Response ~ Concentration, data = hormone.data, fct = LL.4()) | |||
49 | summary(hormone.data.model) | |||
50 | ||||
51 | }}} | |||
52 | ||||
53 | The calibration curve can be plotted using the commands below: | |||
54 | ||||
55 | {{{ | |||
56 | ##### Plotting a nice plot | |||
57 | par(pty="s", mar=c(5,5,1,1)) | |||
58 | plot(hormone.data.model, type="confidence", cex.lab=2, axes=F, xlim=c(-10,10^6)) | |||
59 | axis(side=1, at=hormone.data[1:6,1], labels=pretty10exp(hormone.data[1:6,1]), cex.axis=1.2) | |||
60 | axis(side=2, at=seq(0,1,0.2), labels=seq(0,1,0.2)) | |||
61 | plot(hormone.data.model, type="all", add=T, pch=21, col="red", lwd=1, cex=2, bg="green") | |||
62 | }}} | |||
63 | ||||
64 | ||||
65 | ||||
66 | ||||
67 | ##### Computing the concentration from the response, for instance for a response=0.1, and alpha=1-0.95 | |||
68 | ED(hormone.data.model, respLev=0.1, interval="delta", type="absolute", level=0.95) |