# Simple Binary Series prediction

11 views (last 30 days)
Fabio Galicia on 22 Jul 2016
Answered: Jaynik on 20 Jul 2024
I am trying to extract single binary patterns to be able to predict the next estate. The data normally renders simple patterns, for instance:
1 0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 0 0 0
I am using a LS-Support Vector Machine for more complex problems, but I guess there is a simpler and more elegant way to predict a simple binary series like this one? I am quite new to Matlab. Thanks!

Jaynik on 20 Jul 2024
Hi,
One method for simple binary series is using Autoregressive Integrated Moving Average (ARIMA) models, which are often used in time-series prediction.
Following is a simple example of how you might use an ARIMA model to predict the next state of your binary series:
data = [1 0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 0 0 0];
Mdl = arima(2,0,0); % Fit the ARIMA model
EstMdl = estimate(Mdl, data');
[yF,yMSE] = forecast(EstMdl, 1, 'Y0', data'); % Predicting the next state
next_state = round(yF);
In this example, arima(2,0,0) creates an ARIMA model object representing the AR(2) model, i.e., a 2nd order autoregressive model. The estimate function fits the model to your data, and the forecast function predicts the next state based on the fitted model. The round function is used to convert the predicted value to the nearest integer (0 or 1).
Please note that the example code is very basic and might not work perfectly for your data. You might need to adjust the parameters of the model or preprocess your data to get better results. Also, ARIMA models assume that the data is stationary, which might not be the case for binary series. If the data is not stationary, we might need to use differencing or other methods to make it stationary before fitting the model.
Hope this helps!