Analysis of Heart Rate Dynamics Before and During Meditation

—Heart rate is one of the most important vital signs. People usually face high tension in routine life, and if we found an effective method to control the heart rate, it would be very desirable. One of the goals of this paper is to examine changes in heart rate before and during meditation. Another goal is that what impact could have meditation on the human heartbeat. To heart rate analysis before and during meditation, available heart rate signals have been used for the Physionet database that contains 10 normal subjects and 8 subjects that meditation practice has been done on them. In this paper, first is paid to extract linear and nonlinear characteristics of heart rate and then is paid to the best combination of features to identify two intervals before and during meditation using MLP and SVM classifiers with the help of sensitivity, specificity and accuracy measurements. The achieved results in this paper showed that choosing the best combination of a feature to make a meaningful difference between two intervals before and during meditation includes two-time features (Mean HR, SDNN), a frequency feature ( 𝐿𝐹 𝐻𝐹 ), and three nonlinear characteristics ( 𝑆𝐷 2 𝑆𝐷 1 . 𝑆𝐷 2 . the maximum Lyapunov exponent ). Also, using the support vector machine had better results than the MLP neural network. The sensitivity, specificity, and accuracy of the mean and standard deviation obtained respectively like 92.73 ± 0.23, 89.05 ± 0.67, 89.97 ± 0.23 by using MLP and respectively like 95.96 ± 0.09, 93.80 ± 0.16, and 94.90 ± 0.14 by using SVM. The results also show a valid evidence that this method can be used as a criterion of physiological impact on subjects performing meditation. As


Introduction
Meditation means concentrating on the individual's mind and use to reduce stress in people and especially in patients who get depression, fear, and anxiety due to a particular illness [1]. Meditation can significantly help to reduce the symptoms of many diseases by making conditions of stress relief [2]. As mentioned, the purpose of using various techniques of meditation is to create and maintain a balance of health between all physical and mental aspects, and meditation is usually considered as a medical aid [3].
The present study aimed to evaluate the dynamics of heart rate signals in two different conditions. For this purpose, we used the heart rate signals of two groups of subjects (before meditation and during meditation). Another goal of this study is to find out the effect of meditation on human heart health and relaxation.
Extensive studies have been performed in the context of meditation that some of them show the effects of meditation in the medical field [4]. Dr. Herbert Benson, who works as a cardiologist at Harvard Medical School, believes that a received response from the meditation is, making more calmness in the person. His researches show that meditation's steps directly conflict and have interactions with the effects of the sympathetic nervous system (the system that makes people have more activity). While the sympathetic nervous system, dilate pupils and increase blood pressure and respiratory rate, meditation has acted oppositely and caused a reduction in blood pressure and muscle tension [5].
Meditation has many mental, psychological, and physical benefits. Therefore, it can be used in psychiatric clinics to optimize the level of stress, relaxation, attention, and so on in different people. During meditation, changes are made in biological signals that study of these changes provides valuable information about the dynamic behavior of that system [6].
This recurrence plot is a new method in processing biological signals. The main advantage of this method is to apply it for non-stationary signals. The recurrence plot is used as a nonlinear tool to analyze the heart rate signals [7]. In this method, in addition to the visualization of the status of the transition in the signal, the dimensions of the returned maps can also be used in the dynamic structure of the heart during meditation as quantitative changes.
In another study [8] to analyze the dimension of correlation and Lyapunov exponent was also shown that heart rate signals are less complicated during meditation. Also, the behavior of heart rate signal can be due to the increased parasympathetic activity and increased relaxation during meditation. In the performed study in 2008 [9] showed that an increase in the frequency peak of the heart rate signal during meditation was due to the increase of parasympathetic activity.
Because in the present study, only data from individuals with a history of meditation has been used. In the future study, also the analysis of recursive quantification can be evaluated in individuals without meditation history. This study showed that recursive quantification analysis based on complexity size can play an important role in the analysis of heart rate signals during meditation and is a convenient tool in the study of complex systems. Also, further researches can take on the classification of extractive features from the returned map to distinguish two modes before and during meditation [9].
Another study was performed with the aim of meditation effect in reduction and improvement of the symptoms of patients with heart failure in Brazil in 2005. Observing the results of this research show that meditation significantly reduced the level of Norepinephrine in the test group compared to the control group [10]. Also, another study was performed to estimate the depth of meditation using EEG signal and heart rate in 2011. In this research, heart rate and electroencephalogram signals before and during meditation were collected in a format of two separate data sets from 25 women. The results of this study showed that 88% of the subjects under consideration (22 of 25) came into the deepest level of meditation. The described algorithm in this paper has features such as the possibility to calibrate for each person and also a lack of need for high computational volume and a great time for implementing [11]. Goshvarpour and colleagues performed a study in 2012 with the aim of effecting different delays in the Poincare plot using the heart rate signals in two intervals before and during meditation. In this study, the width of the Poincare was calculated for each time delay. The analysis of achieved results showed that the width of the Poincare could be used as a criterion of changes in cardiac signals and the simplicity of plotting a Poincare plot and its matching with the chaotic nature of biological signals can be useful for evaluating of heart rate signals during meditation [12].
Other studies were performed with the aim of evaluating the effect of meditation on depression, anxiety, and stress among female students of Central and South Tehran University in 2013. The results of this study showed that the stress and anxiety of students had dropped significantly, but no differences were observed in the depression rate of control students compared to the test group [13].
Another study was performed with the aim of evaluating meditation exercises in the reduction of anxiety in patients under hemodialysis in 2015. In this study, 48 people participate that got analyzed by using descriptive statistics and statistical tests (t-test) and analysis of variance with repeated measurement. Analysis of the data showed that there is a significant difference between people who do meditation exercises and other patients [14].
The rest of the paper is structured as follows. The second section describes the database used in articles related to the heart rate of the different subjects before and during meditation, moreover suggested methods in this area. In the third section, all classification systems that have been used in MATLAB software so far are presented, and in Section IV, the summary, accuracy, and validity of all proposed methods will be presentedfrom 1998 to recent years.

