R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.

#library(readr) 
#ERS<- read_csv("D:/MS Sem 2/Data
#Minning/Projects/Project 2/RE\_ Data Mining Project 2 Group
#Members/EnglishReading.csv") View(EnglishReading)

# Importing the dataset
ERS <- read.csv("~/EnglishReading.csv")

# Checking the structure of the dataset
str(ERS)
## 'data.frame':    66 obs. of  5 variables:
##  $ pretest.1  : int  4 6 9 12 16 15 14 12 12 8 ...
##  $ pretest.2  : int  3 5 4 6 5 13 8 7 3 8 ...
##  $ post.test.1: int  5 9 5 8 10 9 12 5 8 7 ...
##  $ post.test.2: int  4 5 3 5 9 8 5 5 7 7 ...
##  $ post.test.3: int  41 41 43 46 46 45 45 32 33 39 ...
head(ERS)
##   pretest.1 pretest.2 post.test.1 post.test.2 post.test.3
## 1         4         3           5           4          41
## 2         6         5           9           5          41
## 3         9         4           5           3          43
## 4        12         6           8           5          46
## 5        16         5          10           9          46
## 6        15        13           9           8          45
#2. Perform a statistical analysis of the dataset
summary(ERS)
##    pretest.1        pretest.2       post.test.1      post.test.2    
##  Min.   : 4.000   Min.   : 1.000   Min.   : 1.000   Min.   : 0.000  
##  1st Qu.: 8.000   1st Qu.: 3.250   1st Qu.: 5.000   1st Qu.: 5.000  
##  Median : 9.000   Median : 5.000   Median : 8.000   Median : 6.000  
##  Mean   : 9.788   Mean   : 5.106   Mean   : 8.076   Mean   : 6.712  
##  3rd Qu.:12.000   3rd Qu.: 6.000   3rd Qu.:11.000   3rd Qu.: 8.000  
##  Max.   :16.000   Max.   :13.000   Max.   :15.000   Max.   :13.000  
##   post.test.3   
##  Min.   :30.00  
##  1st Qu.:40.00  
##  Median :45.00  
##  Mean   :44.02  
##  3rd Qu.:49.00  
##  Max.   :57.00
summary(ERS$pretest.1)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   4.000   8.000   9.000   9.788  12.000  16.000
summary(ERS$pretest.2)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   1.000   3.250   5.000   5.106   6.000  13.000
summary(ERS$post.test.1)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   1.000   5.000   8.000   8.076  11.000  15.000
summary(ERS$post.test.2)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.000   5.000   6.000   6.712   8.000  13.000
summary(ERS$post.test.3)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   30.00   40.00   45.00   44.02   49.00   57.00
#summary provided us complete details about quantiles so no need to use quantile function here

sd(ERS$pretest.1)
## [1] 3.02052
sd(ERS$pretest.2)
## [1] 2.212752
sd(ERS$post.test.1)
## [1] 3.393707
sd(ERS$post.test.2)
## [1] 2.635644
sd(ERS$post.test.3)
## [1] 6.643661
#Histograms
library(ggplot2)
library(reshape2)
data_melted <- melt(ERS, id.vars = NULL)
ggplot(data_melted, aes(x = variable, y = value, fill = variable)) +   geom_boxplot() +   theme_minimal() +   labs(title = "Test Score Distribution", x = "Test", y = "Scores")

ggplot(data_melted, aes(x = value, fill = variable)) +   geom_histogram(bins = 20, position = "identity", alpha = 0.5) +   facet_wrap(~variable, scales = "free") +   theme_minimal() +   labs(title = "Distribution of Test Scores", x = "Scores", y = "Frequency")

# Scatter plot between 5 variables
variable_colors <- c("red", "blue", "green", "orange", "purple")
pairs(ERS[, c("pretest.1", "pretest.2", "post.test.1", "post.test.2", "post.test.3")], col = variable_colors, main = "Scatter Plot Matrix")

# Calculate correlation
correlation_matrix <- cor(ERS[, c("pretest.1", "pretest.2", "post.test.1", "post.test.2", "post.test.3")])
correlation_matrix
##               pretest.1 pretest.2 post.test.1 post.test.2 post.test.3
## pretest.1    1.00000000 0.3348806  0.56590255  0.08883615 -0.03740325
## pretest.2    0.33488057 1.0000000  0.34514482  0.20580036  0.18093653
## post.test.1  0.56590255 0.3451448  1.00000000  0.06439532  0.47008487
## post.test.2  0.08883615 0.2058004  0.06439532  1.00000000 -0.04191999
## post.test.3 -0.03740325 0.1809365  0.47008487 -0.04191999  1.00000000
# Visualize correlation Plot
library(corrplot)
## corrplot 0.92 loaded
corrplot(correlation_matrix, method="circle")

#3. Find if any entries are NA and remove them
ERS <- na.omit(ERS)
str(ERS)
## 'data.frame':    66 obs. of  5 variables:
##  $ pretest.1  : int  4 6 9 12 16 15 14 12 12 8 ...
##  $ pretest.2  : int  3 5 4 6 5 13 8 7 3 8 ...
##  $ post.test.1: int  5 9 5 8 10 9 12 5 8 7 ...
##  $ post.test.2: int  4 5 3 5 9 8 5 5 7 7 ...
##  $ post.test.3: int  41 41 43 46 46 45 45 32 33 39 ...
#4 Normalize the DataSet
ERS_scaled <- scale(ERS)
str(ERS_scaled)
##  num [1:66, 1:5] -1.916 -1.254 -0.261 0.732 2.057 ...
##  - attr(*, "dimnames")=List of 2
##   ..$ : chr [1:66] "1" "2" "3" "4" ...
##   ..$ : chr [1:5] "pretest.1" "pretest.2" "post.test.1" "post.test.2" ...
##  - attr(*, "scaled:center")= Named num [1:5] 9.79 5.11 8.08 6.71 44.02
##   ..- attr(*, "names")= chr [1:5] "pretest.1" "pretest.2" "post.test.1" "post.test.2" ...
##  - attr(*, "scaled:scale")= Named num [1:5] 3.02 2.21 3.39 2.64 6.64
##   ..- attr(*, "names")= chr [1:5] "pretest.1" "pretest.2" "post.test.1" "post.test.2" ...
summary(ERS_scaled)
##    pretest.1         pretest.2         post.test.1        post.test.2     
##  Min.   :-1.9162   Min.   :-1.85563   Min.   :-2.08496   Min.   :-2.5467  
##  1st Qu.:-0.5919   1st Qu.:-0.83880   1st Qu.:-0.90631   1st Qu.:-0.6496  
##  Median :-0.2608   Median :-0.04793   Median :-0.02232   Median :-0.2702  
##  Mean   : 0.0000   Mean   : 0.00000   Mean   : 0.00000   Mean   : 0.0000  
##  3rd Qu.: 0.7324   3rd Qu.: 0.40399   3rd Qu.: 0.86167   3rd Qu.: 0.4886  
##  Max.   : 2.0566   Max.   : 3.56748   Max.   : 2.04032   Max.   : 2.3857  
##   post.test.3     
##  Min.   :-2.1096  
##  1st Qu.:-0.6044  
##  Median : 0.1482  
##  Mean   : 0.0000  
##  3rd Qu.: 0.7503  
##  Max.   : 1.9545
#5 Performing hierarchical clustering

