Abstract
We consider unimodal time series forecasting. We propose Gaussian and Lerch models for this forecasting problem. The Gaussian model depends on three parameters and the Lerch model depends on four parameters. We estimate the unknown parameters by minimizing the sum of the absolute values of the residuals. We solve these minimizations with and without a weighted median and we compare both approaches. As a numerical application, we consider the daily infections of COVID-19 in China using the Gaussian and Lerch models. We derive a confident interval for the daily infections from each local minima.
1. Introduction
The least absolute deviations (LAD) method of curve-fitting proposed [1] consists of fitting the data to a function , with . The parameter minimizes the sum of absolute deviations
According to [2], in the linear regression case , the minimization of the quantity
was suggested by Boscovitch (1757) (some asymptotic results are given in [3]), see also [4,5,6]. The latter objective function is convex with respect to the parameter . Hence, it has only one minima but may have many minimizers.
The linear regression case of LAD optimization is inherently more complex than the minimization of the sum of squares. The interest in the LAD method is associated with the development of robust methods. The LAD method is more resistant to the outliers in the data (see [7,8]).
The aim of our work is to analyze LAD minimization using a nonlinear regression motivated by the daily infections of COVID-19 in China during the first wave. We denote the observed number of infected persons at time with (see Figure 1). The variable represents day .
Figure 1.
Daily infections of COVID-19 in China.
Justified by the sigmoidal nature of a pandemic, we propose two models: the Gaussian model (see [9])
and the Lerch model
as a prediction of the observed number of infected persons at time t.
The Gaussian parameter , with denote, respectively, the peak, the location of the peak, and the width of the first wave of COVID-19.
The Lerch probability distribution on the non-negative integers is proportional to the function with , the parameters and . The Lerch probability distribution is strongly unimodal when and . In this case, its mode is at , where signifies taking the integer part, see [10].
To estimate the three parameters (respectively, ) based on the T observations, we consider LAD nonlinear regression
with the subscript (respectively, ). The Gaussian model was studied in our previous work [11].
As in our previous work [11], we propose to solve our proposed LAD regression using the simplex Nelder–Mead algorithm implemented by the optim function in R software. The Nelder–Mead algorithm [7,12,13,14] is able to optimize functions without derivatives. It is a simplex method for finding a local minima of a function, the most widely used direct search method for solving optimization problems, and is considered one of the most popular derivative-free nonlinear optimization algorithms.
The output of the optim function depends on the initialization and is in general not a minimizer of the objective function. Restarting the Nelder–Mead algorithm from the last solution obtained (and continuing to restart it until there is no further improvement) can only improve the final solution and the latter is in general a local minimizer. Here is the iteration of the optim function until the convergence:
2. Probabilistic Interpretation of LAD Regression
Let us assume that
where the errors are i.i.d. with the common probability distribution
where and are location and scale parameters, respectively (see, e.g., [15,16]). It was named after Pierre-Simon Laplace (1749–1827), as the distribution whose likelihood is maximized when the location parameter is set to the median. Based on the data the likelihood is equal to
It comes that the maximum likelihood estimator of the parameters and are
In practice, are given by an algorithm of optimization, and usually, they are only local minimizers. Having and the scale , we derive a confidence interval for with as a solution of the equation
given by . We derive the confidence interval
of with the confidence level . Here, in the Gaussian case, and in the Lerch case.
3. LAD Regression Analysis Using Weighted Median
Before going forward, we recall the weighted median definition.
3.1. Weighted Median
We recall in the following proposition, the definition and the calculation of the weighted median. For more details, we advise the reader to see the work of [17].
Proposition 1.
Let us consider a sequence of real numbers with positive weighted and . The minimizer of the function (called the weighted median) is given as follows. We calculate the permutation , which rearranges the sequence into ascending order. We form the sequence , then we find the largest integer k which satisfies
If
then the weighted median .
If , then the weighted median is equal to the interval .
3.1.1. Back to Our Proposed LAD Regression
Both our LAD regressions have the form
with , and is a continuous positive map with D is a Euclidean domain. Now, we can announce the following corollary.
Corollary 1.
For each fixed b, the minima of the function is attained at the weighted median of the sequence endowed with the weights . Moreover, if is a local minimizer of the function , then is the weighted median of endowed with the weights .
Proof.
We observe that for fixed b, the map is a convex function. Now, let us assume that is a local minimizer of the function . Then, is the global minimizer of the convex function . Hence, is the weighted median of endowed with the weights . □
3.1.2. Comparison of the Minimizers of the Map and the Minimizers of the Map
The following proposition is obvious.
Proposition 2.
(1) For each fixed a, the map is above the map and they intersect at the curve .
(2) If is a local minimizer of the map , then is also a local minimizer of the map .
(3) The local minimizers of the map belong to the set . If is a local minimizer of the map , then, in general, is not a local minimizer of the map . However, if is a global minimizer of , then is also a global minimizer of .
Proof.
For each fixed b, the minima of the map is attained at the point , which implies that and achieves the proof of (1). Let be a local minimizer of the map . It follows that when with are some neighborhoods, respectively, of and . We derive that the minima of is attained at . As is convex, it has the unique minima . Which achieves the proof of (3). The proof of (2) works as follows. There exists a neighborhood V of such that
for each . By definition of , we have for all a. It follows that is a local minimizer of . □
Proposition 3.
Assume that has only a global minimizer. Then, the map may have many local minimizers, and is discontinuous at any point such that is a local minimizer of the map .
Proof.
By definition of the local minimizer, there exists a neighborhood V of such that for each point . Necessarily, is not in V for at least one point b near , if not for all point b near , and then is a local minimizer of the map . This is absurd because has only a global minimizer. □
4. Numerical Results
In China, COVID-19 appeared on 23 December 2019 in the Wuhan region and after its fast-initial spreading, strict rules of social distancing were imposed almost one month later. Three months after the initially reported cases, the spreading in China subsided. The China data in Figure 1 were extracted from owid/COVID-19-data, available on the web.
Figure 1 shows that the peak and location, which are equal, respectively, to a = 15,136, and .
4.1. LAD Regression Using Gaussian Model with
By varying the initial condition and using the Algorithm 1 with the objectif function equals , we obtain only one minima: , , and . We recall that is the weighted median of the sequence with the weights .
However, by varying the initial condition and using the Algorithm 1 with the objectif function equals , we found several lists of minima. Table 1 shows some of them. The minima corresponds to the minimizer , , . We recall that the observed location is . The minima corresponds to the minimizer = 15,185.797, , . We recall that the observed peak is a = 15,136.
| Algorithm 1 The output of the iteration of optim function until convergence | |
| Input: Fonction F | |
| 1: | initialization , |
| 2: | while do |
| 3: | optim // optim function applied to F with the initialization . |
| 4: | end while |
| output: and . | |
Table 1.
A list of minimizers of with .
4.2. Confidence Intervals Using Six minimas with T = 10 in the Gaussian Model
We recall that the confidence interval of from the minimizer is given by
In Figure 2, we present the confidence intervals for the global minima and five local minimas among the list . The predictions using the minimas and are clearly bad. However, their predictions at the location are close to the real peak among the six minimas. The percentage of predictions is given in Table 1. An R source code is given in Appendix A, which can be used to determine the confidence intervals for the other values of T once the list of minimas is determined by using one of the three considered methods.
Figure 2.
Confidence intervals using six minimas with T = 10 in the Gaussian model.
In Figure 2, we present the confidence intervals for the global minima and six local minimas among the list in the Gaussian model.
Remark 1.
Let us conclude this paragraph with a comparison between the output of the optim function and the output of the iteration of the optim function until the convergence using the same initialization with . As initialization, we use , for the two approaches; the use of the optim function leads to the following minima , while the iteration of the optim function until convergence leads to . Figure 3 illustrates the plots of daily infections of COVID-19 in China, the LAD regression using the minima of the optim function and the LAD regression using the minima of the iteration of the optim function until the convergence.
Figure 3.
Optimal time series for , for the Gaussian model with and without iterations.
4.3. LAD Regression Using the Lerch Model with
By varying the initial condition and using the Algorithm 1 with the function we found a huge number of minimas. Table 2 shows some of them. We recall that is the weighted median of the sequence : with the weights . We also recall that in the Gaussian case, the surface has only one minima equal to the global minima of the map .
Table 2.
A list of minimizers of with .
Figure 4 and Figure 5 show, respectively, the optimal time series for the Lerch and Gauss models for , using our list of local minimas. We can observe that the Lerch model fits better with the prediction of for . But the Gauss model fits better with the prediction of the location and the size of the peak.
Figure 4.
Optimal time series for for Gauss.
Figure 5.
Optimal time series for for Lerch.
In Table 3, we report the columns of mode positions and the corresponding amplitudes for each minimizer.
Table 3.
Mode position and amplitude using Lerch.
4.4. Confidence Intervals Using Six Minimas with in the Lerch Model
The percentage of predictions is given in Table 2. Observe that the best percentage of predictions occurs at the global minima of the Lerch model, but the best percentage of predictions occurs at the local minimizer 325.186 of the Gauss model.
In Figure 6, we present the confidence intervals for the global minima and six local minimas among the list of the Lerch model.
Figure 6.
Confidence intervals using six minimas with T = 10 of the Lerch model.
5. The Case T > 10
In this section, we consider the cases and . In the Lerch model case, LAD regression still has many minimizers for . See Table 4. But in the Gauss model, LAD regression has only one minimizer for . See Table 5.
Table 4.
A list of minimizers of with . The last column contains the percentage of predictions.
Table 5.
The unique minimizer of with .
From Table 4 and Table 5, we can observe that the percentage of prediction of the Lerch model is better than the percentage of prediction of the Gauss model.
Finally, the minima for for both models (Gauss and Lerch) are unique and respective to (3318.433, 16.94084, 10.19735, 617.2386) and (0.05691053, 0.7445283, 3.3413322, −5.2886448, 570.7861098).
Figure 7 shows the optimal time series for the Lerch and Gauss models for , using our local minima.
Figure 7.
Optimal time series for for Lerch and Gauss.
We observe that the Lerch approximation has a heavier tail than the Gaussian approximation.
6. Conclusions
In this work, we considered LAD nonlinear regression
with the subscript (respectively, ).
The two models have the form . We have associated with the map with the sequence , and the weights , and denotes the weighted median of endowed with the weights . We showed that if is a local minimizer of S, then is also a local minimizer of . The converse is, in general, false, i.e., if is a local minimizer of , then is not, in general, a local minimizer of S. However, if is the global minima of , then is also the global minima of S. We showed that if S has only a global minima, then is discontinuous at each local minimizer. Using the data of the daily infections of COVID-19 in China during the first wave, we showed numerically in the Gaussian case that the map has a huge number of local minimas, but the surface S has only a global minima, which is also the global minima of the map . However, in the Lerch case , contrary to the Gaussian case, we showed that the maps and have each a huge number of local minimas. We derived confident intervals for the daily infections from each local minima. Our message is that each local minima contains a part of the information and can be used for the prediction of a part of the parameters.
In future work, we will deal with the log-transformation , where are in bijection with the parameters a, l, s of the Gaussian model. This allows us to consider the linear model , with the errors , which are i.i.d. We will deal with this problem using other robust regression estimators as the least trimmed median estimator (LTM) proposed in [18].
Author Contributions
Conceptualization, A.D. and Y.S.; methodology, A.D., D.O. and Y.S.; software, D.O. and Y.S.; validation, A.D., D.O. and Y.S.; formal analysis, D.O.; investigation, A.D. and Y.S.; resources, A.D.; data curation, A.D.; writing—original draft preparation, A.D., D.O. and Y.S.; writing—review and editing, Y.S.; visualization, A.D. and Y.S.; supervision, A.D. and Y.S.; project administration, A.D., D.O. and Y.S.; funding acquisition, Y.S. All authors have read and agreed to the published version of the manuscript.
Funding
This research received no external funding.
Informed Consent Statement
Informed consent was obtained from all subjects involved in the study.
Data Availability Statement
Data are unavailable due to privacy.
Acknowledgments
We would like to thank the Editor-in-Chief of Entropy, the associate Editor, and two anonymous reviewers for their helpful comments, which helped us to focus on improving the original version of the paper. The authors would like to thank the Editor, the Associate Editor, and the three referees for their very helpful comments, which led to a considerable improvement of the original version of the paper and a more sharply focused presentation.
Conflicts of Interest
The authors declare no conflict of interest.
Appendix A. R Source Code
Here, we provide a source code for a better understanding of the proposed method.
Appendix A.1. opt() Function
library(optim)
OPT = function(T, init) {
y =function(x) f(T, x)
repeat {
optim.result=optim(init, y)$par
init= optim.result$par
min.opt=optim.result$value
if (f(T,init) == f(T, optim(init, y)$par)) {
break
} else{init=init}
}
return(c(init, min.opt))
}
Appendix A.2. Confidence Intervals Plot
library(ggplot2)
library(openxlsx)
conf.int.min=function(T,Min.list,T.inf,T.sup){
# given T
# Min.list is the list of minima obtained for T
## T.inf = T+1 and T.sup=upper limit of days
j=1:(60-T)
Tj=T+j
born_sup=NULL
born_inf=NULL
confid.int=NULL
int_T=NULL
for(i0 in 1:nrow(Min.list)){
for(i00 in 1:length(Tj)){
born_sup=Min.list[i0,1]*exp(-(Tj[i00]-Min.list[i0,2])^2/(Min.list[i0,3]^2))
+2.995732*Min.list[i0,4]
born_inf=Min.list[i0,1]*exp(-(Tj[i00]-Min.list[i0,2])^2/(Min.list[i0,3]^2))
-2.995732*Min.list[i0,4]
int_T=rbind(int_T,c(born_inf,i[Tj[i00]],born_sup))
}
colnames(int_T)=c("lower","i","upper")
confid.int=cbind(confid.int,int_T)
int_T=NULL
}
confid.int=data.frame(confid.int)
row.names(confid.int)=as.character(Tj)
#export all confidence intervals
write.xlsx(confid.int,file=paste0("confid_int_",T,".xlsx"))
#creation of a matrix which is equal to the matrix of
#confidence intervals for use with ggplot below
ggplot.confid=confid.int
iter.plot=1
while(ncol(ggplot.confid)>=3){
ggsave(ggplot(ggplot.confid[,1:3], aes(x=T.inf:T.sup, y=ggplot.confid[,2])) +
xlab(paste0(paste0("minima",sep=Min.list[iter.plot,4])))+ylab("")+
geom_errorbar(aes(ymin=ggplot.confid[,1], ymax=ggplot.confid[,3]), width=.1)+
geom_point(),
file=paste0("int_conf_min_",T,"_", iter.plot,".png"))
iter.plot=iter.plot+1
ggplot.confid=ggplot.confid[,-c(1:3)]
}
}
References
- Bloomfield, P.; Steiger, W.L. Least Absolute Deviations Curve-Fitting. SIAM J. Sci. Stat. Comput. 1980, 2, 290–301. [Google Scholar] [CrossRef] [Scilit]
- Eisenhart, C. Boscovitch and the combination of observations. In Roger Joseph Boscovitch; Whyte, L.L., Ed.; Fordham University Press: New York, NY, USA, 1961. [Google Scholar]
- Koenker, R.; Bassett, G. On Boscovich’s estimator. Ann. Stat. 1985, 13, 1625–1628. [Google Scholar] [CrossRef] [Scilit]
- Rhodes, E.C. Reducing observations by the method of minima deviations. Lond. Edinb. Dublin Philos. Mag. J. Sci. 1930, 9, 974–992. [Google Scholar] [CrossRef] [Scilit]
- Karst, O.J. Linear curve fitting using least deviations. J. Am. Stat. Assoc. 1958, 53, 118–132. [Google Scholar] [CrossRef]
- Sadovski, A.N. Algorithm As 74. L1-norm fit of straight line. J. R. Stat. Soc. Ser. C Appl. Stat. 1974, 23, 244–248. [Google Scholar] [CrossRef] [Scilit]
- Dielman, T.E. Least absolute value regression: Recent contributions. J. Stat. Comput. Simul. 2005, 75, 263–286. [Google Scholar] [CrossRef] [Scilit]
- Li, Y.; Arce, G.R. A maximum likelihood approach to least absolute deviation regression. EURASIP J. Appl. Signal Process. 2004, 12, 1762–1769. [Google Scholar] [CrossRef] [Scilit]
- Barmparis, G.D.; Tsironis, G.P. Estimating the infection horizon of COVID-19 in eight countries with a data-driven approach. Chaos Solitons Fractals 2020, 135, 109842. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Aksenov, S.V.; Savageau, M.A. Some properties of the Lerch family of discrete distributions. arXiv 2005, arXiv:math/0504485. [Google Scholar]
- Dermoune, A.; Ounaissi, D.; Slaoui, Y. Confidence intervals from local minimas of objective function. Stat. Optim. Inf. Comput. 2023, 11, 798–810. [Google Scholar] [CrossRef] [Scilit]
- Gao, F.; Lixing, H. Implementing the Nelder-Mead simplex algorithm with adaptive parameters. Comput. Optim. Appl. 2010, 51, 259–277. [Google Scholar] [CrossRef] [Scilit]
- Lagarias, J.C.; Reeds, J.A.; Wright, M.W.; Wright, P.E. Convergence properties of the Nelder–Mead simplex method in low dimensions. SIAM J. Optim. 1998, 9, 112–147. [Google Scholar] [CrossRef] [Scilit]
- Nelder, J.A.; Mead, R. A simplex method for function minimization. Comput. J. 1965, 7, 308–313. [Google Scholar] [CrossRef] [Scilit]
- Johnson, N.L.; Kotz, S.; Balakrishnan, N. Continuous Univariate Distributions; Wiley: Hoboken, NJ, USA, 1994. [Google Scholar]
- Ord, J.K. Laplace Distribution, in Encyclopedia of Statistical Science; Kotz, S., Johnson, N.L., Read, C.B., Eds.; Wiley: New York, NY, USA, 1983; Volume 4, p. 473475. [Google Scholar]
- Novoselac, V. The Component Weighted Median Absolute Deviations Problem. Eur. J. Pure Appl. Math. 2020, 13, 964–976. [Google Scholar] [CrossRef] [Scilit]
- Croux, C.; Rousseeuw, P.J.; Van Bael, A. Positive-breakdown regression by minimizing nested scale estimators. J. Stat. Plan. Inference 1996, 53, 197–235. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).






