Service as a Freelancer

If you want hire me as a freelancer please use the following links.

Introduction

This article explains how to compute the main descriptive statistics in R and how to present them graphically. To learn more about the reasoning behind each descriptive statistics, how to compute them by hand and how to interpret them. descriptive statistics (in the broad sense of the term) is a branch of statistics aiming at summarizing, describing and presenting a series of values or a dataset. Descriptive statistics is often the first step and an important part in any statistical analysis. It allows to check the quality of the data and it helps to "understand"" the data by having a clear overview of it. If well presented, descriptive statistics is already a good starting point for further analyses. There exists many measures to summarize a dataset. They are divided into two types:

  • location measures and
  • dispersion measures

Location measures give an understanding about the central tendency of the data, whereas dispersion measures give an understanding about the spread of the data.

Data

In this section, the aim is just showing the sample of data. How this data looks? What are the variables? How values in the variable looks? etc. Below is the preview of this data and its structure.

f <- read.xlsx("Data.xlsx",sheetIndex = 1,header = T)
f$Groups <- factor(f$Groups)
f$Groups.1 <- factor(f$Groups.1)
f$Material <- factor(f$Material)
f$Material.1 <- factor(f$Material.1)
head(f)
##    Groups Groups.1 Material Material.1 DE.0 DE.1  DE7 DE14     TP.0    TP.14
## 1 Control        1       CS          1 0.31 0.53 1.46 1.40 5.653053 6.540023
## 2 Control        1       CS          1 0.37 0.52 1.37 1.87 5.674346 7.200251
## 3 Control        1       CS          1 0.03 0.49 1.04 1.24 5.521978 5.860185
## 4 Control        1       CS          1 0.04 0.47 1.36 1.76 5.625432 5.966271
## 5 Control        1       CS          1 0.19 0.47 1.21 1.82 5.499675 8.995576
## 6 Control        1       CS          1 0.14 0.58 1.09 1.32 4.906897 6.457343
##   VHN.0 VHN.14
## 1  79.2   72.4
## 2  80.0   76.5
## 3  83.3   76.7
## 4  86.1   74.0
## 5  83.7   76.2
## 6  82.9   75.1
str(f)
## 'data.frame':    360 obs. of  12 variables:
##  $ Groups    : Factor w/ 3 levels "Control","Regular dentifrice",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ Groups.1  : Factor w/ 3 levels "1","2","3": 1 1 1 1 1 1 1 1 1 1 ...
##  $ Material  : Factor w/ 5 levels "CS","GB","RC",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ Material.1: Factor w/ 4 levels "1","2","3","4": 1 1 1 1 1 1 1 1 1 1 ...
##  $ DE.0      : num  0.31 0.37 0.03 0.04 0.19 0.14 0.19 0.34 0.23 0.31 ...
##  $ DE.1      : num  0.53 0.52 0.49 0.47 0.47 0.58 0.78 0.79 0.85 0.93 ...
##  $ DE7       : num  1.46 1.37 1.04 1.36 1.21 1.09 1.63 1.79 1.52 1.16 ...
##  $ DE14      : num  1.4 1.87 1.24 1.76 1.82 1.32 1.24 1.27 1.32 1.76 ...
##  $ TP.0      : num  5.65 5.67 5.52 5.63 5.5 ...
##  $ TP.14     : num  6.54 7.2 5.86 5.97 9 ...
##  $ VHN.0     : num  79.2 80 83.3 86.1 83.7 82.9 80.9 83.5 81.9 78.8 ...
##  $ VHN.14    : num  72.4 76.5 76.7 74 76.2 75.1 76.2 75.6 76.2 74.1 ...

There are 360 observations of 12 variables, representing the groups and material. There are 4 variables are factor variables (i.e., groups, group1, material and material1), while, other 8 variables are numeric. In addition, group variable have 3 levels of factor, while, material have 4.

Summary of the Data

In the summary, for each numeric varible, we have presented the minimum, maximum, mean, median, 1st quantile and 3rd quantile value. While, for each factor variable, we have presented number of observations for each factor.