distance_matrix <- dist(ERS_scaled, method = "euclidean")
distance_matrix
##            1         2         3         4         5         6         7
## 2  1.6698952                                                            
## 3  1.7829694 1.8017659                                                  
## 4  3.2163250 2.1916435 1.8342760                                        
## 5  4.7891776 3.7305712 3.6237958 2.1467476                              
## 6  6.1433783 4.8587442 5.0564570 3.5212430 3.6652718                    
## 7  4.5637180 3.1617853 3.3058870 1.6331721 2.2248145 2.7004748          
## 8  3.5016726 2.8261543 2.4782655 2.3294353 3.3889797 3.8539187 2.9539857
## 9  3.2468199 2.6221022 2.5575419 2.4985664 2.7060411 4.9903333 3.2820529
## 10 2.9314084 1.8139209 2.5279401 2.0840940 3.3645739 3.4327143 2.7400605
## 11 4.0525384 2.6712762 2.8307132 1.4864443 2.4722626 3.3286005 0.8134515
## 12 1.8422064 2.3455708 1.0669367 2.4104115 3.7357903 5.7560801 3.9741082
## 13 2.9300234 2.5201333 1.7133633 1.6874719 2.6991098 4.1975861 2.9653021
## 14 3.2415545 2.7148286 2.4912592 2.1573159 2.0429691 5.0802194 3.2401284
## 15 2.8057591 2.6973623 1.7732279 2.4545189 3.2932569 5.5334442 3.5910732
## 16 4.6877543 3.4508687 4.0891040 2.7560521 3.0800079 2.3487474 2.7043409
## 17 1.7562941 2.0402569 0.9300826 2.3494761 4.1553944 5.0727621 3.7361906
## 18 2.9650196 2.4800556 1.7934620 1.9305599 2.9948336 4.3598230 2.9659160
## 19 2.4835265 2.5088187 1.5541743 2.3669750 3.3543623 5.2420233 3.6721128
## 20 1.7046963 2.3442754 1.0463976 2.6622995 4.3328898 5.5076027 4.1277693
## 21 2.1943881 2.5077103 1.8782987 2.6369829 4.1127361 5.7416174 4.0878154
## 22 3.0106519 2.1607265 2.7394368 2.6094970 3.3077098 4.2578913 3.2942744
## 23 2.0927089 2.1690113 2.4820862 3.3669511 4.2297655 6.0902566 4.4134411
## 24 1.8501536 1.3673607 1.6597812 2.1168785 3.6557130 4.4219768 3.3395380
## 25 3.7456697 2.6879847 2.6664103 1.9115568 2.8306146 4.7667243 2.1384037
## 26 2.9664399 3.1189623 2.8425163 3.5639263 3.9698950 6.2274474 4.6571720
## 27 5.4074438 3.9456204 4.2423316 2.5757943 2.0409977 2.7810161 1.2511818
## 28 5.0248465 3.6221318 3.8313046 2.1333123 1.9240566 3.2098157 1.0044942
## 29 3.4347951 2.2429425 2.9975993 1.9598335 2.4039265 3.8140178 2.5632388
## 30 3.7396274 2.4304471 3.2165279 2.2888311 3.4679433 4.1058569 2.3847199
## 31 4.3366063 2.9419507 3.2735313 1.5393207 1.6784387 2.9866800 1.0457381
## 32 3.9891022 2.5230643 2.9454359 1.3950787 2.2755579 2.6657335 0.8716833
## 33 2.8619188 2.2002875 2.4238624 2.1389968 3.6834894 4.5464784 3.1372758
## 34 2.7809786 3.1976408 2.5901321 3.5685391 5.2034330 6.7392022 4.7331272
## 35 3.2410460 2.5832935 2.8313341 2.4090041 3.3550019 5.0832124 3.3117015
## 36 3.0328257 2.1642447 2.2714728 1.4968509 2.8858284 4.0082526 2.5573966
## 37 2.3203295 1.4885696 1.9749265 2.0528933 2.8867328 4.7084829 3.0696885
## 38 3.6079818 2.7833451 3.5501445 2.9090947 2.8561115 4.8849511 3.6482479
## 39 3.4951824 2.3959822 2.9147396 2.0430031 2.9092284 4.4954876 2.5607413
## 40 3.6691607 2.4095101 2.4753845 1.0804023 1.7471956 3.3869141 1.3342835
## 41 3.0498572 2.3522518 2.4826427 2.1989807 2.7148286 5.3608277 3.1144050
## 42 2.6566975 1.7610173 2.2880625 1.7772960 2.8578144 3.9769671 2.8843820
## 43 2.6655878 1.8085455 2.3472904 1.8594195 2.7766857 4.3464029 2.9717472
## 44 3.4733654 2.0816636 2.7004178 1.4749598 2.4488521 3.8036212 1.7541680
## 45 4.9233984 3.7710324 4.3963920 3.0428965 2.4596099 3.6341180 3.1275074
## 46 2.4556703 2.1437617 2.3029483 2.3340168 3.5177726 4.3913230 3.6236404
## 47 2.6659588 2.5322308 3.2845628 3.5453229 4.4523794 5.1360474 4.6147432
## 48 1.6515182 2.3900508 1.5171602 2.7829907 4.2005699 6.0468123 4.3343501
## 49 2.6194264 2.4152625 2.6048140 2.7236013 3.6797771 4.5147272 3.9515188
## 50 1.5947613 0.6703162 1.6243696 2.0427258 3.6924103 4.8302923 3.2003395
## 51 3.8184525 2.5792127 3.0993826 1.8333455 1.8957640 4.0215317 2.1648532
## 52 5.4913550 4.1897078 4.7766924 3.2723977 1.8488111 3.8464353 2.9020594
## 53 4.8450523 3.6039923 4.1053470 2.6239490 1.5224078 3.5896478 2.5439003
## 54 3.3137386 2.5571071 3.1284680 2.6119717 2.6627944 4.3432491 3.4835665
## 55 3.5215195 3.1551199 2.9683141 2.7691936 2.5169933 4.9482680 3.8089188
## 56 4.6088409 3.3112608 3.6679538 2.1680273 2.1687729 2.0134744 1.8980157
## 57 3.0854302 3.3028120 3.7195788 4.2580109 5.1407141 5.6695766 5.3501255
## 58 4.6847286 3.4657614 3.4235365 2.3433128 3.5930165 3.7671301 1.6442677
## 59 2.6181006 2.2628368 2.8224335 2.7783612 3.5373338 5.1699336 3.9461585
## 60 4.4861070 4.1006229 4.2251386 3.9574695 3.2974944 5.4461673 4.7195798
## 61 2.5350823 1.7489212 2.7121477 2.5350670 3.4694311 4.4045049 3.5111762
## 62 3.3326336 2.2310702 2.5365042 1.5409203 1.9229329 4.3579896 2.2629191
## 63 4.7532204 3.5171881 3.8133568 2.5079049 1.8955329 4.5038882 2.2332817
## 64 2.2228602 1.9304275 2.2709480 2.9895158 3.8822593 5.8857013 3.9169229
## 65 1.6918064 1.8346888 2.3946325 2.9789947 3.9541335 5.6714900 4.2901512
## 66 1.5617319 1.8954268 1.3110759 2.3425438 3.5518453 5.3614187 3.8673641
##            8         9        10        11        12        13        14
## 2                                                                       
## 3                                                                       
## 4                                                                       
## 5                                                                       
## 6                                                                       
## 7                                                                       
## 8                                                                       
## 9  2.1558538                                                            
## 10 1.9978026 2.7860505                                                  
## 11 2.6026254 2.8102239 2.5718781                                        
## 12 3.1862278 2.6717015 3.2178862 3.5525229                              
## 13 1.4689719 1.7792536 2.1253776 2.6950254 2.0532978                    
## 14 3.2319400 1.7577200 3.1469705 2.9997762 2.1683205 2.0903532          
## 15 2.3873010 1.4321457 3.2699488 3.0260369 1.7801427 1.7219650 2.0249874
## 16 3.7164856 4.1986218 2.2724180 3.1461968 4.5712483 3.5048393 3.8390947
## 17 2.2234586 2.8556501 2.3565417 3.2900791 1.6567812 1.7772960 3.1183113
## 18 1.0103728 1.5049349 2.2084974 2.5367591 2.3067257 0.7702459 2.3979801
## 19 1.9562014 1.5094872 2.7665045 3.1972920 1.6191856 1.1288998 2.1091820
## 20 2.5296412 2.9149812 2.7864646 3.6736229 1.4086225 1.9035486 3.1076952
## 21 4.1373256 3.8481857 3.4577529 3.8380457 1.6014473 3.0524383 2.8800565
## 22 1.6833286 1.7544315 1.4767053 2.9491502 3.1908289 1.9126162 2.7574547
## 23 2.8913676 1.8071542 3.0093333 3.8130863 2.4972540 2.6095448 2.6891801
## 24 2.1303393 2.5717382 1.2001962 3.0118108 2.2215463 1.7475363 2.7798760
## 25 3.7109024 3.1266267 3.5050915 1.7303586 3.0305439 3.2199230 2.6360910
## 26 2.9081618 1.4969021 3.5536590 4.1414435 2.6065084 2.4025288 2.4512547
## 27 3.4398111 3.4380986 3.3872129 1.6833286 4.7859569 3.5527914 3.5308024
## 28 3.7367504 3.5526857 3.4363563 1.4755238 4.3028032 3.5101538 3.1869185
## 29 3.4946021 3.0899318 2.1329371 2.6484464 3.2179046 2.8067145 2.3047591
## 30 4.1595584 4.1024887 2.8890133 2.3900486 3.7205387 3.7667137 3.4872664
## 31 3.2771749 3.1407392 2.6363235 1.4530016 3.7304173 2.9090438 2.6666846
## 32 2.4930556 2.8804389 1.9103344 0.9995727 3.6414181 2.5406927 2.9550715
## 33 3.9636994 4.0149306 2.7183013 3.0841739 2.7395264 3.2058598 3.1693751
## 34 4.9983013 4.7176520 4.5436453 4.3335279 2.5172969 4.1890026 3.9983951
## 35 4.4795660 3.9368914 3.3961390 3.2556173 2.8090210 3.5248069 2.7060411
## 36 3.4795727 3.4685712 2.3659947 2.5815441 2.5851158 2.6496248 2.5817079
## 37 2.1790482 1.2462718 1.8854311 2.6159235 2.2252535 1.6776459 1.7485740
## 38 4.2761487 3.3400805 3.0156088 3.6646122 3.4165032 3.3799332 2.2425815
## 39 4.1433563 3.6507426 3.0594075 2.5315905 3.1314501 3.4118856 2.6561707
## 40 2.1127233 1.9720524 2.1384873 1.0723889 3.0142265 1.8788865 2.1223641
## 41 3.9193962 2.7144089 3.4043717 2.8044929 2.3026966 2.9659160 1.5369075
## 42 2.9493157 2.8745808 1.5527052 2.8257280 2.5598319 2.1829311 2.3048274
## 43 3.3459372 2.9179734 2.0819521 2.8913249 2.4500483 2.4462940 2.0391765
## 44 3.4042207 3.0999510 2.4156979 1.6960732 3.1420693 2.9094940 2.4975312
## 45 4.5033856 4.1012374 3.2587397 3.5326695 4.5234882 3.8475985 3.1836131
## 46 3.0699256 3.2483947 1.8171232 3.5463553 2.4698426 2.2293969 2.7570061
## 47 3.5692994 3.6038531 2.1767655 4.4546921 3.3989456 3.1004771 3.5286764
## 48 3.8241972 3.3807065 3.4358088 3.9646934 0.8949434 2.7239175 2.6455746
## 49 2.8872776 3.0968345 1.8039104 3.8476656 2.7354237 2.1654834 2.8888103
## 50 3.0615520 2.9327600 1.9377372 2.8150931 2.0875268 2.5089102 2.6649990
## 51 3.7171511 3.0012235 2.8072393 2.2379998 3.2715628 2.9972815 2.0377881
## 52 4.5309319 3.7548370 3.8014850 3.2695385 4.9099495 4.0426244 3.0818407
## 53 4.0371178 3.3823365 3.2088405 2.8927800 4.2420123 3.4256690 2.5746101
## 54 3.0981766 2.4553321 2.1106690 3.4343996 3.1428117 2.3602273 2.0730744
## 55 2.7716936 1.6258638 2.9197923 3.6299810 2.7513719 1.7971392 1.5417888
## 56 2.6238643 3.1559359 2.0177785 2.2797494 4.2112654 2.6547234 3.2308868
## 57 3.5068181 3.7981167 2.7492537 5.1206166 3.8357734 3.2969946 4.1687563
## 58 3.7381767 4.2031166 3.5893495 1.5499281 4.1998414 3.7966677 4.1290539
## 59 4.0759544 3.4861575 2.7467284 3.8488346 2.6456258 3.0805164 2.4705695
## 60 3.5360378 2.4420919 3.6338592 4.5964529 4.0249655 2.9619562 2.7066463
## 61 3.1722443 3.0311719 1.5484174 3.3815842 2.9423150 2.6064354 2.7284446
## 62 3.3836766 2.4885542 2.7347060 2.1153250 2.6475199 2.5587947 1.4881008
## 63 4.2523664 3.2706440 3.8776437 2.2660361 3.9649949 3.6821473 2.4940369
## 64 2.8760230 1.6188229 3.0151748 3.2567815 2.3846796 2.5926955 2.4243582
## 65 3.7215339 3.0206719 2.6718508 3.9894287 2.1467476 2.8153886 2.4382204
## 66 2.7418769 2.2631889 2.4970430 3.4843448 1.0457381 1.6657004 2.0033987
##           15        16        17        18        19        20        21
## 2                                                                       
## 3                                                                       
## 4                                                                       
## 5                                                                       
## 6                                                                       
## 7                                                                       
## 8                                                                       
## 9                                                                       
## 10                                                                      
## 11                                                                      
## 12                                                                      
## 13                                                                      
## 14                                                                      
## 15                                                                      
## 16 4.8272449                                                            
## 17 2.2090105 4.1903501                                                  
## 18 1.4462265 3.8695015 1.8008975                                        
## 19 0.8972757 4.4402290 1.6818296 1.0178592                              
## 20 2.1133684 4.5754107 0.5395029 1.9701777 1.5736322                    
## 21 3.2205283 4.2581775 2.4204153 3.4467257 3.0536963 2.3832394          
## 22 2.6470464 3.2936510 2.5984470 1.7428425 2.1716556 2.8541329 3.9865643
## 23 1.9922881 4.9039567 2.5431671 2.3306769 1.8573464 2.4955861 3.6211100
## 24 2.6519993 3.1276021 1.3988363 1.9117421 2.0457559 1.7330856 2.6181193
## 25 2.9116781 4.0319509 3.4771483 3.1883882 3.3444088 3.7026579 3.0758507
## 26 1.6854386 5.2351571 2.9363945 2.2019177 1.5507483 2.7616815 4.0185711
## 27 4.0956484 3.0560078 4.6639936 3.5086658 4.2332208 5.0179179 5.0571789
## 28 3.9354245 3.0124556 4.4089947 3.5789903 4.1364912 4.7389264 4.3251567
## 29 3.6154150 1.8995213 3.4037996 3.1788719 3.3962428 3.6743649 2.9347048
## 30 4.2196785 2.7617296 3.7288439 3.9329519 4.2231260 4.0925316 3.0167687
## 31 3.5915668 2.2190717 3.7872562 3.0960851 3.6195855 4.1248266 3.6850143
## 32 3.3480085 2.1729191 3.2631610 2.5608251 3.2747710 3.6815657 3.7800852
## 33 3.8311967 2.9589813 2.8562112 3.5760699 3.6276590 3.1186123 1.6691858
## 34 3.8098283 5.5121042 3.1715921 4.3350416 3.9374561 3.1335679 1.7283181
## 35 3.8114344 3.4104334 3.5074109 3.9036015 3.8015439 3.6606131 1.8067167
## 36 3.4241771 2.4758841 2.7584371 3.0751688 3.2182833 3.0293194 1.9121904
## 37 1.8625151 3.4795172 2.2342077 1.6243696 1.6218383 2.3963589 3.0442250
## 38 3.9311905 2.8362649 3.9921734 3.7958658 3.7335524 4.1274212 3.1465518
## 39 3.7238064 2.9776922 3.5886940 3.6829001 3.7811093 3.8383149 2.4669175
## 40 2.4308111 2.8450566 2.9184138 1.8558220 2.4723801 3.2298985 3.5155834
## 41 2.6483548 3.9650671 3.3112204 3.1601988 2.9225275 3.3792073 2.3363785
## 42 3.1863758 2.1725489 2.5104739 2.6197937 2.7645996 2.7742795 2.3892410
## 43 3.1735315 2.4913850 2.7576573 2.8759921 2.8839387 2.9604053 2.1395496
## 44 3.3521136 2.5204183 3.2872984 3.0792371 3.3878397 3.6150714 2.8672814
## 45 4.8111243 1.7981553 4.7801168 4.2949583 4.5960509 5.0345555 4.1692942
## 46 3.3763780 2.6629595 2.2604626 2.7548682 2.7620319 2.4459929 2.3104950
## 47 4.0470602 3.2915462 3.0201348 3.4235032 3.3725553 3.1613928 3.4529228
## 48 2.6298953 4.6271661 2.0034134 3.0413276 2.4353187 1.8035961 0.9259945
## 49 3.3909313 2.8878319 2.3874934 2.6542371 2.6630982 2.5297554 2.9198800
## 50 2.8478717 3.3027001 1.9368287 2.6444058 2.6041268 2.2159945 1.9201797
## 51 3.4376387 2.5681600 3.7261066 3.2798339 3.4799454 3.9670905 3.0807332
## 52 4.6624772 2.7911702 5.2693824 4.3079303 4.6715618 5.5114523 4.9265116
## 53 4.1696303 2.2758831 4.5853667 3.7671346 4.1042294 4.8257640 4.2022196
## 54 3.2834172 2.6109275 3.2867256 2.7615737 2.8345735 3.4334005 3.4523829
## 55 2.3588269 3.8179382 3.1721243 2.1493547 1.9712762 3.1438500 3.7043894
## 56 3.9132023 1.5635855 3.7956164 2.8600783 3.6166997 4.1681626 4.4214185
## 57 4.2102577 4.2270715 3.1897737 3.4971138 3.4175704 3.2445167 4.2963506
## 58 4.0341916 3.8568939 3.9098255 3.6928013 4.2594646 4.3057807 4.0889924
## 59 3.6805033 3.1125752 3.1552572 3.5497348 3.3356765 3.2454349 2.1128006
## 60 3.4864474 4.3509561 4.2922718 3.1813026 3.1005566 4.2714186 4.9388105
## 61 3.5141596 2.4655954 2.7525911 2.9386732 3.0187750 2.9951470 2.8564887
## 62 2.7668184 3.0212079 3.2405010 2.8007660 2.8804553 3.4311305 2.6823314
## 63 3.6623460 3.6779859 4.5597676 3.7870446 4.0126521 4.7705241 4.0149200
## 64 1.6979402 4.7862755 2.5787300 2.2520398 1.8881891 2.5995009 3.4406915
## 65 3.1166296 3.8036212 2.5980991 3.1361918 2.7246795 2.5971506 2.1595543
## 66 1.9226768 4.0037642 1.5132723 1.9777722 1.3950030 1.3920347 2.0086638
##           22        23        24        25        26        27        28
## 2                                                                       
## 3                                                                       
## 4                                                                       
## 5                                                                       
## 6                                                                       
## 7                                                                       
## 8                                                                       
## 9                                                                       
## 10                                                                      
## 11                                                                      
## 12                                                                      
## 13                                                                      
## 14                                                                      
## 15                                                                      
## 16                                                                      
## 17                                                                      
## 18                                                                      
## 19                                                                      
## 20                                                                      
## 21                                                                      
## 22                                                                      
## 23 2.0747760                                                            
## 24 1.6767651 2.3345754                                                  
## 25 3.7852328 3.8113074 3.4437739                                        
## 26 2.4077828 1.3056079 2.9158105 4.1805856                              
## 27 3.5849298 4.8343040 4.1185661 2.8683135 4.9243131                    
## 28 3.8445209 4.7877809 3.9625718 2.0511004 4.9608627 1.1284583          
## 29 2.7336795 3.6226821 2.3957924 2.7910350 4.0175691 3.0434943 2.6186912
## 30 3.8375152 4.4103045 3.1374450 2.1757896 5.0900627 3.2593081 2.4835265
## 31 3.1737225 4.2324918 3.1620414 2.0827494 4.4647573 1.5341514 0.9642024
## 32 2.5514379 3.8398434 2.6242643 2.3403194 4.1886305 1.6437008 1.5932781
## 33 3.7156321 4.0679831 2.4541828 2.7228179 4.6486238 4.1503644 3.4057166
## 34 5.0450413 4.2827439 3.7422859 3.2084690 4.8496493 5.7836276 4.9528850
## 35 4.0551044 4.1259560 3.1056117 2.3803107 4.5942863 4.1125916 3.2300493
## 36 3.2640442 3.8416919 2.2469409 2.4157941 4.2574641 3.4926720 2.8003966
## 37 1.2704849 1.5171602 1.5442380 2.8638754 1.9594197 3.5115043 3.4343934
## 38 3.2162340 3.6722902 2.9936089 3.4407673 3.9765481 3.9274803 3.5053633
## 39 3.7304510 4.0536764 3.0557726 1.8408519 4.5635244 3.3109806 2.4342778
## 40 2.2239840 3.2032289 2.4777306 2.0282343 3.3389199 1.8328226 1.7725780
## 41 3.4481955 3.1170908 3.0356453 1.7090728 3.4136182 3.6515628 2.9411194
## 42 2.2819352 3.1230082 1.4638579 3.0525281 3.5472842 3.5772353 3.2292292
## 43 2.6359594 3.1545145 1.8724966 2.7839051 3.5791706 3.6376919 3.1483156
## 44 3.0665445 3.7101866 2.6600923 1.6310889 4.2051422 2.5227351 1.8205389
## 45 3.7850365 4.9393097 3.7543235 3.8107473 5.1158417 3.1727114 2.8781800
## 46 2.5134607 3.2287785 1.3314634 3.7698236 3.5875868 4.3689889 4.0620389
## 47 2.4356854 3.0991252 1.8436973 4.7988160 3.6298169 5.1576321 5.0559553
## 48 3.6521975 2.9492087 2.4011629 3.2797335 3.2790193 5.2267616 4.6262134
## 49 2.1709421 3.0356360 1.3589717 4.2412875 3.2930823 4.5606507 4.4257240
## 50 2.5302167 2.5727644 1.3437401 2.6646677 3.3876800 4.0870844 3.6288682
## 51 3.1865178 3.8101399 3.0089631 2.0224161 4.1034476 2.5533405 1.8932517
## 52 3.8856005 4.9621558 4.3630283 3.6059046 4.9831726 2.3811482 2.3444019
## 53 3.4303889 4.5081852 3.6924707 3.2014295 4.5638803 2.3588428 2.1474396
## 54 1.9404744 2.9354421 2.1632072 3.7875025 3.0480258 3.7103397 3.6649371
## 55 2.1361968 2.5894271 2.6404924 3.8833644 2.0002397 3.9434316 3.9819681
## 56 2.5196643 4.2822587 2.9256467 3.5500352 4.3914861 1.9842310 2.3531352
## 57 2.5558470 3.1443889 2.3440515 5.6417318 3.4783724 5.8326252 5.9062801
## 58 4.3069886 4.9568742 3.9202715 1.9882705 5.3920229 2.6591881 2.0804716
## 59 3.1821712 3.3592541 2.3045264 3.5295698 3.8087140 4.5709845 4.0583557
## 60 2.6064202 3.2304985 3.5696269 5.0253588 2.5771410 4.5727542 4.8413421
## 61 2.0959227 2.9157974 1.4543051 3.6651609 3.4961910 4.0863840 3.8723309
## 62 2.9306161 3.2636545 2.7000638 1.6613820 3.5233595 2.7577188 2.1253776
## 63 3.9756209 4.3850977 4.1048016 1.7639914 4.5225345 2.2143158 1.4836366
## 64 2.2456525 0.8315594 2.4537164 3.1037582 1.6767851 4.3530420 4.2295250
## 65 2.7399900 2.3970616 1.8723270 3.6921840 2.9808581 4.9267698 4.5348709
## 66 2.3602132 1.9587414 1.4578035 3.3319791 2.1791360 4.5768252 4.2587277
##           29        30        31        32        33        34        35
## 2                                                                       
## 3                                                                       
## 4                                                                       
## 5                                                                       
## 6                                                                       
## 7                                                                       
## 8                                                                       
## 9                                                                       
## 10                                                                      
## 11                                                                      
## 12                                                                      
## 13                                                                      
## 14                                                                      
## 15                                                                      
## 16                                                                      
## 17                                                                      
## 18                                                                      
## 19                                                                      
## 20                                                                      
## 21                                                                      
## 22                                                                      
## 23                                                                      
## 24                                                                      
## 25                                                                      
## 26                                                                      
## 27                                                                      
## 28                                                                      
## 29                                                                      
## 30 1.9393443                                                            
## 31 1.7040313 1.9922881                                                  
## 32 2.0003617 2.1713617 1.0540528                                        
## 33 1.9760135 1.6047197 2.6879847 2.7829807                              
## 34 4.1846930 3.5156218 4.5619342 4.5970040 2.6576491                    
## 35 1.9162827 1.7680562 2.6276798 3.0901326 1.2281854 2.7036664          
## 36 1.4161203 1.6212513 2.0143286 2.2023745 0.8203691 3.1006579 1.2792019
## 37 2.2366384 3.2394719 2.7789291 2.4485227 3.0284930 4.0354181 3.1085858
## 38 1.2349213 2.8294614 2.7054584 3.1332644 2.6500262 4.4745677 2.1700279
## 39 1.5535568 1.0862744 1.8788899 2.3775632 1.4827322 3.1937881 0.9300826
## 40 2.1211527 2.6706310 1.3437432 1.0507167 2.9795454 4.3638197 3.0589333
## 41 2.1817012 2.5294487 2.5190918 2.9336975 2.4485227 3.0233956 1.6709850
## 42 1.0609535 2.3326374 2.2981881 2.2131857 1.7152309 3.7906890 2.1070867
## 43 0.8972757 2.1553879 2.2611819 2.4009819 1.5572595 3.5202442 1.6054134
## 44 1.3238224 1.1117293 1.1650352 1.4689521 1.8262677 3.6318248 1.7471891
## 45 1.5451800 2.8961274 2.1657625 2.7860061 3.1438500 5.4822843 2.9079706
## 46 1.9490387 3.0753840 3.1422231 2.9580259 2.0334220 3.8499273 2.6255915
## 47 2.7312735 3.9814848 4.1285581 3.8052803 3.2272507 4.8294659 3.7147865
## 48 3.2296808 3.5714024 3.9908514 3.9671937 2.3699343 2.0024837 2.4653825
## 49 2.3470266 3.6831183 3.5107298 3.2263894 2.7814409 4.4372791 3.3041235
## 50 2.0503115 2.2081716 2.8907808 2.6076781 1.6060677 2.7909572 2.0967597
## 51 1.0754438 1.8411226 1.2206366 1.9288688 2.2823582 4.0655222 1.7955416
## 52 2.3340168 3.4434128 2.0639819 2.7902670 4.0817160 6.0313145 3.6289840
## 53 1.6361019 2.9284981 1.5906513 2.3297796 3.3664599 5.3891867 2.9922032
## 54 1.6345158 3.4606452 2.8036063 2.7991681 3.1210169 4.9063241 3.1291811
## 55 2.8072393 4.3903160 3.3456078 3.3318695 3.9377936 5.0438557 3.8223983
## 56 2.1883358 3.1608541 1.7291108 1.4069111 3.4645280 5.5870270 3.7849878
## 57 3.8748767 5.1223677 5.0323490 4.5445372 4.3394883 5.5873782 4.8879378
## 58 3.5479373 2.4112406 2.3395384 2.1499271 3.2166548 4.1355901 3.4961993
## 59 1.6356858 2.7921692 3.1873556 3.3687436 1.9181129 3.5832657 1.8251237
## 60 3.6191835 5.3715857 4.2322436 4.1894001 5.0535531 6.3080351 4.9226315
## 61 1.5278409 2.8119089 2.9468512 2.7331767 2.2893447 4.2035138 2.6760579
## 62 1.3930817 2.0770459 1.5373309 2.0218203 2.2445619 3.6208109 1.7471073
## 63 2.5106949 2.6588704 1.6588650 2.4606939 3.4399994 4.6106463 2.7767675
## 64 3.4010977 3.9443107 3.7816622 3.4442865 3.7986547 3.9179274 3.7546826
## 65 2.3425438 3.3547466 3.7089376 3.6488010 2.4869799 3.4466496 2.5334195
## 66 2.7348180 3.6312622 3.5389848 3.3371808 2.7036635 3.2303803 2.9030338
##           36        37        38        39        40        41        42
## 2                                                                       
## 3                                                                       
## 4                                                                       
## 5                                                                       
## 6                                                                       
## 7                                                                       
## 8                                                                       
## 9                                                                       
## 10                                                                      
## 11                                                                      
## 12                                                                      
## 13                                                                      
## 14                                                                      
## 15                                                                      
## 16                                                                      
## 17                                                                      
## 18                                                                      
## 19                                                                      
## 20                                                                      
## 21                                                                      
## 22                                                                      
## 23                                                                      
## 24                                                                      
## 25                                                                      
## 26                                                                      
## 27                                                                      
## 28                                                                      
## 29                                                                      
## 30                                                                      
## 31                                                                      
## 32                                                                      
## 33                                                                      
## 34                                                                      
## 35                                                                      
## 36                                                                      
## 37 2.6001662                                                            
## 38 2.2531395 2.5669185                                                  
## 39 1.2712646 2.8783719 2.1500044                                        
## 40 2.3159205 1.8505163 2.9985210 2.4767170                              
## 41 2.1263429 2.2615093 2.2279429 1.6127520 2.4064640                    
## 42 1.2601079 1.8501205 1.7600807 2.0421727 2.2165377 2.4003925          
## 43 1.1189999 1.9288018 1.3674035 1.6251305 2.3059739 1.9062571 0.6178088
## 44 1.3643037 2.3921138 2.2856527 0.9382143 1.6684586 1.8315621 1.8098418
## 45 2.5703066 3.5294235 1.8053473 2.5587562 3.0289180 3.2803060 2.3872190
## 46 1.7941811 2.2481458 2.3562258 2.8081157 2.9091272 3.0290567 0.9439508
## 47 3.1137021 2.5699074 2.7704689 3.8253682 3.7824799 3.9014594 1.9815601
## 48 2.4563708 2.6837785 3.3359777 2.9959413 3.5164165 2.4117974 2.5598319
## 49 2.4840063 2.1948738 2.6204983 3.4223639 3.0962141 3.4528754 1.4160789
## 50 1.6687244 1.7934620 2.5959097 2.0868105 2.5354911 2.2090105 1.4545474
## 51 1.6767851 2.4504529 1.6833286 1.1733471 1.8441616 1.6226652 1.8881891
## 52 3.4080330 3.6087558 2.5271691 3.0479012 2.7912994 3.3178257 3.2444195
## 53 2.6653884 3.0863619 1.9816844 2.4745134 2.3229653 2.8177919 2.5093902
## 54 2.5751357 1.7778482 1.5953904 3.0053299 2.5220838 2.8365441 1.4750729
## 55 3.3176693 1.8139412 2.7450012 3.7631283 2.5740204 2.9686825 2.5199419
## 56 2.7777053 2.8440605 3.1557450 3.2188518 1.8008915 3.7077114 2.3740176
## 57 4.1805240 3.0514093 3.9430316 4.9815759 4.3959625 4.8267129 3.0469905
## 58 2.9843902 3.8879197 4.6125381 2.8448474 2.5114550 3.5082514 3.7093536
## 59 1.8100972 2.4677317 1.3484578 2.2047340 3.2450438 2.3121618 1.3273383
## 60 4.4409749 2.7417160 3.3544047 4.8065606 3.5527704 4.0770284 3.4610130
## 61 2.0503715 1.8910848 1.8515535 2.6310752 2.7661627 2.8762328 0.8867277
## 62 1.6574584 1.9902891 1.8620387 1.2996399 1.6113052 1.0455457 1.8328226
## 63 2.8841034 3.2026754 2.9055855 2.1062276 2.1659079 2.0257908 3.2487298
## 64 3.5595814 1.3970320 3.5544005 3.5867075 2.7728556 2.5941563 3.0579875
## 65 2.4423254 1.9746372 2.1075847 2.8473431 3.3437240 2.4603607 1.7326406
## 66 2.4654307 1.5535191 2.8946237 3.1218448 2.7796942 2.4509794 1.9395341
##           43        44        45        46        47        48        49
## 2                                                                       
## 3                                                                       
## 4                                                                       
## 5                                                                       
## 6                                                                       
## 7                                                                       
## 8                                                                       
## 9                                                                       
## 10                                                                      
## 11                                                                      
## 12                                                                      
## 13                                                                      
## 14                                                                      
## 15                                                                      
## 16                                                                      
## 17                                                                      
## 18                                                                      
## 19                                                                      
## 20                                                                      
## 21                                                                      
## 22                                                                      
## 23                                                                      
## 24                                                                      
## 25                                                                      
## 26                                                                      
## 27                                                                      
## 28                                                                      
## 29                                                                      
## 30                                                                      
## 31                                                                      
## 32                                                                      
## 33                                                                      
## 34                                                                      
## 35                                                                      
## 36                                                                      
## 37                                                                      
## 38                                                                      
## 39                                                                      
## 40                                                                      
## 41                                                                      
## 42                                                                      
## 43                                                                      
## 44 1.6148385                                                            
## 45 2.2914231 2.4383486                                                  
## 46 1.3392866 2.6851043 3.0547222                                        
## 47 2.3179672 3.6408772 3.6969911 1.5420434                              
## 48 2.3749188 3.2228798 4.5485966 2.3794319 3.2994877                    
## 49 1.8558220 3.1828606 3.3280667 0.7702459 1.1436190 2.7873126          
## 50 1.4479357 1.9630626 3.5836195 1.7576355 2.4481123 1.9604625 2.2087108
## 51 1.5486560 0.9551541 1.8468779 2.7782601 3.6800548 3.3874261 3.2007772
## 52 3.0986696 2.7029692 1.5932781 4.0471328 4.6183602 5.1533399 4.2117333
## 53 2.3725967 2.1413387 1.1117293 3.2998388 4.0036180 4.4524489 3.5171301
## 54 1.6131261 2.6820742 2.3515820 1.8127593 1.9729288 3.3499157 1.6218383
## 55 2.5824982 3.4023101 3.4894968 2.6600916 3.0238524 3.3098325 2.3740176
## 56 2.7108830 2.4518915 2.3747972 2.9436344 3.6129672 4.5643325 2.9887074
## 57 3.4475892 4.6746889 4.7971092 2.4844709 1.3753492 3.9135262 1.8201271
## 58 3.7182524 2.3477142 4.3560204 4.3442099 5.4312524 4.4327813 4.8192249
## 59 0.9818701 2.4753845 2.7117773 1.4881008 2.1086431 2.3232495 1.9405581
## 60 3.5708435 4.4028172 3.9635262 3.5643500 3.4183860 4.5267576 3.0813131
## 61 1.1999362 2.4054851 2.7320979 1.1130602 1.2520873 2.8851536 1.2334842
## 62 1.4624444 1.0862744 2.4501854 2.6441921 3.5843967 2.8536628 3.0446276
## 63 2.9237844 1.8697712 2.8592277 4.1143929 5.0029159 4.2413728 4.4813049
## 64 3.0034172 3.2297944 4.7493073 3.3592032 3.4987166 2.8677830 3.3274667
## 65 1.5853107 2.9397892 3.6245765 1.6475708 1.7981553 1.9120001 1.8145456
## 66 1.9728500 2.9905837 4.0537026 1.7578289 2.4326473 1.4141471 1.8310699
##           50        51        52        53        54        55        56
## 2                                                                       
## 3                                                                       
## 4                                                                       
## 5                                                                       
## 6                                                                       
## 7                                                                       
## 8                                                                       
## 9                                                                       
## 10                                                                      
## 11                                                                      
## 12                                                                      
## 13                                                                      
## 14                                                                      
## 15                                                                      
## 16                                                                      
## 17                                                                      
## 18                                                                      
## 19                                                                      
## 20                                                                      
## 21                                                                      
## 22                                                                      
## 23                                                                      
## 24                                                                      
## 25                                                                      
## 26                                                                      
## 27                                                                      
## 28                                                                      
## 29                                                                      
## 30                                                                      
## 31                                                                      
## 32                                                                      
## 33                                                                      
## 34                                                                      
## 35                                                                      
## 36                                                                      
## 37                                                                      
## 38                                                                      
## 39                                                                      
## 40                                                                      
## 41                                                                      
## 42                                                                      
## 43                                                                      
## 44                                                                      
## 45                                                                      
## 46                                                                      
## 47                                                                      
## 48                                                                      
## 49                                                                      
## 50                                                                      
## 51 2.4477297                                                            
## 52 4.1955330 1.9829029                                                  
## 53 3.5368138 1.4003262 0.7896345                                        
## 54 2.5415677 2.3140155 2.8563023 2.2888311                              
## 55 3.2020683 3.0032217 3.4858168 3.0145598 1.6300812                    
## 56 3.3514957 2.4660903 2.4959189 2.0749792 2.4381597 3.0590545          
## 57 3.3522249 4.7388521 5.5363084 4.9624276 2.7684097 3.2564813 4.2269482
## 58 3.4477086 3.0834722 4.2932417 3.9143225 4.6828084 4.9697457 3.4091334
## 59 1.8466081 2.2981881 3.6858858 3.0041255 1.8978038 2.9103630 3.5579624
## 60 4.2449749 3.9150386 3.8145859 3.5465489 2.1358080 1.3645499 3.6041344
## 61 1.6177138 2.4646769 3.5954691 2.9467948 1.3627692 2.6628648 2.7652819
## 62 2.1226308 0.7250122 2.4867079 1.9152377 2.2695334 2.6459013 2.6987215
## 63 3.5230471 1.4624444 2.1272760 2.0028155 3.4517691 3.6554444 3.1665831
## 64 2.3718904 3.3836719 4.6406571 4.2156531 3.0516497 2.7408826 4.1092825
## 65 1.6029517 2.9077367 4.3336277 3.6928025 2.0388669 2.6727355 3.9365785
## 66 1.7298713 3.0636742 4.5237809 3.8528173 2.3036632 2.1228064 3.6822479
##           57        58        59        60        61        62        63
## 2                                                                       
## 3                                                                       
## 4                                                                       
## 5                                                                       
## 6                                                                       
## 7                                                                       
## 8                                                                       
## 9                                                                       
## 10                                                                      
## 11                                                                      
## 12                                                                      
## 13                                                                      
## 14                                                                      
## 15                                                                      
## 16                                                                      
## 17                                                                      
## 18                                                                      
## 19                                                                      
## 20                                                                      
## 21                                                                      
## 22                                                                      
## 23                                                                      
## 24                                                                      
## 25                                                                      
## 26                                                                      
## 27                                                                      
## 28                                                                      
## 29                                                                      
## 30                                                                      
## 31                                                                      
## 32                                                                      
## 33                                                                      
## 34                                                                      
## 35                                                                      
## 36                                                                      
## 37                                                                      
## 38                                                                      
## 39                                                                      
## 40                                                                      
## 41                                                                      
## 42                                                                      
## 43                                                                      
## 44                                                                      
## 45                                                                      
## 46                                                                      
## 47                                                                      
## 48                                                                      
## 49                                                                      
## 50                                                                      
## 51                                                                      
## 52                                                                      
## 53                                                                      
## 54                                                                      
## 55                                                                      
## 56                                                                      
## 57                                                                      
## 58 6.1886190                                                            
## 59 3.3275649 4.6023123                                                  
## 60 3.4000622 6.0497557 3.7604829                                        
## 61 2.4441230 4.3461508 1.3881992 3.3430436                              
## 62 4.5394368 3.0390625 2.2156508 3.7039963 2.4258297                    
## 63 5.9320124 2.9882667 3.6384262 4.5063987 3.8119380 1.5486560          
## 64 3.7682767 4.3454366 3.3535852 3.5440480 3.0163208 2.7971689 3.7768122
## 65 2.7268306 4.8613711 1.1662951 3.5098287 1.4836366 2.5823612 4.0769779
## 66 2.8507093 4.3924380 2.1342066 3.2755862 2.1081307 2.5307624 3.9887538
##           64        65
## 2                     
## 3                     
## 4                     
## 5                     
## 6                     
## 7                     
## 8                     
## 9                     
## 10                    
## 11                    
## 12                    
## 13                    
## 14                    
## 15                    
## 16                    
## 17                    
## 18                    
## 19                    
## 20                    
## 21                    
## 22                    
## 23                    
## 24                    
## 25                    
## 26                    
## 27                    
## 28                    
## 29                    
## 30                    
## 31                    
## 32                    
## 33                    
## 34                    
## 35                    
## 36                    
## 37                    
## 38                    
## 39                    
## 40                    
## 41                    
## 42                    
## 43                    
## 44                    
## 45                    
## 46                    
## 47                    
## 48                    
## 49                    
## 50                    
## 51                    
## 52                    
## 53                    
## 54                    
## 55                    
## 56                    
## 57                    
## 58                    
## 59                    
## 60                    
## 61                    
## 62                    
## 63                    
## 64                    
## 65 2.5554265          
## 66 2.0866224 1.4537842
hc <- hclust(distance_matrix)
hc
## 
## Call:
## hclust(d = distance_matrix)
## 
## Cluster method   : complete 
## Distance         : euclidean 
## Number of objects: 66
# Plotting the dendrogram
plot(hc)

