**Under Construction**

**This is not investment advice, there is no implication of any guarantee. All investment is risky and you should take advice from actual advisors. EDUCATION ONLY.**

- Definition
- Descriptive Analytics
- Diagnostic Analytics
- Predictive Analytics
- Prescriptive Analytics
- Moving Average
- Hot Take
- Formulae
- Moving Average
- Python Code
- Moving Average

## Definition

The prediction of future analytical performance. In these cases, primarily around the logistics aspects of business.

Most organizations will have an analytics slide that maps out the various stages of analysis a corporation will typically progress through. Some people get fancy and will add a stage here or there, but let’s stick to basics.

### Descriptive Analytics

Imagine a dashboard that displays KPIs. Descriptive analytics is the creation of reporting that describes what is going it. It doesn’t *tell you* what’s wrong, but it does give you a digestible output so you can see the patterns.

### Diagnostic Analytics

Diagnostic Analytics answers the question, “why?” Delving into data, mining it, figuring out correlations, and doing scientific studies. This form of analytics gives you actionable insights that will help guide you to optimizing your experiences. Being said, it works off historic data, so it will not tell you what will happen in the future.

### Predictive Analytics

Predictive analytics focuses on understanding how things will perform in the future. Also the primary area we will be addressing: forecasting, Regression analysis, data science, and algorithms live in this domain. It will help you to decide likely performance. Now it can’t accommodate every variable, and it will naturally become less accurate the longer out you attempt to predict.

### Prescriptive Analytics

Prescriptive analytics involves prescribing you courses of action based on predicted future patterns. Typically a pipedream unless you have powerful and reliable sources of data. Examples would be phone apps that predict when your food will arrive based on your distance from the restaurant, driver performance, and traffic patterns.

### Moving Average

Takes the average of a given period and predicts the future value.

## Hot Take

Understanding predictive analysis is a foundational notion at this point for anyone serious about analysis. The concepts of regression analysis, k-nearest, the train / test / validate cycle, supervised vs unsupervised learning, and the different types of ML models provided in many free Python packages are very valuable tools.

Being said, there are degrees to which you can be effective. For someone like myself without a math degree, I can use almost any model once I have the data configured to its requirements, however to effectively tweak it for both mathematical validity and accuracy can be beyond the skills of someone with a common college education. When you get to neural networks and deep learning, which require concepts of multivariable calculus, you start to trend off the rails a bit.

I enjoy the field as a layman however. Basic regressive forecasting is as easy as a few button presses in excel, however truly understanding it can provide some very useful heuristics applicable to many fields.

I’ve done this exercise a few times. Personal study, datacamp.com, and courses I’ve taken have all lead down the routes of regression analysis, visualization, and prediction. For this implementation I’m going with this book.

## Formulae

### Moving Average

- ft forecast period for t
- n number of periods to take the average of
- dt demand during period t

## Python Code

### Moving Average

```
import numpy as np
import pandas as pd
def move_av(d, periods=1, n=3):
cols = len(d)
d = np.append(d,[np.nan]*periods)
f = np.full(cols+periods,np.nan)
for t in range(n,cols):
f[t] = np.mean(d[t-n:t])
f[t+1] = np.mean(d[t-n+1:t+1])
df = pd.DataFrame.from_dict({'Demand':d,'Forecast':f,'Error':d-f})
return df
d = [27,18,17,12,18,16,19,17,12,15,15, 11,18,15,13,15,13,15,11,13,10,12]
df = move_av(d, periods=8, n=3)
df[['Demand','Forecast']].plot(figsize = (9,4), title='Moving Av', ylim=(0,30), style=['-','--'])
```