Testing for nonlinearity in time series