summary(f)
##                   Groups    Groups.1 Material Material.1      DE.0      
##  Control             :120   1:120    CS :90   1:90       Min.   :0.030  
##  Regular dentifrice  :120   2:120    GB :90   2:90       1st Qu.:0.470  
##  Whitening dentifrice:120   3:120    RC :60   3:90       Median :0.825  
##                                      RC :30   4:90       Mean   :0.820  
##                                      VE :90              3rd Qu.:1.170  
##                                                          Max.   :1.840  
##                                                                         
##       DE.1             DE7             DE14            TP.0       
##  Min.   :0.3800   Min.   :0.550   Min.   :0.660   Min.   : 2.927  
##  1st Qu.:0.9975   1st Qu.:1.367   1st Qu.:1.760   1st Qu.: 6.671  
##  Median :1.4400   Median :1.995   Median :3.170   Median : 6.879  
##  Mean   :1.6821   Mean   :2.332   Mean   :3.161   Mean   : 7.016  
##  3rd Qu.:2.3850   3rd Qu.:3.342   3rd Qu.:4.237   3rd Qu.: 7.502  
##  Max.   :3.9700   Max.   :4.990   Max.   :6.610   Max.   :10.205  
##                                                   NA's   :296     
##      TP.14           VHN.0           VHN.14     
##  Min.   :3.094   Min.   : 78.8   Min.   : 72.1  
##  1st Qu.:5.381   1st Qu.:146.4   1st Qu.:128.3  
##  Median :6.137   Median :187.8   Median :170.4  
##  Mean   :6.279   Mean   :204.3   Mean   :176.4  
##  3rd Qu.:7.131   3rd Qu.:240.9   3rd Qu.:212.0  
##  Max.   :9.986   Max.   :369.5   Max.   :309.5  
##  NA's   :168     NA's   :300     NA's   :180

Minimum and Maximum

DE0 <- c("DE0",min(f$DE.0),max(f$DE.0))
DE1 <- c("DE1",min(f$DE.1),max(f$DE.1))
DE7 <- c("DE7",min(f$DE7),max(f$DE7))
DE14 <- c("DE14",min(f$DE14),max(f$DE14))
TP0 <- c("TP0",min(f$TP.0[complete.cases(f$TP.0)]),max(f$TP.0[complete.cases(f$TP.0)]))
TP14 <- c("TP15",min(f$TP.14[complete.cases(f$TP.14)]),max(f$TP.14[complete.cases(f$TP.14)]))
VHN0 <- c("VHN0",min(f$VHN.0[complete.cases(f$VHN.0)]),max(f$VHN.0[complete.cases(f$VHN.0)]))
VHN14 <- c("VHN14",min(f$VHN.14[complete.cases(f$VHN.14)]),max(f$VHN.14[complete.cases(f$VHN.14)]))

df <- data.frame(rbind(DE0,DE1,DE7,DE14,TP0,TP14,VHN0,VHN14))
colnames(df) <- c("Variable","Min Value", "Max Value")
kable(df,caption = "Minimum and Maximum value of each variable")
Minimum and Maximum value of each variable
Variable Min Value Max Value
DE0 DE0 0.03 1.84
DE1 DE1 0.38 3.97
DE7 DE7 0.55 4.99
DE14 DE14 0.66 6.61
TP0 TP0 2.92710909397343 10.2050177739622
TP14 TP15 3.09417792201952 9.98570391778946
VHN0 VHN0 78.8 369.5
VHN14 VHN14 72.1 309.5

Range of each variable

DE0 <- c("DE0",max(f$DE.0)-min(f$DE.0))
DE1 <- c("DE1",max(f$DE.1)-min(f$DE.1))
DE7 <- c("DE7",max(f$DE7)-min(f$DE7))
DE14 <- c("DE14",max(f$DE14)-min(f$DE14))
TP0 <- c("TP0",max(f$TP.0[complete.cases(f$TP.0)])-min(f$TP.0[complete.cases(f$TP.0)]))
TP14 <- c("TP15",max(f$TP.14[complete.cases(f$TP.14)])-min(f$TP.14[complete.cases(f$TP.14)]))
VHN0 <- c("VHN0",max(f$VHN.0[complete.cases(f$VHN.0)])-min(f$VHN.0[complete.cases(f$VHN.0)]))
VHN14 <- c("VHN14",max(f$VHN.14[complete.cases(f$VHN.14)])-min(f$VHN.14[complete.cases(f$VHN.14)]))

df <- data.frame(rbind(DE0,DE1,DE7,DE14,TP0,TP14,VHN0,VHN14))
colnames(df) <- c("Variable","Range")
kable(df,caption = "Range of each variable")
Range of each variable
Variable Range
DE0 DE0 1.81
DE1 DE1 3.59
DE7 DE7 4.44
DE14 DE14 5.95
TP0 TP0 7.2779086799888
TP14 TP15 6.89152599576994
VHN0 VHN0 290.7
VHN14 VHN14 237.4

Summary of Data by each group

