Which brings us to business forecasting and by business forecasting, I'm talking about the process of making forecasts or predicting the future business events, and this forecasting relies on historical data and forecasting techniques. One important thing to note that even though there are these standardized processes or methods to analyze historical data, forecasting does require managerial oversight. So you as a manager will have to ensure that the forecasting techniques are correct, the choice of techniques are correct, and they are implemented appropriately to avoid any constantly errors. So let's begin on some of the empirical notions of business forecasting. Before we go there, we first need to know what is time series data, time series data. That's the first thing we have to understand. Time series data is a collection of numerical data collected at regular intervals, at regular intervals. We have here an example of the closing prices from the SPY from May 2019 the 21st through the 28th. As you can see this is an example of five data points. They're closing prices. It's time-series data. So we have data from the 21st, the 22nd, 23rd, the 24th, and the 28th. They are at regular intervals, they're daily prices. But note here that from the 24th to the 28th is a long weekend here in the United States so there's a three-day gap. But for all intents and purposes they're regularly sequential pieces of data. We don't want to use data that has big gaps like a month missing of daily data or gaps in yearly data and things like that because that would skew our results. So the important thing here is that the data is occurring at regular time intervals. So here is the example in R. The first two lines of code here are to load the two libraries. One is the forecasting libraries that has the commands for a lot of time series analysis, and the FMA data which has a lot of datasets for us to play with. Then from that table, let's run this. So that'll load the Libraries. I had these prices that I showed you in the slides of the five closing prices and I put them here in a column vector and I put them into a variable named spy. So I create the column vector, I hit Enter, there it is. As you can see down below, there are the five prices. We have here a small little R program to demonstrate what is a time series and how to create one in the R programming environment. The first two lines here are our libraries. The first one loads commands associated with time-series data, and the second one has a lot of data examples for us to play with. So here is the vector of closing prices. As you can see, I typed them into a column vector and I'm going to put that into the variable spy. I run the code and there it is. But in time-series data, it's sometimes nice to take a column vector and put it into a data structure called a time series. The command for that is simply ts and then you put the data inside the parentheses. We're going to name it spy time series, and there it is. Now we can look at it. The difference between the column vector appear versus the time series data. Is that it gives you a start and end and the frequency which is a one. A one usually means regular intervals periodical versus four or four which means quarterly, etc. So let's make a plot. We can use the normal plot command in R and there it is, or we can use this autoplot command, which I'll be using more often, that's works better with time series data. As you can see, it looks pretty similar. There is some aesthetic differences, but some of the functionality as we go forward will be apparent in the autoplot. So there is time series data, and you can see that it's trending downwards. Here's another one for coal that's pre-installed in that library. It is time-series data and here you can see it ranges from 19, 20 to 25. The first five elements and here are the values of coal production. This head command if you have a big dataset will just show you the top five rows. You can specify the number of rows which I did here in line 27. To show the first 10 lines of code, you can change that perimeter as you see fit. Then here is the plot command. So let's take a look at that. There you go. There's some time series data it occurs at regular intervals and the values are listed on the left hand on the y-axis. Just from the simple graph, we can notice some things that we might be interested in. We can see a drop-off early in 1932 down here. We can see a peak in 47 up here. It's a little unclear if there is an upward trend or a downward trend over the 50-year period, but just visualizing the data gives us a lot of insight. I've uploaded a link to get the actual raw data if you're interested in looking at the table of data. But that concludes this session about what is time series data.