Testing for unit roots in AR and MA models