Seligman's theory of causal attribution predicts that patients with a pessimistic explanatory style will have less favourable health outcomes. We identified 702 patients who had undergone 894 primary total knee replacements between 1993 and 2005, who responded to follow-up surveys at two (n = 783 knee replacements) and/or five years (n = 443 knee replacements) and had also completed the Minnesota Multiphasic Personality Inventory long before the joint replacement (median = 16.6 and 14.5 years for two- and five-year cohorts, respectively). Scores from the Minnesota Multiphasic Personality Inventory Optimism-Pessimism scale were used to categorise patients as pessimistic (t-score > 60) or non-pessimistic (t-score ≤ 60). Multivariate logistic regression models assessing the effect of pessimistic explanatory style on pain or improvement in knee function were adjusted for gender, age, distance from the place of treatment and depression score. Pessimists reported (a) significantly more moderate or severe pain at two years with odds ratio 2.21 (95% confidence interval (CI) 1.12 to 4.35; p = 0.02), but not at five years when the odds ratio was 1.21 (95% CI 0.51 to 2.83; p = 0.67); and (b) less improvement in knee function at two years when the odds ratio was 0.53 (95% CI 0.30 to 0.96; p = 0.04), but not at five years when the odds ratio was 1.26 (95% CI 0.57 to 2.77; p = 0.57). No significant associations with moderate or severe limitation of activity were seen at two or five years. We conclude that a pessimistic explanatory style is associated with worse pain and functional outcomes two years after total knee replacement. ©2010 British Editorial Society of Bone and Joint Surgery.