A test for the rank of a vector error correction model (VECM) or panel VECM based on the well-known trace test is proposed. The proposed test employs instrumental variables (IV's) generated by a class of nonlinear functions of the estimated stochastic trends of the VECM under the null. The test i… mproves the standard trace test by replacing the non-standard critical values with chi-squared critical values. Extending the result to the panel VECM case, the test is robust to cross-sectional correlation of the disturbances. With this test, I extend earlier research using nonlinear IV's for unit root testing. However, the optimal instrument in the univariate case is not admissable in the more general multivariate case. The chi-squared result suggests that IV tests may be used to replace limits of other standard tests with integrated time series that are given by nonstandard stochastic integrals, even without a panel with which to pool tests.