by(f, f$Groups, summary)
## f$Groups: Control
##                   Groups    Groups.1 Material Material.1      DE.0      
##  Control             :120   1:120    CS :30   1:30       Min.   :0.030  
##  Regular dentifrice  :  0   2:  0    GB :30   2:30       1st Qu.:0.470  
##  Whitening dentifrice:  0   3:  0    RC :30   3:30       Median :0.825  
##                                      RC : 0   4:30       Mean   :0.820  
##                                      VE :30              3rd Qu.:1.170  
##                                                          Max.   :1.840  
##                                                                         
##       DE.1             DE7             DE14            TP.0       
##  Min.   :0.3800   Min.   :0.550   Min.   :0.660   Min.   : 2.927  
##  1st Qu.:0.8275   1st Qu.:1.090   1st Qu.:1.410   1st Qu.: 6.671  
##  Median :1.0000   Median :1.345   Median :1.730   Median : 6.879  
##  Mean   :1.0422   Mean   :1.413   Mean   :1.966   Mean   : 7.016  
##  3rd Qu.:1.1750   3rd Qu.:1.692   3rd Qu.:2.527   3rd Qu.: 7.502  
##  Max.   :1.9200   Max.   :2.830   Max.   :4.510   Max.   :10.205  
##                                                   NA's   :56      
##      TP.14           VHN.0           VHN.14     
##  Min.   :3.986   Min.   : 78.8   Min.   : 72.4  
##  1st Qu.:6.351   1st Qu.:146.4   1st Qu.:128.9  
##  Median :6.866   Median :187.8   Median :155.8  
##  Mean   :6.837   Mean   :204.3   Mean   :170.5  
##  3rd Qu.:7.381   3rd Qu.:240.9   3rd Qu.:193.6  
##  Max.   :8.996   Max.   :369.5   Max.   :304.2  
##  NA's   :56      NA's   :60      NA's   :60     
## ------------------------------------------------------------ 
## f$Groups: Regular dentifrice
##                   Groups    Groups.1 Material Material.1      DE.0      
##  Control             :  0   1:  0    CS :30   1:30       Min.   :0.030  
##  Regular dentifrice  :120   2:120    GB :30   2:30       1st Qu.:0.470  
##  Whitening dentifrice:  0   3:  0    RC :30   3:30       Median :0.825  
##                                      RC : 0   4:30       Mean   :0.820  
##                                      VE :30              3rd Qu.:1.170  
##                                                          Max.   :1.840  
##                                                                         
##       DE.1            DE7             DE14            TP.0         TP.14      
##  Min.   :0.380   Min.   :0.810   Min.   :1.210   Min.   : NA   Min.   :4.342  
##  1st Qu.:1.012   1st Qu.:1.512   1st Qu.:2.163   1st Qu.: NA   1st Qu.:5.222  
##  Median :1.885   Median :2.815   Median :3.910   Median : NA   Median :5.774  
##  Mean   :1.954   Mean   :2.699   Mean   :3.566   Mean   :NaN   Mean   :6.077  
##  3rd Qu.:2.860   3rd Qu.:3.873   3rd Qu.:4.605   3rd Qu.: NA   3rd Qu.:6.640  
##  Max.   :3.970   Max.   :4.990   Max.   :6.610   Max.   : NA   Max.   :9.986  
##                                                  NA's   :120   NA's   :56     
##      VHN.0         VHN.14     
##  Min.   : NA   Min.   : 72.1  
##  1st Qu.: NA   1st Qu.:128.3  
##  Median : NA   Median :169.2  
##  Mean   :NaN   Mean   :174.5  
##  3rd Qu.: NA   3rd Qu.:212.9  
##  Max.   : NA   Max.   :288.0  
##  NA's   :120   NA's   :60     
## ------------------------------------------------------------ 
## f$Groups: Whitening dentifrice
##                   Groups    Groups.1 Material Material.1      DE.0      
##  Control             :  0   1:  0    CS :30   1:30       Min.   :0.030  
##  Regular dentifrice  :  0   2:  0    GB :30   2:30       1st Qu.:0.470  
##  Whitening dentifrice:120   3:120    RC : 0   3:30       Median :0.825  
##                                      RC :30   4:30       Mean   :0.820  
##                                      VE :30              3rd Qu.:1.170  
##                                                          Max.   :1.840  
##                                                                         
##       DE.1            DE7             DE14            TP.0         TP.14      
##  Min.   :0.990   Min.   :1.040   Min.   :1.860   Min.   : NA   Min.   :3.094  
##  1st Qu.:1.475   1st Qu.:2.188   1st Qu.:3.265   1st Qu.: NA   1st Qu.:5.140  
##  Median :1.950   Median :3.015   Median :3.965   Median : NA   Median :5.679  
##  Mean   :2.050   Mean   :2.884   Mean   :3.951   Mean   :NaN   Mean   :5.924  
##  3rd Qu.:2.550   3rd Qu.:3.453   3rd Qu.:4.758   3rd Qu.: NA   3rd Qu.:6.768  
##  Max.   :3.690   Max.   :4.910   Max.   :6.000   Max.   : NA   Max.   :8.716  
##                                                  NA's   :120   NA's   :56     
##      VHN.0         VHN.14     
##  Min.   : NA   Min.   : 75.1  
##  1st Qu.: NA   1st Qu.:150.8  
##  Median : NA   Median :176.8  
##  Mean   :NaN   Mean   :184.4  
##  3rd Qu.: NA   3rd Qu.:215.8  
##  Max.   : NA   Max.   :309.5  
##  NA's   :120   NA's   :60

