# NxTrend - Deterministic trend in a time series

Returns values along a trend curve (e.g. linear, quadratic, exponential, etc.) at time T+m.

## Syntax

NxTrend(X, Order, Trend_type, POrder, Const, Horizon, Return_type, Alpha)

X is the univariate time series data (a one dimensional array of cells (e.g. rows or columns)).

Order is the time order in the data series (i.e. the first data point's corresponding date (earliest date=1 (default), latest date=0)).

Order Description
1 ascending (the first data point corresponds to the earliest date) (default)
0 descending (the first data point corresponds to the latest date)

Trend_type is the model description flag for the trend function (1 = Linear (default), 2 = Polynomial, 3 = Exponential, 4 = Logarithmic, 5 = Power).

Order Description
1 Linear (default)
2 Polynomial
3 Exponential
4 Logarithmic
5 Power

POrder is the polynomial order. This is only relevant for a polynomial type of trend and is ignored for all others. If missing, POrder = 1.

Const is the constant or the intercept value to fix (e.g. zero). If missing, an intercept will not be fixed and is computed normally.

Horizon is the forecast time/horizon beyond the end of X. If missing, a default value of 0 (latest or end of X) is assumed.

Return_type is a switch to select the return output (1 = Forecast value (default), 2 = Upper limit, 3 = Lower Limit, 4 = R-Squared ).

Method Description
1 Forecast value (default)
2 C.I. upper limit
3 C.I. lower limit
4 R-Squared

Alpha is the statistical significance or confidence level (i.e. alpha). If missing or omitted, an alpha value of 5% is assumed.

## Remarks

1. NxTrend supports the following trend functions:
$$\begin{cases} \mathrm{Linear} & Y_t=\alpha + \beta \times t \\ \mathrm{Polynomial} & Y_t=\alpha + \beta_1 \times t + \beta_2 \times t^2 + \cdots + \beta_N \times t^N \\ \mathrm{Exponential:} & Y_t= \alpha \times e^{\beta \times t} \\ \mathrm{Logarithm:} & Y_t= \alpha + \beta \times \ln(t) \\ \mathrm{Power:} & Y_t= \alpha \times t^{\beta} \\ \end{cases}$$
2. For exponential and logarithmic trends, the intercept value is not permitted to be fixed, and thus is ignored.
3. The Excel trend built-in function (i.e. "TREND") is a different function, not part of NumXL, and should not be confused with NxTrend.
4. The polynomial order argument must be a positive integer.
5. The trend function's coefficients that best fit your data are estimated using the "least squares" method.
6. The time series may include missing values (e.g. #N/A) at either end.

## Examples

Example 1:

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
A B C
Date Data
January 10, 2008 -0.30 #N/A
January 11, 2008 -1.28 #N/A
January 12, 2008 0.24 #N/A
January 13, 2008 1.28 0.09
January 14, 2008 1.20 1.55
January 15, 2008 1.73 1.90
January 16, 2008 -2.18 2.34
January 17, 2008 -0.23 0.29
January 18, 2008 1.10 0.08
January 19, 2008 -1.09 0.54
January 20, 2008 -0.69 -0.04
January 21, 2008 -1.69 -0.29
January 22, 2008 -1.85 -0.80
January 23, 2008 -0.98 -1.23
January 24, 2008 -0.77 -1.29
January 25, 2008 -0.30 -1.28
January 26, 2008 -1.28 -1.15
January 27, 2008 0.24 -1.27
January 28, 2008 1.28 -1.03
January 29, 2008 1.20 -0.61
January 30, 2008 1.73 -0.28
January 31, 2008 -2.18 0.10
February 1, 2008 -0.23 -0.30
February 2, 2008 1.10 -0.29
February 3, 2008 -1.09 -0.07
February 4, 2008 -0.69 -0.22
February 5, 2008 -1.69 -0.30
February 6, 2008 -1.85 -0.51
February 7, 2008 -0.98 -0.72