This paper expresses the transition probabilities of a nonstationary Markov chain by means of models involving wavelet expansions and then, given part of a realization of such a process, proceeds to estimate the coefficients of the expansion and the probabilities themselves. Through choice of the number of and which wavelet terms to include, the approach provides a flexible method for handling discrete-valued observations in the nonstationary case. In particular the method appears useful for detecting abrupt or steady changes in the structure of Markov chains. The method is illustrated by means of data sets concerning music, rainfall and sleep. In the examples both direct and shruken estimates are computed. The models include explanatory variables in each case. The approach is implemented by means of programs for fitting generalized linear models. The goodness of fit and the presence of nonstationarity are assessed both by change of deviance and graphically via periodogram plots of residuals.