Summary of Data by each Material

by(f, f$Material, summary)
## f$Material: CS
##                   Groups   Groups.1 Material Material.1      DE.0       
##  Control             :30   1:30     CS :90   1:90       Min.   :0.0300  
##  Regular dentifrice  :30   2:30     GB : 0   2: 0       1st Qu.:0.2400  
##  Whitening dentifrice:30   3:30     RC : 0   3: 0       Median :0.8500  
##                                     RC : 0   4: 0       Mean   :0.7623  
##                                     VE : 0              3rd Qu.:1.1700  
##                                                         Max.   :1.7700  
##                                                                         
##       DE.1            DE7             DE14            TP.0      
##  Min.   :0.380   Min.   :0.810   Min.   :1.210   Min.   :2.927  
##  1st Qu.:0.620   1st Qu.:1.150   1st Qu.:1.390   1st Qu.:5.600  
##  Median :0.850   Median :1.460   Median :1.550   Median :6.296  
##  Mean   :0.989   Mean   :1.775   Mean   :2.196   Mean   :6.054  
##  3rd Qu.:1.240   3rd Qu.:2.328   3rd Qu.:2.795   3rd Qu.:6.872  
##  Max.   :2.470   Max.   :3.960   Max.   :5.300   Max.   :7.048  
##                                                  NA's   :74     
##      TP.14           VHN.0           VHN.14     
##  Min.   :3.094   Min.   :78.80   Min.   :72.10  
##  1st Qu.:5.247   1st Qu.:81.20   1st Qu.:74.60  
##  Median :5.670   Median :82.90   Median :76.20  
##  Mean   :5.905   Mean   :82.41   Mean   :76.73  
##  3rd Qu.:6.364   3rd Qu.:83.60   3rd Qu.:78.30  
##  Max.   :8.996   Max.   :86.10   Max.   :83.50  
##  NA's   :42      NA's   :75      NA's   :45     
## ------------------------------------------------------------ 
## f$Material: GB
##                   Groups   Groups.1 Material Material.1      DE.0       
##  Control             :30   1:30     CS : 0   1: 0       Min.   :0.4700  
##  Regular dentifrice  :30   2:30     GB :90   2:90       1st Qu.:0.5600  
##  Whitening dentifrice:30   3:30     RC : 0   3: 0       Median :0.7400  
##                                     RC : 0   4: 0       Mean   :0.8207  
##                                     VE : 0              3rd Qu.:0.9800  
##                                                         Max.   :1.8300  
##                                                                         
##       DE.1            DE7             DE14            TP.0       
##  Min.   :0.810   Min.   :0.550   Min.   :0.660   Min.   : 6.131  
##  1st Qu.:1.090   1st Qu.:1.050   1st Qu.:1.853   1st Qu.: 6.785  
##  Median :1.310   Median :1.560   Median :2.575   Median : 6.919  
##  Mean   :1.351   Mean   :1.489   Mean   :2.654   Mean   : 7.269  
##  3rd Qu.:1.490   3rd Qu.:1.772   3rd Qu.:3.460   3rd Qu.: 7.284  
##  Max.   :2.600   Max.   :2.860   Max.   :5.090   Max.   :10.205  
##                                                  NA's   :74      
##      TP.14           VHN.0           VHN.14     
##  Min.   :6.066   Min.   :166.5   Min.   :143.2  
##  1st Qu.:6.900   1st Qu.:171.3   1st Qu.:155.0  
##  Median :7.447   Median :176.2   Median :163.4  
##  Mean   :7.484   Mean   :176.8   Mean   :163.5  
##  3rd Qu.:7.914   3rd Qu.:181.1   3rd Qu.:173.8  
##  Max.   :9.986   Max.   :190.4   Max.   :176.2  
##  NA's   :42      NA's   :75      NA's   :45     
## ------------------------------------------------------------ 
## f$Material: RC
##                   Groups   Groups.1 Material Material.1      DE.0       
##  Control             :30   1:30     CS : 0   1: 0       Min.   :0.2300  
##  Regular dentifrice  :30   2:30     GB : 0   2: 0       1st Qu.:0.4500  
##  Whitening dentifrice: 0   3: 0     RC :60   3: 0       Median :0.6000  
##                                     RC : 0   4:60       Mean   :0.6503  
##                                     VE : 0              3rd Qu.:0.9200  
##                                                         Max.   :1.2600  
##                                                                         
##       DE.1            DE7             DE14            TP.0      
##  Min.   :0.700   Min.   :1.060   Min.   :1.190   Min.   :7.210  
##  1st Qu.:1.067   1st Qu.:1.370   1st Qu.:1.657   1st Qu.:7.540  
##  Median :2.135   Median :2.890   Median :3.165   Median :7.968  
##  Mean   :2.004   Mean   :2.784   Mean   :3.263   Mean   :8.089  
##  3rd Qu.:2.860   3rd Qu.:4.005   3rd Qu.:4.830   3rd Qu.:8.532  
##  Max.   :3.970   Max.   :4.990   Max.   :6.610   Max.   :9.417  
##                                                  NA's   :44     
##      TP.14           VHN.0           VHN.14     
##  Min.   :3.986   Min.   :179.5   Min.   :146.3  
##  1st Qu.:5.009   1st Qu.:194.0   1st Qu.:151.6  
##  Median :5.828   Median :197.0   Median :167.4  
##  Mean   :6.006   Mean   :196.0   Mean   :168.5  
##  3rd Qu.:7.103   3rd Qu.:199.6   3rd Qu.:186.1  
##  Max.   :8.472   Max.   :203.2   Max.   :191.9  
##  NA's   :28      NA's   :45      NA's   :30     
## ------------------------------------------------------------ 
## f$Material: RC 
##                   Groups   Groups.1 Material Material.1      DE.0       
##  Control             : 0   1: 0     CS : 0   1: 0       Min.   :0.2300  
##  Regular dentifrice  : 0   2: 0     GB : 0   2: 0       1st Qu.:0.4525  
##  Whitening dentifrice:30   3:30     RC : 0   3: 0       Median :0.6000  
##                                     RC :30   4:30       Mean   :0.6503  
##                                     VE : 0              3rd Qu.:0.8875  
##                                                         Max.   :1.2600  
##                                                                         
##       DE.1            DE7             DE14            TP.0         TP.14      
##  Min.   :1.240   Min.   :2.020   Min.   :2.740   Min.   : NA   Min.   :3.620  
##  1st Qu.:1.833   1st Qu.:2.652   1st Qu.:4.213   1st Qu.: NA   1st Qu.:4.847  
##  Median :2.130   Median :3.185   Median :4.705   Median : NA   Median :5.390  
##  Mean   :2.126   Mean   :3.400   Mean   :4.643   Mean   :NaN   Mean   :5.527  
##  3rd Qu.:2.428   3rd Qu.:4.202   3rd Qu.:5.045   3rd Qu.: NA   3rd Qu.:6.232  
##  Max.   :3.060   Max.   :4.820   Max.   :5.610   Max.   : NA   Max.   :8.163  
##                                                  NA's   :30    NA's   :14     
##      VHN.0         VHN.14     
##  Min.   : NA   Min.   :177.3  
##  1st Qu.: NA   1st Qu.:179.9  
##  Median : NA   Median :183.8  
##  Mean   :NaN   Mean   :183.3  
##  3rd Qu.: NA   3rd Qu.:185.5  
##  Max.   : NA   Max.   :189.4  
##  NA's   :30    NA's   :15     
## ------------------------------------------------------------ 
## f$Material: VE
##                   Groups   Groups.1 Material Material.1      DE.0      
##  Control             :30   1:30     CS : 0   1: 0       Min.   :0.120  
##  Regular dentifrice  :30   2:30     GB : 0   2: 0       1st Qu.:0.990  
##  Whitening dentifrice:30   3:30     RC : 0   3:90       Median :1.210  
##                                     RC : 0   4: 0       Mean   :1.047  
##                                     VE :90              3rd Qu.:1.380  
##                                                         Max.   :1.840  
##                                                                        
##       DE.1            DE7             DE14            TP.0      
##  Min.   :0.990   Min.   :1.420   Min.   :2.440   Min.   :6.149  
##  1st Qu.:1.540   1st Qu.:2.072   1st Qu.:3.365   1st Qu.:6.534  
##  Median :2.485   Median :3.280   Median :4.030   Median :6.688  
##  Mean   :2.343   Mean   :3.074   Mean   :4.071   Mean   :6.653  
##  3rd Qu.:3.005   3rd Qu.:3.632   3rd Qu.:4.800   3rd Qu.:6.774  
##  Max.   :3.750   Max.   :4.910   Max.   :6.000   Max.   :7.186  
##                                                  NA's   :74     
##      TP.14           VHN.0           VHN.14     
##  Min.   :4.342   Min.   :354.2   Min.   :272.3  
##  1st Qu.:5.316   1st Qu.:359.0   1st Qu.:284.7  
##  Median :5.939   Median :360.5   Median :295.3  
##  Mean   :5.882   Mean   :362.0   Mean   :292.1  
##  3rd Qu.:6.430   3rd Qu.:366.6   3rd Qu.:299.2  
##  Max.   :7.856   Max.   :369.5   Max.   :309.5  
##  NA's   :42      NA's   :75      NA's   :45

