Links between cognition and functioning: Examining the role of mental health in clinically ascertained and population-based samples