# Adding labels to the dendrogram
plot(hc, hang = -0.1, labels = NULL)  # You can replace NULL with your desired labels if available

hclust_avg <- hclust(distance_matrix, method = "average")
plot(hclust_avg)

# Find the maximum vertical distance between clusters
max_dist <- max(hclust_avg$height)
max_dist
## [1] 4.123358
# Draw a horizontal line delimiting the distance
abline(h = max_dist, col = "red")

#abline(h = 2, col = "red")

library(dendextend)
## 
## ---------------------
## Welcome to dendextend version 1.17.1
## Type citation('dendextend') for how to cite the package.
## 
## Type browseVignettes(package = 'dendextend') for the package vignette.
## The github page is: https://github.com/talgalili/dendextend/
## 
## Suggestions and bug-reports can be submitted at: https://github.com/talgalili/dendextend/issues
## You may ask questions at stackoverflow, use the r and dendextend tags: 
##   https://stackoverflow.com/questions/tagged/dendextend
## 
##  To suppress this message use:  suppressPackageStartupMessages(library(dendextend))
## ---------------------
## 
## Attaching package: 'dendextend'
## The following object is masked from 'package:stats':
## 
##     cutree
avg_dend_obj <- as.dendrogram(hclust_avg)
avg_col_dend <- color_branches(avg_dend_obj, h = 3)
plot(avg_col_dend)

