In machine learning, the Logistic Regression algorithm is used for classification problems. It provides an output that we can interpret as a probability that a new observation belongs to a certain class. Generally, logistic regression is used to classify binary classes but works on multiple and ordinal classes too. Logistic regression estimates a continuous quantity […]

# Statistics

## ARIMA Modelling – Identify Model for a Time Series

The first step is to identify a possible model for a given time series. To do so, we need three things: a time series plot of the data, ACF plot and the ACF plot. Analysis of these three plots can help us fairly identify the suitable model. Observing the Time Series Plot The very first […]

## ARIMA Modelling in R

We now have a fair idea about how we can use ARIMA modelling in R to estimate and forecast a time series. This is also called the Box–Jenkins method, named after the statisticians George Box and Gwilym Jenkins, that applies autoregressive moving average (ARMA) or autoregressive integrated moving average (ARIMA) models to find the best fit of a time-series […]

## Forecasting with AutoRegressive (AR) Model in R

Now that we know how to estimate the AR model using ARIMA, we can create a simple forecast based on the model. Step 1: Fit the model The first step is to fit the model as ARIMA(1, 0, 0). We have already seen this in the previous lesson.

1 |
> msft_ar<-arima(msft_ts,c(1,0,0)) |

Step 2: Create Forecast We can now […]

## Estimating AutoRegressive (AR) Model in R

We will now see how we can fit an AR model to a given time series using the arima() function in R. Recall that AR model is an ARIMA(1, 0, 0) model. We can use the arima() function in R to fit the AR model by specifying the order = c(1, 0, 0). We will perform the estimation using the msft_ts time series that […]

## AutoRegressive (AR) Model in R

AutoRegressive (AR) model is one of the most popular time series model. In this model, each value is regressed to its previous observations. AR(1) is the first order autoregression meaning that the current value is based on the immediately preceding value. We can use the arima.sim() function to simulate the AutoRegressive (AR) model. Note that model argument […]

## Simulate Random Walk (RW) in R

When a series follows a random walk model, it is said to be non-stationary. We can stationarize it by taking a first-order difference of the time series, which will produce a stationary series, that is, a Zero Mean White Noise series. For example, the stock prices of a stock follow a random walk model, and […]

## Autocorrelation in R

Autocorrelation is an important part of time series analysis. It helps us understand how each observation in a time series is related to its recent past observations. When autocorrelation is high in a time series, it becomes easy to predict their future observations. Let us consider the Microsoft stock prices for the year 2016, which […]

## Differencing and Log Transformation

Removing Variability Using Logarithmic Transformation Since the data shows changing variance over time, the first thing we will do is stabilize the variance by applying log transformation using the log() function. The resulting series will be a linear time series. Removing Linear Trend We will now perform the first difference transformation [z(t) – z(t-1)] to our series to remove […]

## Transforming a Series to Stationary

Most financial and economic times series are not stationary. Even when you adjust them for seasonal variations, they will exhibit trends, cycles, random walk and other non-stationary behavior. We can use a variety of techniques to make a non-stationary series stationary depending on the kind of non-stationary behavior present in the series. The two techniques […]