“every step [less] deeper into the analysis takes a soul [up, up and] away…”
…attributed to Teilhard de Chardin, except for my bracketed lack of “beautiful” statistical “balloons”
SYNOPSIS. “Dasher is a competitive text-entry system wherever a full-size keyboard cannot be used.” In Certain Cerebral Palsy Users of Dasher, joystick mouses are preferential. Depending on handicap degrees, neuromuscular issues and spasms may hamper fluidity of use. This paper attempts the characterization of a primordial number of mouse trails strokes significant for the betterment of Dasher use. The inclusion of that identification into Dasher C++ source; and suggesting a solution (holding/getting back, getting ahead) in the cursor position would ideally help the use of Dasher, and ease the nervous tension; a spasms trigger itself. The generation of a user’s “strokes dictionary”/magnitudes threshold able to come together with the language dictionaries training engines of the Dasher would be the ultimate step for this research. The system configurations for this February/2022 paper was: macOS Monterey Version 12.2 on iMac (iMac (Retina 4K, 21.5-inch, 2017), 3 GHz Intel Core i5 with 4 nuclei processor, 8 GB 2400 MHz DDR4 of RAM; Version 1.3.1073 © 2009-2020 RStudio, PBC, Inc., under R version 4.0.2 (2020-06-22) – “Taking Off Again”. The mouse movements text files researched in this paper were generated under two configurations: I.- miniAudicle version 1.3.5.2 (gidora) git: a8d59b9 Copyright (c) Spencer Salazar; MacOS Catalina 10.15.7 on iMac (Retina 4k, 2017) with a wireless Apple Magic Mouse 2. II.- miniAudicle version 1.4.1.0 (gidora) git: 9f6ee78 Copyright (c) Spencer Salazar; Quemu MacOS High Sierra Version 10.13.6 Virtual System (on a Samsung intel(R) CoreTM i3, Ubuntu 20.04 System) with a heavy duty OPM-200 joystick mouse.
PREAMBLE. (Note.- Please right click links below and click open link in new window/tab)
Towards easing the use of Dasher.
Here is a demo of Dasher use configured with “normal” control options resembling a video game environment in which the scene (a wall filled with text predictions) reacts as the user moves the cursor closer to the wall, proposing suitable routes of text construction. The Subject in this previous video does not have movement handicaps. Our Cerebral Palsy target user writes with Dasher under “pulsation” control options which allow to approach the “scene” (the text proposing wall) moving the mouse cursor accordingly, situating the cursor, and finally clicking on the left button of the joystick mouse. This three actions magnify the text wall and get new propositions of text construction predictions, until a word is constructed and a new cycle begins after a space or another orthographic element is entered.
Capturing the mouse trails.
Running of script trails.ck coded in Chuck/miniAudicle –a robust time managing music language/graphic environment–, renders text files containing information about mouse movements. Each written row holds delta X and delta Y magnitudes, cumulative columns of those magnitudes, miniAudicle’s Virtual Machine time stamps in seconds/Thousandths of a second, X and Y coordinates of labeled (Yield, FRAY 1, SAN- 2, etc.) buttons that need to be hovered and clicked on in order to display next button (up to eight in each single Subject test or control take). X and Y buttons coordinates feeds the user with a map of consecutive targets in the displayed window. Plotting both: the maps, and the trajectories between buttons, give visual ideas about the qualities (e.g. straight versus twisted lines) of the take. Further timing analysis give information about the “stress” quality of the joystick head manipulation (e.g. faster versus slower movements). Data files and previous research for this paper can be found in following GitHub’s mousetrails page. Similarly to Dasher’s use under “pulsation” control options, the script trails.ck requires from our target user several repetitive actions that she performs with the same left hand: holding the joystick, moving the cursor towards the proposed button, releasing the joystick, clicking the left mouse button, and waiting until the next button in the script appears.
A “pattern(less) identification” surrender, yet.
Holding and releasing the OPM_200 mouse joystick head may include trails “bumps” in Cerebral Palsy users; same as with spasms, depending of the user stress level. The analysis below typifies faster/“most stressed” movements more likely to occur before and after mouse paths twists; more evident where trails show that Subject became aware of a “wrongly going” mouse trajectory towards next button clicking. Instead of trying to conceptualize a spasm pattern dictionary per se, a simpler approach would consist of a per Dasher session calibration round, to establish a threshold under which faster movements (more likely to produce undesired paths) are filtered in order to reach the resemblance of a Dasher use under “normal” control options as in the demo video above. Feeding Dasher code with fastest/“most stressed” magnitudes of mouse strokes, or establishing a threshold, would allow to “straighten out” the Dasher interface progression; and, might help discarding “wrongly going” paths, feeding back a reinforcement of “relaxed” use of the joystick if the user feels that her involuntary movements don’t affect badly the text input efficiency.
fileUrl <- "https://raw.githubusercontent.com/iconodo/mousetrails/main/howtoS/out222.txt"
download.file(fileUrl, destfile="./out222.txt")
fileUrl <- "https://raw.githubusercontent.com/iconodo/mousetrails/main/chuckedData/out2221022_ggc.txt"
download.file(fileUrl, destfile="./out2221022_ggc.txt")
fileUrl <- "https://raw.githubusercontent.com/iconodo/mousetrails/main/chuckedData/out2221041_ggc.txt"
download.file(fileUrl, destfile="./out2221041_ggc.txt")
fileUrl <- "https://raw.githubusercontent.com/iconodo/mousetrails/main/chuckedData/out2221026.txt"
download.file(fileUrl, destfile="./out2221026.txt")
fileUrl <- "https://raw.githubusercontent.com/iconodo/mousetrails/main/chuckedData/out2221019.txt"
download.file(fileUrl, destfile="./out2221019.txt")
fileUrl <- "https://raw.githubusercontent.com/iconodo/mousetrails/main/chuckedData/out2221016.txt"
download.file(fileUrl, destfile="./out2221016.txt")
fileUrl <- "https://raw.githubusercontent.com/iconodo/mousetrails/main/chuckedData/out2221062.txt"
download.file(fileUrl, destfile="./out2221062.txt")
"simuled_spasm, CTRL1022, CTRL1041, TST1026, TST1019, TST1016 and TST1062" the downloaded data files into R’s workspace. Dataframes under names CTRLnnnn were generated by the observer. Dataframes under names TSTnnnn were generated by the observed Subject.simuled_spasm <-read.csv("out222.txt", header = TRUE, sep = ",")
CTRL1022 <- read.csv("out2221022_ggc.txt")
CTRL1041 <- read.csv("out2221041_ggc.txt")
TST1026 <- read.csv("out2221026.txt")
TST1019 <- read.csv("out2221019.txt")
TST1016 <- read.csv("out2221016.txt")
TST1062 <- read.csv("out2221062.txt")
library(dplyr)
library(lubridate)
library(ggplot2)
library(ggrepel)
set.seed(42)
options(ggrepel.max.overlaps = Inf)
options(scipen = 999)
library(ggpubr)
str(CTRL1022)
## 'data.frame': 1190 obs. of 8 variables:
## $ deltaX : int -1 -1 -2 -2 -2 -3 -2 -3 -3 -3 ...
## $ deltaY : int 1 1 1 1 1 1 1 1 1 1 ...
## $ WHEN : num 0.174 0.174 0.174 0.174 0.174 ...
## $ SYLLABLE : chr "Yield" "Yield" "Yield" "Yield" ...
## $ XofButton: int 0 0 0 0 0 0 0 0 0 0 ...
## $ YofButton: int 0 0 0 0 0 0 0 0 0 0 ...
## $ XofTrace : int -1 -2 -4 -6 -8 -11 -13 -16 -19 -22 ...
## $ YofTrace : int -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 ...
head(CTRL1022,1)
## deltaX deltaY WHEN SYLLABLE XofButton YofButton XofTrace YofTrace
## 1 -1 1 0.173871 Yield 0 0 -1 -1
tail(CTRL1022,1)
## deltaX deltaY WHEN SYLLABLE XofButton YofButton XofTrace YofTrace
## 1190 1 1 0.299299 GO 8 142 496 142 -784
head(CTRL1041,1)
## deltaX deltaY WHEN SYLLABLE XofButton YofButton XofTrace YofTrace
## 1 -1 1 0.0889905 Yield 0 0 -1 -1
tail(CTRL1041,1)
## deltaX deltaY WHEN SYLLABLE XofButton YofButton XofTrace YofTrace
## 1207 1 -1 0.213328 GO 8 372 216 688 -294
head(TST1026,1)
## deltaX deltaY WHEN SYLLABLE XofButton YofButton XofTrace YofTrace
## 1 1 -1 0.0633382 Yield 0 0 1 1
tail(TST1026,1)
## deltaX deltaY WHEN SYLLABLE XofButton YofButton XofTrace YofTrace
## 1264 1 1 0.189806 GO 8 142 496 83 -475
head(TST1016,1)
## deltaX deltaY WHEN SYLLABLE XofButton YofButton XofTrace YofTrace
## 1 -1 -1 0.372286 Yield 0 0 -1 1
tail(TST1016,1)
## deltaX deltaY WHEN SYLLABLE XofButton YofButton XofTrace YofTrace
## 1308 1 1 0.501011 GO 8 396 426 420 -526
head(TST1062,1)
## deltaX deltaY WHEN SYLLABLE XofButton YofButton XofTrace YofTrace
## 1 -1 -2 0.0147156 Yield 0 0 -1 2
tail(TST1062,1)
## deltaX deltaY WHEN SYLLABLE XofButton YofButton XofTrace YofTrace
## 1018 -1 -1 0.0968911 GO 8 100 161 46 -71
str(simuled_spasm)
## 'data.frame': 735 obs. of 8 variables:
## $ dX : int 0 -21 -10 -15 -15 -11 -10 -10 -10 -7 ...
## $ dY : int -5 -3 -4 -5 -4 -4 -3 -4 -4 -5 ...
## $ WHEN : num 0.0104 0.0104 0.0104 0.0104 0.0104 ...
## $ SYLLABLE: chr "Yield" "Yield" "Yield" "Yield" ...
## $ X : int 0 0 0 0 0 0 0 0 0 0 ...
## $ Y : int 0 0 0 0 0 0 0 0 0 0 ...
## $ cX : int 0 -21 -31 -46 -61 -72 -82 -92 -102 -109 ...
## $ cY : int 5 8 12 17 21 25 28 32 36 41 ...
simuled_spasm <- rename(simuled_spasm, deltaX = dX, deltaY = dY,
WHEN = WHEN, XofButton = X, YofButton = Y,
XofTrace = cX,YofTrace = cY)
head(simuled_spasm, 1)
## deltaX deltaY WHEN SYLLABLE XofButton YofButton XofTrace YofTrace
## 1 0 -5 0.0104141 Yield 0 0 0 5
tail(simuled_spasm, 1)
## deltaX deltaY WHEN SYLLABLE XofButton YofButton XofTrace YofTrace
## 735 -1 1 0.0436071 GO 8 178 594 790 -3525
CTRL1022 <- CTRL1022 %>% mutate(fromfile= "22_ctrl")
TST1026 <- TST1026 %>% mutate(fromfile= "26_test")
TST1016 <- TST1016 %>% mutate(fromfile= "f16_test")
TST1062 <- TST1062 %>% mutate(fromfile= "f62_test")
CTRL1041 <- CTRL1041 %>% mutate(fromfile= "41_ctrl")
TST1019 <- TST1019 %>% mutate(fromfile= "test19")
db1 <- rbind(CTRL1022, TST1026)
db2 <- rbind(db1, CTRL1041)
db3 <- rbind(db2, TST1019)
db4 <- rbind(db3, TST1016)
df_all_research <- rbind(db4, TST1062)
head(df_all_research,1)
## deltaX deltaY WHEN SYLLABLE XofButton YofButton XofTrace YofTrace
## 1 -1 1 0.173871 Yield 0 0 -1 -1
## fromfile
## 1 22_ctrl
tail(df_all_research,1)
## deltaX deltaY WHEN SYLLABLE XofButton YofButton XofTrace YofTrace
## 7490 -1 -1 0.0968911 GO 8 100 161 46 -71
## fromfile
## 7490 f62_test
head(TST1026,1)
## deltaX deltaY WHEN SYLLABLE XofButton YofButton XofTrace YofTrace
## 1 1 -1 0.0633382 Yield 0 0 1 1
## fromfile
## 1 26_test
if(TST1026$WHEN[1] < 1) TST1026 <- TST1026 %>% mutate(WHEN = WHEN * 1000)
head(TST1026,1)
## deltaX deltaY WHEN SYLLABLE XofButton YofButton XofTrace YofTrace fromfile
## 1 1 -1 63.3382 Yield 0 0 1 1 26_test
head(TST1062,1)
## deltaX deltaY WHEN SYLLABLE XofButton YofButton XofTrace YofTrace
## 1 -1 -2 0.0147156 Yield 0 0 -1 2
## fromfile
## 1 f62_test
if(TST1062$WHEN[1] < 1) TST1062 <- TST1062 %>% mutate(WHEN = WHEN * 1000)
head(TST1062,1)
## deltaX deltaY WHEN SYLLABLE XofButton YofButton XofTrace YofTrace fromfile
## 1 -1 -2 14.7156 Yield 0 0 -1 2 f62_test
san2_in_TST1026 <- filter(TST1026, SYLLABLE == "SAN- 2")
san2_in_TST1026_diffs <- san2_in_TST1026 %>% mutate(when_diff = WHEN - lag(WHEN))
id <-rownames(san2_in_TST1026_diffs)
san2_in_TST1026_diffs <- cbind(id=id, san2_in_TST1026_diffs)
quant25_spans_san2_TST1026_diffs <- quantile(san2_in_TST1026_diffs$when_diff, na.rm = TRUE, 0.25)
quantile(san2_in_TST1026_diffs$when_diff, na.rm = TRUE)
## 0% 25% 50% 75% 100%
## 0.0000 0.0175 0.0233 0.0348 1.1204
head(san2_in_TST1026_diffs, 2)
## id deltaX deltaY WHEN SYLLABLE XofButton YofButton XofTrace YofTrace
## 1 1 -1 -1 92.1658 SAN- 2 387 311 -6 -567
## 2 2 -1 -1 92.1890 SAN- 2 387 311 -7 -566
## fromfile when_diff
## 1 26_test NA
## 2 26_test 0.0232
tia3_in_TST1026 <- filter(TST1026, SYLLABLE == "-TIA- 3")
tia3_in_TST1026_diffs <- tia3_in_TST1026 %>% mutate(when_diff = WHEN - lag(WHEN))
id <-rownames(tia3_in_TST1026_diffs)
tia3_in_TST1026_diffs <- cbind(id=id, tia3_in_TST1026_diffs)
quant25_spans_tia3_TST1026_diffs <- quantile(tia3_in_TST1026_diffs$when_diff, na.rm = TRUE, 0.25)
quantile(tia3_in_TST1026_diffs$when_diff, na.rm = TRUE)
## 0% 25% 50% 75% 100%
## 0.0000 0.0170 0.0235 0.0315 0.3490
head(tia3_in_TST1026_diffs, 2)
## id deltaX deltaY WHEN SYLLABLE XofButton YofButton XofTrace YofTrace
## 1 1 1 -1 107.454 -TIA- 3 329 115 374 -365
## 2 2 1 -1 107.485 -TIA- 3 329 115 375 -364
## fromfile when_diff
## 1 26_test NA
## 2 26_test 0.031
head(CTRL1041,1)
## deltaX deltaY WHEN SYLLABLE XofButton YofButton XofTrace YofTrace
## 1 -1 1 0.0889905 Yield 0 0 -1 -1
## fromfile
## 1 41_ctrl
if(CTRL1041$WHEN[1] < 1) CTRL1041 <- CTRL1041 %>% mutate(WHEN = WHEN * 1000)
head(CTRL1041,1)
## deltaX deltaY WHEN SYLLABLE XofButton YofButton XofTrace YofTrace fromfile
## 1 -1 1 88.9905 Yield 0 0 -1 -1 41_ctrl
fray5_in_CTRL1041 <- filter(CTRL1041, SYLLABLE == "FRAY 5")
fray5_in_CTRL1041_diffs <- fray5_in_CTRL1041 %>% mutate(when_diff = WHEN - lag(WHEN))
id <-rownames(fray5_in_CTRL1041_diffs)
fray5_in_CTRL1041_diffs <- cbind(id=id, fray5_in_CTRL1041_diffs)
quant25_spans_fray5_CTRL1041 <- quantile(fray5_in_CTRL1041_diffs$when_diff, na.rm = TRUE, 0.25)
quantile(fray5_in_CTRL1041_diffs$when_diff, na.rm = TRUE)
## 0% 25% 50% 75% 100%
## 0.005 0.020 0.026 0.035 0.067
san6_in_CTRL1041 <- filter(CTRL1041, SYLLABLE == "SAN- 6")
san6_in_CTRL1041_diffs <- san6_in_CTRL1041 %>% mutate(when_diff = WHEN - lag(WHEN))
id <-rownames(san6_in_CTRL1041_diffs)
san6_in_CTRL1041_diffs <- cbind(id=id, san6_in_CTRL1041_diffs)
quant25_spans_san6_CTRL1041 <- quantile(san6_in_CTRL1041_diffs$when_diff, na.rm = TRUE, 0.25)
quantile(san6_in_CTRL1041_diffs$when_diff, na.rm = TRUE)
## 0% 25% 50% 75% 100%
## 0.006 0.023 0.029 0.035 0.064
head(fray5_in_CTRL1041_diffs, 2)
## id deltaX deltaY WHEN SYLLABLE XofButton YofButton XofTrace YofTrace
## 1 1 -2 -1 164.182 FRAY 5 74 137 524 -287
## 2 2 -2 -1 164.188 FRAY 5 74 137 522 -286
## fromfile when_diff
## 1 41_ctrl NA
## 2 41_ctrl 0.006
head(san6_in_CTRL1041_diffs, 2)
## id deltaX deltaY WHEN SYLLABLE XofButton YofButton XofTrace YofTrace
## 1 1 -1 1 178.974 SAN- 6 109 274 156 -167
## 2 2 -1 1 179.020 SAN- 6 109 274 155 -168
## fromfile when_diff
## 1 41_ctrl NA
## 2 41_ctrl 0.046
go4_in_TST1062 <- filter(TST1062, SYLLABLE == "GO 4")
go4_in_TST1062_diffs <- go4_in_TST1062 %>% mutate(when_diff = WHEN - lag(WHEN))
id <-rownames(go4_in_TST1062_diffs)
go4_in_TST1062_diffs <- cbind(id=id, go4_in_TST1062_diffs)
head(go4_in_TST1062_diffs, 2)
## id deltaX deltaY WHEN SYLLABLE XofButton YofButton XofTrace YofTrace
## 1 1 -1 -1 53.4095 GO 4 49 382 25 -559
## 2 2 -1 -1 53.4698 GO 4 49 382 24 -558
## fromfile when_diff
## 1 f62_test NA
## 2 f62_test 0.0603
quant0_spans_go4_in_TST1062 <- quantile(go4_in_TST1062_diffs$when_diff, na.rm = TRUE, 0.0)
quant25_spans_go4_in_TST1062 <- quantile(go4_in_TST1062_diffs$when_diff, na.rm = TRUE, 0.25)
quant50_spans_go4_in_TST1062 <- quantile(go4_in_TST1062_diffs$when_diff, na.rm = TRUE, 0.50)
quant75_spans_go4_in_TST1062 <- quantile(go4_in_TST1062_diffs$when_diff, na.rm = TRUE, 0.75)
#### (relaxed reinforcement approach)
R_shortCut_0_go4_TST1062 <- go4_in_TST1062_diffs
R_shortCut_25_go4_TST1062 <- filter(R_shortCut_0_go4_TST1062, when_diff >= 0.0232000000000028)
R_shortCut_25_go4_TST1062xs <- R_shortCut_25_go4_TST1062 %>% mutate(XofTrace = XofTrace + lag(deltaX))
R_shortCut_25_go4_TST1062xys <- R_shortCut_25_go4_TST1062xs %>% mutate(YofTrace = YofTrace - lag(deltaY))
# workaround rows with NA values
pal25 <- subset(R_shortCut_25_go4_TST1062xys,is.na(XofTrace))
indpal25 <- pal25$id[1]
append25 <- filter(R_shortCut_0_go4_TST1062, id == indpal25)
R_shortCut_25_go4_TST1062xys <- filter(R_shortCut_25_go4_TST1062xys, id != indpal25)
R_shortCut_25_go4_TST1062xys <- rbind(append25, R_shortCut_25_go4_TST1062xys)
##
R_shortCut_50_go4_TST1062 <- filter(R_shortCut_0_go4_TST1062, when_diff >= quant50_spans_go4_in_TST1062)
R_shortCut_50_go4_TST1062xs <- R_shortCut_50_go4_TST1062 %>% mutate(XofTrace = XofTrace + lag(deltaX))
R_shortCut_50_go4_TST1062xys <- R_shortCut_50_go4_TST1062xs %>% mutate(YofTrace = YofTrace - lag(deltaY))
# workaround rows with NA values
pal50 <- subset(R_shortCut_50_go4_TST1062xys,is.na(XofTrace))
indpal50 <- pal50$id[1]
append50 <- filter(R_shortCut_0_go4_TST1062, id == indpal50)
R_shortCut_50_go4_TST1062xys <- filter(R_shortCut_50_go4_TST1062xys, id != indpal50)
R_shortCut_50_go4_TST1062xys <- rbind(append50, R_shortCut_50_go4_TST1062xys)
##
R_shortCut_75_go4_TST1062 <- filter(R_shortCut_0_go4_TST1062, when_diff >= quant75_spans_go4_in_TST1062)
R_shortCut_75_go4_TST1062xs <- R_shortCut_75_go4_TST1062 %>% mutate(XofTrace = XofTrace + lag(deltaX))
R_shortCut_75_go4_TST1062xys <- R_shortCut_75_go4_TST1062xs %>% mutate(YofTrace = YofTrace - lag(deltaY))
# workaround rows with NA values
pal75 <- subset(R_shortCut_75_go4_TST1062xys,is.na(XofTrace))
indpal75 <- pal75$id[1]
append75 <- filter(R_shortCut_0_go4_TST1062, id == indpal75)
R_shortCut_75_go4_TST1062xys <- filter(R_shortCut_75_go4_TST1062xys, id != indpal75)
R_shortCut_75_go4_TST1062xys <- rbind(append75, R_shortCut_75_go4_TST1062xys)
##
R_shortCut_0_go4_TST1062 <- R_shortCut_0_go4_TST1062 %>% mutate(fromfile= "no shortcut")
R_shortCut_25_go4_TST1062xys <- R_shortCut_25_go4_TST1062xys %>% mutate(fromfile=">= quant25% (O.0232)")
R_shortCut_50_go4_TST1062xys <- R_shortCut_50_go4_TST1062xys %>% mutate(fromfile= ">= quant50% (O.0290)")
R_shortCut_75_go4_TST1062xys <- R_shortCut_75_go4_TST1062xys %>% mutate(fromfile= ">= quant75% (O.0348)")
R_df1 <- rbind(R_shortCut_0_go4_TST1062, R_shortCut_25_go4_TST1062xys)
R_df2 <- rbind(R_df1, R_shortCut_50_go4_TST1062xys)
R_df3 <- rbind(R_df2, R_shortCut_75_go4_TST1062xys)
### (stressesful reinforcement approach)
S_shortCut_0_go4_TST1062 <- go4_in_TST1062_diffs
S_shortCut_25_go4_TST1062 <- filter(S_shortCut_0_go4_TST1062, when_diff <= 0.0232000000000028)
S_shortCut_25_go4_TST1062xs <- S_shortCut_25_go4_TST1062 %>% mutate(XofTrace = XofTrace + lag(deltaX))
S_shortCut_25_go4_TST1062xys <- S_shortCut_25_go4_TST1062xs %>% mutate(YofTrace = YofTrace - lag(deltaY))
# workaround rows with NA values
pal25 <- subset(S_shortCut_25_go4_TST1062xys,is.na(XofTrace))
indpal25 <- pal25$id[1]
append25 <- filter(S_shortCut_0_go4_TST1062, id == indpal25)
S_shortCut_25_go4_TST1062xys <- filter(S_shortCut_25_go4_TST1062xys, id != indpal25)
S_shortCut_25_go4_TST1062xys <- rbind(append25, S_shortCut_25_go4_TST1062xys)
##
S_shortCut_50_go4_TST1062 <- filter(S_shortCut_0_go4_TST1062, when_diff <= quant50_spans_go4_in_TST1062)
S_shortCut_50_go4_TST1062xs <- S_shortCut_50_go4_TST1062 %>% mutate(XofTrace = XofTrace + lag(deltaX))
S_shortCut_50_go4_TST1062xys <- S_shortCut_50_go4_TST1062xs %>% mutate(YofTrace = YofTrace - lag(deltaY))
# workaround rows with NA values
pal50 <- subset(S_shortCut_50_go4_TST1062xys,is.na(XofTrace))
indpal50 <- pal50$id[1]
append50 <- filter(S_shortCut_0_go4_TST1062, id == indpal50)
S_shortCut_50_go4_TST1062xys <- filter(S_shortCut_50_go4_TST1062xys, id != indpal50)
S_shortCut_50_go4_TST1062xys <- rbind(append50, S_shortCut_50_go4_TST1062xys)
##
S_shortCut_75_go4_TST1062 <- filter(S_shortCut_0_go4_TST1062, when_diff <= quant75_spans_go4_in_TST1062)
S_shortCut_75_go4_TST1062xs <- S_shortCut_75_go4_TST1062 %>% mutate(XofTrace = XofTrace + lag(deltaX))
S_shortCut_75_go4_TST1062xys <- S_shortCut_75_go4_TST1062xs %>% mutate(YofTrace = YofTrace - lag(deltaY))
# workaround rows with NA values
pal75 <- subset(S_shortCut_75_go4_TST1062xys,is.na(XofTrace))
indpal75 <- pal75$id[1]
append75 <- filter(S_shortCut_0_go4_TST1062, id == indpal75)
S_shortCut_75_go4_TST1062xys <- filter(S_shortCut_75_go4_TST1062xys, id != indpal75)
S_shortCut_75_go4_TST1062xys <- rbind(append75, S_shortCut_75_go4_TST1062xys)
##
S_shortCut_0_go4_TST1062 <- S_shortCut_0_go4_TST1062 %>% mutate(fromfile= "no shortcut")
S_shortCut_25_go4_TST1062xys <- S_shortCut_25_go4_TST1062xys %>% mutate(fromfile="<= quant25% (O.0232)")
S_shortCut_50_go4_TST1062xys <- S_shortCut_50_go4_TST1062xys %>% mutate(fromfile= "<= quant50% (O.0290)")
S_shortCut_75_go4_TST1062xys <- S_shortCut_75_go4_TST1062xys %>% mutate(fromfile= "<= quant75% (O.0348)")
S_df1 <- rbind(S_shortCut_0_go4_TST1062, S_shortCut_25_go4_TST1062xys)
S_df2 <- rbind(S_df1, S_shortCut_50_go4_TST1062xys)
S_df3 <- rbind(S_df2, S_shortCut_75_go4_TST1062xys)
ggTST1026Trace <- ggplot(TST1026, aes(XofTrace, YofTrace))
ggTST1026Trace + geom_point(aes(color = SYLLABLE), size = 1, alpha = 1/3) +
scale_y_continuous(limits = c(min(TST1026[,"YofTrace"]), max(TST1026[,"YofTrace"])), breaks = seq(min(TST1026[,"YofTrace"]), max(TST1026[,"YofTrace"]), by = 250)) +
scale_x_continuous(limits = c(min(TST1026[,"XofTrace"]), max(TST1026[,"XofTrace"])), breaks = seq(min(TST1026[,"XofTrace"]), max(TST1026[,"XofTrace"]), by = 200)) +
theme(plot.caption = element_text(hjust = 0)) +
labs(title = "Subject on a stressful situation") +
scale_colour_discrete("Segment") +
labs(x = "x axis of traces", y = "y axis of traces",
caption = "Fig. 5 Traces from file out2221026.txt ---TST1026/26_test--- in the process")
ggSan2_1026 <- ggplot(san2_in_TST1026_diffs, aes(x=XofTrace, y=YofTrace))
ggSan2_1026 + geom_count(mapping=aes(color=ifelse(when_diff <= 0.01730, substr(when_diff,1,7), NA)),
size = 1.5)+
scale_y_continuous(limits = c(min(san2_in_TST1026_diffs[,"YofTrace"]),
max(san2_in_TST1026_diffs[,"YofTrace"])),
breaks = seq(min(san2_in_TST1026_diffs[,"YofTrace"]),
max(san2_in_TST1026_diffs[,"YofTrace"]), by = 100)) +
scale_x_continuous(limits = c(min(san2_in_TST1026_diffs[,"XofTrace"]),
max(san2_in_TST1026_diffs[,"XofTrace"])),
breaks = seq(min(san2_in_TST1026_diffs[,"XofTrace"]),
max(san2_in_TST1026_diffs[,"XofTrace"]), by = 100)) +
scale_colour_discrete("Time spans") +
theme(plot.caption = element_text(hjust = 0)) +
labs(title = "Most stressed movements in segment SAN- 2 (of 222 observations)") +
labs(x = "Horizontal mouse movement magnitudes", y = "Vertical mouse movement magnitudes",
caption = "Fig. 6 Segment SAN- 2 from subject's file out2221026.txt (TST1026/26_test). Labels: 'obs#[span from previous'")+
geom_text_repel(min.segment.length = 0,
size = 3,
force = 2,
segment.color = '#cccccc',
segment.size = 0.5,
box.padding = unit(2, 'lines'),
point.padding = unit(.25, 'lines'),
nudge_x = -10,
nudge_y = 9,
aes(label=ifelse(when_diff <= 0.01730,
paste(id,"[", substr(when_diff,1,7)),NA)))
ggTia3_1026 <- ggplot(tia3_in_TST1026_diffs, aes(x=XofTrace, y=YofTrace))
ggTia3_1026 + geom_count(mapping=aes(color=ifelse(when_diff < quant25_spans_tia3_TST1026_diffs,
substr(when_diff,1,9), NA)), size = 1.5)+
scale_y_continuous(limits = c(min(tia3_in_TST1026_diffs[,"YofTrace"]), max(tia3_in_TST1026_diffs[,"YofTrace"])), breaks = seq(min(tia3_in_TST1026_diffs[,"YofTrace"]), max(tia3_in_TST1026_diffs[,"YofTrace"]), by = 50)) +
scale_x_continuous(limits = c(min(tia3_in_TST1026_diffs[,"XofTrace"]), max(tia3_in_TST1026_diffs[,"XofTrace"])), breaks = seq(min(tia3_in_TST1026_diffs[,"XofTrace"]), max(tia3_in_TST1026_diffs[,"XofTrace"]), by = 50)) +
scale_colour_discrete("Time span") +
theme(plot.caption = element_text(hjust = 0)) +
labs(title = "Most stressed time stamped movements in segment -TIA- 3") +
labs(x = "Horizontal mouse movement magnitudes", y = "Vertical mouse movement magnitudes",
caption = "Fig. 7 Segment -TIA- 3 from file out2221026.txt (TST1026/26_test) Labels: 'obs#[span from previous'")+
geom_text_repel(min.segment.length = 0,
size = 3,
force = 3,
segment.color = '#cccccc',
segment.size = 0.5,
box.padding = unit(2.5, 'lines'),
point.padding = unit(.25, 'lines'),
nudge_x = 7,
nudge_y = 9,
aes(label=ifelse(when_diff <= quant25_spans_tia3_TST1026_diffs,
paste(id,"[", substr(when_diff,1,7)),NA)))
gg1062_Trace <- ggplot(TST1062, aes(XofTrace, YofTrace))
gg1062_Trace + geom_point(aes(color = SYLLABLE), size = 1, alpha = .75) +
scale_y_continuous(limits = c(min(TST1062[,"YofTrace"]), max(TST1062[,"YofTrace"])), breaks = seq(min(TST1062[,"YofTrace"]), max(TST1062[,"YofTrace"]), by = 250)) +
scale_x_continuous(limits = c(min(TST1062[,"XofTrace"]), max(TST1062[,"XofTrace"])), breaks = seq(min(TST1062[,"XofTrace"]), max(TST1062[,"XofTrace"]), by = 200)) +
theme(plot.caption = element_text(hjust = 0)) +
labs(title = "Subject on a NOT stressful situation") +
scale_colour_discrete("Segment") +
labs(x = "x axis of traces", y = "y axis of traces",
caption = "Fig. 8 Traces from file out2221062.txt ---TST1062/f62_test--- in the process")
# observations progress
xxx <- ggplot(go4_in_TST1062_diffs, aes(x=as.integer(id), y=substr(when_diff,1,9)))
go4_diff_levels_progress <- xxx + geom_count(mapping=aes(color=substr(when_diff,1,9)), size = 4) +
geom_line(aes(group = 1), size = 1/3) +
scale_colour_discrete("Time spans") +
labs(x = "Observations progress", y = "Time span levels") +
theme(plot.caption = element_text(hjust = 0)) + # set the left align here
labs(title = "Segment GO 4. Stress fluctuations on joystick head",
caption = "Fig. 9 GO 4 segment from file out2221062.txt ---TST1062/f62_test--- in the process. Labels: observation #") +
geom_text(aes(label = paste0(id)), nudge_x = 1)
# labeled trajectory
yyy <- ggplot(go4_in_TST1062_diffs, aes(x=XofTrace, y=YofTrace))
go4_trail <- yyy + geom_count(mapping=aes(color=ifelse(when_diff >= quant0_spans_go4_in_TST1062,
substr(when_diff,1,9), NA)), size = 3)+
scale_y_continuous(limits = c(min(go4_in_TST1062_diffs[,"YofTrace"]),
max(go4_in_TST1062_diffs[,"YofTrace"])),
breaks = seq(min(go4_in_TST1062_diffs[,"YofTrace"]),
max(go4_in_TST1062_diffs[,"YofTrace"]), by = 50)) +
scale_x_continuous(limits = c(min(go4_in_TST1062_diffs[,"XofTrace"]),
max(go4_in_TST1062_diffs[,"XofTrace"])),
breaks = seq(min(go4_in_TST1062_diffs[,"XofTrace"]),
max(go4_in_TST1062_diffs[,"XofTrace"]), by = 50)) +
scale_colour_discrete("Time spans") +
labs(x = "X axis of mouse movements", y = "Y axis of mouse movements")+
theme(plot.caption = element_text(hjust = 0)) + # set the left align here
labs(title = "Segment GO 4. Mouse movements path",
caption = "Fig. 10 GO 4 segment from subject's file out2221062.txt ---TST1062/f62_test--- in the process. Labels: observation #") +
geom_text_repel(min.segment.length = 0,
size = 3,
force = 5,
segment.color = '#cccccc',
segment.size = 0.5,
box.padding = unit(2, 'lines'),
point.padding = unit(.3, 'lines'),
nudge_x = -3,
nudge_y = -2,
aes(label=ifelse(when_diff >= quant0_spans_go4_in_TST1062, paste(id),NA)))
# in same page arrange
figures9n10 <- ggarrange(go4_diff_levels_progress, go4_trail,
common.legend = TRUE,
legend = "bottom")
# print plot
figures9n10
R_plot <- ggplot(R_df3, aes(x=XofTrace, y=YofTrace))
R_shcuts <- R_plot + geom_point(size=2) +
facet_wrap(~fromfile, nrow = 2) +
aes(color = substr(when_diff,1,9)) +
theme(plot.caption = element_text(hjust = 0)) +
labs(x = "x axis of traces", y = "y axis of traces",
caption = "Fig. 11 GO 4 segment from file out2221062.txt ---TST1062/f62_test--- in the process") +
scale_colour_discrete("Time stamped spans") +
labs(title = "Reinforcement Feedback of a relaxed approach. Hypothetical path trimmings")
# observations progress
xxx <- ggplot(go4_in_TST1062_diffs, aes(x=as.integer(id), y=substr(when_diff,1,9)))
R_go4_diff_levels_progress <- xxx + geom_count(mapping=aes(color=substr(when_diff,1,9)), size = 4) +
geom_line(aes(group = 1), size = 1/3) +
scale_colour_discrete("Time spans") +
labs(x = "Observations progress", y = "Time span levels") +
theme(plot.caption = element_text(hjust = 0)) + # set the left align here
labs(title = "Segment GO 4. Stress fluctuations on joystick head",
caption = "Fig. 12 GO 4 segment from file out2221062.txt ---TST1062/f62_test--- in the process. Label: observation #") +
geom_text(aes(label = paste0(id)), nudge_x = 1)
# in same page arrange
figures11n12 <- ggarrange( R_shcuts, R_go4_diff_levels_progress,
common.legend = TRUE,
legend = "bottom")
# print plot
figures11n12
S_plot <- ggplot(S_df3, aes(x=XofTrace, y=YofTrace))
S_shcuts <- S_plot + geom_point(size=2) +
facet_wrap(~fromfile, nrow = 2) +
aes(color = substr(when_diff,1,9)) +
theme(plot.caption = element_text(hjust = 0)) +
labs(x = "x axis of traces", y = "y axis of traces",
caption = "Fig. 13 GO 4 segment from file out2221062.txt ---TST1062/f62_test--- in the process") +
scale_colour_discrete("Time stamped spans") +
labs(title = "Reinforcement Feedback of a stressed approach. Hypothetical path trimmings")
# observations progress
yyy <- ggplot(go4_in_TST1062_diffs, aes(x=as.integer(id), y=substr(when_diff,1,9)))
S_go4_diff_levels_progress <- yyy + geom_count(mapping=aes(color=substr(when_diff,1,9)), size = 4) +
geom_line(aes(group = 1), size = 1/3) +
scale_colour_discrete("Time spans") +
labs(x = "Observations progress", y = "Time span levels") +
theme(plot.caption = element_text(hjust = 0)) + # set the left align here
labs(title = "Segment GO 4. Stress fluctuations on joystick head",
caption = "Fig. 14 GO 4 segment from file out2221062.txt ---TST1062/f62_test--- in the process. Label: observation #") +
geom_text(aes(label = paste0(id)), nudge_x = 1)
# in same page arrange
figures13n14 <- ggarrange( S_shcuts, S_go4_diff_levels_progress,
common.legend = TRUE,
legend = "bottom")
# print plot
figures13n14
“Magnitudes of stress” over the mouse joystick head, in terms of time spans between mouse movements in Segments FRAY 5 and SAN- 6 from file out2221041_ggc.txt (CTRL1041/41_ctrl in the process). The observer holds/releases joystick head with the right hand, and left clicks the mouse with the left hand. Only occasionally, as in beginning of segment SAN- 6, the observer moved the joystick towards a wholly undesired direction.
Fig. 15 Observer’s take: traces from file out2221041_ggc.txt —CTRL1041/41_ctrl.
ggCTRL1041Trace <- ggplot(CTRL1041, aes(XofTrace, YofTrace))
ggCTRL1041Trace + geom_point(aes(color = SYLLABLE), size = 1) +
scale_y_continuous(limits = c(min(CTRL1041[,"YofTrace"]), max(CTRL1041[,"YofTrace"])), breaks = seq(min(CTRL1041[,"YofTrace"]), max(CTRL1041[,"YofTrace"]), by = 100)) +
scale_x_continuous(limits = c(min(CTRL1041[,"XofTrace"]), max(CTRL1041[,"XofTrace"])), breaks = seq(min(CTRL1041[,"XofTrace"]), max(CTRL1041[,"XofTrace"]), by = 100)) +
theme(plot.caption = element_text(hjust = 0)) +
labs(title = "Paths from observer's experiment") +
scale_colour_discrete("Segment") +
labs(x = "x axis of traces", y = "y axis of traces",
caption = "Fig. 15 Traces from file out2221041_ggc.txt CTRL1041/41_ctrl in the process")
ggFray5_1041 <- ggplot(fray5_in_CTRL1041_diffs, aes(x=XofTrace, y=YofTrace))
ggFray5_1041 + geom_count(mapping=aes(color=ifelse(when_diff <= quant25_spans_fray5_CTRL1041, substr(when_diff,1,6), NA)), size = 2)+
scale_y_continuous(limits = c(min(fray5_in_CTRL1041_diffs[,"YofTrace"]), max(fray5_in_CTRL1041_diffs[,"YofTrace"])), breaks = seq(min(fray5_in_CTRL1041_diffs[,"YofTrace"]), max(fray5_in_CTRL1041_diffs[,"YofTrace"]), by = 100)) +
scale_x_continuous(limits = c(min(fray5_in_CTRL1041_diffs[,"XofTrace"]), max(fray5_in_CTRL1041_diffs[,"XofTrace"])), breaks = seq(min(fray5_in_CTRL1041_diffs[,"XofTrace"]), max(fray5_in_CTRL1041_diffs[,"XofTrace"]), by = 100)) +
scale_colour_discrete("Time span") +
theme(plot.caption = element_text(hjust = 0)) +
labs(title = "Most stressful/fastest time stamped observations in segment FRAY 5") +
labs(x = "Horizontal mouse movement magnitudes", y = "Vertical mouse movement magnitudes",
caption = "Fig. 16 Segment FRAY 5 from file out2221041_ggc.txt (CTRL1041/41_ctrl in the process) Labels: 'obs#[span from previous'")+
geom_text_repel(min.segment.length = 0,
size = 3,
force = 5,
segment.color = '#cccccc',
segment.size = 0.5,
box.padding = unit(1, 'lines'),
point.padding = unit(.25, 'lines'),
nudge_x = -7,
nudge_y = 6,
aes(label=ifelse(when_diff < quant25_spans_fray5_CTRL1041, paste(id,"[", substr(when_diff,1,7)),NA)))
ggSan6_1041 <- ggplot(san6_in_CTRL1041_diffs, aes(x=XofTrace, y=YofTrace))
ggSan6_1041 + geom_count(mapping=aes(color=ifelse(when_diff <= quant25_spans_san6_CTRL1041, substr(when_diff,1,7), NA)), size = 2)+
scale_y_continuous(limits = c(min(san6_in_CTRL1041_diffs[,"YofTrace"]), max(san6_in_CTRL1041_diffs[,"YofTrace"])), breaks = seq(min(san6_in_CTRL1041_diffs[,"YofTrace"]), max(san6_in_CTRL1041_diffs[,"YofTrace"]), by = 100)) +
scale_x_continuous(limits = c(min(san6_in_CTRL1041_diffs[,"XofTrace"]), max(san6_in_CTRL1041_diffs[,"XofTrace"])), breaks = seq(min(san6_in_CTRL1041_diffs[,"XofTrace"]), max(fray5_in_CTRL1041_diffs[,"XofTrace"]), by = 100)) +
scale_colour_discrete("Time span") +
theme(plot.caption = element_text(hjust = 0)) +
labs(title = "Most stressful/fastest time stamped observations in segment SAN- 6") +
labs(x = "Horizontal mouse movement magnitudes", y = "Vertical mouse movement magnitudes",
caption = "Fig. 17 Segment FRAY 5 from file out2221041_ggc.txt (CTRL1041/41_ctrl in the process) Labels: 'obs#[span from previous'")+
geom_text_repel(min.segment.length = 0,
size = 3,
force = 5,
segment.color = '#cccccc',
segment.size = 0.5,
box.padding = unit(1, 'lines'),
point.padding = unit(.25, 'lines'),
nudge_x = -7,
nudge_y = 6,
aes(label=ifelse(when_diff <= quant25_spans_san6_CTRL1041, paste(id,"[", substr(when_diff,1,7)),NA)))
Pseudocode to be tested in Chuck/miniAudicle scripts prior to an attempt in Dasher code itself. The reinforcement of relaxed movements visual feedback would be something like the following: “IF ONLY and ONLY IF mouse head handling IS time stamped SLOWER than a training/configuration parameter threshold, update cursor position in the program window”.
Beginning of program “joystick mouse movements control”
COMMENT: vars declaration format: type of var, name of var [= optional/configuration value]
numeric, Threshold
position, window.mousePosition
mousePosition, previousMousePosition = origin
mousePosition, newMousePosition = origin
movement, mouseMovement = MOVEDnot
gate, goAhead = TRUE
Beginning of EXTERNAL Loop {
if goAhead is TRUE: {
window.mousePosition = window.newMousePosition
} else if goAhead is FALSE: {
window.mousePosition = window.previousMousePosition
} endif
Beginning of INTERNAL Loop {
if mouseMovement turns MOVEDyes: {
update newMousePosition with mouseMovement.timeStampedDifference
} endif
if newMousePosition.mouseMovement.timeStampedDifference is SLOWER than Threshold: {
update previousMousePosition with newMousePosition
go to Beginning of EXTERNAL loop with goAhead = TRUE
} else if FASTER than Threshold: {
go to Beginning of EXTERNAL loop with goAhead = FALSE
} else if EQUAL to Threshold: {
go to Beginning of INTERNAL loop
} endif
} End of INTERNAL loop
} End of EXTERNAL loop
End of program “joystick mouse movements control”