# Determining clusters
library(cluster)
cut_avg<-cutree(hclust_avg,k=6)
cut_avg
##  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 
##  1  1  1  2  2  3  2  4  4  1  2  1  4  4  4  3  1  4  4  1  1  4  4  1  2  4 
## 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 
##  2  2  1  2  2  2  2  5  2  2  4  1  2  2  2  1  1  2  2  1  1  1  1  1  2  2 
## 53 54 55 56 57 58 59 60 61 62 63 64 65 66 
##  2  1  4  3  6  2  1  4  1  2  2  4  1  1
sil<-silhouette(cut_avg,distance_matrix)
sil
##       cluster neighbor    sil_width
##  [1,]       1        5  0.169604461
##  [2,]       1        4  0.216384292
##  [3,]       1        4  0.105908464
##  [4,]       2        1  0.168769087
##  [5,]       2        3  0.181400982
##  [6,]       3        2  0.431860274
##  [7,]       2        3  0.142385892
##  [8,]       4        1  0.240019668
##  [9,]       4        1  0.431026273
## [10,]       1        3  0.084988759
## [11,]       2        3  0.264072093
## [12,]       1        5  0.087852640
## [13,]       4        1  0.211413885
## [14,]       4        1  0.128145077
## [15,]       4        1  0.335206168
## [16,]       3        2  0.330115558
## [17,]       1        4  0.104734828
## [18,]       4        1  0.328249498
## [19,]       4        1  0.319319248
## [20,]       1        4  0.074127469
## [21,]       1        5 -0.293131712
## [22,]       4        6  0.175023176
## [23,]       4        1  0.248423774
## [24,]       1        6  0.218407653
## [25,]       2        5  0.282991101
## [26,]       4        1  0.376365566
## [27,]       2        3  0.013453734
## [28,]       2        3  0.268148957
## [29,]       1        2 -0.111769194
## [30,]       2        1  0.258174301
## [31,]       2        3  0.244695925
## [32,]       2        3  0.024315075
## [33,]       2        1 -0.104614548
## [34,]       5        1  0.000000000
## [35,]       2        1  0.051826826
## [36,]       2        1  0.003567982
## [37,]       4        1  0.179325024
## [38,]       1        2  0.044127536
## [39,]       2        1  0.265704856
## [40,]       2        4  0.165378047
## [41,]       2        1  0.087938468
## [42,]       1        2  0.281922624
## [43,]       1        2  0.208532236
## [44,]       2        1  0.349035071
## [45,]       2        3 -0.065040869
## [46,]       1        6  0.260955885
## [47,]       1        6 -0.432692632
## [48,]       1        5 -0.133383447
## [49,]       1        6 -0.109482239
## [50,]       1        2  0.337666945
## [51,]       2        1  0.353437571
## [52,]       2        3  0.083543074
## [53,]       2        3  0.112075370
## [54,]       1        4  0.068290664
## [55,]       4        1  0.271114127
## [56,]       3        2  0.314209956
## [57,]       6        1  0.000000000
## [58,]       2        3  0.227509639
## [59,]       1        2  0.325259742
## [60,]       4        6  0.152065015
## [61,]       1        6  0.229027995
## [62,]       2        1  0.265264505
## [63,]       2        3  0.409223858
## [64,]       4        1  0.248346021
## [65,]       1        6  0.289005673
## [66,]       1        4  0.107339083
## attr(,"Ordered")
## [1] FALSE
## attr(,"call")
## silhouette.default(x = cut_avg, dist = distance_matrix)
## attr(,"class")
## [1] "silhouette"
plot(sil)