Database
In this method, available data from the Physionet database has been used to analyze the beat's status in both cases before and during meditation that two data sets have been used [15]. Normal data (N1 to N10) are 10 healthy subjects who had no history of heart disease. Data of these people have involuntarily been recorded during sleep that the period of each of them has lasted 6 hours. To test for systematic variation across conditions the sleep period introduced 6 hours as standard by database.
The Chi meditation data obtained in related to 5 women and 3 men who had no heart disease and in the age range between 26 to 35 years old with an average of 29 years old and cardiac signals of before and during their meditation exercises are available. Subjects have been asked to relax and do meditation exercises that each record has lasted an hour. The sampling rate of 360 HZ and the start and end time of meditation have been specified.

RR processing
The RR intervals compute the duration of heartbeat cycles, which are generated by calculating the period between adjacent QRS peaks after locating the QRS complexes (see Fig.1). The QRS complexes are detected from the ECG signals using the method presented by Pan and Tompkins. Formula (1) shows how to calculate the heart rate from RR intervals [16].

Linear and nonlinear analysis of HRV signal
Short term and long-term changes in heart rate have different physiological origins, and the domain of these changes can indicate a person's autonomic status. R-R intervals in the analysis of HRV are usually plotted as a function of the number of intervals and constitute a time series. Before evaluating the HRV analysis methods, there should be a clear definition of the HRV signal. In the initial definition and what comes from the HRV concept, HRV indicates the heart rate changes in the specified time periods, which are originally based on the average of R-R intervals per minute, and it has been the basis of analysis and decision making of this thesis [17]. In linear methods, the total amount of changes is computed by statistical methods. Linear methods can be divided into time domain and frequency domain methods. One of the main advantages of these features is simplicity in their calculations. Of course, the statistical features somewhat depend on the quality of recorded data that this quality may be affected by environmental noises.
Features that are extracted from the time domain included a set of statistical and geometrical features such as the mean of R-R intervals (Mean HR), the standard deviation of beat-to-beat interval (SDNN), and root mean square of successive differences between normal heartbeats (RMSSD) [18].
Frequency domain methods are based on the estimation of power spectrum density that can provide useful information about how the cardiac signal is distributed as a function of frequency. The cardiac signal spectrum that is seen in healthy people usually includes harmonic components. When the power spectrum density is taken from the signal of heart rate changes, it is expected that information will be obtained about the functioning of the autonomic cardiac system that corresponds to the harmonic frequency components. Spectral analysis of HRV also can be used for short term records, even 5 minutes' pieces of the signal, and also it can be calculated for 24 hours long term records. Analysis of heart rate changes in adults has been shown that signal of heart rate changes can be divided into three frequency categories of high frequency (0.15-0.4 Hz), low frequency (0.04-0.15 Hz), and very low frequency (0.0001-0.04 Hz) [19]. High frequency is a parasympathetic indicator, and low frequency is an indicator of sympathetic and parasympathetic activity. The measured power spectrum density in low frequency and high-frequency bands corresponds to the autonomic balance. The increase in parasympathetic activity causes an increase in high-frequency power, while the increase in sympathetic activity causes an increase in low-frequency power. Of course, it is believed that the low-frequency band is also affected by parasympathetic activity. The physiological origin of the very low frequency is not precisely determined. The power spectrum analysis of the low frequency that has been done in 24 hours has been included frequency components of very low frequency in addition to three other frequency components. Oscillations in frequency bands of very low frequency and very low frequency are because of the mechanisms that regulate the thermal system of the body and also can be created by other factors that are still not recognized [20].
In the frequency domain is assumed that time series of R-R intervals are stationary, or in other words, changes are harmonic and sinusoidal. The fluctuations in heart rate can be periodic (because of breathing) and non-periodic (because of sudden environmental changes or individual mode). So, the signal of heart rate changes can be evaluated due to the complexity and dynamic interaction of biological signals using nonlinear methods. In the frequency domain, parameters such as VLF, HF, LF, and LF/HF can be extracted from the signal of heart rate changes [21][22].
Recent developments in the theory of nonlinear dynamics have paved a way to analyze the signals of dynamic nonlinear systems. Today recognized that nonlinear technique is able to describe processes that are caused by living biological systems. In recent years the nonlinear analysis methods have been found many applications in physiology. Changes in heart rate, blood pressure, cardiac output, blood hormone levels, and other physiological processes as obtained signals from nonlinear dynamic systems have been evaluated, and chaotic dynamic characteristics have been seen in their different systems.
Nonlinear analysis of the cardiac signal has been highly regarded for two main reasons. The first reason is the non-linear nature of the heart signal that acts as a nonlinear dynamic oscillator, and the second reason is the need to acquire sufficient knowledge about this real phenomenon [23].
Many researchers have been very interested in the analysis of heart rate signals because this signal has much information in itself, which is directly concerned with heart health [24] and heart diseases such as heart failure [25], myocardial infarction [26] and angina [27]. In addition, this signal is a valuable non-invasive tool for describing the role of the autonomous nervous system in the regulation of the circulatory system. Initial analysis of time-series was based on a statistical index that this analysis gave way to a more sophisticated analysis very soon to extract valuable information from the signal.
Because of the chaotic behavior of the cardiovascular system, nonlinear methods used in the analysis of the heart rate signal. One of these techniques is the Poincare plot. This method was used as a qualitative tool for the first time, and a little later, the geometry quantification of the Poincare plot proposed. Tulppo et al. [28] placed an oval on the Poincare plot to calculate the index of heart rate. Brennan et al. [29] showed that the Poincare plot width shows the level of short-term changes in the heart rate signal.
Poincare plot is a relatively new method for analyzing nonlinear dynamical system such as the HRV signal. Each point determined on this graph as (RR (n), RR (n+1)) n = 1, 2, 3…k that k is the signal length [30]. Regarding statistical, this chart graphically shows the correlation between R-R successive intervals, but its original and important concept is that this graph is a two-dimensional state space of successive intervals, which represents its nonlinear dynamics. Also, this graph gives useful information about the oscillations of the short and long term. Poincare plot analyzed quantitatively by calculating the standard deviation of RR (n) intervals with the y=x and y=-x+2RRm lines, which the RRm is the RR (n) s mean. Standard deviations called SD1 and SD2, which SD1 is related to the rapid changes of the heartbeat to BPM data that is mainly related to respiratory sinus arrhythmia. While SD2 describes the long-term changes in RR (i)s. Also, the SD2/ SD1 ratio can be calculated to describe the relationship between these components [31]. The SD1 and SD2 amounts of Poincare plot directly depend on the statistical amounts of the standard deviation of the heart rate signal and standard deviation of two consecutive distances of R peaks and are calculated by the formula (2). For the formation of heart rate variability of time series, the opposite of the heart rate values is used according to formula (2). Figure 2 shows a cardiac signal before and during meditation with the Poincare plot.Table1 shows linear and non-linear extracted features from the HRV signal.
whereN is the total number of all RRIs in a given segment

