How do i predict future price by applying moving average?

조회 수: 10 (최근 30일)
Ahmad
Ahmad 2014년 11월 20일
댓글: Ali 2019년 2월 25일
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!

채택된 답변

Roger Wohlwend
Roger Wohlwend 2014년 11월 20일
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.
  댓글 수: 2
Ahmad
Ahmad 2014년 11월 20일
Thanks, I made use of loop to calculate the moving average: for i=4:253 myhousedata(i,4) = mean(myhousedata([i-2 i-2 i-1],3)); please any idea on how to get the predicted next month's price from there? I am looking to find a price value.
Ali
Ali 2019년 2월 25일
Hi month ,i am facing the same issue.Have you predicted the fututre price/forecast?

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2014년 11월 20일
What I would do is to take the most recent data and assume some polynomial model, like a line or quadratic. Then fit that most recent data to the model. Then extrapolate into the future. But I'm not really sure how the financial analysts do it. Perhaps there's something in the Financial Toolbox. I often see ranges where there is an upper limit, best guess, and lower limit when they do the stock price estimates into the future.

카테고리

Help CenterFile Exchange에서 Price and Analyze Financial Instruments에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by