avg_silhouette_width <- mean(sil[, 3])
avg_silhouette_width
## [1] 0.16526
#OR we can use the below fuction to find silhouette scores for different number of clusters.
library(fpc)
## Warning: package 'fpc' was built under R version 4.3.3
# Calculate silhouette scores for different numbers of clusters
set.seed(1234)

num_clusters=2:6
# Define the methods
methods <- c('complete', 'single', 'average')

sil_scores <- numeric(length(num_clusters))

# Create a matrix to store silhouette scores
avgSilhouette <- matrix(NA, ncol = 3, nrow = 5, dimnames = list(2:6, methods))

# Iterate over different numbers of clusters
for (k in num_clusters) {
  # Iterate over different linkage methods
  for (m in seq_along(methods)) {
    # Perform hierarchical clustering
    hclust_result <- hclust(distance_matrix, method = methods[m])
    
    # Cut the hierarchical clustering tree into k clusters
    cut_tree <- cutree(hclust_avg, k)
    
    # Compute silhouette scores
    sil_scores[k-1] <- cluster.stats(distance_matrix,  cut_tree)$avg.silwidth
    
    # Calculate the average silhouette width
    avgSilhouette[k - 1, m] <- mean(sil_scores)
  }
}

# Display the matrix of average silhouette scores
avgSilhouette
##     complete     single    average
## 2 0.04884370 0.04884370 0.04884370
## 3 0.09384882 0.09384882 0.09384882
## 4 0.12758561 0.12758561 0.12758561
## 5 0.15576918 0.15576918 0.15576918
## 6 0.18882119 0.18882119 0.18882119
# Display the silhouette scores
sil_scores
## [1] 0.2442185 0.2250256 0.1686840 0.1409178 0.1652600
# Plotting silhouette scores vs. number of clusters
plot(num_clusters, sil_scores, type = "b", xlab = "Number of Clusters", ylab = "Average Silhouette Width")

# Finding the optimal value of k
optimal_clusters <- num_clusters[which.max(sil_scores)]
optimal_clusters
## [1] 2
# Optionally, create a plot to visualize the silhouette scores
plot(num_clusters, sil_scores, type = "b", xlab = "Number of Clusters", ylab = "Average Silhouette Width", main = "Silhouette Scores vs. Number of Clusters")
abline(v = optimal_clusters, col = "red", lty = 2)  # Add a vertical line at the optimal number of clusters

#5 Performing K-means clustering & Finding the optimal value of k in-case of K-means clustering


# Set seed for reproducibility
set.seed(1234)

# Define the range of cluster values to try
cluster_values <- 2:6  # Try cluster values from 2 to 6

# Create an empty list to store kmeans results
kmeans_results <- list()
silhouette_scores <- numeric(length(cluster_values))

# Iterate over different numbers of clusters
for (i in seq_along(cluster_values)) {
  
  
  # Apply K-means clustering
  k <- cluster_values[i]
  kmeans_results[[as.character(k)]] <- kmeans(ERS_scaled, centers = k)
  # Compute silhouette scores
  clusters <- kmeans_results[[as.character(k)]]$cluster
  silhouette_scores[i] <- cluster.stats(distance_matrix,  clusters)$avg.silwidth
  
}
kmeans_results
## $`2`
## K-means clustering with 2 clusters of sizes 29, 37
## 
## Cluster means:
##    pretest.1  pretest.2 post.test.1 post.test.2 post.test.3
## 1  0.6296188  0.5598310   0.9226308  0.10922521   0.6361294
## 2 -0.4934850 -0.4387864  -0.7231431 -0.08560895  -0.4985879
## 
## Clustering vector:
##  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 
##  2  2  2  1  1  1  1  2  2  2  1  2  2  2  2  1  2  2  2  2  2  2  2  2  1  2 
## 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 
##  1  1  1  1  1  1  1  2  1  1  2  1  1  1  1  2  2  1  1  2  2  2  2  2  1  1 
## 53 54 55 56 57 58 59 60 61 62 63 64 65 66 
##  1  2  2  1  2  1  2  2  2  1  1  2  2  2 
## 
## Within cluster sum of squares by cluster:
## [1]  93.31408 129.38164
##  (between_SS / total_SS =  31.5 %)
## 
## Available components:
## 
## [1] "cluster"      "centers"      "totss"        "withinss"     "tot.withinss"
## [6] "betweenss"    "size"         "iter"         "ifault"      
## 
## $`3`
## K-means clustering with 3 clusters of sizes 22, 22, 22
## 
## Cluster means:
##    pretest.1  pretest.2 post.test.1 post.test.2 post.test.3
## 1 -0.1254048 -0.6436521  -0.8393431  -0.2184504  -1.0559166
## 2  0.9580930  0.7942941   1.0491789   0.1092252   0.4355941
## 3 -0.8326882 -0.1506420  -0.2098358   0.1092252   0.6203225
## 
## Clustering vector:
##  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 
##  1  3  1  2  2  2  2  1  1  3  2  1  1  1  1  2  1  1  1  1  3  1  1  1  2  1 
## 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 
##  2  2  3  2  2  2  3  3  3  3  1  3  3  2  3  3  3  2  2  3  3  3  3  3  2  2 
## 53 54 55 56 57 58 59 60 61 62 63 64 65 66 
##  2  3  1  2  1  2  3  1  3  2  2  1  3  1 
## 
## Within cluster sum of squares by cluster:
## [1] 62.59900 63.47605 60.20814
##  (between_SS / total_SS =  42.7 %)
## 
## Available components:
## 
## [1] "cluster"      "centers"      "totss"        "withinss"     "tot.withinss"
## [6] "betweenss"    "size"         "iter"         "ifault"      
## 
## $`4`
## K-means clustering with 4 clusters of sizes 17, 19, 14, 16
## 
## Cluster means:
##     pretest.1   pretest.2 post.test.1 post.test.2 post.test.3
## 1  1.19975551  0.93567205   1.0349972  0.04226982   0.2721960
## 2 -0.06917067 -0.42850078  -0.7047004  0.30891673  -1.1747477
## 3 -0.94662741 -0.59669880  -0.8852646 -0.83930952   0.1159847
## 4 -0.36430107  0.03680458   0.5117537  0.32264552   1.0043181
## 
## Clustering vector:
##  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 
##  3  3  3  1  1  1  1  2  2  2  1  3  2  2  2  1  3  2  2  3  3  2  2  3  1  2 
## 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 
##  1  1  4  4  1  1  4  3  4  4  2  4  4  1  4  4  4  4  4  3  2  3  2  3  4  1 
## 53 54 55 56 57 58 59 60 61 62 63 64 65 66 
##  1  2  2  1  2  1  4  2  4  4  1  2  3  3 
## 
## Within cluster sum of squares by cluster:
## [1] 48.20409 58.20640 27.94474 28.05031
##  (between_SS / total_SS =  50.0 %)
## 
## Available components:
## 
## [1] "cluster"      "centers"      "totss"        "withinss"     "tot.withinss"
## [6] "betweenss"    "size"         "iter"         "ifault"      
## 
## $`5`
## K-means clustering with 5 clusters of sizes 15, 7, 14, 19, 11
## 
## Cluster means:
##    pretest.1   pretest.2 post.test.1 post.test.2 post.test.3
## 1  0.2688680 -0.71075631  -0.5527164   0.1598137  -1.2967477
## 2  1.1107286  1.30784638   0.7353819   1.3016689   0.5137860
## 3 -0.3554332 -0.04793154   0.5459557   0.1634272   1.0513554
## 4 -1.0449524 -0.28578732  -0.9373291  -0.3900036  -0.0656572
## 5  1.1838217  0.69158369   1.2099042  -0.5806182   0.2166567
## 
## Clustering vector:
##  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 
##  4  4  4  5  2  2  5  1  1  4  5  4  1  1  1  2  4  1  1  4  4  1  1  4  5  1 
## 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 
##  5  5  3  3  5  5  3  4  3  3  1  3  3  5  3  3  3  3  2  4  4  4  4  4  3  2 
## 53 54 55 56 57 58 59 60 61 62 63 64 65 66 
##  2  1  1  2  4  5  3  1  4  3  5  1  4  4 
## 
## Within cluster sum of squares by cluster:
## [1] 34.58221 18.44131 20.28707 52.94569 16.99983
##  (between_SS / total_SS =  55.9 %)
## 
## Available components:
## 
## [1] "cluster"      "centers"      "totss"        "withinss"     "tot.withinss"
## [6] "betweenss"    "size"         "iter"         "ifault"      
## 
## $`6`
## K-means clustering with 6 clusters of sizes 11, 11, 11, 7, 14, 12
## 
## Cluster means:
##    pretest.1   pretest.2 post.test.1 post.test.2 post.test.3
## 1 -0.8928825 -0.74636259  -0.8795244 -1.13249298   0.1482388
## 2  1.1838217  0.69158369   1.2099042 -0.58061823   0.2166567
## 3 -1.1035626  0.23965771  -0.8259493  0.73008431  -0.1528000
## 4  1.1107286  1.30784638   0.7353819  1.30166887   0.5137860
## 5  0.3067044 -0.75810093  -0.5695543  0.05502323  -1.3677068
## 6 -0.2608421 -0.04793154   0.6897793  0.07760739   1.1015285
## 
## Clustering vector:
##  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 
##  1  1  1  2  4  4  2  5  5  3  2  1  5  5  5  4  1  5  5  1  1  5  5  3  2  5 
## 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 
##  2  2  6  6  2  2  6  1  6  6  5  6  6  2  6  3  6  6  4  3  3  1  3  1  6  4 
## 53 54 55 56 57 58 59 60 61 62 63 64 65 66 
##  4  3  5  4  3  2  3  5  3  6  2  5  3  1 
## 
## Within cluster sum of squares by cluster:
## [1] 19.51480 16.99983 17.73188 18.44131 30.38791 16.08689
##  (between_SS / total_SS =  63.3 %)
## 
## Available components:
## 
## [1] "cluster"      "centers"      "totss"        "withinss"     "tot.withinss"
## [6] "betweenss"    "size"         "iter"         "ifault"
# Validate clustering results using silhouette scores
silhouette_avg <- silhouette(kmeans_results[[as.character(k)]]$cluster, distance_matrix)
cat("Average silhouette width:", mean(silhouette_avg[, 3]), "\n")
## Average silhouette width: 0.2365234
# Plot silhouette scores vs. number of clusters
plot(cluster_values, silhouette_scores, type = "b", xlab = "Number of Clusters (k)", ylab = "Average Silhouette Width", main = "Silhouette Scores vs. Number of Clusters")