Mean of each variable

DE0 <- c("DE0",mean(f$DE.0))
DE1 <- c("DE1",mean(f$DE.1))
DE7 <- c("DE7",mean(f$DE7))
DE14 <- c("DE14",mean(f$DE14))
TP0 <- c("TP0",mean(f$TP.0[complete.cases(f$TP.0)]))
TP14 <- c("TP15",mean(f$TP.14[complete.cases(f$TP.14)]))
VHN0 <- c("VHN0",mean(f$VHN.0[complete.cases(f$VHN.0)]))
VHN14 <- c("VHN14",mean(f$VHN.14[complete.cases(f$VHN.14)]))

df <- data.frame(rbind(DE0,DE1,DE7,DE14,TP0,TP14,VHN0,VHN14))
colnames(df) <- c("Variable","Mean Value")
kable(df,caption = "Mean of each variable")
Mean of each variable
Variable Mean Value
DE0 DE0 0.82
DE1 DE1 1.68205555555556
DE7 DE7 2.33172222222222
DE14 DE14 3.16105555555556
TP0 TP0 7.01637932999703
TP14 TP15 6.27924091906769
VHN0 VHN0 204.318333333333
VHN14 VHN14 176.439444444444

Median of each variable

DE0 <- c("DE0",median(f$DE.0))
DE1 <- c("DE1",median(f$DE.1))
DE7 <- c("DE7",median(f$DE7))
DE14 <- c("DE14",median(f$DE14))
TP0 <- c("TP0",median(f$TP.0[complete.cases(f$TP.0)]))
TP14 <- c("TP15",median(f$TP.14[complete.cases(f$TP.14)]))
VHN0 <- c("VHN0",median(f$VHN.0[complete.cases(f$VHN.0)]))
VHN14 <- c("VHN14",median(f$VHN.14[complete.cases(f$VHN.14)]))

