-
Notifications
You must be signed in to change notification settings - Fork 0
/
RFID-Tag-Error-Analysis.Rmd
91 lines (76 loc) · 2.8 KB
/
RFID-Tag-Error-Analysis.Rmd
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
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
---
title: "RFID Tag Error Distribution"
output:
html_notebook: default
pdf_document: default
---
```{r}
# load in libraries
library(tidyverse)
library(viridis)
library(plyr)
# load in data
tg_df <- read_csv("tg-update-df.csv")
ttg_df <-read_csv("update_t-test.csv")
mu <- ddply(ttg_df, "update", summarise, grp.mean=mean(percent))
```
```{r}
# plot 1
ttg_df %>%
ggplot( aes(x=percent, y = ..scaled.., fill=update)) +
geom_density( color="#e9ecef", alpha=0.6) +
scale_fill_manual(values=c("#69b3a2", "#404080")) +
scale_color_manual(values=c("#46897a", "#27274d")) +
labs(fill="", x = "Error (%)", y = "") +
geom_vline(data=mu, aes(xintercept=grp.mean, color=update),
linetype="dashed") +
theme(legend.title = element_blank(), legend.position = c(.9,.78), axis.line = element_line(), panel.grid = element_blank(), )
```
```{r}
# clean up and remove outliers
Q <- quantile(ttg_df$percent, probs=c(.25, .75), na.rm = FALSE)
iqr <- IQR(ttg_df$percent)
up <- Q[2]+1.5*iqr # Upper Range
low<- Q[1]-1.5*iqr # Lower Range
eliminated<- subset(ttg_df, ttg_df$percent > (Q[1] - 1.5*iqr) & ttg_df$percent < (Q[2]+1.5*iqr))
# plot 2
eliminated %>%
ggplot( aes(x=percent, y = ..scaled.., fill=update)) +
geom_density( color="#000000", alpha=0.6) +
scale_fill_manual(values=c( "#404080","#69b3a2")) +
scale_color_manual(values=c("#27274d","#46897a")) +
expand_limits(x=0, y=0) +
labs(color="Mean", fill="Group", y="", x="Error (%)", title = "RFID Tag Error Distribution", subtitle = "") +
geom_vline(data=mu, aes(xintercept=grp.mean, color=update),
linetype="dashed") +
theme(legend.position = c(.9,.7), axis.line = element_line(), panel.grid = element_blank()) +
theme_classic()
```
```{r}
# plot 3
eliminated %>%
ggplot( aes(x=percent, y = ..scaled.., fill=update)) +
geom_density( color="#e9ecef", alpha=0.6) +
scale_fill_manual(values=c( "#404080","#69b3a2")) +
scale_color_manual(values=c("#27274d","#46897a")) +
expand_limits(x=0, y=0) +
labs(color="Mean", fill="Group", y="", x="Error (%)", title = "RFID Tag Error Distribution", subtitle = "") +
geom_vline(data=mu, aes(xintercept=grp.mean, color=update),
linetype="dashed") +
theme(legend.position = c(.9,.7), axis.line = element_line(), panel.grid = element_blank()) +
theme_classic()
```
```{r}
# t.test for signif of percent error ~ update groups
eliminated %>%
t.test(percent~update, data = .)
```
```{r}
# this is just for making a cool looking shape
ggplot(eliminated, aes(x=x)) +
# Top
geom_density( aes(x = 'post-update', y = ..scaled..), fill="#69b3a2" ) +
# Bottom
geom_density( aes(x = 'pre-update', y = -..scaled..), fill= "#404080") +
xlab("")
```