# Find the optimal number of clusters
optimal_k <- cluster_values[which.max(silhouette_scores)]
abline(v = optimal_k, col = "red", lty = 2)
text(optimal_k, max(silhouette_scores), labels = paste("Optimal k =", optimal_k), pos = 3)

kmeans_results$betweenss
## NULL
#table(kmeans_result$cluster,ERS$post.test.3)
#cm<- table(kmeans_result$cluster,ERS$post.test.3)

#Error<-1-sum(diag(cm))/sum(cm)
#Error
# Interpret clusters
cluster_means <- aggregate(ERS_scaled, by=list(cluster=kmeans_results[[as.character(k)]]$cluster), FUN=mean)
cluster_means
##   cluster  pretest.1   pretest.2 post.test.1 post.test.2 post.test.3
## 1       1 -0.8928825 -0.74636259  -0.8795244 -1.13249298   0.1482388
## 2       2  1.1838217  0.69158369   1.2099042 -0.58061823   0.2166567
## 3       3 -1.1035626  0.23965771  -0.8259493  0.73008431  -0.1528000
## 4       4  1.1107286  1.30784638   0.7353819  1.30166887   0.5137860
## 5       5  0.3067044 -0.75810093  -0.5695543  0.05502323  -1.3677068
## 6       6 -0.2608421 -0.04793154   0.6897793  0.07760739   1.1015285
# Interpret clusters (when k=2: we can see that cluster 1 shows the results of students who performed well throughout all 5 tests while, cluster 2 shows the results of students who didn't perform well throughout)

cluster_means <- aggregate(ERS_scaled, by=list(cluster=kmeans_results[[as.character(2)]]$cluster), FUN=mean)
cluster_means
##   cluster  pretest.1  pretest.2 post.test.1 post.test.2 post.test.3
## 1       1  0.6296188  0.5598310   0.9226308  0.10922521   0.6361294
## 2       2 -0.4934850 -0.4387864  -0.7231431 -0.08560895  -0.4985879
library("clValid")
dunn_index <- dunn(distance_matrix, cut_avg)
print(paste("Dunn Index:", dunn_index))
## [1] "Dunn Index: 0.246886770670848"