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