0

I have some time series eye tracking data (x-y coordinates over time) from a 2560x1600 monitor. I've reduced these coordinates to a single column of values ranging from 1-40 according to 40 equally-sized 320x320 pixel blocks. See pic below for illustration:

Monitor Division

For each of the 40 blocks, I'd like to return the block that most frequently followed in the series (i.e., at time+1) as well as a probability value (freq target/freq all).

The end goal would be to plot a single arrow that connects all the blocks (in ggplot if possible), with thickness corresponding to the probability value.

Some kind of weighted route algorithm might work, where weight is specified by frequency.. But I'm not sure how to proceed. Any help would be greatly appreciated!

Here's a small excerpt from my dataset. The variables are: pid: Participant ID, screen: which one (of two) monitors are being looked at, xcoord: x-axis (pixel), ycoord: y-axis pixel, time: in milliseconds, gsqr: 1-40 block.

Data:

structure(list(pid = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("P_1", 
"P_1", "P_10", "P_12", "P_14", "P_15", "P_16", "P_17", "P_19", 
"P_2", "P_20", "P_21", "P_22", "P_23", "P_3", "P_4", "P_5", "P_6", 
"P_7", "P_8", "P_9"), class = "factor"), screen = c(2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L), xcoord = c(1154.01227666667, 1155.940191, 1164.879753, 1074.846603, 
1092.546799, 1078.143765, 1094.580922, 1106.799512, 1159.408059, 
1166.93691, 1142.677101, 1132.947821, 1117.288215, 1131.395988, 
1145.429976, 1125.658871, 1115.351177, 1061.143624, 1076.735769, 
1105.468566, 1140.021823, 1147.393039, 1122.128114, 1321.6034475, 
1670.063845, 1379.848096, 1973.913449, 1951.287792, 1952.3526205, 
1940.310299, 1906.957022, 1912.736649, 1891.805489, 2006.59441, 
2036.647668, 2025.339708, 1983.73872, 1999.694169, 1975.601473, 
1975.981649, 2034.807021, 2087.773419, 2098.74746, 2070.586998, 
1920.953708, 1666.604803, 1552.383377, 1570.594313, 1558.798661, 
1509.094398, 1549.834645, 1551.745516, 1603.123519, 1586.478754, 
1523.956076, 1559.820335, 1566.904846, 1522.701939, 1537.874355, 
1590.692474, 1571.672819, 1569.387303, 1542.246469, 1541.303953, 
1554.1687335, 1498.235121, 1497.137561, 1554.563621, 1592.455178, 
1555.935572, 1582.93965, 1612.7030495, 1592.1366, 1574.328262, 
1535.520099, 1214.258315, 964.9041596, 696.0528832, 588.5852169, 
620.9915804, 674.3107345, 644.800353, 677.7952189, 663.1705067, 
664.037588, 688.4489732, 707.6031205, 682.3794414, 690.2102382, 
663.6196247, 651.4586402, 611.2698717, 616.7892918, 606.3280656, 
609.9678356, 596.0489586, 596.9350689, 613.7279028, 645.7202201, 
614.0420775), ycoord = c(992.7537215, 1016.8362145, 999.1472443, 
976.6834361, 1007.520448, 1016.265703, 1049.940269, 1059.477207, 
1095.889827, 1112.342984, 1123.692207, 1115.968239, 1085.073457, 
1083.841625, 1089.193325, 1131.880333, 1084.167356, 1036.945735, 
1058.828504, 1074.39414, 1056.124785, 1084.490989, 1088.5553755, 
1022.14947155, 1103.157852, 589.137999, 348.3233178, 361.274262, 
366.91643625, 366.8896819, 363.1556742, 356.3001216, 365.2487051, 
310.1548873, 311.0964855, 346.206749, 393.8948754, 399.0503393, 
376.8980165, 405.7304857, 368.2036409, 372.6653281, 393.9490203, 
440.2435257, 395.9638301, 649.9943096, 829.827756, 771.2689986, 
745.1354633, 758.9204603, 781.6829601, 749.6104794, 757.3137338, 
756.3926051, 717.6162352, 819.0179534, 849.0746459, 744.9108462, 
795.9806317, 877.6018499, 805.4779231, 794.4930012, 740.9918106, 
843.4881496, 799.50432945, 842.5302298, 765.9102761, 444.0052531, 
718.2618065, 670.9974055, 674.9919201, 704.12445135, 711.347027, 
761.5353487, 792.4824637, 736.5552571, 843.6366849, 932.7377608, 
1011.549409, 1118.03355, 1116.275445, 1086.213557, 1079.41763, 
1074.0375845, 1061.520593, 1075.469137, 1094.019599, 1074.833966, 
1068.151009, 1096.464941, 1126.035224, 1158.060378, 1142.250594, 
1138.57293, 1143.929135, 1139.0282, 1147.633656, 1140.692305, 
1129.022813, 1153.418443), time = c(237689L, 237744L, 237746L, 
237750L, 237752L, 237766L, 237782L, 237798L, 237815L, 237832L, 
237848L, 237866L, 237882L, 237935L, 237936L, 237938L, 237948L, 
237964L, 237980L, 237997L, 238014L, 238030L, 238048L, 238064L, 
238081L, 238149L, 238152L, 238292L, 238344L, 238347L, 238350L, 
238353L, 238366L, 238379L, 238396L, 238412L, 238429L, 238445L, 
238463L, 238479L, 238496L, 238544L, 238545L, 238550L, 238562L, 
238579L, 238596L, 238612L, 238629L, 238646L, 238662L, 238680L, 
238695L, 238748L, 238750L, 238763L, 238779L, 238796L, 238812L, 
238829L, 238846L, 238862L, 238879L, 238898L, 238947L, 238950L, 
238962L, 238979L, 239062L, 239079L, 239095L, 239149L, 239152L, 
239162L, 239179L, 239203L, 239213L, 239228L, 239245L, 239262L, 
239278L, 239295L, 239311L, 239350L, 239361L, 239378L, 239395L, 
239411L, 239428L, 239445L, 239463L, 239479L, 239495L, 239513L, 
239552L, 239555L, 239563L, 239580L, 239596L, 239613L), gsqr = c(28, 
28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 
28, 28, 28, 28, 28, 28, 29, 30, 13, 15, 15, 15, 15, 14, 14, 14, 
1, 1, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 22, 21, 21, 21, 
21, 21, 21, 22, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 
21, 21, 13, 21, 21, 21, 22, 21, 21, 21, 20, 20, 19, 26, 26, 27, 
27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 26, 26, 26, 26, 26, 26, 
26, 27, 26)), .Names = c("pid", "screen", "xcoord", "ycoord", 
"time", "gsqr"), row.names = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 
9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 
22L, 23L, 24L, 25L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 
37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L, 
50L, 51L, 52L, 53L, 54L, 55L, 56L, 57L, 58L, 59L, 60L, 61L, 62L, 
63L, 64L, 65L, 66L, 67L, 68L, 69L, 70L, 71L, 72L, 73L, 74L, 75L, 
76L, 77L, 78L, 79L, 80L, 81L, 82L, 83L, 84L, 85L, 86L, 87L, 88L, 
89L, 90L, 91L, 92L, 93L, 94L, 95L, 96L, 97L, 98L, 99L, 100L, 
101L, 102L), class = "data.frame") 
smgmu
  • 71
  • 1
  • 7
  • I am sorry but could you please specify well what you are trying to achieve? and about your data: `screen` indicates the pixel blocks? `time` is it in seconds? – SabDeM Jun 30 '15 at 18:42
  • I've added a statement explaining the variables. Screen refers to which monitor the participants were looking at (two set up side-by-side), and time is in milliseconds. – smgmu Jun 30 '15 at 19:25

0 Answers0