SDNN ms
The standard deviation of all

SDANN ms
The standard deviation of the average RRIs in all 1-minute section which they divide selected segments of long-term signal (SDANN) whereN is the total number of 1-minute sections RRIs in the selected segment, is mean of RR interval in 1 minutes section, is mean of all 1 minutes sections.

RMSSD ms
Root mean square of successive differences between adjacent RRIs (RMSSD) The absolute power of the lowfrequency band (0.04-0.15), an estimate of long-term HRV.
-HF ms 2 The absolute power of the highfrequency band (0.15-0.4), an estimate of the short term of HRV.
-HF % The ratio of LF to HF power -
The ratio of SD2 to SD1, describe the relationship between sympathetic to parasympathetic activity -Maximal Lyapunov exponent -The average rate of divergence of two neighboring trajectories xn is a time series, and N is the number of samples Two close points at step n, x, and xn+dxn Entropy -Entropy measures the regularity and complexity of a time series Where pi is the probability that a random variable takes a given value out of n values, and α is the order of the entropy measure.

Feature extraction
In diagnostic and forecasting systems for choosing the best combination of features is very important to make the most distinction between the groups. So first performed each feature separately classified according to the highest sensitivity and specificity, the best features are selected. Then combine this feature with every feature; the best binary composition will be obtained. Similarly, this process continues until the best resulting combination that makes the greatest difference between the groups is achieved [17].
The selection of a large number of feature functions makes the classifier confused and leads to its failure to distinguish between the two groups of features extracted from the two categories of the signal [32]. Since some of the features are incapable of proper classification, the feature dimensions are reduced with the principal component analysis (PCA) method. The selection of a few features prevents highlighting the properties and state of a signal and fails to distinguish between two different signals (before and during meditation).
In this paper, from the features listed in Table 1, the best combination has 6 features that are two-time features (Mean HR, SDNN), a frequency feature ( ), and three nonlinear characteristics ( 2 1 . 2 , the maximum lyapunov exponent).

