Monday, 7 April 2014

Analysing some of Jack's data in R....

Put data into columns in Excel.

Save as in comma separated (CSV) format.

> jack = read.csv("JackELISAdata.csv", header=TRUE)
> jack
   Sample_ID P50_NTL P50_40L p50_Fold_Increase P65_NTL
1          2    0.73   3.600              4.94    0.08
2          4    1.21   2.910              2.41    0.82
3          5    0.74   3.024              4.06    0.27
4          7    0.77   2.989              3.89    0.43
5          6    0.95   3.314              3.47    0.50
6          8    1.37   3.422              2.49    0.94
7          9    0.95   3.259              3.42    0.18
8         10    1.33   3.751              2.82    0.41
9         11    1.49   3.191              2.14    0.77
10        12    1.41   3.347              2.38    0.35
11        13    1.63   3.855              2.36    0.50
12        14    0.95   3.034              3.18    0.29
13        NA      NA      NA                NA      NA
14        NA      NA      NA                NA      NA
   P65_40L p65_Fold_Increase
1     4.18             52.85
2     3.49              4.28
3     2.77             10.21
4     2.97              6.98
5     3.88              7.83
6     3.35              3.55
7     2.26             12.88
8     4.20             10.29
9     4.20              5.43
10    4.08             11.67
11    4.31              8.69
12    2.86              9.99
13      NA                NA
14      NA                NA

> summary(jack)
   Sample_ID         P50_NTL         P50_40L     
 Min.   : 2.000   Min.   :0.730   Min.   :2.910  
 1st Qu.: 5.750   1st Qu.:0.905   1st Qu.:3.031  
 Median : 8.500   Median :1.080   Median :3.287  
 Mean   : 8.417   Mean   :1.127   Mean   :3.308  
 3rd Qu.:11.250   3rd Qu.:1.380   3rd Qu.:3.466  
 Max.   :14.000   Max.   :1.630   Max.   :3.855  
 NA's   :2        NA's   :2       NA's   :2      
 p50_Fold_Increase    P65_NTL          P65_40L     
 Min.   :2.140     Min.   :0.0800   Min.   :2.260  
 1st Qu.:2.402     1st Qu.:0.2850   1st Qu.:2.942  
 Median :3.000     Median :0.4200   Median :3.685  
 Mean   :3.130     Mean   :0.4617   Mean   :3.546  
 3rd Qu.:3.575     3rd Qu.:0.5675   3rd Qu.:4.185  
 Max.   :4.940     Max.   :0.9400   Max.   :4.310  
 NA's   :2         NA's   :2        NA's   :2      
 p65_Fold_Increase
 Min.   : 3.550   
 1st Qu.: 6.593   
 Median : 9.340   
 Mean   :12.054   
 3rd Qu.:10.635   
 Max.   :52.850   
 NA's   :2        

> plot(jack$P50_NTL)
> plot(jack$P50_NTL~jack$P65_NTL)
> hist(jack$P50_NTL)
> plot(jack$P50_NTL~jack$P65_NTL)
> plot(jack$P50_40L~jack$P65_40L)
> plot(jack$P50_NTL~jack$P50_40L)
> plot(jack)
> plot(jack$P50_NTL~jack$P50_40L)



Adding a line that is fitted properly.
>  abline(lm(jack$P50_NTL~jack$P50_40L))

> results = lm(jack$P50_NTL~jack$P50_40L)
> summary(results)

Call:
lm(formula = jack$P50_NTL ~ jack$P50_40L)

Residuals:
     Min       1Q   Median       3Q      Max 
-0.53743 -0.18644 -0.02799  0.24623  0.41857 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)
(Intercept)   -0.4577     0.9636  -0.475    0.645
jack$P50_40L   0.4792     0.2902   1.652    0.130

Residual standard error: 0.2941 on 10 degrees of freedom
  (2 observations deleted due to missingness)
Multiple R-squared:  0.2143, Adjusted R-squared:  0.1357 
F-statistic: 2.728 on 1 and 10 DF,  p-value: 0.1296

