Next Article in Journal
Conformal Vector Fields and the De-Rham Laplacian on a Riemannian Manifold
Next Article in Special Issue
Interdependence between Green Financial Instruments and Major Conventional Assets: A Wavelet-Based Network Analysis
Previous Article in Journal
Automated Generation of EQ-Algebras through Genetic Algorithms
Previous Article in Special Issue
Grading Investment Diversification Options in Presence of Non-Historical Financial Information
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

TAC Method for Fitting Exponential Autoregressive Models and Others: Applications in Economy and Finance

by
Javier Cabello Sánchez
*,†,
Juan Antonio Fernández Torvisco
and
Mariano R. Arias
*,†
Facultad de Ciencias, Universidad de Extremadura, Avda. de Elvas s/n, 06006 Badajoz, Spain
*
Authors to whom correspondence should be addressed.
These authors contributed equally to this work.
Mathematics 2021, 9(8), 862; https://doi.org/10.3390/math9080862
Submission received: 12 March 2021 / Revised: 9 April 2021 / Accepted: 12 April 2021 / Published: 14 April 2021
(This article belongs to the Special Issue Application of Mathematical Methods in Financial Economics)

Abstract

:
There are a couple of purposes in this paper: to study a problem of approximation with exponential functions and to show its relevance for economic science. The solution of the first problem is as conclusive as it can be: working with the max-norm, we determine which datasets have best approximation by means of exponentials of the form f ( t ) = b + a exp ( k t ) , we give a necessary and sufficient condition for some a , b , k R to be the coefficients that give the best approximation, and we give a best approximation by means of limits of exponentials when the dataset cannot be best approximated by an exponential. For the usual case, we have also been able to approximate the coefficients of the best approximation. As for the second purpose, we show how to approximate the coefficients of exponential models in economic science (this is only applying the R-package nlstac) and also the use of exponential autoregressive models, another well-established model in economic science, by utilizing the same tools: a numerical algorithm for fitting exponential patterns without initial guess designed by the authors and implemented in nlstac. We check one more time the robustness of this algorithm by successfully applying it to two very distant areas of economy: demand curves and nonlinear time series. This shows the utility of TAC (Spanish for CT scan) and highlights to what extent this algorithm can be useful.

1. Introduction

This paper is designed to cover a couple of major objectives. Broadly, the first one is to solve one of the remaining issues in [1]. Later this introduction, this first objective will be introduced in a detailed way. The second objective is to exemplify the interest, for the economic science, of the algorithm presented in [1] and implemented in the R-package nlstac; see [2]. We have developed this algorithm in order to fit data coming from an exponential decay. In this primitive utilization of the algorithm, we do not distinguish between fitting data and fitting coefficients, but we hasten to remark that there is no model proposed in the present paper: our goal is to provide a tool that allows the reader to fit the coefficients of a previously chosen model. Therefore, we will illustrate the interest of this algorithm by fitting the pattern in a couple of cases related with different economic problems.
The first economic problem deals with demand curves. Economic demand curves can be used to map the relationship between the consumption of a good and its price. When plotting price (actually the logarithm of the price) and consumption, we obtain a curve with a negative slope, meaning that when price increases, demand decreases. Hursh and Silberbeg proposed in [3] an equation to model this situation; in this paper, we will fit some data using this model.
The second and third economic problems deal with nonlinear time series models. Many financial time series display typical nonlinear characteristics, so many authors (see [4]) apply nonlinear models. Although the TAC (Spanish for CT scan) algorithm was not designed for these kinds of problems, we can obtain good results from using it. In these examples, we will focus on the model that, among all nonlinear time series models, seems to have more relevance in the literature, namely, the exponential autoregressive model. We show that the coefficients given by nlstac give a realistic approximation of such datasets. In any case, our purpose is not to assess the fitness of any model nor to provide an economic analysis.
Before we get into the first objective, let us outline the structure of this paper. Section 2 deals with approximations by means of exponential functions measuring the error with the max-norm when fitting a small set of data, i.e., three or four observations. Section 3 is devoted to some symmetric cases that could happen. Section 4 deals with approximation in generaldatasets. Section 5 gathers two examples about Newton Law of Cooling and directly applies what has been developed in previous sections. Section 6 shows examples related to economy and uses the R-package nlstac for the calculations. Although the section on economics represents one out of the six sections of this paper, it remains a very important one, and everything we have been working on before directly applies in it. What we have been able to do with nlstac gives an idea of how it can approximate the best coefficients for patterns that are usually regarded as unapproachable; see, e.g., [5].
We will focus on the first objective in Section 2, Section 3, Section 4 and Section 5. In these sections, we will deal with approximations by means of exponential functions, and we will measure the error with the max-norm. Therefore, when we say that some function f is the best approximation for some data ( t , T ) , we mean that we have t = ( t 1 , t n ) , T = ( T 1 , T n ) R n , with t i < t i + 1 for every i, and that { ( t , f ( t ) ) : t [ t 1 , t n ] } R 2 is the center of the narrowest band that contains every point and has exponential shape; see Figure 1.
We will need the following definition:
Definition 1.
A real function defined in a linear topological space X is quasiconvex whenever it fulfills
f ( λ x + ( 1 λ ) y ) max { f ( x ) , f ( y ) } , x , y X and λ ( 0 , 1 ) .
This definition can be consulted in, for example, [1] or [6].
The authors already proved in [1] that for every k R , k 0 , there exists the best approximation f k ( t ) = a k exp ( k t ) + b k amongst all the functions of the form a exp ( k t + b ) , with a , b R . We also showed that, given any dataset ( t , T ) , the function E ( k ) that assigns to every k ( , 0 ) the error max | T i f k ( t i ) | is quasiconvex, so there are two options: either E attains its minimum at some k or it is monotonic. If E is monotonic, then either it is increasing and the minimum would be attained, so to say, at , or it is decreasing and attains its minimum at k = 0 . We will also study what happens for positive k, so we will need to pay attention not only to the behaviour of the exponentials but also to their limits when k 0 and k ± ; see Proposition 2 and Section 3.2.
Remark 1.
Our main results show that every dataset ( t , T ) with at least four data fulfills one of the following conditions:
  • There exists one triple ( a , b , k ) R 3 with a k 0 such that a exp ( k t ) + b is the best possible approximation, i.e.,
max i = 1 , , n { | a exp ( k t i ) + b T i | } < max i = 1 , , n { | f ( t i ) T i | }
whenever f : R R is a different exponential.
  • There are two indices i 1 < i 3 where max { T 1 , , T n } is attained and there is some i 2 , with i 1 < i 2 < i 3 , such that min { T 1 , , T n } = T i 2 . In this case, the best approximation by means of exponentials does not exist and the constant 1 2 ( T i 1 + T i 2 ) approximates ( t , T ) better than any strictly monotonic function—in particular any exponential. Therefore, for every k R , the best approximation with the form a exp ( k t ) + b has a = 0 and b = 1 2 ( T i 1 + T i 2 ) . Exactly the same happens when the maximum is attained at i 2 and the minimum at i 1 and i 3 , with i 1 < i 2 < i 3 . In both cases, the function E is constant.
  • T 1 = max { T 1 , , T n } , T i 2 = min { T 1 , , T n } and T attains its second greatest value at i 3 > i 2 . The best approximation by means of exponentials does not exist and every exponential approximates ( t , T ) worse than any function fulfiling f ( t 1 ) = T 1 + 1 2 ( T i 2 T i 3 ) , f ( t i ) = 1 2 ( T i 2 + T i 3 ) for i 2 . The pointwise limit of the best approximations when k takes these values. (The symmetric cases belong to these kind of limits, with k instead of k .) If this happens, E increases in ( , 0 ) .
  • There are some c , d R such that the line c t + d approximates ( t , T ) better than any exponential. In this case, each c t i + d is the limit when k 0 of the values in t i of the best approximations with k as exponent. This happens when there are four indices i 1 < i 2 < i 3 < i 4 or i 2 < i 1 < i 4 < i 3 such that
    T i j ( c t i j + d ) = ( 1 ) j max | T i ( c t i + d ) | , j = 1 , 2 , 3 , 4 .