df <- data.frame(rbind(DE0,DE1,DE7,DE14,TP0,TP14,VHN0,VHN14))
colnames(df) <- c("Variable","Median Value")
kable(df,caption = "Median of each variable")
Median of each variable
Variable Median Value
DE0 DE0 0.825
DE1 DE1 1.44
DE7 DE7 1.995
DE14 DE14 3.17
TP0 TP0 6.87938232456182
TP14 TP15 6.1371069648664
VHN0 VHN0 187.75
VHN14 VHN14 170.45

Standard Deviation of each variable

DE0 <- c("DE0",sd(f$DE.0))
DE1 <- c("DE1",sd(f$DE.1))
DE7 <- c("DE7",sd(f$DE7))
DE14 <- c("DE14",sd(f$DE14))
TP0 <- c("TP0",sd(f$TP.0[complete.cases(f$TP.0)]))
TP14 <- c("TP15",sd(f$TP.14[complete.cases(f$TP.14)]))
VHN0 <- c("VHN0",sd(f$VHN.0[complete.cases(f$VHN.0)]))
VHN14 <- c("VHN14",sd(f$VHN.14[complete.cases(f$VHN.14)]))

df <- data.frame(rbind(DE0,DE1,DE7,DE14,TP0,TP14,VHN0,VHN14))
colnames(df) <- c("Variable","Standard Deviation")
kable(df,caption = "Standard Deviation of each variable")
Standard Deviation of each variable
Variable Standard Deviation
DE0 DE0 0.442472793177106
DE1 DE1 0.857843508088838
DE7 DE7 1.16178823386211
DE14 DE14 1.42081207789534
TP0 TP0 1.09812749949824
TP14 TP15 1.21552974031525
VHN0 VHN0 101.678830507861
VHN14 VHN14 77.5675755109012