> plot(jack)
> plot(jack$P50_NTL~jack$P65_NTL)




> results = lm(jack$P50_NTL~jack$P65_NTL)
> summary(results)

Call:
lm(formula = jack$P50_NTL ~ jack$P65_NTL)

Residuals:
    Min      1Q  Median      3Q     Max 
-0.3348 -0.1816 -0.0772  0.1663  0.4751 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept)    0.7972     0.1606   4.965 0.000566 ***
jack$P65_NTL   0.7154     0.3052   2.344 0.041079 *  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.2666 on 10 degrees of freedom
  (2 observations deleted due to missingness)
Multiple R-squared:  0.3545, Adjusted R-squared:   0.29 
F-statistic: 5.493 on 1 and 10 DF,  p-value: 0.04108




> plot(jack$P50_40L~jack$P65_40L)
> results = lm(jack$P50_40L~jack$P65_40L)
> summary(results)

Call:
lm(formula = jack$P50_40L ~ jack$P65_40L)

Residuals:
     Min       1Q   Median       3Q      Max 
-0.38237 -0.12235 -0.07443  0.19158  0.33310 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept)    2.3155     0.3854   6.008 0.000131 ***
jack$P65_40L   0.2799     0.1068   2.621 0.025574 *  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.2468 on 10 degrees of freedom
  (2 observations deleted due to missingness)
Multiple R-squared:  0.4071, Adjusted R-squared:  0.3478 
F-statistic: 6.867 on 1 and 10 DF,  p-value: 0.02557

> plot(jack$P50_NTL~jack$P65_NTL)
> plot(jack$P50_40L~jack$P65_40L)
> jack
   Sample_ID P50_NTL P50_40L p50_Fold_Increase P65_NTL P65_40L
1          2    0.73   3.600              4.94    0.08    4.18
2          4    1.21   2.910              2.41    0.82    3.49
3          5    0.74   3.024              4.06    0.27    2.77
4          7    0.77   2.989              3.89    0.43    2.97
5          6    0.95   3.314              3.47    0.50    3.88
6          8    1.37   3.422              2.49    0.94    3.35
7          9    0.95   3.259              3.42    0.18    2.26
8         10    1.33   3.751              2.82    0.41    4.20
9         11    1.49   3.191              2.14    0.77    4.20
10        12    1.41   3.347              2.38    0.35    4.08
11        13    1.63   3.855              2.36    0.50    4.31
12        14    0.95   3.034              3.18    0.29    2.86
13        NA      NA      NA                NA      NA      NA
14        NA      NA      NA                NA      NA      NA
   p65_Fold_Increase
1              52.85
2               4.28
3              10.21
4               6.98
5               7.83
6               3.55
7              12.88
8              10.29
9               5.43
10             11.67
11              8.69
12              9.99
13                NA
14                NA


> plot(jack$p50_Fold_Increase~jack$p65_Fold_Increase)
> results = lm(jack$p50_Fold_Increase~jack$p65_Fold_Increase)
> summary(results)

Call:
lm(formula = jack$p50_Fold_Increase ~ jack$p65_Fold_Increase)

Residuals:
    Min      1Q  Median      3Q     Max 
-0.7323 -0.4247 -0.1503  0.3226  1.0151 

Coefficients:
                       Estimate Std. Error t value Pr(>|t|)    
(Intercept)             2.57393    0.25326  10.163 1.37e-06 ***
jack$p65_Fold_Increase  0.04613    0.01452   3.177  0.00987 ** 
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.6341 on 10 degrees of freedom
  (2 observations deleted due to missingness)
Multiple R-squared:  0.5023, Adjusted R-squared:  0.4526 
F-statistic: 10.09 on 1 and 10 DF,  p-value: 0.009867

> abline(lm(jack$p50_Fold_Increase~jack$p65_Fold_Increase))


Not a great line but it would seem to be significant!!! IRONY


> plot(jack)



1 comment: