Time series problems involve analysis of periodic functions for predicting the future. A flexible regression method should be able to dynamically select the appropriate model to fit the available data. In this paper, we present a function approximation scheme that can be used for modeling periodic functions using a series of orthogonal polynomials, named Chebychev polynomials. In our approach, we obtain an estimate of the error due to neglecting higher order polynomials and thus can flexibly select a polynomial model of the proper order. We also show that this approximation approach is stable in the presence of noise.