Diagnostic system using neural networks
The most common way to classify is the use of artificial neural networks. An artificial neural network is an information processing system, which its executive features iJOE -Vol. 17, No. 05, 2021 are similar and common with the performance of live neural networks in humans. In the following two successful methods that are used in the classification of biological signals, are introduced.

Multi-layer perceptron neural network
The multi-layer perceptron neural network, usually used in the classification issues that is formed of an input layer, one or more hidden layers, and an output layer. In this structure, all of the neurons in one layer are connected to all of the neurons in the next layer, and in fact; they form a network with full connections. In this network, the number of neurons in each layer is independent of the number of other layer neurons [33][34].
To use an appropriate classification using the supervised neural network, the first step is to choose the network dimensions. The input dimension determines the dimension of the input layer, and also, in the output layer, neurons should be laid to the number of classes. Ideally, with a corresponding entry to any class or group, expect that the related neuron of that class takes one value, and other neurons take zero value on their own. Due to using the sigmoid function, the network output value will be a number between zero and one. Thus, in practice, the neuron of the output layer that its value is much larger than the other neurons will specify the class of that data.
In the case of neurons in the middle layer, there is no special basis and usually are chosen by trial-and-error method so that the network will have a reasonable answer. It should be noted in this issue that if the network is very complex, will learn the behavior of the input pattern exactly, and if the data change slightly than the training data, the network will not easily be able to pursue it [35].
The MLP network has a two-layer feed-forward that uses an error propagation algorithm that will be trained with a variable learning rate. The number of neurons of the first layer equal to the number of features considered, and the output layer contains a neuron that has values between zero and one that related to the two groups before and during the meditation. Also, the activity function of neurons selected of the tangent sigmoid to change the number of neurons in the middle layer is attempting to optimize the neural network architecture [36]. Some common structures types of the artificial neural network are reviewed, and the best-resulted network is a two-layer neural network with 5 neurons in the hidden layer with the standard sigmoid activity function. Network training will be continued until the square of error is less than 0.01, or the number of repetitions of training will be 1000. Since the number of data used is limited, this network according to the Leave One Out method in each level one of the observations as test data, and the rest are selected as training data and in the next level the second data as test data and the rest are selected as training data, and this action will be continued until all data participate in the test and training phase [37]. Finally, network error extracted, and the average is calculated. One advantage of this method is that all data participate in the training and testing level and are causing an increase in network performance.

