The statistical properties of the likelihood ratio test statistic (LRTS) for autoregressive regime-switching models are addressed in this paper. This question is particularly important for estimating the number of regimes in the model. Our purpose is to extend the existing results for mixtures [X. Liu and Y. Shao, Ann. Stat. 31 (2003) 807–832] and hidden Markov chains [E. Gassiat, Ann. Inst. Henri Poincaré 38 (2002) 897–906]. First, we study the case of mixtures of autoregressive models (i.e. independent regime switches). In this framework, we give sufficient conditions to keep the LRTS tight and compute its the asymptotic distribution. Second, we consider the extension of the ideas in Gassiat [Ann. Inst. Henri Poincaré 38 (2002) 897–906] to autoregressive models with regimes switches according to a Markov chain. In this case, it is shown that the marginal likelihood is no longer a contrast function and cannot be used to select the number of regimes. Some numerical examples illustrate the results and their convergence properties.