Variance of each variable

DE0 <- c("DE0",var(f$DE.0))
DE1 <- c("DE1",var(f$DE.1))
DE7 <- c("DE7",var(f$DE7))
DE14 <- c("DE14",var(f$DE14))
TP0 <- c("TP0",var(f$TP.0[complete.cases(f$TP.0)]))
TP14 <- c("TP15",var(f$TP.14[complete.cases(f$TP.14)]))
VHN0 <- c("VHN0",var(f$VHN.0[complete.cases(f$VHN.0)]))
VHN14 <- c("VHN14",var(f$VHN.14[complete.cases(f$VHN.14)]))

df <- data.frame(rbind(DE0,DE1,DE7,DE14,TP0,TP14,VHN0,VHN14))
colnames(df) <- c("Variable","Variance")
kable(df,caption = "Variance of each variable")
Variance of each variable
Variable Variance
DE0 DE0 0.19578217270195
DE1 DE1 0.735895484370164
DE7 DE7 1.34975190034045
DE14 DE14 2.01870696069328
TP0 TP0 1.20588400515426
TP14 TP15 1.47751254959086
VHN0 VHN0 10338.5845734463
VHN14 VHN14 6016.72877063935

Detailed Stats about each variable

stat.desc(f,basic = T,norm = T)
##            Groups Groups.1 Material Material.1          DE.0          DE.1
## nbr.val        NA       NA       NA         NA  3.600000e+02  3.600000e+02
## nbr.null       NA       NA       NA         NA  0.000000e+00  0.000000e+00
## nbr.na         NA       NA       NA         NA  0.000000e+00  0.000000e+00
## min            NA       NA       NA         NA  3.000000e-02  3.800000e-01
## max            NA       NA       NA         NA  1.840000e+00  3.970000e+00
## range          NA       NA       NA         NA  1.810000e+00  3.590000e+00
## sum            NA       NA       NA         NA  2.952000e+02  6.055400e+02
## median         NA       NA       NA         NA  8.250000e-01  1.440000e+00
## mean           NA       NA       NA         NA  8.200000e-01  1.682056e+00
## SE.mean        NA       NA       NA         NA  2.332036e-02  4.521232e-02
## CI.mean        NA       NA       NA         NA  4.586169e-02  8.891428e-02
## var            NA       NA       NA         NA  1.957822e-01  7.358955e-01
## std.dev        NA       NA       NA         NA  4.424728e-01  8.578435e-01
## coef.var       NA       NA       NA         NA  5.396010e-01  5.099971e-01
## skewness       NA       NA       NA         NA  1.859398e-01  6.281323e-01
## skew.2SE       NA       NA       NA         NA  7.231307e-01  2.442842e+00
## kurtosis       NA       NA       NA         NA -8.592988e-01 -6.722446e-01
## kurt.2SE       NA       NA       NA         NA -1.675476e+00 -1.310755e+00
## normtest.W     NA       NA       NA         NA  9.715510e-01  9.323120e-01
## normtest.p     NA       NA       NA         NA  1.656365e-06  1.022359e-11
##                      DE7          DE14          TP.0        TP.14         VHN.0
## nbr.val     3.600000e+02  3.600000e+02  64.000000000  192.0000000  6.000000e+01
## nbr.null    0.000000e+00  0.000000e+00   0.000000000    0.0000000  0.000000e+00
## nbr.na      0.000000e+00  0.000000e+00 296.000000000  168.0000000  3.000000e+02
## min         5.500000e-01  6.600000e-01   2.927109094    3.0941779  7.880000e+01
## max         4.990000e+00  6.610000e+00  10.205017774    9.9857039  3.695000e+02
## range       4.440000e+00  5.950000e+00   7.277908680    6.8915260  2.907000e+02
## sum         8.394200e+02  1.137980e+03 449.048277120 1205.6142565  1.225910e+04
## median      1.995000e+00  3.170000e+00   6.879382325    6.1371070  1.877500e+02
## mean        2.331722e+00  3.161056e+00   7.016379330    6.2792409  2.043183e+02
## SE.mean     6.123162e-02  7.488337e-02   0.137265937    0.0877233  1.312668e+01
## CI.mean     1.204177e-01  1.472652e-01   0.274304088    0.1730309  2.626643e+01
## var         1.349752e+00  2.018707e+00   1.205884005    1.4775125  1.033858e+04
## std.dev     1.161788e+00  1.420812e+00   1.098127499    1.2155297  1.016788e+02
## coef.var    4.982533e-01  4.494739e-01   0.156509141    0.1935791  4.976491e-01
## skewness    5.606173e-01  1.561504e-01  -0.204526323    0.2707034  4.975577e-01
## skew.2SE    2.180273e+00  6.072778e-01  -0.341643571    0.7716025  8.059079e-01
## kurtosis   -8.750807e-01 -1.162157e+00   2.481283044   -0.1610153 -1.026537e+00
## kurt.2SE   -1.706248e+00 -2.265995e+00   2.101032952   -0.2306246 -8.435094e-01
## normtest.W  9.249549e-01  9.498039e-01   0.931966013    0.9905939  8.282249e-01
## normtest.p  1.864326e-12  1.018096e-09   0.001632336    0.2430921  7.347752e-07
##                   VHN.14
## nbr.val     1.800000e+02
## nbr.null    0.000000e+00
## nbr.na      1.800000e+02
## min         7.210000e+01
## max         3.095000e+02
## range       2.374000e+02
## sum         3.175910e+04
## median      1.704500e+02
## mean        1.764394e+02
## SE.mean     5.781546e+00
## CI.mean     1.140876e+01
## var         6.016729e+03
## std.dev     7.756758e+01
## coef.var    4.396272e-01
## skewness    3.083468e-01
## skew.2SE    8.514241e-01
## kurtosis   -1.024336e+00
## kurt.2SE   -1.421758e+00
## normtest.W  8.768612e-01
## normtest.p  5.517536e-11

