-
Notifications
You must be signed in to change notification settings - Fork 0
/
Phishing.Rmd
141 lines (97 loc) · 3.04 KB
/
Phishing.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
---
title: "Phishing Training Task"
output:
html_document:
df_print: paged
html_notebook: default
pdf_document: default
---
```{r Libraries}
library(here)
library(dplyr)
library(tidyverse)
library(ggplot2)
library(ggrepel)
library(xtable)
library(gmodels)
library(DescTools)
library(qqplotr)
library(dunn.test)
library(rstatix)
library(afex);
library(parallel);
library(car);
library(emmeans)
library(lme4)
library(Matrix)
library(coin)
library(readxl)
here()
```
```{r LoadData}
syncRate_data_M1 <- read.csv(file =here("Data", "Phishing", "MaxSyncRate_Fitting_Data_M1.csv"), na="NULL")
syncRate_data_M2 <- read.csv(file =here("Data", "Phishing", "MaxSyncRate_Fitting_Data_M2.csv"), na="NULL")
```
```{r SyncRate}
### M1
# Assuming 'userID' is the column containing participant IDs
syncRate_data_M1 %>%
group_by(UserID) %>%
summarize(
min_SyncRate = min(SyncRate_Value),
decay_min = Decay_Value[which.min(SyncRate_Value)],
max_SyncRate = max(SyncRate_Value),
decay_max = Decay_Value[which(SyncRate_Value == max(SyncRate_Value))[length(which(SyncRate_Value == max(SyncRate_Value)))]]
)
# Count decays with min and max SyncRate for each participant
syncRate_data_M1 %>%
group_by(UserID) %>%
summarize(
count_min_SyncRate = sum(SyncRate_Value == min(SyncRate_Value)),
count_max_SyncRate = sum(SyncRate_Value == max(SyncRate_Value))
)
### M2
syncRate_data_M2 %>%
group_by(UserID) %>%
summarize(
min_SyncRate = min(SyncRate_Value),
decay_min = Decay_Value[which.min(SyncRate_Value)],
max_SyncRate = max(SyncRate_Value),
decay_max = Decay_Value[which(SyncRate_Value == max(SyncRate_Value))[length(which(SyncRate_Value == max(SyncRate_Value)))]]
)
# Count decays with min and max SyncRate for each participant
syncRate_data_M2 %>%
group_by(UserID) %>%
summarize(
count_min_SyncRate = sum(SyncRate_Value == min(SyncRate_Value)),
count_max_SyncRate = sum(SyncRate_Value == max(SyncRate_Value))
)
```
```{r dataSyncRate_Only_MaxDecayChoice}
### M1
# Filter to include only rows with maximum SyncRate for each participant
get_Max_SyncRate_rows_M1 <- syncRate_data_M1 %>%
group_by(UserID) %>%
filter(SyncRate_Value == max(SyncRate_Value))
# Find the maximum decay value for the maximum SyncRate for each participant
max_decay_for_max_SyncRate_M1 <- get_Max_SyncRate_rows_M1 %>%
group_by(UserID) %>%
arrange(desc(Decay_Value)) %>%
slice(1)
head(max_decay_for_max_SyncRate_M1)
### M2
get_Max_SyncRate_rows_M2 <- syncRate_data_M2 %>%
group_by(UserID) %>%
filter(SyncRate_Value == max(SyncRate_Value))
# Find the maximum decay value for the maximum SyncRate for each participant
max_decay_for_max_SyncRate_M2 <- get_Max_SyncRate_rows_M2 %>%
group_by(UserID) %>%
arrange(desc(Decay_Value)) %>%
slice(1)
head(max_decay_for_max_SyncRate_M2)
```
```{r SaveMaxDecay}
# Saving the selected data frame to a CSV file
write.csv(max_decay_for_max_SyncRate_M1, "./max_decays_M1.csv", row.names = FALSE)
write.csv(max_decay_for_max_SyncRate_M2, "./max_decays_M2.csv", row.names = FALSE)
```