data <- read.csv("/Users/manojdannana/Desktop/Manoj/IUPUI/class work/intro to statistics/datasets/Occupancy_Estimation.csv")
set.seed(42)
sample_sizes <- sapply(1:5, function(x) round(nrow(data) * 0.5))
subsamples <- lapply(sample_sizes, function(size) data[sample(1:nrow(data), size, replace = TRUE), ])

df_1 <- subsamples[[1]]
df_2 <- subsamples[[2]]
df_3 <- subsamples[[3]]
df_4 <- subsamples[[4]]
df_5 <- subsamples[[5]]
head(df_1)
##          Date     Time S1_Temp S2_Temp S3_Temp S4_Temp S1_Light S2_Light
## 2369 23/12/17  7:49:48   25.00   25.00   24.44   25.31        3        4
## 5273 24/12/17  8:54:29   25.13   25.13   24.63   25.38        7        7
## 9290 11/01/18  1:47:41   25.19   25.19   24.75   25.25        0        0
## 1252 22/12/17 22:11:18   25.56   25.63   25.19   25.94        0        0
## 8826 10/01/18 21:47:43   25.38   25.38   25.00   25.50        0        0
## 356  22/12/17 14:20:33   26.19   26.75   26.06   26.38       18       22
##      S3_Light S4_Light S1_Sound S2_Sound S3_Sound S4_Sound S5_CO2 S5_CO2_Slope
## 2369       18       13     0.08     0.05     0.06     0.06    355 -0.023076923
## 5273       35       23     0.07     0.05     0.05     0.07    360 -0.003846154
## 9290        0        0     0.07     0.05     0.06     0.09    345  0.000000000
## 1252        0        0     0.07     0.05     0.06     0.06    480 -1.307692308
## 8826        0        0     0.07     0.05     0.06     0.08    360 -0.238461538
## 356        96       59     0.07     0.05     0.06     0.06    965  0.050000000
##      S6_PIR S7_PIR Room_Occupancy_Count
## 2369      0      0                    0
## 5273      0      0                    0
## 9290      0      0                    0
## 1252      0      0                    0
## 8826      0      0                    0
## 356       0      0                    0
head(df_2)
##          Date     Time S1_Temp S2_Temp S3_Temp S4_Temp S1_Light S2_Light
## 2609 23/12/17  9:53:52   25.06   25.13   24.69   25.38        8        9
## 7734 26/12/17  6:08:45   25.19   25.25   24.63   25.50        0        0
## 6886 25/12/17 22:49:39   25.38   25.38   25.06   25.88        0        0
## 1741 23/12/17  2:25:04   25.31   25.31   24.81   25.63        0        0
## 1749 23/12/17  2:29:09   25.31   25.25   24.81   25.69        0        0
## 3913 23/12/17 21:09:53   25.75   25.75   25.38   26.00        0        0
##      S3_Light S4_Light S1_Sound S2_Sound S3_Sound S4_Sound S5_CO2 S5_CO2_Slope
## 2609       41       28     0.08     0.05     0.07     0.06    355  -0.03846154
## 7734        0        0     0.08     0.04     0.07     0.09    355   0.00000000
## 6886        0        0     0.08     0.06     0.06     0.10    355   0.00000000
## 1741        0        0     0.08     0.05     0.06     0.06    365  -0.05769231
## 1749        0        0     0.07     0.05     0.06     0.06    365   0.00000000
## 3913        0        0     0.07     0.05     0.06     0.07    710  -1.90769231
##      S6_PIR S7_PIR Room_Occupancy_Count
## 2609      0      0                    0
## 7734      0      0                    0
## 6886      0      0                    0
## 1741      0      0                    0
## 1749      0      0                    0
## 3913      0      0                    0
head(df_3)
##          Date     Time S1_Temp S2_Temp S3_Temp S4_Temp S1_Light S2_Light
## 8656 10/01/18 20:20:24   25.50   25.50   25.13   25.63        0        0
## 9249 11/01/18  1:26:15   25.19   25.19   24.81   25.31        0        0
## 5140 24/12/17  7:46:04   25.06   25.13   24.50   25.44        3        3
## 4886 24/12/17  5:34:51   25.19   25.19   24.63   25.50        0        0
## 9920 11/01/18  7:11:55   25.06   25.06   24.56   25.19        0        0
## 2203 23/12/17  6:23:00   25.06   25.06   24.44   25.19        0        0
##      S3_Light S4_Light S1_Sound S2_Sound S3_Sound S4_Sound S5_CO2 S5_CO2_Slope
## 8656        0        0     0.07     0.05     0.05     0.08    390  -0.88846154
## 9249        0        0     0.07     0.04     0.05     0.09    345   0.00000000
## 5140       17       12     0.07     0.04     0.06     0.06    360   0.04230769
## 4886        0        0     0.07     0.05     0.15     0.06    360  -0.10384615
## 9920        5        3     0.07     0.05     0.06     0.09    345   0.00000000
## 2203        0        0     0.08     0.05     0.06     0.05    355  -0.18846154
##      S6_PIR S7_PIR Room_Occupancy_Count
## 8656      0      0                    0
## 9249      0      0                    0
## 5140      0      0                    0
## 4886      0      0                    0
## 9920      0      0                    0
## 2203      0      0                    0
head(df_4)
##          Date     Time S1_Temp S2_Temp S3_Temp S4_Temp S1_Light S2_Light
## 6542 25/12/17 19:51:58   25.44   25.44   25.19   25.94        0        0
## 1647 23/12/17  1:36:03   25.31   25.31   24.88   25.75        0        0
## 8336 10/01/18 17:35:29   25.94   26.19   25.88   25.94      146      230
## 6215 25/12/17 17:02:27   25.44   25.44   25.31   26.19        1        1
## 1742 23/12/17  2:25:35   25.25   25.31   24.81   25.69        0        0
## 6211 25/12/17 17:00:25   25.44   25.44   25.31   26.19        1        2
##      S3_Light S4_Light S1_Sound S2_Sound S3_Sound S4_Sound S5_CO2 S5_CO2_Slope
## 6542        0        0     0.08     0.05     0.06     0.09    355   0.09230769
## 1647        0        0     0.07     0.04     0.06     0.06    370   0.00000000
## 8336      170       19     0.10     0.31     0.08     0.08    835   1.27692308
## 6215        9        6     0.08     0.05     0.05     0.10    350   0.00000000
## 1742        0        0     0.07     0.05     0.07     0.07    365  -0.06538461
## 6211       10        7     0.07     0.05     0.06     0.10    350   0.00000000
##      S6_PIR S7_PIR Room_Occupancy_Count
## 6542      0      0                    0
## 1647      0      0                    0
## 8336      1      0                    2
## 6215      0      0                    0
## 1742      0      0                    0
## 6211      0      0                    0
head(df_5)
##          Date     Time S1_Temp S2_Temp S3_Temp S4_Temp S1_Light S2_Light
## 5997 25/12/17 15:10:07   25.44   25.44   25.44   26.13       14       17
## 9072 10/01/18 23:55:22   25.25   25.31   24.88   25.38        0        0
## 1989 23/12/17  4:32:43   25.19   25.19   24.63   25.44        0        0
## 9626 11/01/18  4:40:47   25.19   25.13   24.63   25.25        0        0
## 3338 23/12/17 16:10:41   26.06   26.81   25.50   26.31      119       22
## 8632 10/01/18 20:08:09   25.56   25.50   25.19   25.63        0        0
##      S3_Light S4_Light S1_Sound S2_Sound S3_Sound S4_Sound S5_CO2 S5_CO2_Slope
## 5997       65       47     0.08     0.06     0.07     0.11    355    0.0000000
## 9072        0        0     0.07     0.05     0.05     0.08    345    0.0000000
## 1989        0        0     0.08     0.05     0.06     0.06    360    0.0000000
## 9626        0        0     0.08     0.05     0.06     0.08    345    0.0000000
## 3338       34       23     0.10     0.12     0.06     0.07    485    0.7076923
## 8632        0        0     0.08     0.05     0.06     0.09    415   -1.1192308
##      S6_PIR S7_PIR Room_Occupancy_Count
## 5997      0      0                    0
## 9072      0      0                    0
## 1989      0      0                    0
## 9626      0      0                    0
## 3338      0      0                    1
## 8632      0      0                    0
analyze_subsample <- function(subsample, subsample_number) {
  cat("Analysis for Subsample", subsample_number, "\n")
  
  # Summary statistics
  summary_stats <- summary(subsample)
  print(summary_stats)
  
  # Check for anomalies in S6_PIR and S7_PIR
  anomalies <- as.data.frame(table(subsample$S6_PIR, subsample$S7_PIR))
  colnames(anomalies) <- c("S6_PIR", "S7_PIR", "Count")
  
  cat("Anomalies in S6_PIR and S7_PIR:\n")
  print(anomalies)
  
  # Monte Carlo simulation for a selected column (e.g., S1_Temp)
  column_to_simulate <- "S1_Temp"
  num_simulations <- 1000
  
  simulated_means <- replicate(num_simulations, mean(sample(subsample[[column_to_simulate]], replace = TRUE)))
  
  cat("Monte Carlo Simulation for", column_to_simulate, "Mean:\n")
  hist(simulated_means, main = paste("Distribution of Simulated Means for", column_to_simulate))
}
list_df = list(df_1, df_2, df_3, df_4, df_5)
for (i in 1:5){
  print(analyze_subsample(list_df[[i]], i))
}
## Analysis for Subsample 1 
##      Date               Time              S1_Temp         S2_Temp     
##  Length:5064        Length:5064        Min.   :24.94   Min.   :24.75  
##  Class :character   Class :character   1st Qu.:25.19   1st Qu.:25.19  
##  Mode  :character   Mode  :character   Median :25.38   Median :25.38  
##                                        Mean   :25.45   Mean   :25.53  
##                                        3rd Qu.:25.63   3rd Qu.:25.63  
##                                        Max.   :26.38   Max.   :28.94  
##     S3_Temp         S4_Temp         S1_Light         S2_Light     
##  Min.   :24.44   Min.   :25.00   Min.   :  0.00   Min.   :  0.00  
##  1st Qu.:24.69   1st Qu.:25.44   1st Qu.:  0.00   1st Qu.:  0.00  
##  Median :24.94   Median :25.75   Median :  0.00   Median :  0.00  
##  Mean   :25.05   Mean   :25.74   Mean   : 24.03   Mean   : 24.44  
##  3rd Qu.:25.31   3rd Qu.:26.00   3rd Qu.: 11.00   3rd Qu.: 12.00  
##  Max.   :26.19   Max.   :26.50   Max.   :165.00   Max.   :257.00  
##     S3_Light         S4_Light        S1_Sound        S2_Sound     
##  Min.   :  0.00   Min.   : 0.00   Min.   :0.060   Min.   :0.0400  
##  1st Qu.:  0.00   1st Qu.: 0.00   1st Qu.:0.070   1st Qu.:0.0500  
##  Median :  0.00   Median : 0.00   Median :0.080   Median :0.0500  
##  Mean   : 32.42   Mean   :13.03   Mean   :0.165   Mean   :0.1168  
##  3rd Qu.: 49.00   3rd Qu.:22.00   3rd Qu.:0.080   3rd Qu.:0.0600  
##  Max.   :280.00   Max.   :74.00   Max.   :3.830   Max.   :3.4400  
##     S3_Sound         S4_Sound           S5_CO2        S5_CO2_Slope     
##  Min.   :0.0500   Min.   :0.05000   Min.   : 345.0   Min.   :-6.28846  
##  1st Qu.:0.0600   1st Qu.:0.06000   1st Qu.: 355.0   1st Qu.:-0.04615  
##  Median :0.0600   Median :0.08000   Median : 360.0   Median : 0.00000  
##  Mean   :0.1473   Mean   :0.09941   Mean   : 457.3   Mean   :-0.02976  
##  3rd Qu.:0.0700   3rd Qu.:0.10000   3rd Qu.: 450.0   3rd Qu.: 0.00000  
##  Max.   :3.6600   Max.   :1.54000   Max.   :1270.0   Max.   : 8.83846  
##      S6_PIR            S7_PIR        Room_Occupancy_Count
##  Min.   :0.00000   Min.   :0.00000   Min.   :0.0000      
##  1st Qu.:0.00000   1st Qu.:0.00000   1st Qu.:0.0000      
##  Median :0.00000   Median :0.00000   Median :0.0000      
##  Mean   :0.08531   Mean   :0.06991   Mean   :0.3726      
##  3rd Qu.:0.00000   3rd Qu.:0.00000   3rd Qu.:0.0000      
##  Max.   :1.00000   Max.   :1.00000   Max.   :3.0000      
## Anomalies in S6_PIR and S7_PIR:
##   S6_PIR S7_PIR Count
## 1      0      0  4496
## 2      1      0   214
## 3      0      1   136
## 4      1      1   218
## Monte Carlo Simulation for S1_Temp Mean:

## $breaks
## [1] 25.430 25.435 25.440 25.445 25.450 25.455 25.460 25.465
## 
## $counts
## [1]  11 120 332 379 132  24   2
## 
## $density
## [1]  2.2 24.0 66.4 75.8 26.4  4.8  0.4
## 
## $mids
## [1] 25.4325 25.4375 25.4425 25.4475 25.4525 25.4575 25.4625
## 
## $xname
## [1] "simulated_means"
## 
## $equidist
## [1] TRUE
## 
## attr(,"class")
## [1] "histogram"
## Analysis for Subsample 2 
##      Date               Time              S1_Temp         S2_Temp     
##  Length:5064        Length:5064        Min.   :24.94   Min.   :24.75  
##  Class :character   Class :character   1st Qu.:25.19   1st Qu.:25.19  
##  Mode  :character   Mode  :character   Median :25.38   Median :25.38  
##                                        Mean   :25.45   Mean   :25.54  
##                                        3rd Qu.:25.63   3rd Qu.:25.63  
##                                        Max.   :26.38   Max.   :29.00  
##     S3_Temp         S4_Temp         S1_Light         S2_Light     
##  Min.   :24.44   Min.   :25.00   Min.   :  0.00   Min.   :  0.00  
##  1st Qu.:24.69   1st Qu.:25.44   1st Qu.:  0.00   1st Qu.:  0.00  
##  Median :24.94   Median :25.75   Median :  0.00   Median :  0.00  
##  Mean   :25.05   Mean   :25.74   Mean   : 24.26   Mean   : 25.27  
##  3rd Qu.:25.31   3rd Qu.:26.00   3rd Qu.: 10.00   3rd Qu.: 12.00  
##  Max.   :26.13   Max.   :26.50   Max.   :165.00   Max.   :257.00  
##     S3_Light         S4_Light        S1_Sound         S2_Sound    
##  Min.   :  0.00   Min.   : 0.00   Min.   :0.0600   Min.   :0.040  
##  1st Qu.:  0.00   1st Qu.: 0.00   1st Qu.:0.0700   1st Qu.:0.050  
##  Median :  0.00   Median : 0.00   Median :0.0800   Median :0.050  
##  Mean   : 32.88   Mean   :12.86   Mean   :0.1663   Mean   :0.119  
##  3rd Qu.: 49.00   3rd Qu.:21.00   3rd Qu.:0.0800   3rd Qu.:0.060  
##  Max.   :280.00   Max.   :74.00   Max.   :3.8800   Max.   :3.440  
##     S3_Sound         S4_Sound          S5_CO2        S5_CO2_Slope      
##  Min.   :0.0400   Min.   :0.0500   Min.   : 345.0   Min.   :-6.288462  
##  1st Qu.:0.0600   1st Qu.:0.0600   1st Qu.: 355.0   1st Qu.:-0.042308  
##  Median :0.0600   Median :0.0800   Median : 360.0   Median : 0.000000  
##  Mean   :0.1609   Mean   :0.1039   Mean   : 457.4   Mean   :-0.005393  
##  3rd Qu.:0.0700   3rd Qu.:0.1000   3rd Qu.: 445.0   3rd Qu.: 0.000000  
##  Max.   :3.6700   Max.   :3.4000   Max.   :1270.0   Max.   : 8.980769  
##      S6_PIR            S7_PIR        Room_Occupancy_Count
##  Min.   :0.00000   Min.   :0.00000   Min.   :0.0000      
##  1st Qu.:0.00000   1st Qu.:0.00000   1st Qu.:0.0000      
##  Median :0.00000   Median :0.00000   Median :0.0000      
##  Mean   :0.08491   Mean   :0.07741   Mean   :0.3809      
##  3rd Qu.:0.00000   3rd Qu.:0.00000   3rd Qu.:0.0000      
##  Max.   :1.00000   Max.   :1.00000   Max.   :3.0000      
## Anomalies in S6_PIR and S7_PIR:
##   S6_PIR S7_PIR Count
## 1      0      0  4477
## 2      1      0   195
## 3      0      1   157
## 4      1      1   235
## Monte Carlo Simulation for S1_Temp Mean:

## $breaks
## [1] 25.430 25.435 25.440 25.445 25.450 25.455 25.460 25.465 25.470
## 
## $counts
## [1]  12 105 307 363 169  40   3   1
## 
## $density
## [1]  2.4 21.0 61.4 72.6 33.8  8.0  0.6  0.2
## 
## $mids
## [1] 25.4325 25.4375 25.4425 25.4475 25.4525 25.4575 25.4625 25.4675
## 
## $xname
## [1] "simulated_means"
## 
## $equidist
## [1] TRUE
## 
## attr(,"class")
## [1] "histogram"
## Analysis for Subsample 3 
##      Date               Time              S1_Temp         S2_Temp     
##  Length:5064        Length:5064        Min.   :24.94   Min.   :24.75  
##  Class :character   Class :character   1st Qu.:25.19   1st Qu.:25.19  
##  Mode  :character   Mode  :character   Median :25.38   Median :25.38  
##                                        Mean   :25.46   Mean   :25.54  
##                                        3rd Qu.:25.63   3rd Qu.:25.69  
##                                        Max.   :26.38   Max.   :28.94  
##     S3_Temp         S4_Temp         S1_Light         S2_Light     
##  Min.   :24.44   Min.   :24.94   Min.   :  0.00   Min.   :  0.00  
##  1st Qu.:24.69   1st Qu.:25.44   1st Qu.:  0.00   1st Qu.:  0.00  
##  Median :24.94   Median :25.75   Median :  0.00   Median :  0.00  
##  Mean   :25.06   Mean   :25.75   Mean   : 25.44   Mean   : 25.54  
##  3rd Qu.:25.38   3rd Qu.:26.00   3rd Qu.: 12.00   3rd Qu.: 14.00  
##  Max.   :26.13   Max.   :26.50   Max.   :165.00   Max.   :258.00  
##     S3_Light         S4_Light       S1_Sound         S2_Sound    
##  Min.   :  0.00   Min.   : 0.0   Min.   :0.0600   Min.   :0.040  
##  1st Qu.:  0.00   1st Qu.: 0.0   1st Qu.:0.0700   1st Qu.:0.050  
##  Median :  0.00   Median : 0.0   Median :0.0800   Median :0.050  
##  Mean   : 34.15   Mean   :12.8   Mean   :0.1635   Mean   :0.121  
##  3rd Qu.: 49.00   3rd Qu.:21.0   3rd Qu.:0.0800   3rd Qu.:0.060  
##  Max.   :280.00   Max.   :74.0   Max.   :3.8400   Max.   :3.440  
##     S3_Sound         S4_Sound          S5_CO2        S5_CO2_Slope      
##  Min.   :0.0500   Min.   :0.0500   Min.   : 345.0   Min.   :-6.288462  
##  1st Qu.:0.0600   1st Qu.:0.0600   1st Qu.: 355.0   1st Qu.:-0.046154  
##  Median :0.0600   Median :0.0800   Median : 360.0   Median : 0.000000  
##  Mean   :0.1628   Mean   :0.1034   Mean   : 462.3   Mean   :-0.009192  
##  3rd Qu.:0.0700   3rd Qu.:0.1000   3rd Qu.: 475.0   3rd Qu.: 0.000000  
##  Max.   :3.6600   Max.   :3.4000   Max.   :1270.0   Max.   : 8.838462  
##      S6_PIR            S7_PIR        Room_Occupancy_Count
##  Min.   :0.00000   Min.   :0.00000   Min.   :0.000       
##  1st Qu.:0.00000   1st Qu.:0.00000   1st Qu.:0.000       
##  Median :0.00000   Median :0.00000   Median :0.000       
##  Mean   :0.08452   Mean   :0.07682   Mean   :0.394       
##  3rd Qu.:0.00000   3rd Qu.:0.00000   3rd Qu.:0.000       
##  Max.   :1.00000   Max.   :1.00000   Max.   :3.000       
## Anomalies in S6_PIR and S7_PIR:
##   S6_PIR S7_PIR Count
## 1      0      0  4493
## 2      1      0   182
## 3      0      1   143
## 4      1      1   246
## Monte Carlo Simulation for S1_Temp Mean:

## $breaks
##  [1] 25.442 25.444 25.446 25.448 25.450 25.452 25.454 25.456 25.458 25.460
## [11] 25.462 25.464 25.466 25.468 25.470 25.472 25.474
## 
## $counts
##  [1]   1  10  28  57  94 107 178 152 125 111  82  34  12   4   2   3
## 
## $density
##  [1]  0.5  5.0 14.0 28.5 47.0 53.5 89.0 76.0 62.5 55.5 41.0 17.0  6.0  2.0  1.0
## [16]  1.5
## 
## $mids
##  [1] 25.443 25.445 25.447 25.449 25.451 25.453 25.455 25.457 25.459 25.461
## [11] 25.463 25.465 25.467 25.469 25.471 25.473
## 
## $xname
## [1] "simulated_means"
## 
## $equidist
## [1] TRUE
## 
## attr(,"class")
## [1] "histogram"
## Analysis for Subsample 4 
##      Date               Time              S1_Temp         S2_Temp     
##  Length:5064        Length:5064        Min.   :24.94   Min.   :24.75  
##  Class :character   Class :character   1st Qu.:25.19   1st Qu.:25.19  
##  Mode  :character   Mode  :character   Median :25.38   Median :25.38  
##                                        Mean   :25.44   Mean   :25.53  
##                                        3rd Qu.:25.56   3rd Qu.:25.63  
##                                        Max.   :26.38   Max.   :28.94  
##     S3_Temp         S4_Temp         S1_Light         S2_Light     
##  Min.   :24.44   Min.   :24.94   Min.   :  0.00   Min.   :  0.00  
##  1st Qu.:24.69   1st Qu.:25.44   1st Qu.:  0.00   1st Qu.:  0.00  
##  Median :24.94   Median :25.75   Median :  0.00   Median :  0.00  
##  Mean   :25.05   Mean   :25.74   Mean   : 24.13   Mean   : 24.98  
##  3rd Qu.:25.31   3rd Qu.:26.00   3rd Qu.: 11.00   3rd Qu.: 12.00  
##  Max.   :26.13   Max.   :26.50   Max.   :165.00   Max.   :257.00  
##     S3_Light         S4_Light        S1_Sound         S2_Sound     
##  Min.   :  0.00   Min.   : 0.00   Min.   :0.0600   Min.   :0.0400  
##  1st Qu.:  0.00   1st Qu.: 0.00   1st Qu.:0.0700   1st Qu.:0.0500  
##  Median :  0.00   Median : 0.00   Median :0.0800   Median :0.0500  
##  Mean   : 32.78   Mean   :13.04   Mean   :0.1667   Mean   :0.1158  
##  3rd Qu.: 48.00   3rd Qu.:21.00   3rd Qu.:0.0800   3rd Qu.:0.0600  
##  Max.   :280.00   Max.   :74.00   Max.   :3.8400   Max.   :3.4400  
##     S3_Sound         S4_Sound          S5_CO2        S5_CO2_Slope      
##  Min.   :0.0400   Min.   :0.0500   Min.   : 345.0   Min.   :-6.296154  
##  1st Qu.:0.0600   1st Qu.:0.0600   1st Qu.: 355.0   1st Qu.:-0.042308  
##  Median :0.0600   Median :0.0800   Median : 360.0   Median : 0.000000  
##  Mean   :0.1492   Mean   :0.1007   Mean   : 455.1   Mean   : 0.004828  
##  3rd Qu.:0.0700   3rd Qu.:0.1000   3rd Qu.: 450.0   3rd Qu.: 0.000000  
##  Max.   :3.6600   Max.   :1.5400   Max.   :1265.0   Max.   : 8.838462  
##      S6_PIR            S7_PIR        Room_Occupancy_Count
##  Min.   :0.00000   Min.   :0.00000   Min.   :0.0000      
##  1st Qu.:0.00000   1st Qu.:0.00000   1st Qu.:0.0000      
##  Median :0.00000   Median :0.00000   Median :0.0000      
##  Mean   :0.08946   Mean   :0.07938   Mean   :0.3839      
##  3rd Qu.:0.00000   3rd Qu.:0.00000   3rd Qu.:0.0000      
##  Max.   :1.00000   Max.   :1.00000   Max.   :3.0000      
## Anomalies in S6_PIR and S7_PIR:
##   S6_PIR S7_PIR Count
## 1      0      0  4466
## 2      1      0   196
## 3      0      1   145
## 4      1      1   257
## Monte Carlo Simulation for S1_Temp Mean:

## $breaks
##  [1] 25.426 25.428 25.430 25.432 25.434 25.436 25.438 25.440 25.442 25.444
## [11] 25.446 25.448 25.450 25.452 25.454 25.456 25.458
## 
## $counts
##  [1]   1   4   3  10  47  78 111 142 158 166 114  68  58  27   9   4
## 
## $density
##  [1]  0.5  2.0  1.5  5.0 23.5 39.0 55.5 71.0 79.0 83.0 57.0 34.0 29.0 13.5  4.5
## [16]  2.0
## 
## $mids
##  [1] 25.427 25.429 25.431 25.433 25.435 25.437 25.439 25.441 25.443 25.445
## [11] 25.447 25.449 25.451 25.453 25.455 25.457
## 
## $xname
## [1] "simulated_means"
## 
## $equidist
## [1] TRUE
## 
## attr(,"class")
## [1] "histogram"
## Analysis for Subsample 5 
##      Date               Time              S1_Temp         S2_Temp     
##  Length:5064        Length:5064        Min.   :24.94   Min.   :24.75  
##  Class :character   Class :character   1st Qu.:25.19   1st Qu.:25.19  
##  Mode  :character   Mode  :character   Median :25.38   Median :25.38  
##                                        Mean   :25.45   Mean   :25.54  
##                                        3rd Qu.:25.63   3rd Qu.:25.63  
##                                        Max.   :26.38   Max.   :28.94  
##     S3_Temp         S4_Temp         S1_Light         S2_Light     
##  Min.   :24.44   Min.   :25.00   Min.   :  0.00   Min.   :  0.00  
##  1st Qu.:24.69   1st Qu.:25.44   1st Qu.:  0.00   1st Qu.:  0.00  
##  Median :24.94   Median :25.75   Median :  0.00   Median :  0.00  
##  Mean   :25.05   Mean   :25.75   Mean   : 25.26   Mean   : 25.83  
##  3rd Qu.:25.38   3rd Qu.:26.00   3rd Qu.: 11.00   3rd Qu.: 12.00  
##  Max.   :26.13   Max.   :26.50   Max.   :165.00   Max.   :257.00  
##     S3_Light         S4_Light        S1_Sound         S2_Sound     
##  Min.   :  0.00   Min.   : 0.00   Min.   :0.0600   Min.   :0.0400  
##  1st Qu.:  0.00   1st Qu.: 0.00   1st Qu.:0.0700   1st Qu.:0.0500  
##  Median :  0.00   Median : 0.00   Median :0.0800   Median :0.0500  
##  Mean   : 33.68   Mean   :12.62   Mean   :0.1672   Mean   :0.1194  
##  3rd Qu.: 49.00   3rd Qu.:21.00   3rd Qu.:0.0800   3rd Qu.:0.0600  
##  Max.   :280.00   Max.   :74.00   Max.   :3.8800   Max.   :3.4400  
##     S3_Sound         S4_Sound          S5_CO2        S5_CO2_Slope      
##  Min.   :0.0400   Min.   :0.0500   Min.   : 345.0   Min.   :-6.296154  
##  1st Qu.:0.0600   1st Qu.:0.0600   1st Qu.: 355.0   1st Qu.:-0.046154  
##  Median :0.0600   Median :0.0800   Median : 360.0   Median : 0.000000  
##  Mean   :0.1547   Mean   :0.1061   Mean   : 460.1   Mean   : 0.003468  
##  3rd Qu.:0.0700   3rd Qu.:0.1000   3rd Qu.: 465.0   3rd Qu.: 0.000000  
##  Max.   :3.6700   Max.   :3.4000   Max.   :1265.0   Max.   : 8.946154  
##      S6_PIR            S7_PIR        Room_Occupancy_Count
##  Min.   :0.00000   Min.   :0.00000   Min.   :0.0000      
##  1st Qu.:0.00000   1st Qu.:0.00000   1st Qu.:0.0000      
##  Median :0.00000   Median :0.00000   Median :0.0000      
##  Mean   :0.08333   Mean   :0.07563   Mean   :0.3944      
##  3rd Qu.:0.00000   3rd Qu.:0.00000   3rd Qu.:0.0000      
##  Max.   :1.00000   Max.   :1.00000   Max.   :3.0000      
## Anomalies in S6_PIR and S7_PIR:
##   S6_PIR S7_PIR Count
## 1      0      0  4487
## 2      1      0   194
## 3      0      1   155
## 4      1      1   228
## Monte Carlo Simulation for S1_Temp Mean:

## $breaks
##  [1] 25.436 25.438 25.440 25.442 25.444 25.446 25.448 25.450 25.452 25.454
## [11] 25.456 25.458 25.460 25.462 25.464 25.466 25.468
## 
## $counts
##  [1]   1   5  10  29  53  90 120 170 160 133 103  62  38  23   2   1
## 
## $density
##  [1]  0.5  2.5  5.0 14.5 26.5 45.0 60.0 85.0 80.0 66.5 51.5 31.0 19.0 11.5  1.0
## [16]  0.5
## 
## $mids
##  [1] 25.437 25.439 25.441 25.443 25.445 25.447 25.449 25.451 25.453 25.455
## [11] 25.457 25.459 25.461 25.463 25.465 25.467
## 
## $xname
## [1] "simulated_means"
## 
## $equidist
## [1] TRUE
## 
## attr(,"class")
## [1] "histogram"

Inferences:

Subsample 1 (S1_Temp):

  1. Central Tendency: By examining the Monte Carlo simulation, we can identify where the majority of the data points cluster, providing insights into the average temperature that is most frequently observed.

  2. Variability: By looking at how spread out the data is, we can see if temperatures in Subsample 1 tend to vary a lot.

  3. Likelihood of Extreme Temperatures: Peaks at the ends of the graph show how often really high or low temperatures might occur just by chance.

