The purpose of this study is to assess the efficacy of noninvasive ventilation (NIV) in the prevention of extubation failure and mortality in patients with either chronic respiratory disorders or hypercapnic respiratory failure during spontaneous breathing.