Professional Documents
Culture Documents
Movements
Dylan Drein
13344741
References ............................................................................. 23
Declaration
I hereby certify that this material, which I now submit for assessment on the program of study
as part of BSc. Computer Science qualification, is entirely my own work and has not been
taken from the work of others - save and to the extent that such work has been cited and
acknowledged within the text of my work.
I hereby acknowledge and accept that this thesis may be distributed to future final year
students, as an example of the standard expected of final year projects.
Signed: Date:
i
Acknowledgements
I would like to thank my supervisor Dr Kevin Casey for providing consistent and invaluable assistance
throughout the course of this project.
I would like to thank Dr Patrick Murphy of University College, Dublin for meeting with me and assisting
me greatly with the mathematics and statistics elements of this project.
Many thanks to everybody who spent the past 6-7 months in the final year lab, driving me to continue
and providing moral support when it was needed. Misery loves company.
I extend my gratitude to the entire department of Computer Science and its faculty here at Maynooth
University for the level of support and assistance provided over the past 4 years.
Finally, I would like to thank my family and friends who supported and guided me throughout the
duration of this project and the past 4 years in general. It has been hugely appreciated.
ii
Abstract
Stress has been shown to manifest in many forms and has debilitating effects on a person’s mental
and physical health, personal productivity, workplace efficiency and quality of life. Symptoms and
indicators of stress are well studied, however traditional detection methods can be invasive, cost-
prohibitive or too subjective to be reliable.
Here we explore the advantages of using computer mouse movements as a method of stress detection
in 129 college students. Mouse movement data from each individual user was logged across the
semester and analysed within the context of whether it took place in a lab exam environment or
outside of a lab exam environment. Metrics were devised, based on this data, as being potentially
effective in identifying a change in user stress state between environments. These metrics were
calculated for each mouse movement and the difference in results between environments was tested
for significance. Of the 9 metrics tested, mouse movement speed; efficiency; time duration; target
overshoot; hover time over target, error in the x-axis component of movement and efficiency in the
x-axis and y-axis components of movement were found to be significantly different between the
stressful and less stressful environments. Error in the y-axis component of movement was found to
have no significant difference.
These findings strongly support the merit in using Human Computer Interaction through computer
mouse movements in detecting stress and serve as a potential foundation for further research using
keyboard data as an additional stress detection indicator or in the application of machine learning
principles to the data to be able to classify a user as stressed or non-stressed.
iii
List of Figures
Figure 3-1: Cleaned, reversed JSON data showing a mouse click event. ............................... 8
Figure 3-2 Plot of an individual users Click Sequence (note: overshoot) ............................... 9
Figure 3-3: Actual mouse path (left), Approximation of actual mouse path using
intermediate Euclidean distances between mouse events (right) ..................... 10
Figure 3-4: Actual mouse path with overshoot of mouseDown location, showing overshoot
and return path of mouse cursor to the location of the click event. ................. 11
Figure 4-1: (Left) Mouse activity over the week of lab 1 and (Right) mouse activity over the
week of lab 2. ..................................................................................................... 14
Figure 4-2 Distance function using NumPy linear algebra tools ......................................... 15
Figure 4-3 (Left) Histogram of in lab Click Sequence efficiency and (Right) Histogram of
out of lab Click Sequence efficiency (sample mean, standard deviation and
variance incl.) ..................................................................................................... 15
Figure 4-4 Histogram of in lab Click Sequence speed (Left) and out of lab Click Sequence
speed (Right) ...................................................................................................... 15
Figure 4-5 Histogram of in lab Click Sequence hovertime (Left) and out of lab Click
Sequence hovertime (Right) ............................................................................... 16
Figure 5-1: Example of dummy file used to verify code analysis of metrics ........................ 18
List of Tables
Table 2-1 Type errors encountered in Hypothesis Testing ................................................... 7
Table 4-1 UNIX time stamps of lab exam........................................................................... 13
Table 5-1 Table of metric descriptive statistics.................................................................. 19
Table 5-2 Summary of Welch’s t-test results showing the significance of the stress
indicator metrics. Star (∗) indicates significance at α = 0.0167. ........................ 20
iv
Chapter one: Introduction
Summary
Chapter one outlines an overview of the existing work in this field and the motivation for carrying out
this project as well as an outline of the approach and methodology used, from planning, through the
implementation to the evaluation of the results.
1.2 Motivation
The motivation for this project was to provide a passive, non-invasive and inexpensive model of
detecting stress indicators in users by monitoring their behaviour through their computer mouse
movements.
Previous research has strongly indicated that stress in the workplace has a negative effect on employee
efficiency and employee performance, negatively affects work ethic and contributes to employee
‘burnout’. [1] Furthermore, in college students stress has been shown to negatively affect physical and
emotional health [2] and strongly correlates with high levels of depression and anxiety. [3]
Although conventional stress indicators are well studied and understood [4], measuring and collecting
data in an unobtrusive yet effective way has not been straightforward. [5] Electroencephalography
(EEG) and electrocardiography (ECG) are proven methods in indicating levels of stress in subjects [6],
though they require specialised and expensive equipment to be in place before, during and after the
stressful situation takes place. Custom sensing hardware encounters similar issues, while self-report
tools can provide biased and unreliable feedback depending on the environment in which testing takes
place. [5]
1
data was classified into one of two groups based on whether or not Click Sequences occurred in or out
of a lab environment.
Before the data was cleaned, it was necessary to determine what aspects of a Click Sequence would
be most useful to analyse in order to achieve the aims of the project. Determining this early on ensured
that only the most relevant fields were retained during the cleaning process. Relevant analytical
methods that would be appropriate to apply to this data were explored throughout the project as the
distribution and structure of the data became more understood.
1.4 Approach
The three mouse events encountered in the data were mouseMove, mouseDown and mouseUp. A
mouseDown event followed by a mouseUp event constitutes a ‘full’ mouse click, however
‘mouseDown’ and ‘click’ are used synonymously throughout this report. A full mouse movement
sequence is identified as a succession of mouseMove events ending in a mouseDown event. This full
sequence will hereafter be referred to as a Click Sequence.
1.4.1 Initial Decisions
Python was the programming language used to carry out this project, chosen for its widely supported
and well documented statistical analysis and numerical packages, namely NumPy, SciPy, Pandas, scikit-
learn for machine learning and matplotlib for graph plotting. Initially Project Jupyter’s IPython [7]
command shell was used which offers an interactive browser-based development notebook, though
as time went on the Windows command prompt was used as the predominant Python interpreter.
1.4.2 Designed Solution
Relevant metrics such as efficiency of the users Click Sequence, the speed of the Click Sequence, the
time duration of each Click Sequence among others outlined in this report were initially identified as
promising methods of identifying and measuring stress indicators in users. Data for each of these
metrics was generated from the raw data and categorised at first by user, then by environment.
Descriptive statistics were generated for each of these metrics across both environments as well as
visual analysis that was carried out using plotting software. These initial analyses served as the
foundation for a final round of testing which determined which metrics, if any, show a significant
difference between in lab vs. out of lab environments thus determining which metrics were strongest
in identifying stress indicators in users.
1.4.3 Evaluation
Data was initially analysed by graphing its spread with histograms, scatter plots and box plots using
matplotlib plotting software. Doing this allowed for further relevant analysis to be identified based on
how the data looked visually and also allowed for tweaks and changes in the previous code to be made
to better suit the data once it had been visualised.
In addition, descriptive statistics such as the mean, median, standard deviation and variance were used
alongside the visual analysis. This information was used to compare data between both environments
and served as the basis for testing for correlation between in lab and out of lab conditions for each of
the metrics outlined in section 1.5.
Hypothesis testing was used to determine if corresponding metrics from in lab and out of lab
environments were significantly different from one another. A modified student’s t-test was used to
carry this out called Welch’s t-test which can be less powerful than the Student’s t-test but has no
2
restrictions for data skew or data variance[8]. Data transformation such as square or log
transformation can be carried out on the data to normalise it’s spread and make it more suitable for
various tests which rely on the assumption of a normal distribution. These method of transformation,
although widely used, have been highlighted as potentially problematic [9], so alternative approaches
will be explored to strengthen conclusions.
1.5 Metrics
Based on the spread of the distribution for each metric (discussed in detail below) relevant Click
Sequences are limited to those which last for at most 1450ms and end with a mouseDown event
The relevant metrics that were obtained from the data and used for analysis are:
1. Distance: Both actual distance and optimal distances were calculated for each Click Sequence.
Actual distance measured the real mouse path distance of each Click Sequence. Actual paths were
made up of a sequence of mouseMove events ending in a mouseDown event. The Euclidean
distance between these successive mouseMove events were summed to approximate the distance
travelled. Optimal distance was calculated as the Euclidean distance between the start and end
point of the Click Sequence.
2. Time: The duration of each Click Sequence was calculated in milliseconds from the initial point to
the mouseDown point.
3. Speed: The speed of each Click Sequence was calculated in pixels per millisecond (px/ms) and
pixels per second (px/s).
See Appendix D
4. Click hover time: The duration for which each user ‘hovered’ the cursor over the click point before
clicking the mouse was calculated for each Click Sequence.
See Appendix B, I
6. Overshoot: The distance for which the user ‘overshot’ the target with the mouse cursor was
calculated for each Click Sequence.
See Appendix C, I
7. X/Y-axis error: The error was calculated for optimal and actual distance for the individual x-y
components of each Click Sequence. This used the same method as (1.) though it measured the
change in distance along each axis separately for each Click Sequence.
See Appendix E, F, G
8. X/Y-axis efficiency: Efficiency was calculated in the same way as above for the individual x-y
components of each Click Sequence.
See Appendix E, F, G
3
Chapter two: Technical Background
Summary
This chapter outlines and discusses the previous approaches, methodologies and results of similar
research carried out in this area. It also aims to break down and describe in detail all technical aspects
of this particular project, the approaches taken and the technology used.
4
software, is indicative of a strong relationship between mouse cursor movement and eye gaze
movement.
This exploratory work serves as a foundation for further work in this field and, when considered in
conjunction with other work in the fields of augmented reality [17] and virtual reality [18] for example,
the prospective applications of mouse movement analysis are extremely promising.
2.2.4 Packages
Anaconda is an extensive data science platform for Python. Conda is an open source package and
environment management system which comes preinstalled as part of the Anaconda suite. As an
environment manager, Conda handles switching between Python environments quickly when working
with packages which are version specific. Conda supports the installation of packages through the
command prompt with the ‘conda install [package name]’ command. It also handles the
deletion and updating of packages among other tasks.[22]
NumPy is a scientific computation package for use with Python. It allows for the storage of data in
homogenous, n-dimensional ‘ndarrays’ data objects as well as the ability to carry out a wide range of
mathematical functions and transformations on the data stored in these arrays.
SciPy is a Python library which has features for handling data processing, optimisation, numerical
integration, regression analysis, clustering, statistical analysis and hypothesis testing among data sets
along with many other features. SciPy works with NumPy ndarray objects as part of the NumPy stack.
2.2.5 Graphing
Matplotlib [23] is a Python plotting library which is capable of producing static and interactive graphs
and figures. These graphs can be heavily manipulated depending on the graph being generated (eg.
5
Histograms, box plots, error bars, scatter plots etc.), allowing for in depth analysis of spread of the data
as well as visual analysis of relationships between data sets.
2.2.8 Distributions
Distribution of the data can be visually represented with graphs such as box plots and histograms.
Representing the data this way can show, among other things, the spread of the data, data outliers,
6
the maximum and minimum values as well as the skew of the data in a more intuitive and readable
way. Plotting the data this way can also give a more informed view of how further analysis should be
carried out as, in the case of hypothesis testing for example, certain testing methods are only suited
to specific distributions of data and can give inaccurate, unreliable or less powerful results if applied
incorrectly.
As such, it is important to identify features of the data like data skew to determine if it is positively or
negatively skewed or if it is normally distributed, if it is unimodal or bimodal etc. It is also useful, and
even necessary, to identify more descriptive statistical attributes such as the mean value, the median
value, variance (how far a set of numbers in a set are spread out from their mean) and standard
deviation (measure of the amount of variation among a set of data values) to get a true understanding
of the distribution and ‘shape’ of the data set being worked with.
7
Chapter three: The Problem
Summary
The aim of the project is to create a system which analyses collected mouse movement data and
identifies potential correlations between the metrics outlined section 1.5 for in lab and out of lab
environments. The raw data needs to be cleaned and prepared appropriately so that this can be carried
out and the results need to be obtained in such a way that they can be statistically analysed to produce
useful and potentially novel conclusions.
Figure 3-1: Cleaned, reversed JSON data showing a mouse click event.
One of the 11 fields recorded in each mouse event is the UNIX timestamp of when that event took
place. In the raw file, entries were logged from oldest to most recent, with the mouseDown event
being the final event in a Click Sequence. During analysis, the data will be read in row by row, starting
with the final mouseDown event and working backwards in time to the start of the Click Sequence, or
until the mouseDown event of a previous Click Sequence is encountered. Thus, the data needs to be
loaded in the reverse order of which it is saved. The serialised nature of the data based on the
timestamp means it is straightforward to reverse the log file ordering and save the data from newest
to oldest to make the backwards traversal of the Click Sequences possible.
After the data has been cleaned and reversed it will be necessary to create separate files for each
user’s mouse movement data. This will involve parsing the data based on the name identifier saved in
each mouse event.
Due to the tabular nature of the data, with each column holding the same fields in each row entry, it
may be appropriate and indeed more efficient to convert the JSON files to comma separated value
files using the built-in reader and writer objects of Python’s CSV module.
Associated files: initialcleaning.py, FileReverse.py
8
3.3 Isolating Relevant Data
3.3.1 Isolate Click Sequences
As the project is concerned primarily with the analysis of user Click Sequences, it will need to be
determined what does and what does not constitute a valid mouse Click Sequence. A generic definition
of what we expect a valid Click Sequence to look like will need to be used as a general rule at first, with
refinements and improvements made a posteriori based on the observed spread of the data and also
based on previous research approaches that are applicable to this data.
9
MouseDown Event MouseDown Event
(xn, yn)
(xn+1, yn+1)
X
Initial Point Initial Point
Figure 3-3: Actual mouse path (left), Approximation of actual mouse path using intermediate Euclidean
distances between mouse events (right)
Time duration of each Click Sequence will be calculated using the UNIX timestamps associated with
each mouse event. As the data is read in, the initial mouse event the CSV module will load will be the
most recent, the mouseDown event. The parser will then work backwards to the start of the Click
Sequence, saving the timestamp of the first and last point in the sequence and calculating the duration
of the Click Sequence as follows:
Efficiency will be used as a measure of how close the actual path length of the Click Sequence is to the
optimal path length. Using:
𝑂𝑝𝑡𝑖𝑚𝑎𝑙 𝐷𝑖𝑠𝑡𝑎𝑛𝑐𝑒
𝐸=
𝐴𝑐𝑡𝑢𝑎𝑙 𝐷𝑖𝑠𝑡𝑎𝑛𝑐𝑒
The efficiency of each Click Sequence can be parameterised as a numerical value such that 𝐸 ∈ [0,1]
with 𝐸 = 1 indicating highest possible efficiency in actual path length. Due to the fact that efficiency
of a Click Sequence is calculated using distances, it may be required to apply some sort of weighting
factor such as time or speed to the efficiency values when plotting their spread so that shorter Click
Sequences do not result in a disproportionate level of skew towards high efficiency.
X-Y component efficiency was also calculated using a similar method as above, in which the actual and
optimal Click Sequence length in individual axes was compared and used to calculate axis efficiency.
Speed of mouse Click Sequences will be measured in the traditional way as the rate of change in Actual
distance with respect to time. The average speed of the entire Click Sequence will be measured, though
it may prove useful to calculate differences in speed across specific intervals of the Click Sequence such
as comparing the initial speed of the cursor movement to the speed of the cursor just before the
mouseDown event.
Overshoot will measure how far the user overshoots the target click point before bringing the mouse
cursor back to that point. It should provide a useful measure of how accurate each Click Sequence is
in getting from the initial point to the click point. It is expected that Click Sequences with large
overshoot distances would have a corresponding drop in the measure of efficiency. Based on previous
research [24] this measure can also be compared to metrics such as speed and time taken to get a
better indication of the users stress level during that click sequence.
10
Figure 3-4: Actual mouse path with overshoot of mouseDown location, showing overshoot and return
path of mouse cursor to the location of the click event.
Click Hover Time will be measured to indicate how long the user hovers the mouse cursor over the
mouseDown event point before a mouseDown event is actually recorded. This metric can be compared
with speed, among other metrics, to investigate the relationship between hesitation and efficiency.
X-Y Axis error will be investigated to determine if there is any significant difference in the efficiency or
the level of error between Actual distance and Optimal distance when the x and y axis movements are
considered in isolation rather than together. This may prove a stronger indication of efficiency as it can
better account for the variation in movement of the human arm vertically and horizontally when using
a computer mouse.
11
Chapter four: The Solution
Summary
The chapter outlines in extensive detail the approach taken and the methods used to solve the
problems explored in Chapter Three to achieve the stated aims of the project.
4.1 Tools
When comparing programming languages which are used by data analysts, Python had the shallowest
learning curve compared to software suites such as R or MATLAB. Python has numerous data analysis
packages and plotting libraries which are widely supported by a community of data scientists as well
as extensive reference documentation. Python is also an extremely common language used in the field
of machine learning and neural networks which may be used in future work based on the results and
conclusions of this project.
12
Traditional text editors were unable to open such a large file, so in order to carry out the data cleaning
a Python script was developed and executed from the command line which read in the JSON file, line
by line, using Python’s json.load() method. It deleted the unnecessary fields using key-matching
before writing the new, cleaned JSON object back out to a file. As part of this script, the data was also
parsed into separate user files with the name attribute used as an identifier. This is discussed in section
4.4.
Reversing of each user file was handled separately but in a similar manner to the above. Each user file
was read in binary mode using the name key as the identifier. If a user name was encountered which
hadn’t been read before, it was saved to a name array. The entire file was converted to a list (with
each row as an element), passed to Python’s reverse() method and subsequently written back
out to an output file. Output files were created dynamically for each user by comparing if that name
had been encountered before, if it had then the row was appended to the existing file, if not then a
new file was created with that name as the filepath.
Associated files: InitialCleaning.py, FileReverse.py
4.4 Classification
4.4.1 By User
As outlined above, the data was categorised into separate user files which held mouse movement data
for each individual user across the college year. This was done to identify potential patterns,
relationships or interesting characteristics in the data for individual users or between users.
Associated files: InitialCleaning.py
13
each metric, allowing analysis to be carried out on how behaviour and stress is affected by the stress
inducing lab environment vs. the calmer out of lab environment.
Associated files: CSVScript.py, inVsOutLabData.py,
As a result of the out of lab environment being outside of the control of our test design, emphasis is
put on the fact that the out of lab environment cannot accurately be defined as ‘calm’, however it is
assumed that by nature it is at least calmer than the in lab environment. This is supported by research
outlined previously relating higher stress levels to mentally intensive tasks carried out under time
constraints.
To visually represent the difference in the level of mouse activity during a lab environment versus the
level of mouse activity out of a lab environment, the mouse activity for the entire week of both lab
exams was plotted on a histogram. Note the pronounced spikes in activity during both lab exams.
Figure 4-1: (Left) Mouse activity over the week of lab 1 and (Right) mouse activity over the week of lab 2.
4.5 Metrics
CSV files containing the mouse events for each individual user were stored in a directory called
‘CSVSeparated’. The files were read in using Python’s os.walk() directory tree generator which
treats the current directory like a root node in a tree and recursively walks through the sub directories
and files of that root node, returning a tuple [current_directory, directories, files] for each that can be
used in a for-in loop to do the traversing. Python’s os.path.join() method is used to join the
filepath inside the for-in loop and the open()method is used to open the file in ‘read binary’ mode.
One user has been removed from the test data due to them having made no Click Sequences in or out
of the lab environment in the timeframe being investigated. (n*=128)
4.5.1 Distance
Distance was calculated using NumPy’s core linear algebra tools which treats the distance between
two points as a vector and calculates its 2-norm. When a mouseDown event was encountered, the
start x-y coordinates and start time were saved and the distance between each subsequent mouse
event was calculated by passing the current and previous x-y coordinates to the dist() function.
This continued ‘while(measuring = True)’ until the 1450ms time limit for a Click Sequence
was reached, until another mouseDown event was encountered or until the end of the file was
reached. Optimal distance was calculated as the distance between the last point and the start point.
Both actual and optimal values were appended to separate numpy arrays for analysis.
Associated files: ActualVsOptimalCalculator.py, inVsOutLabData.py, MousePathScript.py,
14
Figure 4-2 Distance function using NumPy linear algebra tools
4.5.2 Efficiency
Efficiency is calculated as a measure of how efficient the actual mouse path distances are compared
to the optimal Euclidean distances by calculating optimal distance divided by actual distance as
discussed above.
Figure 4-3 (Left) Histogram of in lab Click Sequence efficiency and (Right) Histogram of out of lab Click
Sequence efficiency (sample mean, standard deviation and variance incl.)
Efficiency was also graphed with weighting factors of both speed and time which aimed to reduce the
effect that the large number of much shorter mouse paths had on the skew of the distribution towards
higher efficiency.
Efficiency in the x-y axes was calculated in the same way with distance limited specifically to the
individual x-y components of the Click Sequence.
Associated files: ActualVsOptimalCalculator.py, ttest.py, EfficiencyWithTimeGraphs.py, GraphScript.py
4.5.3 Speed
Speed of Click Sequences was calculated as a function of distance per unit time. Although the unit of
time was milliseconds, it was converted into seconds to make the plot more intuitive to read. Speed
was plotted with weighting factors including distance of Click Sequence and efficiency of Click
Sequence to investigate whether these weightings had any bearing on the spread of the data.
Figure 4-4 Histogram of in lab Click Sequence speed (Left) and out of lab Click Sequence speed (Right)
15
There were constraints places on the measurement of this metric to yield a more accurate result and
also to handle potential edge case errors in the data. These constraints were that the actual distance
of the Click Sequence could not be 0 (i.e. the mouse had to actually have been moved) and that the
time between the initial point of the Click Sequence and the final mouseDown event could not be 0.
4.5.4 Time
Time was measured for actual Click Sequences by recording the difference between the mouseDown
event time and the initial point’s time in the click sequence.
Associated files: TimeGraphs.py , InVsOutLabData.py
4.5.5 Hover time
Hover time was measured as an indication of user hesitation before executing the mouseDown event
click. This was achieved by measuring how long the user hovered the mouse over the x-y coordinates
of the mouseDown event before a mouseDown event was actually recorded.
Associated files: ClickWaitTime.py, ClickWaitTimes-relevant.py, HovertimeGraphs.py
Figure 4-5 Histogram of in lab Click Sequence hovertime (Left) and out of lab Click Sequence hovertime
(Right)
4.5.6 Overshoot
Overshoot was measured as the distance a user brought the mouse cursor past the x-y coordinates of
the mouseDown event before bringing the mouse back to that point to click. This metric was measured
to determine if the level of inaccuracy could be correlated with stress and was also compared alongside
other metrics such as speed and efficiency.
Associated files: Overshoot.py, Overshoot-relevant.py, OvershootGraph.py
4.5.7 Axis Error
Axis error was measured as a more in depth analysis of distance. Click Sequences were isolated into
their individual x and y axis components and error analysis on the Click Sequence distance was
compared between individual axes rather than as a Click Sequence whole. This aimed to account for
the difference in arm movement in the vertical and horizontal planes while using a computer mouse
and to potentially identify if one axis is a higher source of error than the other.
Associated files: In_Lab_X_Axes_Graphs.py, In_Lab_Y_Axes_Graphs.py, Out_Lab_X_Axes_Graphs.py
4.6 Hypothesis Testing
In order to identify whether or not the difference between the in lab environment and the out of lab
environment was statistically significant, Welch’s t-test was carried out on each metric for their in and
out of lab values. Due to the skewed nature of the data, transformations (logarithmic and squaring)
were considered to make the data follow a normal distribution. However, these transformations are
16
controversial among data scientists [9] and the Student’s t-test for unequal variances (equivalent to
Welch’s t-test) which was used can handle non-normal data distributions if the sample sizes are
sufficiently large(n>15). [8]
Associated files: ttest.py
17
Chapter five: Evaluation
Summary
Descriptive statistics served as a strong basis for the evaluation of results alongside the visual analysis
discussed previously. These statistics, as well as the plots of spread and distribution, allowed
appropriate testing methods to be identified and applied to the data to make significant conclusions
about what we can say about the users stress state from each individual metric.
Figure 5-1: Example of dummy CSV file with {name, time, y, x, mouseEvent} used to verify code
analysis of metrics
The dummy files were created to be simple enough so that the metrics being analysed could be
computed by hand such as optimal distance, actual distance, efficiency, time etc. These hand
computed values were then compared against the output of the Python code after it was run on the
same dummy file to verify its correctness. Time values were changed to reflect in and out of lab times
to test classification of both situations, invalid mouse event descriptors and negative UNIX times were
used to test error handling for example. This method allowed for a controlled level of error testing and
code accuracy verification.
5.2 Validation/Measurements
Due to the way in which the metric data was analysed, it was not treated as a dependent test with
repeated measures among users, but rather an independent test comparing independent Click
Sequences in the in lab vs. out of lab environment.
18
5.2.1 Results
Descriptive statistics for all metrics were calculated (with 0 values masked out) as follows:
Speed
264.88 914.94 837129.1 0.69 258924.7 251.75 530.11 281024.2 0.11 203456.7
(px/s)
Time (ms) 1010.738 403.72 162986.5 1 1450 1066.2 382.3 146162.3 1 1450
Overshoot
16.691 35.897 1288.6 2 837.6 14.255 53.566 2869.3 1 2714.2
(px)
Hovertime
181.95 180.31 32512.14 34 1443 208.88 193.45 37424.1 258 1450
(ms)
X-axis REL
2.695 18.55 344.18 0.001 1452 2.125 16.52 273.015 0.001 3836
error (px)
Y-axis REL
2.588 14.41 207.69 0.001 1194 2.61 14.28 203.78 0.002 1952
error (px)
X-axis
0.7398 0.5234 0.2739 0.0006 1 0.7653 0.332 0.11 0.0002 1
efficiency
Y-axis
0.7117 0.332 0.11 0.0008 1 0.7048 0.512 0.262 0.0005 1
efficiency
19
The time duration of each Click Sequence appears to share a similar mean and standard deviation in
both environments, although due to the fact that time was one of the most controlled variables in the
analysis this isn’t hugely surprising. Time is also negatively skewed, towards longer click sequence
times.
Overshoot and Hover time both show a marked difference in spread between environments, with both
exhibiting a positively skewed distribution towards short overshoot lengths and short hover time
durations respectively. Both of these metrics are promising as indicators of stress between
environments.
The average relative error in x-axis movements between environments was considerably larger than
the average relative error in y-axis movements. Maximum values of both metrics show that x-axis error
was more prone to large outliers in comparison to the y-axis errors. Further examination of the
implications of these values would require more extensive and specific analysis to be carried out in a
more controlled environment than was available for this project. It may also require an analysis more
similar to that used in the MouStress [5] paper with a focus on mechanical arm-hand dynamics.
5.2.3 Analysis of Results
An independent-samples 2-tailed Welch’s t-test was conducted to compare behavioural stress
indicators in lab exam and non-lab exam conditions.
t df p-value (Sig) mean
diff
SPEED (PX/S) 4.8675 622836 <0.000001* 13.13
EFFICIENCY -17.68 622836 <0.000001* -0.015
TIME (MS) -43.85 622836 <0.000001* -55.46
OVERSHOOT (PX) 2.9005 15839 <0.00003* 2.44
HOVERTIME (MS) -46.209 617537 <0.000001* -26.93
X-AXIS REL ERROR (PX) 9.6 585916 <0.000001* 0.57
Y-AXIS REL ERROR (PX) -0.635 588578 0.53 -0.022
X-AXIS EFFICIENCY -15.839 585916 <0.000001* -0.026
Y-AXIS EFFICIENCY 5.683 588578 <0.000001* 0.0069
Table 5-2 Summary of Welch’s t-test results showing the significance of the stress indicator metrics. Star
(∗) indicates significance at α = 0.0167.
Each metric except for relative error in the y-axis component of the Click Sequences was statistically
significantly different between in lab versus out lab environment. With test hypotheses as follows:
𝐻0 : 𝜇𝑖𝑛 = 𝜇𝑜𝑢𝑡
𝐻1 : 𝜇𝑖𝑛 ≠ 𝜇𝑜𝑢𝑡
For speed, efficiency, time, overshoot, hovertime, relative error in the x-axis component and efficiency
in both x and y axes we reject the null hypothesis H0 and accept the alternative hypothesis H1. For
relative error in the y-axis component we fail to reject the null hypothesis.
20
Chapter six: Conclusion
Summary
The results and their implications are discussed in this chapter, along with a general discussion and
summation of the project success and progress as a whole.
21
Difficulties arose throughout the duration of the project including how to handle such a vast amount
of data in a way that maintained its integrity during processing, how to handle edge cases in the data
such as duplicate or anomalous entries and how to deal with specific problems in the data which
needed to be tackled on a case by case basis for each metric as they arose.
These issues were solved, and the level of confidence in our results improved as a result, by identifying
previous research methods which have been proven effective in this field, along with consistent and
productive consultation with my project supervisor through email and regular face to face meetings.
Dr Patrick Murphy of University College Dublin (UCD) was consulted for his expertise in the area of
mathematics and statistics early on in the project. Having Dr Murphy’s advice at such an early stage in
the development process allowed me to identify potentially fruitful areas of statistical analysis for the
data I was working with while also identifying approaches which may not be as useful. I was then able
to tailor the identification of relevant metrics and subsequent processing of the data with this in mind.
The above observations explore several possible approaches and potential developments in the area
of low-level learning analytics. With the emergence of augmented reality and VR headsets as well as
the increasing ubiquity of computers in every facet of people’s daily lives, the importance of exploring
and understanding how people and computers interact cannot be understated.
22
References
[1] W. U. Ali, A. R. Raheem, A. Nawaz, and K. Imamuddin, “Impact of Stress on Job Performance:
An Empirical study of the Employees of Private Sector Universities of Karachi, Pakistan,” Res. J.
Manag. Sci. Res. J. Manag. Sci, vol. 3, no. 7, pp. 2319–1171, 2014.
[2] T. Baghurst and B. C. Kelley, “An Examination of Stress in College Students Over the Course of
a Semester,” Health Promot. Pract., vol. 15, no. 3, pp. 438–447, May 2014.
[3] R. Beiter et al., “The prevalence and correlates of depression, anxiety, and stress in a sample
of college students,” J. Affect. Disord., vol. 173, pp. 90–96, 2014.
[4] N. Mucci et al., “Work-related stress assessment in a population of Italian workers. The Stress
Questionnaire,” Sci. Total Environ., vol. 502, pp. 673–679, Jan. 2015.
[5] D. Sun, J. Canny, and P. Paredes, “MouStress: Detecting Stress from Mouse Motion.”
[6] J. F. Alonso, S. Romero, M. R. Ballester, R. M. Antonijoan, and M. A. Mañanas, “Stress
assessment based on EEG univariate features and functional connectivity measures.”
[7] “IPython: A System for Interactive Scientific Computing Python: An Open and General-
Purpose Environment,” 2007.
[8] “Minitab - 2-Sample t-Test,” http://support.minitab.com/en-
us/minitab/17/Assistant_Two_Sample_t.pdf.
[9] C. Feng et al., “Log-transformation and its implications for data analysis.,” Shanghai Arch.
psychiatry, vol. 26, no. 2, pp. 105–9, Apr. 2014.
[10] T. Issa and P. Isaias, “Human Computer Interaction and Usability in the New Participative
Methodology for Marketing Websites,” Issa Isaias Pacific Asia J. Assoc. Inf. Syst., vol. 6, no. 3,
pp. 47–78, 2014.
[11] S. Zahoor, D. Rajput, M. Bedekar, and P. Kosamkar, “Inferring Web Page Relevancy through
Keyboard and Mouse Usage,” in 2015 International Conference on Computing Communication
Control and Automation, 2015, pp. 474–478.
[12] T. Yamauchi, “Mouse trajectories and state anxiety: Feature selection with random forest,” in
Proceedings - 2013 Humaine Association Conference on Affective Computing and Intelligent
Interaction, ACII 2013, 2013, pp. 399–404.
[13] S. Arshad, Y. Wang, and F. Chen, “Analysing mouse activity for cognitive load detection,” in
Proceedings of the 25th Australian Computer-Human Interaction Conference on
Augmentation, Application, Innovation, Collaboration - OzCHI ’13, 2013, pp. 115–118.
[14] J. Hernandez, P. Paredes, A. Roseway, and M. Czerwinski, “Under pressure,” Proc. 32nd Annu.
ACM Conf. Hum. factors Comput. Syst. - CHI ’14, no. April, pp. 51–60, 2014.
[15] Q. Guo and E. Agichtein, “Exploring mouse movements for inferring query intent,” 31st Annu.
Int. ACM SIGIR Conf. Res. Dev. Inf. Retr., pp. 707–708, 2008.
[16] U. Demšar and A. Çöltekin, “Quantifying the interactions between eye and mouse movements
on spatial visual interfaces through trajectory visualisations.”
[17] Z. Lv et al., “PreprintTouch-less Interactive Augmented Reality Game on Vision Based
Wearable Device.”
[18] N. Padmanaban, R. Konrad, T. Stramer, E. A. Cooper, and G. Wetzstein, “Optimizing virtual
reality for all users through gaze-contingent and adaptive focus displays.,” Proc. Natl. Acad.
Sci. U. S. A., vol. 114, no. 9, pp. 2183–2188, Feb. 2017.
[19] “The JSON Data Interchange Format COPYRIGHT PROTECTED DOCUMENT.”
[20] “CSV, Comma Separated Values (RFC 4180).” [Online]. Available:
http://www.digitalpreservation.gov/formats/fdd/fdd000323.shtml. [Accessed: 16-Mar-2017].
[21] “General Concepts.” [Online]. Available:
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_16.
[Accessed: 16-Mar-2017].
[22] “Presentations & Blog Posts — Conda documentation.” [Online]. Available:
https://conda.io/docs/index.html#. [Accessed: 16-Mar-2017].
[23] J. D. Hunter, “Matplotlib: A 2D graphics environment,” Comput. Sci. Eng., vol. 9, no. 3, pp. 90–
23
95, 2007.
[24] M. Hibbeln, J. L. Jenkins, C. Schneider, J. S. Valacich, and M. Weinmann, “HOW IS YOUR USER
FEELING? INFERRING EMOTION THROUGH HUMAN–COMPUTER INTERACTION DEVICES 1,”
MIS Q., vol. 41.
24