Analysis of discrete-valued time series