# Variation Trends of Fractal Dimension in Epileptic EEG Signals
## 2 Data and Methods
### RSE Algorithm  
RSE algorithm is based on the scaling relationship of root-mean-squared roughness (\(Rq\)) and the data-point length (\(L\)), which satisfy:  
\[Rq=AL^{H}=AL^{2-D} \tag{5}\] \begin{table}
\begin{tabular}{c c c c} \hline \hline
**File Names (Patients)** & **Seizure Labels** & **Number** & **Seizure Durations (s)** \\ \hline \hline \multirow{8}{*}{CHB12 (12)} & \multirow{8}{*}{31} & \multirow{8}{*}{37–67} & 400–(461,413,423,420,432,432, 445,437,497,440,435,427, 425,442,452,448,438,436, 446,421,423,427,425,423, 443,455,451,428,429,425,423) \\  & & & 446,421,423,427,425,423, 443,455,451,428,429,425,423) \\ CHB13 (13) & 1 & 68 & 400–465 \\ CHB14 (14) & 7 & 69–75 & 400–(414,420,422,414,441,422,416) \\ CHB15 (15) & 1 & 76 & 400–577 \\ CHB16 (16) & 1 & 77 & 400–414 \\ CHB17 (17) & 3 & 78–80 & 400–(490,515,488) \\ CHB18 (18) & 3 & 81–83 & 400–(455,468,446) \\ CHB19 (19) & 1 & 84 & 400–477 \\ CHB20 (20) & 6 & 85–90 & 400–(430,439,438,449,435,439) \\ CHB21 (21) & 1 & 91 & 400–412 \\ CHB22 (22) & 2 & 92–93 & 400–(474,472) \\ CHB23 (23) & 6 & 94–99 & 400–(513,447,471,462,427,484) \\ CHB24 (24) & 10 & 100–109 & 400–(425,425,425,432,427,419, 424,419,427,468) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: _Cont._Among this equation, \(A\): \(Rq\) value when \(L=1\); \(H\): Hurst exponent (\(0<H<1\)); \(D\): fractal dimension (\(D=2-H\)). The \(Rq\) and \(L\) of the fractal curve satisfy the above equation, and \(D\) can be obtained by fitting a straight line to them in the double logarithmic coordinate system:  
\[\ln Rq=(2-D)\ln L+\ln A \tag{6}\]  
The special feature of RSE algorithm was the flattening operation on the segmented sub-series in prior to \(Rq\) calculation, whose details could be found in our previous publication [22]. Therefore, the RSE algorithms with various flattening orders were denoted in this study as RSE-f1 and RSE-f2, which used first-order polynomials (\(y_{f1}=ax+b\)) and second-order polynomials (\(y_{f2}=ax^{2}+bx+c\)), respectively. However, the \(Rq-L\) curves in double logarithmic coordinates obtained in RES algorithms was not linear globally. In our recent work [38], it has been demonstrated that such a linear scope, named as scaling region, was the efficient partial for \(D\) calculation, and a scaling region interception method was proposed to enhance the accuracy of RSE algorithm. The scaling region interception method was based on the characteristics of the scaling region in the \(Rq-L\) curve. First, a seventh-order polynomial \(f(l)\) was used to fit the entire \(Rq-L\) curve. Second, the first and second derivatives (\(f^{\prime}(l)\) and \(f^{\prime\prime}(l)\)) of the \(f(l)\) were obtained. Due to the linearity of the scaling region, the corresponding \(f^{\prime}(l)\) should be a constant in the region, while \(f^{\prime\prime}(l)\) should be close to 0. Therefore, the scaling region was determined according to the first criterion of \(|f^{\prime\prime}(l)|<\delta_{1}\). The series of \(l\) values in the region was marked as \(l_{i}\), then the corresponding \(f^{\prime}(l)\) values were calculated and averaged to obtain \(\overline{f^{\prime\prime}(l_{i})}\), which could be considered as the scope of the region. Since there was always fluctuations in the actual curves, the second criterion \(|(f^{\prime}(l)-\overline{f^{\prime}(l_{i})})/f^{\prime}(l)|<\delta_{2}\) should also be met, and the obtained series were \(L_{i}\), which should be a continuous segment corresponding to the target scaling region in the \(Rq-L\) curve. Besides, the obtained series of \(L_{i}\) should be more than half of the total series of \(L_{i}\), otherwise the scaling region was represented the whole property of the global data. For a batch of data, the corresponding scaling region and the parameter \(\delta_{1}\), \(\delta_{2}\) should be fixed. In this study, \(\delta_{1}=0.5\) and \(\delta_{2}=0.75\) were used to identify the scaling regions. After using the scaling region interception method, RSE-f1 sc and RSE-f2 sc algorithms were added for calculation.