pop1 <- st_read(params$file_real)
## Reading layer `run5-pocket-backpack' from data source `C:\websites\fivegbp_locatienet_com\R\geodata\run5-pocket-backpack.shp' using driver `ESRI Shapefile'
## Simple feature collection with 2126 features and 12 fields
## Geometry type: POINT
## Dimension: XY
## Bounding box: xmin: 4.477241 ymin: 51.03083 xmax: 4.489469 ymax: 51.04172
## Geodetic CRS: WGS 84
pop1 = pop1[pop1$speed > 0.5,]
pop1$sample = "realistic"
pop1 <- filter(pop1, network == params$network)
pop2 <- st_read(params$file_ideal)
## Reading layer `run5-handlebar' from data source `C:\websites\fivegbp_locatienet_com\R\geodata\run5-handlebar.shp' using driver `ESRI Shapefile'
## Simple feature collection with 3977 features and 12 fields
## Geometry type: POINT
## Dimension: XY
## Bounding box: xmin: 4.477157 ymin: 51.02976 xmax: 4.489385 ymax: 51.04175
## Geodetic CRS: WGS 84
pop2 = pop2[pop2$speed > 0.5,]
pop2$sample = "ideal"
pop2 <- filter(pop2, network == params$network)
base_data <- rbind(pop1, pop2)
data <- base_data
## [1] 792
## pop1.latency pop1.rsrp pop1.arrived
## Min. : -1 Min. :-88.00 Min. : 0.00
## 1st Qu.: 110 1st Qu.:-88.00 1st Qu.:45.00
## Median : 128 Median :-70.00 Median :45.00
## Mean : 166 Mean :-78.45 Mean :42.92
## 3rd Qu.: 168 3rd Qu.:-70.00 3rd Qu.:45.00
## Max. :1924 Max. :-70.00 Max. :54.00
## [1] 1862
## pop2.latency pop2.rsrp pop2.arrived
## Min. : -1.0 Min. :-96.00 Min. : 0.00
## 1st Qu.: 116.0 1st Qu.:-86.00 1st Qu.:45.00
## Median : 144.5 Median :-82.00 Median :45.00
## Mean : 277.2 Mean :-81.07 Mean :43.34
## 3rd Qu.: 224.0 3rd Qu.:-77.00 3rd Qu.:45.00
## Max. :3255.0 Max. :-65.00 Max. :93.00
## Warning: 'scattergl' trace types don't currently render in RStudio on Windows. Open in another web browser (IE, Chrome, Firefox, etc).
Remove outliers and Bad measurements and create equal size samples
data = data[data$latency > 0,]
data = data[data$latency < 1000,]
data = data[data$arrived == 45,]
pop1 <- data[data$sample == 'realistic',]
pop2 <- data[data$sample == 'ideal',]
n <- min(c(nrow(pop1), nrow(pop2)))
pop1 = pop1[sample(1:nrow(pop1)),]
pop1 <- head(pop1, n)
pop2 = pop2[sample(1:nrow(pop2)),]
pop2 <- head(pop2, n)
data = rbind(pop1, pop2)
## [1] 728
## pop1.latency pop1.rsrp pop1.arrived
## Min. : 91.0 Min. :-88.00 Min. :45
## 1st Qu.:111.0 1st Qu.:-88.00 1st Qu.:45
## Median :128.0 Median :-70.00 Median :45
## Mean :153.8 Mean :-78.41 Mean :45
## 3rd Qu.:168.0 3rd Qu.:-70.00 3rd Qu.:45
## Max. :752.0 Max. :-70.00 Max. :45
## [1] 728
## pop2.latency pop2.rsrp pop2.arrived
## Min. : 92.0 Min. :-96.00 Min. :45
## 1st Qu.:116.0 1st Qu.:-85.00 1st Qu.:45
## Median :139.5 Median :-82.00 Median :45
## Mean :210.3 Mean :-80.68 Mean :45
## 3rd Qu.:191.0 3rd Qu.:-77.00 3rd Qu.:45
## Max. :991.0 Max. :-65.00 Max. :45
## Warning: 'scattergl' trace types don't currently render in RStudio on Windows. Open in another web browser (IE, Chrome, Firefox, etc).
## [1] 1099 1275
Because of lack of overlap the sample is assumed not normal distributed.
If the distribution of Latency values is not normal, non-parametric tests, such as the Wilcoxon rank test or the Kruskal-Wallis test, can be used to determine the significance of the differences between the groups. These tests do not make assumptions about the distribution of the data and are therefore useful when analyzing non-normally distributed data. As the resulting p-value is less than the significance level 0.05, we can conclude that there are significant differences between the populations.
Dunn’s test, also known as the Dunn’s post-hoc test or the Dunn-Bonferroni test, is a pairwise comparison test that is often used as a follow-up analysis after performing a Kruskal-Wallis test. The purpose of Dunn’s test is to identify which specific groups differ significantly from each other when there is a significant result in the Kruskal-Wallis test.
kruskal.test(latency ~ sample, data = data)
##
## Kruskal-Wallis rank sum test
##
## data: latency by sample
## Kruskal-Wallis chi-squared = 31.621, df = 1, p-value = 1.873e-08
pairwise.wilcox.test(data$latency, data$sample, p.adjust.method = "bonferroni")
##
## Pairwise comparisons using Wilcoxon rank sum test with continuity correction
##
## data: data$latency and data$sample
##
## ideal
## realistic 1.9e-08
##
## P value adjustment method: bonferroni
as.data.frame(data) %>% rstatix::dunn_test(latency ~ sample, p.adjust.method = "bonferroni", detailed = FALSE)
In a Dunn’s test:
In the context of a Dunn’s test, the Z-value is typically used to determine the significance of the pairwise comparisons between groups. The Z-value in this case represents the standardized difference in the average ranks between two groups being compared.
Here’s how to interpret the Z-value in Dunn’s test:
Remember that Dunn’s test is a non-parametric test and does not make assumptions about the distribution of the data. The Z-values in Dunn’s test are based on the ranks rather than the raw data values.