To measure how well your lungs transfer oxygen from the blood and how well the lungs remove carbon dioxide