A Markov Chain Based Method For Time Series Data Modeling And Prediction