This implies that E decreases in ( , 0 ) .
Remark 2.
What happens with this kind of functions is the following: consider two exponentials that agree at α < β R , say g ( α ) = f ( α ) > g ( β ) = f ( β ) . Then, the following are equivalent:
  • g ( γ ) < f ( γ ) for some γ ( α , β ) .
  • g ( γ ) < f ( γ ) for every γ ( α , β ) .
  • g ( γ ) > f ( γ ) for some γ ( , α ) ( β , ) .
  • g ( γ ) > f ( γ ) for every γ ( , α ) ( β , ) .
A visual way to look at this is the following. Consider a wooden slat supported on two points, and imagine we put a load between the supports. When we increase the load, the slat lowers between the two supports but the other part of the slat raises. For these functions, the behaviour is similar—if two of them agree at α and β, then one function is greater than the other in ( α , β ) and lower outside [ α , β ] .
Besides, if α < β and f ( β ) < f ( α ) then for each ( γ , x ) that does not lie in the line defined by ( α , f ( α ) ) and ( β , f ( β ) ) and belongs to
( , α ) × ( f ( α ) , ) ( α , β ) × ( f ( β ) , f ( α ) ) ( β , ) × ( , f ( β ) )
there is exactly one exponential h such that h ( α ) = f ( α ) , h ( β ) = f ( β ) and h ( x ) = γ . Of course, if ( γ , x ) does not belong to the set given by (1), then there is no monotonic function that fulfils the latter. The existence of such an exponential is a straightforward consequence of [1], Lemma 2.10—we will develop this later, see Proposition 4.
Remark 3.
A significant problem when dealing with the problem of approximating datasets with exponentials has been to find conditions determining whether some dataset is worth trying or not. The only way we have found to answer this problem has been to identify the most general conditions that ensure that some dataset has one best approximation by exponentials—needless to say, this has been a very sinewy problem. The different behaviors described in Remark 1 can give a hint about the several different details that we will need to deal with, but there is still some casuistry that we need to break down. Specifically, our main interest in these results comes from the fact that they can be applied to exponential decays, which appear in several real-life problems—the introduction in [1] presents quite a few examples. The typical data that we have worked with are easily recognizable, but we needed to determine when the data may be fitted with a decreasing, convex function—like the exponentials f ( t ) = a exp ( k t ) + b with a > 0 , k < 0 . The easiest way we have found is as follows:
  • If some data ( t , T ) are to be fitted with a decreasing function and we are measuring the error with the max-norm, then the maximum value in T must be attained before the minimum. There may exist more than one index where they are attained, but every appearance of the maximum must lie before every appearance of the minimum. In short, if T i = max ( T ) and T j = min ( T ) , then i < j .
  • Moreover, if we are going to approximate ( t , T ) with a convex function, the dataset must have some kind of convexity. The only way we have found to state this is as follows:
    ♡ “Let r ( t ) be the line that best approximates ( t , T ) . Then ( T 1 r ( t 1 ) , , T n r ( t n ) ) has two maxima and one minimum between them.”
    Thanks to Chebyshev’s Alternation Theorem (the polynomial p n is the best approximation of function f in [ a , b ] if and only if there exists n + 2 points a t 1 < t 2 < < t n + 2 b where | f ( t ) p n ( t ) | attains its maximum and f ( t i ) p n ( t i ) = p n ( t i + 1 ) f ( t i + 1 ) ; see for example [7], Theorem 8, p. 29 or [8]) we know that the line that best approximates any dataset behaves this way, the opposite way or as described in Remark 1. Please observe that this Theorem would not apply so easily to approximations with general degree polynomials.
Before we go any further, let us comment something about the notation that will be used. For the remainder of the paper, we will always take n as the number of coordinates of t and T, i.e., t , T R n . In addition, t R n will fulfil t 1 < t 2 < < t n .
Moreover, for any k 0 we will always denote as f k ( t ) = a k exp ( k t ) + b k the best approximation with the form f ( t ) = a exp ( k t ) + b with a , b R .
To ease the notation, whenever we have some function f : R R and t = ( t 1 , , t n ) R n , we will let f ( t ) denote ( f ( t 1 ) , , f ( t n ) ) R n , and the same will apply to any fraktur character: g ( t ) , r ( t ) , f 1 ( t ) , f 2 ( t ) , f k ( t ) would represent the same for g , r , f 1 , f 2 , f k : R R and so on.
Given any vector v = ( v 1 , , v n ) , M ( v ) will denote its maximum and M ( v ) will denote its minimum.

2. Small Datasets

In this Section, we show some not too complicated, general results about the behavior of exponentials that will allow us to prove our main results in Section 4. We will focus only on the approximation of the most simple datasets, with n = 3 or n = 4 .
We will begin with Proposition 1, just a slight modification of [1], Proposition 2.3 that will be useful for the subsequent results. Later, in Lemma 1, we will find the expression of the best approximation for ( ( t 1 , t 2 , t 3 ) , ( T 1 , T 2 , T 3 ) ) for each fixed k (please note that with n = 2 , for every k there is an exponential that interpolates the data). In Lemma 2, we study the case n = 4 , determining a technical condition on ( t , T ) that ensures that the best approximation exists and it is unique, and moreover, we kind of determine analytically this best approximation.
Proposition 1
([1]). Let k 0 , a k , b k R such that f k ( t ) = a k exp ( k t ) + b k is the best approximation to T for this k, i.e.,
f k ( t ) T = min { a exp ( k t ) + b T : a , b R } .
Then, there exist indices 1 i < j < m n such that f k ( t i ) T i = T j f k ( t j ) = f k ( t m ) T m = ± f k ( t ) T .
Reciprocally, if a k and b k fulfil this condition, then a k exp ( k t ) + b k is the best approximation to T for this k.
Lemma 1.
Let n = 3 , k 0 and T 1 T 3 . Then, the best approximation to ( t , T ) by means of exponentials has these coefficients:
a k = T 1 T 3 exp ( k t 1 ) exp ( k t 3 ) , b k = 1 2 ( T 1 a k exp ( k t 1 ) + T 2 a k exp ( k t 2 ) ) .
Proof. 
It is clear that T 1 f ( t 1 ) = T 3 f ( t 3 ) , and a simple computation shows that T 1 f ( t 1 ) = f ( t 2 ) T 2 also holds. Indeed,
f ( t 1 ) f ( t 3 ) = a k exp ( k t 1 ) + b k a k exp ( k t 3 ) b k = a k ( exp ( k t 1 ) exp ( k t 3 ) ) = T 1 T 3 exp ( k t 1 ) exp ( k t 3 ) ( exp ( k t 1 ) exp ( k t 3 ) ) = T 1 T 3 . f ( t 1 ) + f ( t 2 ) = a k exp ( k t 1 ) + b k + a k exp ( k t 2 ) + b k = a k ( exp ( k t 1 ) + exp ( k t 2 ) ) + 2 1 2 ( T 1 a k exp ( k t 1 ) + T 2 a k exp ( k t 2 ) ) = T 1 + T 2 .
By Proposition 1, this is enough to ensure that a k and b k are optimal. □
Remark 4.
Please observe that a k does not depend on ( t 2 , T 2 ) .
Lemma 2.
Let n = 4 and ( t , T ) such that ( T 1 T 3 ) / ( t 3 t 1 ) > ( T 2 T 4 ) / ( t 4 t 2 ) > 0 . Then, there exists a unique exponential f ( t ) = a exp ( k t ) + b , with k < 0 , a > 0 and b R such that
T 1 f ( t 1 ) = ( T 2 f ( t 2 ) ) = T 3 f ( t 3 ) = ( T 4 f ( t 4 ) ) .
Moreover, this exponential is the best approximation to ( t , T ) .
Proof. 
Let ( t , T ) be as in the statement. For k R , k 0 , there exist unique a , b R such that a exp ( k t 1 ) + b = T 1 and a exp ( k t 3 ) + b = T 3 . Specifically, a is as in (3) and b = T 1 a exp ( k t 1 ) .
Indeed, T 1 f ( t 1 ) = T 3 f ( t 3 ) means that T 1 ( a exp ( k t 1 ) + b ) = T 3 ( a exp ( k t 3 ) + b ) , so T 1 T 3 = a ( exp ( k t 1 ) exp ( k t 3 ) ) and each k 0 determines a k + = T 1 T 3 exp ( k t 1 ) exp ( k t 3 ) . The same way, T 2 f ( t 2 ) = T 4 f ( t 4 ) determines a k = T 2 T 4 exp ( k t 2 ) exp ( k t 4 ) .
Therefore, the equalities (4) hold if and only if, for some k 0 , we have a k + = a k . Equivalently,
exp ( k t 1 ) exp ( k t 3 ) T 1 T 3 = exp ( k t 2 ) exp ( k t 4 ) T 2 T 4 .
Please observe that this equality holds trivially when k = 0 and that, as both T 1 T 3 and T 2 T 4 are positive, we are not trying to divide by 0.
If we put z = exp ( k ) , the last equality can be written as
( T 1 T 3 ) z t 4 ( T 2 T 4 ) z t 3 ( T 1 T 3 ) z t 2 + ( T 2 T 4 ) z t 1 = 0 .
We will denote as p ( z ) the left hand side of this equality.
As we are only interested in positive roots of p, we can divide by z t 1 and consider q ( z ) = ( T 1 T 3 ) z s 4 ( T 2 T 4 ) z s 3 ( T 1 T 3 ) z s 2 + T 2 T 4 , with s i = t i t 1 for i = 2 , 3 , 4 .
Taking into account that q ( 0 ) = T 2 T 4 > 0 , that q obviously vanishes at 1 (but this root corresponds to the void case k = 0 and so a k + and a k are not defined) and also that the limit of q ( z ) is as z goes to , there must exist another z ( 0 , ) , maybe z = 1 , such that p ( z ) = q ( z ) = 0 . By Descartes’ rule of signs—see [9], Theorem 2.2—both q and p have at most two positive roots, so there is exactly one other positive root of p. To determine whether this root is greater or smaller than 1, we can compute the derivative of p at 1.
p ( z ) = t 4 ( T 1 T 3 ) z t 4 1 t 3 ( T 2 T 4 ) z t 3 1 t 2 ( T 1 T 3 ) z t 2 1 + t 1 ( T 2 T 4 ) z t 1 1 ,
so p ( 1 ) = ( t 4 t 2 ) ( T 1 T 3 ) ( T 2 T 4 ) ( t 3 t 1 ) . This is positive provided ( T 1 T 3 ) / ( t 3 t 1 ) > ( T 2 T 4 ) / ( t 4 t 2 ) > 0 , so the other root of p lies between 0 and 1 whenever the condition in the statement is fulfiled.
Therefore, there exists just one k = log ( z ) ( , 0 ) for which
T 1 T 3 exp ( k t 1 ) exp ( k t 3 ) = T 2 T 4 exp ( k t 2 ) exp ( k t 4 ) .
Now, taking
a = T 1 T 3 exp ( k t 1 ) exp ( k t 3 ) = T 2 T 4 exp ( k t 2 ) exp ( k t 4 ) , b = 1 2 ( T 1 a exp ( k t 1 ) + T 2 a exp ( k t 2 ) )
and f ( t ) = a exp ( k t ) + b , we have the function we were looking for.
Moreover, suppose that there exist a ¯ , b ¯ , k ¯ such that f ¯ ( t ) = a ¯ exp ( k ¯ t ) + b ¯ approximates ( t , T ) at least as well as f. We may suppose that T 1 f ( t 1 ) = f ( t 2 ) T 2 = T 3 f ( t 3 ) = f ( t 4 ) T 4 = r > 0 . Now, the conditions for f ¯ can be rewritten as
f ¯ ( t 1 ) f ( t 1 ) , f ¯ ( t 2 ) f ( t 2 ) , f ¯ ( t 3 ) f ( t 3 ) , f ¯ ( t 4 ) f ( t 4 ) .
By [1], Lemma 2.8, this means that f ¯ = f . □
Remark 5.
This Lemma gives a kind of analytic solution to the best approximation problem, with the only obstruction of being able to determine the other root of p. In the next section, we do the same with the symmetric cases and give actual analytic solutions to the same problem when the data are not good to be approximated by exponentials, ironically.

