-
Notifications
You must be signed in to change notification settings - Fork 0
/
crqa.R
137 lines (91 loc) · 3.57 KB
/
crqa.R
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
#### Scipt for running ANOVAs on SA data ####
# set working directory
setwd("./SA_Analysis/")
# read in libraries and functions
source('./lib/functions_and_libraries-SA.R')
# load librariies
library(stats)
library(readr)
### Prep for analyses ###
# read in radius files and bind together
files <- list.files(path = "./data/crqa_results/radius_calculations", pattern = "*.csv", full.names = T)
tbl <- sapply(files, read_csv, simplify=FALSE) %>%
bind_rows()
# create empty dataframe for saving filtered data
#filtered = data.frame()
# filtering for radii with closest rr to .05
filtered = tbl %>% ungroup() %>%
dplyr::group_by(chosen.participant) %>%
dplyr::filter(from.target == min(from.target))
# write the whole thing to a dataframe
write.table(filtered,
'./data/crqa_results/best_radius_calculations.csv',
sep=',',
col.names = TRUE,
row.names = FALSE)
### Getting condition back ###
# Read in old downsampled data to get condition back
gaze_data = read.table('./data/downsampled/all_participants-downsampled.csv',
sep=',',header=TRUE)
# get unique participant and condition combos
gaze_data_simplified = gaze_data %>% ungroup() %>%
group_by(participant, condition) %>% slice(1)
# merge condition back into filtered data
filtered = cbind(gaze_data_simplified, filtered)
#### ANOVAs across RQA metrics and condition ####
### % Determinism (det) ###
# run the anova
det_anova <- aov(condition ~ det, data=filtered)
# summarize results
det_anova_results <- summary(det_anova)
# save results to file
capture.output(det_anova_results, file = './data/crqa_results/det_anova_results.txt')
### Mean Line (meanL) ###
# run the anova
meanL_anova <- aov(condition ~ meanL, data=filtered)
# summarize results
meanL_anova_results <- summary(meanL_anova)
# save results to file
capture.output(meanL_anova_results, file = './data/crqa_results/meanL_anova_results.txt')
### NRLINE ###
# run the anova
NRLINE_anova <- aov(condition ~ NRLINE, data=filtered)
# summarize results
NRLINE_anova_results <- summary(NRLINE_anova)
# save results to file
capture.output(NRLINE_anova_results, file = './data/crqa_results/NRLINE_anova_results.txt')
### maxL ###
# run the anova
maxL_anova <- aov(condition ~ maxL, data=filtered)
# summarize results
maxL_anova_results <- summary(maxL_anova)
# save results to file
capture.output(maxL_anova_results, file = './data/crqa_results/maxL_anova_results.txt')
### ENTR ###
# run the anova
ENTR_anova <- aov(condition ~ ENTR, data=filtered)
# summarize results
ENTR_anova_results <- summary(ENTR_anova)
# save results to file
capture.output(ENTR_anova_results, file = './data/crqa_results/ENTR_anova_results.txt')
### rENTR ###
# run the anova
rENTR_anova <- aov(condition ~ rENTR, data=filtered)
# summarize results
rENTR_anova_results <- summary(rENTR_anova)
# save results to file
capture.output(rENTR_anova_results, file = './data/crqa_results/rENTR_anova_results.txt')
### LAM ###
# run the anova
LAM_anova <- aov(condition ~ LAM, data=filtered)
# summarize results
LAM_anova_results <- summary(LAM_anova)
# save results to file
capture.output(LAM_anova_results, file = './data/crqa_results/LAM_anova_results.txt')
### TT ###
# run the anova
TT_anova <- aov(condition ~ TT, data=filtered)
# summarize results
TT_anova_results <- summary(TT_anova)
# save results to file
capture.output(TT_anova_results, file = './data/crqa_results/TT_anova_results.txt')