## 2 Materials and Methods
### Segmentation Algorithm  
The acquired data were segmented into brushstrokes using a custom semi-automated program developed in MATLAB (v.R2022b) that considered pressure, as well as temporal and spatial measurements. Pen-on-tablet contact was defined as instances where pressure exceeded a threshold, \(P_{T}\). In this study, \(P_{T}=0.7\) was empirically determined as the threshold that captured most of the authentic brushstrokes. In complementarity, pen lifts occurred at timepoints where instantaneous pressure, \(p(t_{i})\), fell below this threshold, namely, \(p(t_{i})<P_{T}\). Therefore, the set of times, \(L_{p}\), associated with pressure-demarcated pen lifts is given by,  
\[L_{p}=\{t_{i}|p_{i}(t)<P_{T}\},i=1,\ldots,N \tag{1}\]  
where \(N\) is the number of samples in the entire tracing. This definition identified complete lifts, i.e., where \(p(t_{i})=0\), with neither pen nor hand contact, as well as partial lifts where the pen was raised but the hand remained on the screen, yielding non-zero pressure readings, or where the pen tip traversed proximal to the screen without drawing, thereby registering supra-threshold pressure values. However, in these instances, pen lifts could not be detected based on pressure alone. Concurrent spatial and temporal data were subsequently considered. It was found that the time difference, \(\delta(t_{i})\), between successive unique x- and y-coordinate values varied as the stylus moved across the screen while tracing (Figure 1a). These variations reflected within-stroke pauses while tracing, natural fluctuations in drawing speed, as well as pen lifts between successive brushstrokes. The latter were an order of magnitude larger than thetime differences associated with pauses and speed fluctuations. Exploiting this observation, we fitted, via maximum likelihood estimation, a Rayleigh probability density to the time differences between successive unique pen positions. The 95 th percentile of this density was empirically determined as the temporal threshold, \(\delta_{T}\), that identified authentic pen lifts, i.e., \(\delta(t_{i})>\delta_{T}\), from unique x- and y-coordinates with the highest sensitivity and specificity (Figure 1b). Identifying the set of pen lift times, \(L_{S}\), by spatiotemporal information, that is, the time differences between successive unique coordinates \((x_{i},y_{i})\) and \((x_{i+1},y_{i+1})\), can, thus, be summarized as follows:  
\[L_{S}=\{t_{i}|\delta(t_{i})>\delta_{T},x_{i+1}\
eq x_{i}\text{ and }y_{i+1}\
eq y_{i}\},\ i=1,\ldots,N-1\text{where }\delta(t_{i})=t_{i+1}-t_{i} \tag{2}\]  
The threshold \(\delta_{T}\) is defined as the 98 th percentile,  
\[\frac{1}{N}\sum_{i=1}^{N}H(\delta_{T}-\delta(t_{i}))\times 100\%=98\% \tag{3}\]  
where \(H(\cdot)\) is the Heaviside function, namely, \(H(x)=1,\ x>0\) otherwise \(H(x)=0\). The times of spatiotemporally determined pen lifts, \(L_{S}\), were combined with pen lift times detected based on pressure, \(L_{p}\), to define a final set of pen lift times, \(L=t_{1},\ldots,t_{K}\) where \(t_{k}\in L_{S}\cup L_{p}\) and \(K=\left|L_{S}\cup L_{p}\right|\) where \(\left|\cdot\right|\) denotes the cardinality of the set. We further define \(t_{0}\) as the time of the beginning of the first stroke, i.e., the initial time at which \(p(t)>P_{T}\). The \(k^{th}\) brushstroke, \(B_{k}\), is then defined as the set of coordinates between pen lift times,  
\[B_{k}=\{(x_{i},y_{i})|t_{k-1}+\tau\leq t_{i}\leq t_{k}\},\text{t}_{k}\in\text{ L}i=1,\ldots,N,k=1,\ldots,K \tag{4}\]  
where, as above, \(N\) is the total number of samples in the tracing, \(K\) is the number of brushstrokes comprising the tracing, and \(\tau>\delta_{T}\) is a temporal offset guaranteeing a unique point following the last pen lift, wherein \(p(t_{k-1}+\tau)>P_{T}\). Figure 1: (**a**) A plot of the time-varying time differences between unique x- and y-coordinates versus the sample number. Time differences above a defined threshold were identified as pen lifts (red peaks) while those below indicated pauses while drawing a brushstroke.