Support vector machine
A support vector machine is one of the learning methods to monitor that is used for classification, clustering, and modeling [38]. This method has shown good performance compared to other methods of categorizing, including perceptron neural networks. The basis of support vector machine work is linear categories of data, and in the linear dividing of data tries to choose a line that has a greater safety margin. In this method, by using an optimization algorithm, the samples which form the class borders will be achieved, which call backup vectors. Teaching points that are closest to the point of decision-making can be considered as a subset to define boundaries for decision-making and to be a support vector [39].
The advantages of support vector machine are its relatively simple training, and for data with high dimension have almost good answers. Support vector machine, unlike types of neural networks instead of minimizing error, tries to minimize the operational risk by classifying or modeling. The main difference of support vector machine to neural networks is in some neural networks if the error rate of the whole network is less than a certain threshold, they stop learning network, but support vector machine looking for the optimal solution. In other words, a compromise between the complexity of the categorization and the error rate is controlled. Also, other neural networks, such as MLP, may be stopped at the national maximum. But the mode of support vector machine operation is not the case. For better separation of data in SVM, data are mapped to higher space by a nonlinear function, because separation is done easier in higher space [40].
SVM is a nonlinear classifier that uses kernel functions to map the features on higher dimensional space; to obtain a linear optimal hyperplane. The obtained hyperplane is capable of separating features before and during meditation. The selection of the proper kernel function has a significant impact in distinguishing the two groups. In this paper, various kernel functions, including linear, quadratic, polynomial, and radial basis function (RBF) are used to map features on higher dimensional space. The degree of polynomial kernel function is changed from 1 to 5, and the scaling factor of RBF is changed from 0.5 to 1.5 with 0.1 steps.

Classifier performance evaluation
There are several methods to judge the performance of different classifiers, and various parameters can be considered for this purpose that many of the most common of these are accuracy, sensitivity, and specificity. The Accuracy of the test is as formula (3).
Which TP, TN, FP, FN are True Positive, True Negative, False Positive, False Negative, respectively.
The sensitivity of the test is its ability to identify the true positive or correctly identify those who are sick. For example, when told that a test sensitivity is 80% it means that the desired test can detect 80% of sickness, and in other words, such this test will result in 80% of cases is true-positive, and in 20% of cases, false-negative and so 20% of patients cannot be distinguished. The sensitivity formula is shown in formula (4).
The specificity of the test is its ability to identify the true negative or correctly identify those who are not really sick. For example, when told that a test specificity is 70%, it means that the desired test can detect 70% of healthy people. In other words, such this test will result in 70% of cases is a true negative, and 30% of cases are false-positive and so 30% of healthy people introduced as a patient. The specificity of a test is the ratio of true negatives. The specificity formula is shown in formula (5).
The sensitivity and specificity of a test indicate that the test is positive or not in healthy and patient's subjects and, therefore, can be used as a diagnostic tool. They are the most suitable tests with high sensitivity and accuracy, but it is difficult to make a balance between these two parameters and is highly dependent on the type of selected features [18].

Fig. 3. Diagnosis steps before and during meditation
The distribution of feature space of heart rate is shown in Figure 4. As seen in this Figure, this feature can provide an appropriate resolution between the two intervals before and during meditation.

Leave-One-Out Cross Validation
Leave-One-Out Cross Validation (LOOCV) is a special case of K-fold cross validation with = , where n is the total number of samples in the training multiset. experiments are performed using n − 1 samples for training and the remaining sample for testing. If the original sample is small, a larger may be better. In this study, the number of samples (n) is 8. This method is usually used in cases where it is difficult to obtain labeled data. It is rather computationally expensive, if the number of data is large [41].

Simulation Results
After extraction of various linear and nonlinear characteristics of the heart rate signal in two intervals before and during meditation, the combination of features and finally select the best combination of features will be discussed. Finally, the best combination of features was used as input for an artificial neural network and support vector machine. Table 2 shows the mean values and standard deviation of linear characteristics, and Table 3 shows the values listed for nonlinear characteristics in two intervals before and during the meditation. Figure 5 shows the comparison of the changes in the best combination of the selected feature in two intervals before and during the meditation.    The results of the sensitivity, specificity, and accuracy of the system proposed in this paper use MLP and SVM neural network to determine the period before and during meditation to help select the best combination of features are shown in Table 4. These results are based on test data.

Discussion
Meditation is typically considered as a medical aid method. The goal of meditation techniques is to make and maintain a balance of health between all physical and mental aspects [42]. In recent years, extensive researches have focused on controlling some mental and physical illnesses using meditation and its effects on the mind [43][44][45][46]. Also, meditation is considered a method in managing psychological diseases (such as anxiety and depression) and maintaining the health of the mind [47][48]. Researches have shown that physiologically, meditation causes a reduction in metabolic activity, increases the coalition and order in brain function, reduces the peripheral vascular resistance, and increases the blood flow of the brain [48]. Also, it is different from sleep or simple relaxation. This technique has improvements in mental health and increases positive features and reduces psychological anxiety [49]. According to the great benefits of meditation, scientific studies are important in this phenomenon.
The heart rate signal is a valuable non-invasive tool for describing the role of the autonomic nervous system in regulating the circulatory system. The first analyses of the time series were based on the statistical indexes that these analyses replaced with more complex analyzes very soon to extract valuable information from the signal [7,50]. Initial analyses, such as spectral analysis, have limiting assumptions for time series of heart rate and are conditioned with many changes of noise sources. In these methods, the signal is considered static, and tests are carried out under controlled circumstances. To provide a solution for the non-stationary signal issue, the method of analyzing nonlinear dynamics and chaos theory is used to quantify these dynamics. One of these techniques is the analysis of the returned map.
Researches have shown that physiologically, meditation causes a reduction in metabolic activity, increases the coalition and order in brain function, reduces the peripheral vascular resistance, and increases the blood flow of the brain. Meditation is different from sleep or simple relaxation. This technique has improvements in mental health and increases positive features and reduces psychological anxiety. According to the great benefits of meditation, scientific studies are important in this phenomenon.
In most meditation techniques, the individual focuses on breathing, and since breathing oscillations are modeled on the heart rate signal, most studies have been performed on the heart rate signal. Due to the interaction of biological systems with each other, changes occur in all vital signals, including electroencephalogram signals during meditation. The study of these changes provides useful information about brain function.

Conclusion
Meditation can reduce fatigue in the minds of athletes. This is one of the subjects of sports medicine. High sports activity may cause muscle tension, anxiety, and disorder in focus. Researches have shown that meditation increases concentration and the control of heart rate.
Because in the present study, only data from individuals with a history of meditation has been used. In the future study, also the analysis of recursive quantification can be evaluated in individuals without meditation history. This study showed that recursive quantification analysis based on complexity size can play an important role in the analysis of heart rate signals during meditation and is a convenient tool in the study of complex systems. Also, further researches can take on the classification of extractive features from the returned map to distinguish two modes before and during meditation. The results showed that meditation is effective in reducing heart rate and calm the people. Since meditation is a simple and low-cost method and considering that reduction and increased heart rate can be very problematic and dangerous for the patient, one of the most common problems of patients can be reduced by the implementation of the meditation exercises.