Subsample 2 (S1_Temp):

  1. Comparison with S1: Both subsample 1 and subsample 2 seem to have a central tendency and similar spread of data by looking at the histograms.

  2. Identifying Patterns or Anomalies: While comparing S2 with S1 we can see that there seem to be fewer data points at the right end of the distribution which could be mistook for outliers when only the sample is considered

Subsample 3 (S1_Temp):

  1. Assessment of Outliers: With The Monte Carlo simulation we can see that S3 has a rich distribution spread centrally across many data points. This shows a basic normal distribution

  2. Detecting Non-Random Factors: No Significant deviations of the observed mean temperature in Subsample 3 which indicates that this subsample although random still holds good in terms of

Subsample 4 (S1_Temp):

  1. Central Tendency: The Monte Carlo simulation reveals the central tendency of S4_Temp, indicating the most likely range of mean temperatures that could occur by chance.

  2. Variability: Compared to other samples S4 has a bigger distribution indicating that Variance in this subsample might be greater compared to other samples, which could mean that this distribution might hold few outliers when analysis is done using the whole data.

Subsample 5 (S1_Temp):

  1. Comparison with Other Subsamples: Comparing with other samples S5 seems to be in line with other samples except for S4 which has a lower S1_temp value.

From the monte-carlo simulation and the graphs we have made the above inferences.

From the above samples we can see that there are no major outlier scares in any of the samples except S4 which although is a cause of concern however can only be judged when it’s analysed using the complete data.

The data for all the samples seems to have a major Central Tendency which indicates that the data has been sampled in a proper way without any major issues.