Functions for Bai and Ng(2004,2010) PANIC method R package