Macro risk factors of credit default swap indices in a regime-switching framework