3. Symmetric Cases and Limits

In this section, we focus on those cases that do not match with the problem we have in mind but, nevertheless, have their own interest. First, we approach the symmetric cases such as, for example, exponential growths. Second, we approach the limit cases, that is, the ones whose best approximation is not an exponential but the limit as k 0 or k of exponentials. They are not what one can expect to find while adjusting data that follow an exponential decay, but we have been able to identify when they occur and deal successfully with them.

3.1. Symmetric Cases

If ( t , T ) and f are as in the statement of Lemma 2, then a moment’s reflection is enough to realize that:
1.
The t-symmetric data ( ( t 4 , t 3 , t 2 , t 1 ) , ( T 4 , T 3 , T 2 , T 1 ) ) have
g 1 ( t ) = f ( t ) = a exp ( k t ) + b
as its best approximation.
2.
The T-symmetric data ( ( t 1 , t 2 , t 3 , t 4 ) , ( T 4 , T 3 , T 2 , T 1 ) ) have
g 2 ( t ) = f ( t ) = a exp ( k t ) b
as its best approximation.
2.
The bisymmetric data ( ( t 4 , t 3 , t 2 , t 1 ) , ( T 4 , T 3 , T 2 , T 1 ) ) have
g 3 ( t ) = f ( t ) = a exp ( k t ) b
as its best approximation.
These symmetries correspond to the following:
1.
If ( T 2 T 4 ) / ( t 4 t 2 ) < ( T 1 T 3 ) / ( t 3 t 1 ) < 0 , then there are still two changes of sign in the coefficients of p, so it has another positive root. The difference here is that both a and k are positive. Please observe that this means that ( T 2 T 4 ) / ( t 2 t 4 ) > ( T 1 T 3 ) / ( t 1 t 3 ) > 0 , so f must be increasing and increases faster for greater t.
2.
If ( T 1 T 3 ) / ( t 3 t 1 ) < ( T 2 T 4 ) / ( t 4 t 2 ) < 0 , then a < 0 and k < 0 .
3.
If ( T 2 T 4 ) / ( t 4 t 2 ) > ( T 1 T 3 ) / ( t 3 t 1 ) > 0 , then everything goes undisturbed, but we have p ( 1 ) < 0 , so the second root of p is greater than 1. This implies that k = exp ( z ) ( 0 , ) and a < 0 .

3.2. Limit Cases

Even if the conditions are not fulfiled by any symmetric version of the dataset, the computations made in the proof of Lemma 2 give the answer to the approximation problem:
If ( T 1 T 3 ) / ( t 3 t 1 ) = ( T 2 T 4 ) / ( t 4 t 2 ) > 0 , then z = 1 is a double root—this corresponds to k = 0 —and the “exponential” we are looking for is a line with negative slope. Namely, its slope is ( T 3 T 1 ) / ( t 3 t 1 ) and this best approximation is the line given by Chebyshev’s Alternation Theorem.
If ( T 1 T 3 ) / ( t 3 t 1 ) = ( T 2 T 4 ) / ( t 4 t 2 ) < 0 , then this “exponential” is a line with positive slope ( T 3 T 1 ) / ( t 3 t 1 ) —this is symmetric to the previous case.
If T 1 = T 3 or T 2 = T 4 , then we have, up to symmetries, three cases:
i:
If T 2 = T 4 = M ( T ) and T 1 T 3 , then the best approximation is a constant, namely, f ( t ) = 1 2 ( T 2 + T 3 ) .
ii:
If T 1 > T 3 T 2 = T 4 then there is no global best approximation, but every exponential approximates ( t , T ) worse than the limit, with k , of the best approximations. This limit is
f ( t ) = lim k f k ( t ) = T 1 T 3 T 2 2 , T 3 + T 2 2 , T 3 + T 2 2 , T 3 + T 2 2 ,
and it turns out to be also a kind of best approximation for every T 4 [ T 2 , T 3 ] .
iii:
If T 1 > T 2 = T 4 > T 3 then the situation is as follows:
As M ( T ) lies before M ( T ) , any good approximation must be non-increasing. T attains its second greatest value after M ( T ) , so every decreasing function approximates ( t , T ) worse than the function f ( t ) defined as in (6). Actually, ( t 2 , T 2 ) could be ignored whenever T 2 [ T 3 , T 4 ] , as we are about to see in the last item.
Finally, if T 1 T 3 and T 2 T 4 have different signs, then there is just one change of signs in the coefficients of p, so the only positive root of p is z = 1 and k = 0 , and there is no function fulfilling the statement. More precisely, this situation has two paradigmatic examples with t = ( 1 , 2 , 3 , 4 ) and T = ( 3 , 0 , 1 , 2 ) or with t = ( 1 , 2 , 3 , 4 ) and T = ( 3 , 1 , 0 , 2 ) .
In the first case, the third point ( 3 , 1 ) simply does not affect the approximation in the sense that, for every k, the exponential f k : R R that best approximates T fulfils
( f k ( 1 ) T 1 , f k ( 2 ) T 2 , f k ( 3 ) T 3 , f k ( 4 ) T 4 ) > | f k ( 3 ) T 3 | .
Namely, if f k is decreasing then f k ( 4 ) T 4 < f k ( 3 ) T 3 < f k ( 2 ) T 2 , so f k ( 3 ) T 3 is neither M ( f k ( t ) T ) nor M ( f k ( t ) T ) . If f k is increasing then f k ( 1 ) T 1 < f k ( i ) T i for i = 2 , 3 , 4 , and this, along with Proposition 1, implies that f k cannot be the best approximation.
The second case is similar. Though the point ( t 2 , T 2 ) = ( 2 , 1 ) is relevant for some approximations, it is skippable for every k < k 0 for some k 0 < 0 .

