//
//previous value function
//
//This function is used to get value of previous record.
//

//Syntax  
  value=prev(variable);
//argument 1 is variable name.

//
//Example histgram of stock value and diffence of two day.
//
//Read time series of stock data for 250 days.
get stockdata.csv@;

//Get daily difference of stock value and difference of that difference by previous function.
diff=data1-prev(data1);
diff2=diff - prev(diff);

//Plot time series of stock , difference and diff of diffrences. plot line data1 diff diff2;

stock is not stationay but difference looks like to be stationary.

plot hist data1;

histgram of stock data has two peek

plot hist diff2;

histgram of stock difference shows normal distribution