Stress may lead to lower cognitive function, study finds