4. General Datasets

In this Section, we apply the previous results to datasets with arbitrary size in order to find out when a dataset has an exponential as its best approximation. Before we arrive to this first objective’s main result, Theorem 1, we will need several minor results. The path that we will follow is, in a nutshell, the following:
Lemma 3 is a technical Lemma that allows us to show that the maps k a k , k b k , k f k ( t ) are continuous; see Corollary 1.
Lemma 4 is just Chebyshev’s Alternation Theorem, and it suffices to determine which datasets are good to be approximated by decreasing, convex functions—like exponential decays. We will call these datasets admissible from Definition 2 on.
Then, we determine the vectors one obtains by taking limits of exponentials with exponents converging to ± or 0; see Proposition 2.
With all these preparations, we are ready to translate Lemma 2 to a more general statement, keeping the n = 4 condition. We give a necessary and sufficient condition for any dataset ( t , T ) to be approximable by exponential decays in terms that are easily generalizable to n > 4 . This is Proposition 3.
In Proposition 3 and Remark 7, we improve the results in Corollary 1 to get Remark 8, where we show that we can handle the best approximations at ease if the variations of k are small enough.
Finally, Proposition 5 reduces the general problem to the n = 4 case, thus getting Theorem 1.
Lemma 3.
Let k 0 0 and f k 0 ( t ) = a k 0 exp ( k t ) + b k 0 be the best approximation for k 0 and suppose that there are exactly three indices i < j < m such that the equalities
T i f k 0 ( t i ) = f k 0 ( t j ) T j = T m f k 0 ( t m ) = δ T f k 0 ( t ) , δ = ± 1
hold. Then, there exists ε > 0 such that, for every k ( k 0 ε , k 0 + ε ) the equalities hold with the same indices. Moreover, if k > k 0 is such that the indices where the norm is attained are not i < j < m , then there exists k [ k 0 , k ] for which the norm is attained in at least four indices.
Proof. 
Suppose δ = 1 , the case δ = 1 is symmetric.
As a k 0 = T i T m exp ( k 0 t i ) exp ( k 0 t m ) —see Lemma 1—taking α k = T i T m exp ( k t i ) exp ( k t m ) for every k 0 we have α k 0 = a k 0 . If we take, further
β k = 1 2 ( T i + T j α k ( exp ( k t i ) + exp ( k t j ) ) ) ,
then β k 0 = b k 0 , so defining f k ¯ ( t ) = α k exp ( k t ) + β k we get f k 0 ¯ = f k 0 and a straightforward computation shows that
T i f k ¯ ( t i ) = f k ¯ ( t j ) T j = T m f k ¯ ( t m )
for every k. Given any l { 1 , , n } \ { i , j , m } , our hypotheses give
T j f k 0 ( t j ) < T l f k 0 ( t l ) < T i f k 0 ( t i ) .
As the map k f k ¯ ( t l ) = α k exp ( k t l ) + β k is continuous for every l, we obtain that
T j f k ¯ ( t j ) < T l f k ¯ ( t l ) < T i f k ¯ ( t i )
holds for every k in a neighbourhood of k 0 , say ( k 0 ε l , k 0 + ε l ) . Since there are only finitely many indices, we may take ε as the minimum of the ε l to see that f k ¯ is the best approximation for k ( k 0 ε , k 0 + ε ) , and finish the proof of the first part.
Moreover, it is quite obvious that the expression for f k will be f k ( t ) = a k exp ( k t ) + b k with
a k = T i T m exp ( k t i ) exp ( k t m ) and b k = 1 2 ( T i + T j a k ( exp ( k t i ) + exp ( k t j ) ) )
if and only if, for every l { i , j , m } , one has
T j T i T m exp ( k t i ) exp ( k t m ) t j T l T i T m exp ( k t i ) exp ( k t m ) t l T i T i T m exp ( k t i ) exp ( k t m ) t i .
Please observe that the symmetric inequalities could hold and it would make f k have the same expression, but this would imply n = 3 . In any case, if k > k is such that there is some l for which
T l T i T m exp ( k t i ) exp ( k t m ) t l T j T i T m exp ( k t i ) exp ( k t m ) t j , T i T i T m exp ( k t i ) exp ( k t m ) t i ,
then it is clear that there is k ¯ [ k , k ] such that
T l T i T m exp ( k ¯ t i ) exp ( k ¯ t m ) t l = T j T i T m exp ( k ¯ t i ) exp ( k ¯ t m ) t j or
T l T i T m exp ( k ¯ t i ) exp ( k ¯ t m ) t l = T i T i T m exp ( k ¯ t i ) exp ( k ¯ t m ) t i .
Maybe it is not k = k ¯ , but taking k as the smallest real number in ( k , k ] for which there exists such an l, we are done. □
Corollary 1.
The maps k a k , k b k and k f k ( t ) are continuous.
Lemma 4.
Let T , t R n . There exists exactly one line r ( t ) = a t + b such that
T i ( a t i + b ) = a t j + b T j = T m ( a t m + b ) = δ T ( a t + b )
for some 1 i < j < m n and δ = ± 1 , and this line approximates T better than any other line.
Proof. 
It is a particular case of the Chebyshev’s Alternation Theorem, applied to the polygonal defined by ( t , T ) . □
Remark 6.
Thanks to Lemma 4, we can define which vectors T will be our “good vectors”: those for which a < 0 and the equalities (8) hold with δ = 1 and not with δ = 1 . When data fulfil these conditions, we have some idea of decreasing monotonicity and also some kind of convexity, and this is the kind of dataset that we wanted, though we will need to add some further conditions. Anyway, when dealing with datasets that fulfil any couple of symmetric conditions, we just need to have in mind the symmetries. Specifically, they will behave as in Section 3.1.
Definition 2.
Let r ( t ) = a t + b be the line that best approximates ( t , T ) . We will say that ( t , T ) is admissible when a < 0 and there exist 1 i < j < m n such that
1.
T i r ( t i ) = r ( t j ) T j = T m r ( t m ) = T r ( t ) .
2.
T r ( t ) r ( t l ) T l < T r ( t ) for every l < i and every l > m .
3.
T r ( t ) T l r ( t l ) < T r ( t ) for every i < l < m .
Once we have stated the kind of data which we will focus on, say discretely decreasing and convex, now we have to determine when they will be approximable. Before that, we will study the behavior of the limits of best approximations.
Lemma 5.
Let t 1 < t 2 < t 3 . For each k 0 , consider some exponential g k ( t ) = a k exp ( k t ) + b k and
ψ ( k ) = g k ( t 1 ) g k ( t 2 ) g k ( t 2 ) g k ( t 3 ) .
Then ψ ( k ) depends on k but not on a k or b k , and moreover:
1.
When k , ψ ( k ) .
2.
When k 0 , lim ( ψ ( k ) ) = t 1 t 2 t 2 t 3 .
3.
When k , lim ( ψ ( k ) ) = 0 .
Proof. 
We only need to make some elementary computations to show that
g k ( t 1 ) g k ( t 2 ) g k ( t 2 ) g k ( t 3 ) = exp ( k t 1 ) exp ( k t 2 ) exp ( k t 2 ) exp ( k t 3 ) .
The computation of the limit at 0 only needs a L’Hôpital’s rule application, and the other ones are even easier once one substitutes z = exp ( k ) . See [1] (lemma 2.10). □
Proposition 2.
Let T , t R n . Then, the following hold:
1.
For k 0 0 , lim k k 0 f k ( t ) = f k 0 ( t ) .
2.
For k 0 = 0 , lim k k 0 f k ( t ) is r ( t ) , the line that best approximates ( t , T ) .
3.
For k 0 = , f ( t ) = lim k f k ( t ) takes at most two values, and fulfils
( f ( t ) ) 1 = ( f ( t ) ) 2 = = ( f ( t ) ) n 1 .
4.
For k 0 = , f ( t ) = lim k f k ( t ) takes at most two values, and fulfils
( f ( t ) ) 2 = ( f ( t ) ) 3 = = ( f ( t ) ) n .
Proof. 
Let k 0 0 . If the best approximation for k 0 is a constant, then it is constant for every k 0 , and the constants are obviously the same. Therefore, we may suppose f k is not a constant for any k 0 . In this case, Lemma 3 implies that k f k ( t l ) is continuous for every l. As we have just a finite amount of indices, this means that lim k k 0 f k ( t ) = f k 0 ( t ) , so we are done.
The proof of the three last items is immediate from Lemma 5. □
Proposition 3.
Let t = ( t 1 , t 2 , t 3 , t 4 ) and T = ( T 1 , T 2 , T 3 , T 4 ) . Then, the best exponential approximation to ( t , T ) has the form f ( t ) = a exp ( k t ) + b with a > 0 , k < 0 if and only if ( t , T ) is admissible and the following does not happen:
T 1 = M ( T ) and the second greatest value of T is attained after M ( T ) .
Proof. 
As the second greatest value of T will appear frequently in this proof, we will denote it as M T = max { T i : i = 2 , 3 , 4 } . Analogously, m T = min { T i : i = 2 , 3 , 4 } .
If ♠ happens, then the following expression is the limit of best approximations when k
f ( t ) = T 1 ( M T M ( T ) ) 2 , ( M ( T ) + M T ) 2 , ( M ( T ) + M T ) 2 , ( M ( T ) + M T ) 2 .
Indeed, as f ( t ) is the pointwise limit of functions fulfiling (2), it must fulfil (2) as well. It is clear that this implies that f ( t ) must be as in (9). It is clear that every strictly decreasing function approximates ( t , T ) worse than f ( t ) , so we have finished the first part of the proof.
Conversely, if ( t , T ) is admissible, then there are exponentials with a > 0 , k < 0 that approximate ( t , T ) better than the line r ( t ) = f 0 ( t ) . Indeed, we only have to consider the three points of the Definition 2 and take into account Lemma 3. As the function error is quasiconvex, the only option for contradicting the statement is that every exponential is worse than the limit of the approximations f k , and of course this limit is not better than f ( t ) as in (9) because no vector of the form ( x , y , y , y ) approximates T better than this. Therefore, we may suppose f ( t ) is the best approximation—recall that we are supposing that ( t , T ) is admissible. We need to break down several possibilities:
I:
If T 1 [ m T , M T ] , then we can change the first coordinate of f ( t ) from T 1 + ( M T M ( T ) ) / 2 to ( M T + M ( T ) ) / 2 without increasing the error, so one best approximation is a constant, and this means that a = 0 , so ( t , T ) is not admissible, a contradiction.
II:
If T 1 < m T , then ( t , T ) is not admissible.
III:
If T 1 > M T , then we still have some options:
i:
If T 2 T 4 then we obtain that ♠ holds, no matter the value of T 3 .
ii:
If T 2 > T 4 and the rate of decreasing ( T 2 T 4 ) / ( t 4 t 2 ) is greater than ( T 1 T 3 ) / ( t 3 t 1 ) , then ( t , T ) fulfils the hypotheses of Lemma 2. This implies that the best approximation to ( t , T ) has a > 0 , k < 0 , so the best approximation to ( t , T ) has a < 0 , k > 0 .
iii:
If T 2 > T 4 and the rates of decreasing are equal, then ( t , T ) is not admissible because this implies
T 1 r ( t 1 ) = r ( t 2 ) T 2 = T 3 r ( t 3 ) = r ( t 4 ) T 4 .
iv:
If T 2 > T 4 and ( T 2 T 4 ) / ( t 4 t 2 ) < ( T 1 T 3 ) / ( t 3 t 1 ) , then Lemma 2 ensures that the best approximation is f k ( t ) = a exp ( k t ) + b , with a > 0 and k < 0 . □
Remark 7.
Let r ( t ) = T 1 T 1 T 3 t 1 t 3 ( t t 1 ) be the line that contains ( t 1 , T 1 ) and ( t 3 , T 3 ) . In [1] (lemma 2.10), it is seen that, if g k ( t ) = a k exp ( k t ) + b , where
a k = T 1 T 3 exp ( k t 1 ) exp ( k t 3 ) , and b = T 1 a k exp ( k t 1 ) ,
then g k ( t 1 ) = T 1 , g k ( t 3 ) = T 3 and
  • As k , g k ( t 4 ) .
  • As k , g k ( t 4 ) T 3 .
  • As k 0 , g k ( t 4 ) r ( t 4 ) .
