Determining the number of cointegrating relations under rank constraints