// //kalman filter command // //This command kalman filter using space status equation. // //Syntax with options kalman time_data/ model=kalman.csv@ ; //Option model=file name //this file is defined space status equation. npre=nn //num of prediction ndata=nn //start point of time_data. // //Example 1 //prediction span is 15 day. // //read time sirease of daily stock data and defined space status by file. get stockdata.csv@;
//Execute kalman filter for prediction 15 day. kalman data1 / npre=15 ndata=0 model=kalman\model1.csv@ ; //Model is defined as status space model which is consist of trend and AR modle.
This status space model is defined in csv file as below.
//Edit output for sumation trend data and AR data. get freq@ana; xpx = xp_0 + xp_2; //View last 70day with prediction 15 day. if(# >= 180) { outrec; } plot line data1 xpx;