Essentially, the same proof suffices to show how g k ( t 2 ) behaves:
  • As k , g k ( t 2 ) T 1 .
  • As k , g k ( t 2 ) T 3 .
  • As k 0 , g k ( t 2 ) r ( t 2 ) .
This implies that the map k g k ( t 2 ) is strictly increasing, while k g k ( t 4 ) is strictly decreasing. So, k g k ( t 2 ) increases as k g k ( t 4 ) decreases, and, moreover, the map ϕ : ( T 3 , T 1 ) ( , T 3 ) given by ϕ ( g k ( t 2 ) ) = g k ( t 4 ) for k 0 , and ϕ ( r ( t 2 ) ) = r ( t 4 ) is a (decreasing) homeomorphism from ( T 3 , T 1 ) to ( , T 3 ) . Applying the same reasoning to t 0 < t 1 and to t 3 < t 4 , we obtain this key result:
Proposition 4.
Let t 0 < t 1 < t 2 < t 3 < t 4 and T 1 > T 3 and consider for every k 0 the only exponential g k ( t ) = a exp ( k t ) + b such that g k ( t 1 ) = T 1 , g k ( t 3 ) = T 3 and f 0 ( t ) the only line such that g 0 ( t 1 ) = T 1 , g 0 ( t 3 ) = T 3 . Then, all the following maps are homeomorphisms, ϕ 0 and ϕ 4 are decreasing and ϕ 2 is increasing:
1.
ϕ 0 : ( , ) ( T 1 , ) defined as k g k ( t 0 ) .
2.
ϕ 2 : ( , ) ( T 3 , T 1 ) defined as k g k ( t 2 ) .
3.
ϕ 4 : ( , ) ( , T 3 ) defined as k g k ( t 4 ) .
We can rewrite Proposition 4 as follows:
Remark 8.
Let t = ( t 0 , t 1 , t 2 , t 3 , t 4 ) and α 1 > α 3 R . Let, for every k R , g k ( t ) = c k exp ( k t ) + d k be the only exponential that fulfils g k ( t 1 ) = α 1 , g k ( t 3 ) = α 3 . Then, when k increases, g k ( t 0 ) and g k ( t 4 ) decrease and g k ( t 2 ) increases and everything is continuous.
Proposition 5.
The best exponential approximation (including limits) to ( t , T ) is the best approximation for some quartet ( ( t i 1 , t i 2 , t i 3 , t i 4 ) , ( T i 1 , T i 2 , T i 3 , T i 4 ) ) .
Proof. 
Let f k 0 be the best approximation, and suppose that the conclusion does not hold. Then, we may suppose that there are exactly three indices where the norm is attained, say i < j < m and
T i f k 0 ( t i ) = f k 0 ( t j ) T j = T m f k 0 ( t m ) = T f k 0 ( t ) .
If f k 0 ( t ) is the limit at of the best approximations, then it is the best approximation for every quartet that contains ( ( t i , t j , t m ) , ( T i , T j , T m ) ) because this means that ♠ holds. Therefore, suppose that the best approximation is f k 0 , for some k 0 R – maybe k 0 = 0 . Then, for some ε > 0 the functions f k , with k ( k 0 ε , k 0 ) approximate this triple better than f k 0 . Reducing if necessary ε , Remark 8 implies that every f k with k ( ε , 0 ) approximates ( t , T ) better than f k 0 , thus getting a contradiction. □
Theorem 1.
Let ( t , T ) be admissible. Then, the best approximation is a exponential if and only if ♠ does not happen.
Proof. 
The proof of Proposition 3 is enough to see that ♠ avoids the option of ( t , T ) being approximable by a best exponential.
If ( t , T ) is admissible, then the best approximation cannot be the 0-limit of exponentials, so it is either an exponential or the -limit of exponentials. So, suppose it is the -limit and let us see that in this case ♠ holds. It is clear that T 1 > M T = max { T 2 , , T n } as in the proof of Proposition 3, so just need to show that M T occurs later than M ( T ) . Let m T = min { T 2 , , T n } . A moment’s reflection suffices to realize that f ( T m ) = ( M T + m T ) / 2 for every m 2 , so the error for f is exactly r = ( M T m T ) / 2 . Let T i be the last appearance of M T and T j the first appearance of m T , and suppose i < j , i.e., that ♠ does not hold. Thanks to Proposition 4, for small ε > 0 , there is k close enough to that we can find g k ( t ) = a exp ( k t ) + b such that | g k ( t 1 ) T 1 | < r , f ( T m ) < g k ( t m ) < f ( T m ) + ε when m { 2 , , j 1 } and f ( T m ) > g k ( t m ) > f ( T m ) ε when m { j , , n } . If we take ε small enough, g k approximates ( t , T ) better than f . □
The value of b in (3) can be easily generalised, so we do not need to worry about it. If we are able to determine k and a k , then finding b is just a straightforward computation. Namely, the following Lemma solves it:
Lemma 6.
For k ( , 0 ) , a ( 0 , ) , the best approximation to T in { a exp ( k t ) + b : b R } is attained when
b = 1 2 ( M ( T a exp ( k t ) ) + M ( T a exp ( k t ) ) .
With this b, the error is
1 2 ( M ( T a exp ( k t ) ) M ( T a exp ( k t ) ) .
Proof. 
First, we compute the error. Since, obviously,
M ( | T a exp ( k t ) b | ) = max { M ( T a exp ( k t ) b ) , M ( T a exp ( k t ) b ) } ,
we just need to take into account that (10) implies
M ( T a exp ( k t ) b ) = M ( T a exp ( k t ) ) b = M ( T a exp ( k t ) ) 1 2 ( M ( T a exp ( k t ) ) + M ( T a exp ( k t ) ) ) = 1 2 ( M ( T a exp ( k t ) ) M ( T a exp ( k t ) ) ) .
M ( T a exp ( k t ) b ) = M ( T a exp ( k t ) ) + b = M ( T a exp ( k t ) ) + 1 2 ( M ( T a exp ( k t ) ) + M ( T a exp ( k t ) ) ) = 1 2 ( M ( T a exp ( k t ) ) M ( T a exp ( k t ) ) ) .
On the one hand, this implies that the error is as in the statement. On the other hand, let b < b . Then,
M ( T a exp ( k t ) b ) > M ( T a exp ( k t ) b ) ,
so a exp ( k t ) + b approximates T worse than a exp ( k t ) + b . The same happens with M ( T a exp ( k t ) b ) if we take b > b , so the best approximation is the one with b as in (10). □
With this section, we have covered the theoretical aspects about the first objective of this paper. Examples in Section 5 are about Newton Law of Cooling and directly apply what have been developed here, ending this way the first objective.

5. Examples

In this section, we present two different examples. We intend to apply what has been developed in previous sections to fit exponential functions to some data.
The calculations in this section were carried out by means of a GNU Octave using an AMD Ryzen 7 3700U processor with 16 GB of RAM. The system used is an elementary OS 5.1.7 Hera (64-bit) based on Ubuntu 18.04.4 LTS with a Linux kernel 5.4.0-65-generic.

5.1. Exponential Decay in a Newton’s Law of Cooling Process

In [1], Section 4, the paper that motivated this one, we presented an example that was the beginning of our work. In this new approach we consider necessary to fit the same pattern with the same data but using a new tool: approximation through the max-norm.
We are going to use data coming from a thermometer achieving thermal balance at the bottom of the ocean. The time evolution of the temperature, according to Newton’s law of cooling process, follows an exponential function as
P ( t ) = λ 1 e k t + λ 2 ,
where λ 1 and λ 2 R and, in the considered case, k < 0 .
We implemented an algorithm to fit, by a pattern as (11), and taking the max-norm as the approximation criteria, the records obtained by the device. The results corresponding to this implementation are gathered in Table 1. Table 2 of [1] shows similar information for the same fit but using the Euclidean norm, so interested readers can compare both approximations.
In Figure 2, we present some graphical information about this approximation. Figure 2a shows observations and fit, and Figure 2b shows the relative error in this implementation. We have designed this figures to resemble [1], Figure 3 so the reader can graphically compare the results of both approximations. Taking into account that each example uses a different norm, differences in the fit must exist. Nevertheless, they both give a more than reasonable approximation.

5.2. Exponential Decay Attaining the Max-Norm in 4 Indices

We wanted to include an example to illustrate the meaning of Proposition 5. The data considered in Section 5.1 were difficult to approach with the implementation we have wrote for max-norm, which is in a very early stage. We have been able to approximate a dataset of the same nature but maybe with a more adequate distribution. For this implementation, we present in Figure 3 the four points prescribed by Proposition 5 coloured in red.

6. Economical Models and nlstac

Now we will cover the second objective: to exemplify the interest for the economic science of the algorithm presented in [1] and implemented in the R-package nlstac. The calculations in this section were carried out by the same machine as in Section 5 using RStudio instead of GNU Octave.

6.1. The Exponential Model in Demand Curves

In this example, we will use the exponential model to fit demand curves. As stated in [10], “behavioral economic demand analyses describe the relationship between the price (including monetary cost and/or effort) of a commodity and the amount of that commodity that is consumed. Such analyses have been successful in quantifying the reinforcing efficacy of commodities including drugs of abuse, and have been shown to be related to other markers of addiction”.
Different mathematical representations of demand curves have been proposed—see, for example, [3]. The most widely used model for demand curves in addiction research is presented in the following equation
log 10 Q = log 10 ( Q 0 ) + k ( e α · Q 0 · C 1 ) ,
where Q represents consumption at a given price, Q 0 is known as derived demand intensity, k is a constant that denotes the range of consumption values in log units, C is the commodity price and α is the derived essential value, a measure of demand elasticity.
This model was established by Hursh and Silberberg in [3] and has been used in many other works such as [10,11,12]. The parameters to be estimated are Q 0 , k and α .
Renaming log 10 ( Q 0 ) k as b, k as a and α · Q 0 as d, the pattern is now similar to the one we have been working in this paper:
log 10 Q = a · e d · C + b
Therefore we simply need to adjust the pattern presented in (13) to consumption data and undo the changes, with k = a , Q 0 = 10 b + k and α = d Q 0 being the parameters we originally sought.
We ran a simulation for this kind of data and successfully fitted the pattern using R package nlstac. For the simulation, we have established 15 as the number of observations, Q 0 as 48, α as 0.006 and k as 3.42 and added some noise to the pattern with mean 0 and standard deviation 0.1 . Tolerance value was set as 10 7 .
Table 2 shows the result of this TAC implementation. As can be seen, output is reasonably similar to the values we originally established. Please take into account that we added some noise to the data so differences in the parameters were expected.
In Figure 4, we can see the observations (blue dots) and the approximation (red dots). This approximation makes sense: it is in the middle of the observations, keeping the errors under control.

6.2. The Exponential Autoregressive Model

As stated in [13], “nonlinear time series models can reveal nonlinear features of many practical processes, and they are widely used in finance, ecology and some other fields”. Out of those nonlinear time series models, the exponential autoregressive (ExpAR) model is especially relevant. Given a time series { x 1 , x 2 , x 3 , } , the ExpAR model is defined as
x t = i = 1 p c i + π i e γ x t 1 2 x t i + ε t ,
where ε t are independent and identically distributed random variables and independent with x i , p denotes the system degree, t N , t > p , and c i , π i (for i = 1 , , p ) and γ are the parameters to be estimated from observations. This model can be found in, for example, [13] or [14]. We have followed the notation of the former.
Some generalizations for this model have been made, and [14] presents a wide variety of those generalizations. Teräsvirta’s model is an extension of the ExpAR model presented in [15] and used in [14]. We will focus on a generalization of Teräsvirta’s model that can be found in [14], Equation (10):
x t = c 0 + i = 1 p c i + π i e γ ( x t d z i ) 2 x t i + ε t ,
where z i (for i = 1 , , p ) are scalar parameters and d is an integer number.
We intend to fit (14) in the particular case when p = d = 2 for some data. Please observe that this problem is way beyond the proven convergence of TAC algorithm. It requires more than just fitting of a curve following some exponential function since now we have no function to be fitted because every observation depends on the previous ones. This obstacle can be overcome by looking at the problem not as a one-dimensional problem but as a two-dimensional one: if ( x 1 , , x n ) are the observations, denoting y = ( x 3 , , x n ) , x 1 = ( x 2 , , x n 1 ) , x 2 = ( x 1 , , x n 2 ) , 1 = ( 1 , n , 1 ) , z 1 = z 1 · 1 and z 2 = z 2 · 1 , data y will depend on two independent variables, x 1 and x 2 , and could be written as
y = c 0 + c 1 x 1 + π 1 x 1 e ζ ( x 2 z 1 ) 2 + c 2 x 2 + π 2 x 2 e ζ ( x 2 z 2 ) 2
where operator ζ represents the element-wise product of two vectors, that is, given ( a 1 , , a n ) , ( b 1 , , b n ) R n , ( a 1 , , a n ) ( b 1 , , b n ) : = ( a 1 · b 1 , , a n · b n ) , and where the exponential and power functions are applied coordinate-wise.
As indicated before, this new approach is far from proven in the TAC convergence; however, running nlstac package will provide us a result that stands to reason.
For the simulation, we have considered in (14) p = d = 2 . We have generated the 100 first elements of the time series setting c 0 as −1.49, c 1 as 1.65 , c 2 as 0.54 , π 1 as −0.44, π 2 as −0.84, γ as 1.3 , z 1 as 2.52 , z 2 as 3.86 , x 1 as 2.75 , x 2 as 3.1 , and tolerance as 10 7 .
In Table 3 and Table 4, we gather the results of this implementation. As can be seen, parameters are quite similar to the ones we have previously established.
In Figure 5, we can see the approximations (red dots) over the actual observations (blue dots, a bit bigger than the red ones), which indicate that the approximation is good.
This example is especially relevant because it shows us the possibility to use nlstac in a problem significantly different from the one it was intended for, so it opens the door to its use in different nonlinear time series models or even in some other models.

6.3. The Exponential Autoregressive Model. Applications to Real Data

In order to get a broader perspective about the utility of TAC in relation to the ExpAR model, we have included in this subsection an application of the ExpAR model to real data. The ExpAR model and several generalization has been used in [5] as the fitting model for real data from S&P500 and several other indices.
For this application we have used the S&P500 index, which is a stock market index that measures the stock performance of 500 large companies listed on stock exchanges in the United States. It is often thought to be a good representation of the United States stock market.
We have considered the first differences of the daily close values on S&P500 from 1 January 2000 until 31 December 2020 as the data. These data are public and can be consulted in https://finance.yahoo.com ( accessed on 31 March 2021).
We will present a couple of examples where the same data are processed through two different generalizations of the ExpAR model. In both implementations we fit the models by TAC.
For the first implementation, we have used the first-order Extended ExpAR model defined in [5], taking an order 4 polynomial:
x t = c 0 + c 1 x t 1 + i = 1 4 π i x t i i e γ x t 1 2 .
As stated in [5], when the order of the polynomial is greater than 2, the model becomes very complicated, and it is usually avoided because of its complexity. In our case, the complexity of the calculations remain virtually the same since increasing the order of the polynomial just increases the number of linear parameters, which are easily computed, but not the number of nonlinear ones.
Table 5 and Table 6 and Figure 6 gather the information about this implementation.
Once we have established that the order of the polynomial does not make the fit any more complex, let us choose a different model with different nonlinear parameters and different lags. We have chosen the following model:
x t = c 0 + i = 1 2 c i x t i + k = 1 2 π i k x t i k e γ i x t i 2 .
Now we have two nonlinear parameters, γ 1 and γ 2 , and the problem, as can be seen, is quite a bit more complex than the previous implementation.
Table 7 and Table 8 and Figure 7 gather the information about this implementation.
Again, this example shows the possibility to use nlstac in problems that are different from the ones that it was initially designed for.

7. Conclusions

Thoughout the present paper, we have been able to determine the exact conditions that some dataset need to have a best-fitting exponential function, we have found conditions that the coefficients of this exponential must fulfil if there is such a function and we have been able to show how to approximate these coefficients with the R-package nlstac.
Moreover, we have applied nlstac in a straightforward manner to a pattern provided by an economic model. Furthermore, we have challenged our method, approximating with it very different patterns given by some generalizations of the ExpAR model. Implementations use both simulated and real data. All implementations converge with reasonable computer and time of processing requirements (the hardest, 27.574 s). In all these implementations, we checked the utility of nlstac for fitting complex patterns and also checked the goodness of those fits.

Author Contributions

As can be deduced by the acknowledgments, all authors have been involved during the whole creative process of this paper. However, we would like to note that the contributions of J.C.S. have been crucial in the results involving the max-norm. This same comment can be suitable for the examples presented in this paper, where J.A.F.T. has had a predominant role. Nevertheless M.R.A. was key to obtaining the final version of the paper, connecting both major goals of this paper. All authors have read and agreed to the published version of the manuscript.

Funding

This research was partially supported by MICINN [research project references CTM2010-09635 (subprogramme ANT) and PID2019-103961GB-C21], MINECO [research project reference MTM2016-76958-C2-1-P], European Regional Development Fund and Consejería de Economía e Infraestructuras de la Junta de Extremadura [research projects references: GR18097, IB16056 and GR15152].

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not available.

Acknowledgments

We thank our workmates, who always had interesting comments or hints during coffee breaks. Each author is grateful to the rest for their good attitude, which promoted a positive working atmosphere. The endurance of Javier Cabello Sánchez has been key in this work, and the other authors are grateful to him.

Conflicts of Interest

The authors declare no conflict of interest.

Abbreviations

The following abbreviations are used in this manuscript:
ExpARExponential autoregressive model
TACSpanish for CT scan
S&P500Standard & Poor’s 500

References

  1. Fernández Torvisco, J.A.; Rodríguez-Arias Fernández, M.; Cabello Sánchez, J. A new algorithm to fit exponential decays. Filomat 2018, 32, 4233–4248. [Google Scholar] [CrossRef]
  2. Rodríguez-Arias, M.; Fernández, J.A.; Cabello, J.; Benítez, R. R Package nlstac. Version 0.1.0. 2020. Available online: https://CRAN.R-project.org/package=nlstac (accessed on 31 March 2021).
  3. Hursh, S.; Silberberg, A. Economic Demand and Essential Value. Psychol. Rev. 2008, 115, 186–198. [Google Scholar] [CrossRef] [PubMed]
  4. Franses, P.H.; Dijk, D.V. Non-Linear Time Series Models in Empirical Finance; Cambridge University Press: Cambridge, UK, 2000. [Google Scholar] [CrossRef]
  5. Katsiampa, P. Nonlinear Exponential Autoregressive Time Series Models with Conditional Heteroskedastic Errors with Applications to Economics and Finance. Ph.D. Thesis, Loughborough University, Loughborough, UK, 2015. [Google Scholar]
  6. Greenberg, H.J.; Pierskalla, W.P. A Review of Quasi-Convex Functions. Oper. Res. 1971, 19, 1553–1570. [Google Scholar] [CrossRef]
  7. Lorentz, G. Approximation of Functions; Chelsea Pub. Co: New York, NY, USA, 1986; ISBN 0828403228. [Google Scholar]
  8. Poreda, S. Complex Chebyshev alterations. Pac. J. Math. 1972, 40, 197–199. [Google Scholar] [CrossRef] [Green Version]
  9. Haukkanen, P.; Tossavainen, T. A generalization of Descartes’ rule of signs and fundamental theorem of algebra. Appl. Math. Comput. 2011, 218, 1203–1207. [Google Scholar] [CrossRef]
  10. Koffarnus, M.; Franck, C.; Stein, J.; Bickel, W. A Modified Exponential Behavioral Economic Demand Model to Better Describe Consumption Data. Exp. Clin. Psychopharmacol. 2015, 23. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  11. Christensen, C.; Silberberg, A.; Hursh, S.; Roma, P.; Riley, A. Demand for Cocaine and Food over Time. Pharmacol. Biochem. Behav. 2008, 91, 209–216. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  12. Strickland, J.; Lile, J.; Rush, C.; Stoops, W. Comparing exponential and exponentiated models of drug demand in cocaine users. Exp. Clin. Psychopharmacol. 2016, 24, 447–455. [Google Scholar] [CrossRef] [PubMed]
  13. Xu, H.; Ding, F.; Yang, E. Modeling a nonlinear process using the exponential autoregressive time series model. Nonlinear Dyn. 2019, 95. [Google Scholar] [CrossRef]
  14. Chen, G.Y.; Gan, M.; Chen, G.L. Generalized Exponential Autoregressive Models for Nonlinear Time Series: Stationarity, Estimation and Applications. Inf. Sci. 2018, 438. [Google Scholar] [CrossRef]
  15. Teräsvirta, T. Specification, Estimation, and Evaluation of Smooth Transition Autoregressive Models. J. Am. Stat. Assoc. 1994, 89, 208–218. [Google Scholar] [CrossRef]
Figure 1. In blue, the points, in black the best approximation and in green the upper and lower borders of the narrowest band that contains ( t , T ) . The band has constant width.
Figure 1. In blue, the points, in black the best approximation and in green the upper and lower borders of the narrowest band that contains ( t , T ) . The band has constant width.
Mathematics 09 00862 g001
Figure 2. Some graphical aspects of this TAC implementation. In the numerical analysis bibliography, relative error is defined with or without sign; in this paper, we will consider the latter. A spike can be seen in the small window of (b). This spike should not be considered as an indicator of a poor adjustment of the curve to the data. On the contrary: the spike is due to the proximity of the data to zero; however, the error remains bounded. This is because curve and data are close enough to control the fact that we are virtually dividing by zero.
Figure 2. Some graphical aspects of this TAC implementation. In the numerical analysis bibliography, relative error is defined with or without sign; in this paper, we will consider the latter. A spike can be seen in the small window of (b). This spike should not be considered as an indicator of a poor adjustment of the curve to the data. On the contrary: the spike is due to the proximity of the data to zero; however, the error remains bounded. This is because curve and data are close enough to control the fact that we are virtually dividing by zero.
Mathematics 09 00862 g002
Figure 3. Blue dots represent differences between T and f k ( t ) . In 4 dots, M ( T f k ( t ) ) and M ( T f k ( t ) ) are reached, and we have colored them in red. Those are the 4 points mentioned in Proposition 5. Please observe how the maxima and the minima are alternatively reached.
Figure 3. Blue dots represent differences between T and f k ( t ) . In 4 dots, M ( T f k ( t ) ) and M ( T f k ( t ) ) are reached, and we have colored them in red. Those are the 4 points mentioned in Proposition 5. Please observe how the maxima and the minima are alternatively reached.
Mathematics 09 00862 g003
Figure 4. Observations in blue, approximation in red.
Figure 4. Observations in blue, approximation in red.
Mathematics 09 00862 g004
Figure 5. Observations in blue, approximation in red (smaller circle). Please observe how each approximation lays over the actual observation.
Figure 5. Observations in blue, approximation in red (smaller circle). Please observe how each approximation lays over the actual observation.
Mathematics 09 00862 g005
Figure 6. First differences in black, approximation in red. Implementation using pattern (16).
Figure 6. First differences in black, approximation in red. Implementation using pattern (16).
Mathematics 09 00862 g006
Figure 7. First differences in black, approximation in red. Implementation using pattern (17).
Figure 7. First differences in black, approximation in red. Implementation using pattern (17).
Mathematics 09 00862 g007
Table 1. Result of implementation of TAC (Spanish for CT scan).
Table 1. Result of implementation of TAC (Spanish for CT scan).
CPU Time (in Seconds)k λ 1 λ 2
0.31419 −0.0026042 5.7259032 −1.3743464
Table 2. Result of implementation of nlstac for pattern (12). RSS denotes residual sum of squares, and M S E = R S S / n where n = 15 is the number of observations.
Table 2. Result of implementation of nlstac for pattern (12). RSS denotes residual sum of squares, and M S E = R S S / n where n = 15 is the number of observations.
CPU Time (in Seconds) Q 0 k α RSSMSE
0.345 47.74341 3.479838 0.005514662 0.0799227 0.00532818
Table 3. Result of implementation of nlstac for pattern (14).
Table 3. Result of implementation of nlstac for pattern (14).
CPU Time (in Seconds) c 0 c 1 c 2 π 1 π 2
27.574 −1.5188868 1.6530616 0.5556431 −0.4445339−0.8514089
Table 4. Result of implementation of nlstac for pattern (14), with RSS being residual sum of squares and M S E = R S S / n where n = 98 is the number of observations.
Table 4. Result of implementation of nlstac for pattern (14), with RSS being residual sum of squares and M S E = R S S / n where n = 98 is the number of observations.
γ z 1 z 2 RSSMSE
1.2729767 2.5142174 3.8667688 2.157779 × 10 6 2.201815 × 10 8
Table 5. Result of implementation of nlstac for pattern (16) taking a tolerance of 10 12 , the number of divisions as 50 and [ 0 , 0.01 ] as the interval where to seek the nonlinear parameter γ .
Table 5. Result of implementation of nlstac for pattern (16) taking a tolerance of 10 12 , the number of divisions as 50 and [ 0 , 0.01 ] as the interval where to seek the nonlinear parameter γ .
CPU Time (in Seconds) π 1 π 2 π 3 π 4
10.39 2.064385 × 10 12 2.015606 × 10 3 23.08854 6.210421 × 10 9
Table 6. Result of implementation of nlstac for pattern (16), RSS being the residual sum of squares and M S E = R S S / n where n = 5282 is the number of observations.
Table 6. Result of implementation of nlstac for pattern (16), RSS being the residual sum of squares and M S E = R S S / n where n = 5282 is the number of observations.
γ c 0 c 1 RSSMSE
1.118422 × 10 11 −1.300912−2.064385 × 10 12 2,104,829 398.49
Table 7. Result of implementation of nlstac for pattern (17) taking a tolerance of 10 12 , the number of divisions as 10 and [ 0 , 10 4 ] and [ 2 × 10 4 , 10 3 ] as the intervals where to seek, respectively, the nonlinear parameters γ 1 and γ 2 .
Table 7. Result of implementation of nlstac for pattern (17) taking a tolerance of 10 12 , the number of divisions as 10 and [ 0 , 10 4 ] and [ 2 × 10 4 , 10 3 ] as the intervals where to seek, respectively, the nonlinear parameters γ 1 and γ 2 .
CPU Time (in Seconds) π 11 π 12 π 21 π 22 c 0
24.376 2.588434 1.954240 × 10 3 −0.1454913 5.582754 × 10 3 −2.258932
Table 8. Result of implementation of nlstac for pattern (17), RSS being residual sum of squares and M S E = R S S / n where n = 5281 is the number of observations.
Table 8. Result of implementation of nlstac for pattern (17), RSS being residual sum of squares and M S E = R S S / n where n = 5281 is the number of observations.
γ 1 γ 2 c 1 c 2 RSSMSE
2.891373 × 10 6 3.649545 × 10 4 −2.676104 8.950874 × 10 2 2,101,326 397.90
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Cabello Sánchez, J.; Fernández Torvisco, J.A.; Arias, M.R. TAC Method for Fitting Exponential Autoregressive Models and Others: Applications in Economy and Finance. Mathematics 2021, 9, 862. https://doi.org/10.3390/math9080862

AMA Style

Cabello Sánchez J, Fernández Torvisco JA, Arias MR. TAC Method for Fitting Exponential Autoregressive Models and Others: Applications in Economy and Finance. Mathematics. 2021; 9(8):862. https://doi.org/10.3390/math9080862

Chicago/Turabian Style

Cabello Sánchez, Javier, Juan Antonio Fernández Torvisco, and Mariano R. Arias. 2021. "TAC Method for Fitting Exponential Autoregressive Models and Others: Applications in Economy and Finance" Mathematics 9, no. 8: 862. https://doi.org/10.3390/math9080862

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop