MATLAB: How do i predict future price by applying moving average

Financial Toolboxmovingaverageprediction

Hello Everyone,I have a house price data with two rows, 1st: Date (monthly) and 2nd: Price of house, my data has the price record of houses from 1990-2012, I would like to predict the price of house in 2013 by calculating the moving average of the prices i have to forecast and predict the 2013 house price.Please any idea on how to carry out simple time series analysis (step-by-step)in MATLAB? I would appreciate sample codes.
>> Q = ones (1,3)./3;
>> G = conv2(c1,Q,'same').';
>> Moving_average=conv2(c1,Q,'same').';
I tried finding the moving average of my price row (c1) but the results i am getting is invalid, Any suggestions please? This is exactly what i am trying to replicate in matlab. Thanks!

Best Answer

I always use the function filter to calculate a moving average of length N.
N = 3;
MA = filter(ones(N,1),N,Y);
However you cannot really forecast a time series with a simple moving average. Try an ARMA model or a linear regression model instead.