Proposed Method for Estimating Parameters of Archimedean Spirals

Consider an Archimedean spiral in two-dimensional space series of points subject to random errors. In this paper, a methodology of a fitting procedure to spiral curve is studied. Three methods are proposed to give initial estimates of the spiral parameters. An Optimize algorithm proposed to updates the initial estimates. The approach is validated using simulated and real databases obtained from Parkinson patients handwriting. Finally, a comparison done between these three methods and Mishara’s method which shown that our methods give better results.


Introduction
An Archimedean spiral is a curve flow from a point that draw circles away around this point with a fixed distance between turns.A formal definition of spirals is described by Lockwood (1967) " The word spiral, in its mathematical sense, means, properly speaking, a plane curve traced by a point which winds about a fixed pole from which it continually recedes." The Archimedean spiral can be use in handwriting, for example to distinguish patients diagnosed with Parkinson's disease and how bad is the condition (Pereira et al. 2016).The spiral also can be found in jewellery, clocks, cars and spiral wound springs (Pickover 1988).
We focus on an important research about Parkinson's disease to study the efficiency of our methodology, in Sect. 5.As we study the handwriting of these patients by drawing an Archimedes spirals and straight lines as clinical assessments, in Pereira et al. (2016).
Consider an Archimedean spiral in two-dimensional space which a sequence of points is observed.There are many approaches in the literature that have been developed based on Least squares to fit an Archimedean spiral, such as Mishra (2004) and Jinting et al. (2018).
In this paper, we study a set of points in ℝ 2 that present almost Archimedean spi- ral structure.A Mathematical Archimedean spiral in two dimensions can be given by the function where r the radius is defined by the equation r(t) = at + b , a, b ∈ ℝ 2 and t time.Measurements subject to statistical error determine a statistical Archimedes spiral.Spiral Equations present in more details in Sect. 2.
The main goal of this paper is to re-explore the estimation problem for a statistical Archimedes spiral using optimized least squares problem under certain assumptions.The optimization algorithm needs starting estimates of the parameters to start the iterations, the methodology introduced in Sect.3. We need an initial point to start the algorithm, as a bad choice of this point can lead us to local minimum.Furthermore, these techniques work well on the logarithmic spiral, by using Taylor approximation and modifying the results.
Three methods are proposed to estimate the initial parameters, the optimization algorithm, are presented in details in Sect.3.3.We also describe a forth method by Mishra (2004) to estimate spiral curve parameters.In fact, we were inspired by Mishara method for fitting the Archimedean spiral.However, Mishara's method not working well with clockwise data.On the other hand, our proposal methods working well with both clockwise and counter-clockwise data.Therefore, we turn the data into counter-clockwise inorder to use meshara's method.We update these estimation by least squares, in Sect.3.4.We propose a methodology that clear view procedure to follow in Sect.3.
Numerical examples with various choices of the radius parameters are used to form datasets and then apply the methods on them in Sect. 4. In addition, we apply our approach on real data from Pereira et al. (2016) in Sect. 5.

Archimedean Spiral Model
In general, a spiral curve going around a definite point, usually called the pole or the center of the spiral, say ( , ) .If this point is selected as the pole of a polar coordi- nate system, then the general form of the equation of a spiral is given by r = f (t) , Journal of the Indian Society for Probability and Statistics (2023) 24:443-467 where f is a continuous function, r is the length of the radius from the centre and t is the angular position (amount of rotation) of the radius r.
There are many types of spiral and the most common ones are Archimedean spirals.The general form of the Archimedean spiral is: where b and a are the parameters that determine the initial radius of the spiral and the distance between its successive turns.The r increases as t time increases.
In Cartesian coordinates, the Archimedean spiral (1) of the center ( , ) is described by the couple of equations where r = √ (x − ) 2 + (y − ) 2 .Throughout the paper, we operate with n pairs (x i , y i ) i=0,…,n−1 of data, where x i , y i ∈ ℝ .Let that they resemble the trace of a spiral.
A statistical spiral that is obtained from (2) by adding noise at equally spaced time points t i = t 0 + i , is the turn angle, to give data where i = 0, … , n − 1,and i = [ 1,i , 2,i ] T are small noise terms.We assumed these noise terms are following independent normal distributions In the previous parametric equations, let and k i is a non-negative integer for each i.Then, the Eqs.(3) can also be written as The structural parameters of the spiral data are: The center point ( , ) (sometimes we mentioned them as the shift parameters), the values of k i , the initial radius b, and the distance between its successive turns a.

The Suggested Methods
In this Section, we present some methods to compute initial values of the parameters in a spiral equation and then use them to obtain a good fitting.The performance of the least squares method in fitting a spiral curve depends on estimating its center and the positions of some points, we will give more details afterward.
(1) r(t) = at + b, Before employing the data for estimation purposes, the data must be preprocessed to make sure that the point (0, 0) is inside the inner turn of the data, the point (0, 0) does not belong to the data and the turn angle is assumed to be known or has been estimated.
The data fitting procedure follows six steps.Each of these steps will be discussed in some detail and illustrated with examples later.These steps are: 1. Estimating the center of the spiral, 2. Estimating the step size (the turn angle), 3. Estimating the values of k i in the Eq. ( 4), 4. Getting initial values of the parameters a and b, 5. Using least squares method, 6.Getting a better estimation of the center of the spiral.

Estimating the Center of the Spiral
The problem of transferring data points with an unknown shift has received considerable attention in many models.Our aim is to estimate the point ( , ) without prior knowledge of the pattern of data.Ferris (2000) and Mishra (2006) has discussed this problem in some detail.
The difficulties in fitting a spiral to data become much more intensified when z i = (x i , y i ) are not measured from the origin (0, 0).Plot the data and look at them carefully, if the point (0, 0) is not inside the inner turn of the data, we need to work on adjusting the data.
We begin with the recognition of the fact that z � i = (x � i , y � i ) are measured from ( , ) ≠ (0, 0) .Let z i = (x i , y i ) be the points measured from true (0, 0) such that Here is a constant by which value the measured x ′ i has shifted from the true x i and is a constant by which value the measured y ′ i has shifted from the true y i .Once the values of , are obtained, we translate (x � i , y � i ) into (x i , y i ).Firstly, we choose values of and by observation the plot of data or considering ( ∑ x i ∕n, ∑ y i ∕n) as the first estimation of ( , ) .Then based on the inspection of the graphical presentation of the spiral obtained from the data on (x � i − , y � i − ) , we may need to adjust the values to make sure the point (0, 0) is inside the inner loop and not one of the data's points.For example, the point (0, 0) is outside the inner loop of the data in both Figs. 1 and 2. Figure 2 shows the approximation ( ∑ x i ∕n, ∑ y i ∕n) of the center is good.For the data in Fig. 1, estimating the center by mean was not good, so we have modified it by using the first data point.Then, we can fit the new data set (x � i − x 1 , y � i − y 1 ) .We use this way to make sure that the point (0, 0) is inside the inner loop in simulated dataset 3 in Sect.3.2.

Estimating the Step Size and the values of k i
Estimating the step size : This step is to find one of the most important parameters of the model the constant angle .Note that not any value of will produce a spiral.To obtain good calculations of angles of the points we must let the point (0, 0) be inside the inner loop of the data.To estimate the step size, we apply the following steps: Step 3: Remove all points that corresponding to the values of i that come from the points which near the positive x-axis, and compute n � ∶= n − 1 − c, where c = the number of the removed points.• Step 4: Compute the mean of the rest, ≈ ∑ Estimating the values of k i : We need to find where are the intersections (if they exist) of data with the positive x-axis.Let the numbers m 1 , … , m l representing these intersections, i.e. there are two points (x m j , y m j ), and (x m j+1 , y m j+1 ) , for each j = 1, … , l , where one of them is above and the other is below the positive x-axis.Then where i = 1, … , l .Recall, the point (0, 0) must be inside the inner loop of the data and none of them.Therefore, we work out the locations of the intersections of data with the positive x-axis as follows: • Step 1: Find t ′ i and r i for each i. • Step 2: Arrange r i in an ascending order of their magnitudes, i.e. when we draw the plot of a data, there will be one direction of drawing left or right without going back.Actually, the points which near the positive x-axis, in which x i > 0 and y i almost zero, are most important ones in this step.Because these points may oscillate around the x-axis.
Step 4: Find all i such that abs( i ) ≥ , and that only happens when one of the points z i+1 , z i are above the x-axis and the other under it.These values represent the values of m j 's.
Remark 1 In the case m 1 is too small comparing to n (in other words, t 0 is close to 2 ), it is better to delete the first m 1 points from the data.In all the numerical exam- ples that have been studied, we obtained a better fitting by deleting the first m 1 points from the data in this case.For example, see Fig. 3.
Remark 2 In the previous step 2, after arranging the points we may have different points in the same turn with almost the same angles, specially the first turn.It is Journal of the Indian Society for Probability and Statistics ( 2023) 24:443-467 better to delete all points that have almost the same angles except one which has the biggest radius.For example, see Fig. 4. In Fig. 4a the first nine points, in the first turn of spiral, have equal angles.Therefore we omit the first nine points in Fig. 4b.Recall, we start by completeing the previous steps, i.e. finding r i , t ′ i and t i for all i, where all the points of data are measured from the point (0, 0).We can define the radius of each point in the data, from equation (3), as follows (5) (1) Method 1: When the noise in the data is too small comparing to the value of the radius, from the equation ( 5) the difference between the radiuses of successive points in the data is almost constant.We use this fact to approximate a and b as follows:

Getting Initial
(2) Method 2: From geometric properties of Archimedean spirals that their center (0, 0), any line passes through the origin point is intersecting with the curve of a spiral infinitely times.We employ this fact to approximate a and b as follows: (i) For each i, check if there exist j such that t ′ i is almost equal to t ′ j .Choose i, j such that abs(t � i − t � j ) is the smallest.(ii) For the values i, j from the previous step, calculate (3) Method 3: From the definition of an Archimedean spiral, we have dr dt = a .In this method, we use a numerical method for approximating the first derivative of the radius to obtain an initial value of a: The first derivative is approximated by a formula known as the center divided difference method (Faires and Burden 1998).(4) Method 4 (Mishra's algorithm): Mishra (2004) presented an algorithm to compute an initial value of a where a different way used to determine the values of k i and the data is assumed to be measured from the origin (0, 0).In this method, the initial values are:

Least Squares Optimization
The estimates for all the parameters in Sect.3.3 can be improved using least squares (LS) optimization.In order to do that we use the optimization algorithm routine nlm in R (R core team 2014) and the algorithm lsquares _ estimates in WxMaxima (Tim- berlake and Mixon 2016).
In this subsection, we assume that all the points of data are measured from the point (0, 0), so r i ≈ at i + b .Least squares method is a method for estimating values of the parameters a and b that minimizes the residual sum of squares (RSS), that is the sum over all i of (r i − at i − b) 2 .Starting with initial values of these parameters the algorithm provides the solution vector more rapidly.
After computing r i and t i for all i, then both of the nlm and the lsquares _ estimates procedures work on the two parameters a and b with an initial value from any of the previous methods, see Sect.3.3.

Getting a Better Estimation of the Center of Spiral
The equations (3) can be written in matrix form as Z = AB + Υ where Calculate the values t i for all i, then apply the LS method on the equation Z = AB + Υ , we obtain the approximation:

Numerical Examples
Herein, we present few examples to illustrate the efficiency of the suggested methods and to find out any problems we may face in order to find a good fitting.In addition, we carry on some comparison between these suggested methods.
In this section, we simulate 10 000 datasets from four sets and apply our methodology on them.The first dataset was created by the spiral r = t∕3 + 1 , where n = 150 , = 0.1 = t 0 and the true center is (−4, 1) .The second example contains a data was build from the curve r = t∕3 without shift, where n = 150 and = 0.1 = t 0 .The third data points were extracted from the spiral r = t∕4 , where n = 100 , = 0.2 = t 0 and the true center is (2, 3).The Last data was created from the spiral r = 2t + 1 , where n = 100 , = 0.2 = t 0 and the true center is (0, 0).All datasets are subject to normally distributed noise with = 0 and 2 = 0.05.Example 1 In order to use Mishara's method and our methods for fitting, we need the point (0,0) be inside the first loop.Therefore, we shift the data by its means and then we remove the first 6 points as in Fig. 2. Deleting the first 6 points gives a better fit when we use Mishara method.After that we apply our methodology as in Sect.3. The step size is estimated to be 0.19909 ≈ 0.1 , and the positions of the intersections with the positive x-axis are in m 1 = 31, m 2 = 62 and m 3 = 94.
Table 1 shows the estimate of initial values of the parameters a and b by the four methods as in Sect.3.3 and the updated estimate of these parameters by least squares method using the previous initial estimations with the residual sum of squares.After applying the method in Sect.3.4, we get ( , ) ≈ (0.83, −0.29) .Figure 8 gives four  b), (c) and (d) show that the distributions of the estimate are around the true value, whereas Mishara's method is not fitted plots of one simulated spiral using each of four methods.Our methods give much better fit than Mishara's methods.Figures 9 and 10 present the ditribution of the estimates a and b, respectively.It is clearly from these Figures that our methods shows that the distributions of the estimates are around the true value, whereas Mishara's results are far away.Table 1 also shows that methods 1, 2, 3 have estimates close to a = 1∕3 and b = 1 .The variances of 10 000 data are very small.Method 3 has the best esimates with the minimum variances among all methods.Method 1 comes after.For method 2, the hardest part is to choose the values of i and j, as in Sect.3.3.Overall, with any choice of initial values of a and b we get a better fit using the least squares method.Example 2 We applied methodology to the 10 000 simulated datasets from data in Fig. 2.The step size is estimated to be 0.106 ≈ 0.1 , and the positions of the intersec- tions with the positive x-axis are in m 1 = 62 and m 2 = 125.
In this example, we apply our methods three times: without deleting and no shifting, deleting nine points and without shift, and finally without deleting and with shifting.The best initial values are obtained from our three methods in all our tries, as the true values are a = 1∕3 and b = 0 .Table 1 and Figs . 11, 12, and 13 are sum- marize our findings.Methods 1, 2, and 3 give estimets that close to the true values with small variances amonge 10 000 datasets.On the other hand, Mishara's estimate of b is a way from the true value and the variances of a and b are much larger than those of the other methods.We obtain much better fitting using least squares method with RSS= 0.243.Example 3 From the data in Fig. 14, where the point (0, 0) is between the last external turns of data.The first choice of ( , ) is the first point of the data since gives a better estimation using Mishara's to make the first data point on the right side of the point (0, 0).Table 1 shows the results that are obtained after shifting the original data, the step size is estimated to be 0.196 ≈ 0.2 , and the positions of the intersec- tions with the positive x-axis are in m 1 = 31, m 2 = 62 and m 3 = 94.
As in previouse examples, our methods give much better initial estimates of the parameters than Mishara's method.These three methods give simillar results, where method 1 has the minimum variances.We obtain much better fitting using the least squares with RSS= 0.589 (Figs. 15, 16).Table 1 and Figs.18 and 19 show the results that are obtained after deleting the first 6 points.The best initial values are obtained from our methods which are close to the true values a = 2 and b = 1 .The best method among these methods is method 3, which has the minimum variances.In all the previous simulated data, the turn would begin by rotating to the left.But the data sets from Pereira et al. ( 2016) are all clockwise.The Mishara's Fig. 14 The four figures present the simulated dataset where the data spiral in points and the fitted spiral in line method is designed to apply on counter-clockwise turns.We changed the direction of real data by starting from the last point in the data instead of the initial one.After applying all the four methods on each data set in both directions, the obtained results from counter-clockwise were clearly better and the forth method gave the worse estimation.
Since the big data take much time to analysis and to obtain the initial solution, the approach of using random sampling is appropriate.After selecting many random samplings (each includes twenty points at least) and applying the Table 2 shows that the parameters estimates of all datasets are close, which implies that our optimal algorithm fit well.The updated estimates from the Least squares procedure with the 95% confidence interval (C.I.

Conclusion
we established an approach to fit an Archimedean spiral, which started by finding the initial values of the spiral parameters a, b.We present four different methods to estimates these initial values a, b.One method is Mishara's method (Mishra 2004) and three proposed methods.These values are updated by least squares.We also discuss the methodology to analysis spiral data in two dimensions.
The errors are assumed to be independent and identically normally distributed with mean 0 and variance 2 .In the numerical examples we assumed that 2 = 0.01 Fig. 17 The four figures present the simulated dataset where the data spiral in points and the fitted spiral in line and 0.1.The algorithm working even for larger 2 = 1 .The results show that the best initial starting points is obtained by the first and the third methods.In general, our methods behave better in both the simulatted and real data.
In the future, It could be more interesting to fit a spiral 3-dimensional Model, which commonly seen in many engineering designs.

A Simulation studies
The results figures of the simulated datasets in Sect. 4.

Fig. 1 aFig. 2 a
Fig. 1 a Plot of the original data points in blue and the point (0, 0) in red.The point (0, 0) is close to the last external turns of data.b The data points after shifting by the first estimation of ( , ) = (2.2331,2.9269) , by using the mean.c Plot of the data points after shifting by the altered values of the shift parameters (1.8331, 2.9269).We alter the first estimation to make the first data point on the right side of the point (0, 0) Values of the Parameters a, b In this part, we present four methods to obtain initial values of the parameters a and b.Let the initial values of the parameters a and b denoted by â and b respectively.

Fig. 3 aFig. 4 a
Fig. 3 a Plot of the original data in blue and the point (0, 0) in red.The first intersection is after the second point, m 1 = 2 and the third and forth points are too close to the x-axis.b Plot the data after deleting the first four points

Fig. 6
Fig.6The five figures present the first real dataset where the data spiral in points and the fitted spiral in line

Fig. 8
Fig.8The four figures present the first simulated dataset where the data spiral in points and the fitted spiral in line

Fig. 9
Fig. 9 The four figures present the distribution of the estimate of a for 10 000 simulated data 1.Figures (b), (c) and (d) show that the distributions of the estimate are around the true value, whereas Mishara's method is not

Fig. 10
Fig. 10 The four figures present the distribution of the estimate of b for 10 000 simulated data 1.Figures (b), (c) and (d) show that the distributions of the estimate are around the true value, whereas Mishara's method is not

Fig. 11
Fig. 11The four figures present the simulated dataset where the data spiral in points and the fitted spiral in line

Fig. 12
Fig. 12 The four figures present the distribution of the estimate of a for 10 000 data.Figures (b), (c) and (d) show that the distributions of the estimate are close to the true value, whereas Mishara's method is far away

Fig. 13
Fig. 13 The four figures present the distribution of the estimate of b for 10 000 simulated data.Figures (b), (c) and (d) show that the distributions of the estimate are close to the true value, whereas Mishara's method is far away

Fig. 15
Fig. 15 The four figures present the distribution of the estimate of a for 10 000 simulated data.Figures (b), (c) and (d) show that the distributions of the estimate are close to the true value, whereas Mishara's method is far away ) are provided.The first dataset gives â = 10.45 with C.I.= (10.336,10.564)and b = 4.12 with C.I.=(2.742,5.498).The second dataset gives â = 7.95 with C.I.= (7.688, 8.204) and b = 6.8 with C.I.=(3.693,9.895).Figures 6 and 7 present 2D-spiral of two people in points, after shifting by (200, 215), and the fitted spiral in line.

Fig. 16
Fig. 16 The four figures present the distribution of the estimate of b for 10 000 simulated data.Figures (b), (c) and (d) show that the distributions of the estimate are close to the true value, whereas Mishara's method is far away

Fig. 18
Fig. 18 The four figures present the distribution of the estimate of a for 10 000 simulated data.Figures (b), (c) and (d) show that the distributions of the estimate are close to the true value, whereas Mishara's method is far away

Table 1
The initial estimates of the spiral parameters, fitted curve equation and RSS of the data spiral after shifting (as needed) and deleting 6 points Journal of the Indian Society forProbability and Statistics (2023) 24:443-467