Histograms of each variable

par(mfrow=c(2,2))
hist(f$DE.0,xlab = "Values",main = "DE0", col = "red")
hist(f$DE.1,xlab = "Values",main = "DE1", col = "green")
hist(f$DE7,xlab = "Values",main = "DE7", col = "blue")
hist(f$DE14,xlab = "Values",main = "DE14",col = "pink")

par(mfrow=c(1,2))
hist(f$TP.0,xlab = "Values",main = "TP0",col = "red")
hist(f$TP.14,xlab = "Values",main = "TP14",col = "green")

par(mfrow=c(1,2))
hist(f$VHN.0,xlab = "Values",main = "VHN0",col = "red")
hist(f$VHN.14,xlab = "Values",main = "VHN14",col = "blue")

Plots about each group

ggplot(f) +
  aes(x = Groups, y = DE.0, colour = Groups) +
  geom_point() +
  scale_color_hue()

ggplot(f) +
  aes(x = Groups, y = DE.1, colour = Groups) +
  geom_point() +
  scale_color_hue()

ggplot(f) +
  aes(x = Groups, y = DE7, colour = Groups) +
  geom_point() +
  scale_color_hue()

ggplot(f) +
  aes(x = Groups, y = DE14, colour = Groups) +
  geom_point() +
  scale_color_hue()

ggplot(f) +
  aes(x = Groups, y = TP.0, colour = Groups) +
  geom_point() +
  scale_color_hue()

ggplot(f) +
  aes(x = Groups, y = TP.14, colour = Groups) +
  geom_point() +
  scale_color_hue()

ggplot(f) +
  aes(x = Groups, y = VHN.0, colour = Groups) +
  geom_point() +
  scale_color_hue()

ggplot(f) +
  aes(x = Groups, y = VHN.14, colour = Groups) +
  geom_point() +
  scale_color_hue()

Correlation

dat <- f[, 5:8]
round(cor(dat), 2)
##      DE.0 DE.1  DE7 DE14
## DE.0 1.00 0.05 0.07 0.09
## DE.1 0.05 1.00 0.78 0.75
## DE7  0.07 0.78 1.00 0.83
## DE14 0.09 0.75 0.83 1.00

Normality Test

Density plot and Q-Q plot can be used to check normality visually.

ggdensity(f$DE.0, 
          main = "Density plot of DE0",
          xlab = "DE0")

ggdensity(f$DE.1, 
          main = "Density plot of DE0",
          xlab = "DE1")

ggdensity(f$DE7, 
          main = "Density plot of DE0",
          xlab = "DE7")

ggdensity(f$DE14, 
          main = "Density plot of DE0",
          xlab = "DE14")