I have a data from last 28 years about the yield of cornstover on different states. I want to make a prediction for next year using this data. I am entirely new on time series model and don't know about fitting the data on a multivariate model and predict to consider the correlation of yield of neighboring states. Simple MATLAB code to predict the data for future time period using historical data will be appreciated.


1 Answer 1


and welcome to CrossValidated!

So, the data which you're working with is composed of the same type of variable (cornstover yield) and it's multivariate in the sense that you have yields for each state. Hopefully it's reduced to a per-acre/section/hectare metric; otherwise you may run into trouble later. If it's not, I would highly recommend finding a way to normalize it into a per-unit-area quantity.

Perhaps the simplest type of time series model is the auto-regressive model. Much like linear regression, it regards the output as a sum of terms with coefficients. In this case, the regression is done on the time series itself. Thus, the output for the next time step is going to be the sum of the previous time steps, with each term multiplied by a different coefficient. The equation for this looks like the following:

$ X_{t+1} = \alpha_1 X_{t} + \alpha_2 X_{t-1}+ \alpha_3 X_{t-2}...$

We can use as many of these $\alpha$ coefficients as we like--the number of timesteps that we think contribute to the next timestep is a parameter of the model which we have to choose. Again, this is the autoregressive (AR) model.

Now, since you also have time series data from other states, you can incorporate this as well. We would call this exogenous data in our model because it is not taken directly from our first time series. The autoregressive-exogenous (ARX) model would be a good first method for predicting the time series under consideration with this new information. The formula for this model is very similar to the previous one, except there are also new sets of coefficients and terms from the other time series which we think have correlations with the main time series of interest.

Thankfully, MATLAB has this built into one of its toolboxes. This webpage explains the ARX parameter-fitting process; MATLAB pretty much does all the work:


You asked for MATLAB code but all you would need to do is arrange your time series data for one state's yields as a vector, put the time series for other states' yields into a matrix and then run this function, after careful selection of the parameters. For more advanced models, I would suggest taking a look at a book by Box and Jenkins from 1976 regarding time series analysis. Some other basic models include the autoregressive/moving average (ARMA) and its variant which uses exogenous data (ARMAX).

  • 1
    $\begingroup$ Thank you very much @Christopher Krapu. It helped me a lot. $\endgroup$
    – SUSHIL
    Jul 13, 2015 at 14:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.