# Forecasting if the next number is higher or lower

how will I know (or are there any math formulas) if the next number will be higher or lower based on a given set of numbers?

Like:

46,73,29,12,04,27,28,81,62 - Next number is higher or lower?

I'd also like to know the probability or percentage of each of the 2?

Please help me guys.

• Welcome to Cross Validated! Depends what assumptions you're willing to make; & what assumptions are sensible depends on where the numbers come from. Can you edit your question to add some context? – Scortchi - Reinstate Monica Feb 11 '16 at 10:27
• Probability of being higher or lower given what? Given only previous number, or the whole set? – Tim Feb 11 '16 at 10:43
• You need to know something about the underlying process, otherwise I could fit a polynomial 8th degree to this data. – Aksakal Feb 11 '16 at 14:03
• Scortchi - actually I don't have any assumptions to it. I just need to know if the next number is going to be higher or lower than the last number in the set. Tim - based on the set of numbers given above. – Alvin Feb 11 '16 at 17:42

## 2 Answers

Color your vector of numbers in such way that red color marks $\color{red}{\text{higher}}$ and blue color marks $\color{blue}{\text{lower}}$ number than the preceding one:

$$\color{black}{46}, \color{red}{73}, \color{blue}{29}, \color{blue}{12}, \color{blue}{4}, \color{red}{27}, \color{red}{28}, \color{red}{81}, \color{blue}{62}$$

first number is left black as we do not know it's history. Now count the changes in pairs of numbers: how often red precedes blue, red precedes red, blue precedes red, blue precedes red.

$$\begin{array}{cc} & \color{blue}{\text{lower}} & \color{red}{\text{higher}} \\ \color{blue}{\text{lower}} & 2 & 1 \\ \color{red}{\text{higher}} & 2 & 2 \\ \end{array}$$

Now you know that given your data, conditional probabilities are easy to calculate, for example

$$\Pr(X_i = \color{red}{\text{higher}} ~|~ X_{i-1} = \color{blue}{\text{lower}}) = 1/3$$

since there were three cases when previous value was lower and only in one case it was followed by a change to higher value.

This gives you the exact answer to the question about probability of increase or decrease given the previous value in the series. Unfortunately, it discards whole a lot of information in the data (the actual values). If you need something more complicated you should look at time series forecasting models. The same, if you have any background knowledge about the process that generated the data, you could use it to build more precise model of the series behavior. However if you know nothing about the numbers and the only thing that you have are very short vectors of numbers (as in your example), than you probably don't have enough data to build more complicated model than something like the approach described above.

• I'll try this one out. – Alvin Feb 11 '16 at 17:40

Not sure what you mean.

If those figures are not randomly generated and closely relate to real world i.e. monthly sales of a company, yhen you can make them a time series object and use models to forecast sales next month. ARIMA or AR model will do.

• I'll be reading more into it. – Alvin Feb 11 '16 at 17:41