A non-linear statistical classification methodology known as hierarchically optimal classification tree analysis (CTA) offers promise of outperforming linear alternatives. We present the first example of CTA in medicine, for an application that uses four attributes (age, body mass index, alveolar-arterial oxygen gradient, prior history of AIDS) to predict in-hospital mortality for a sample of 1339 patients with AIDS-related Pneumocystis carinii pneumonia. We also illustrate use of a hold-out (cross-generalizability) sample that suggests a three-attribute model (alveolar-arterial oxygen gradient, total lymphocyte count, private insurance). Both CTA models achieved approximately 25 per cent of the total possible theoretical improvement beyond chance in classification accuracy (for comparative purposes, logistic regression and regression-tree models obtained in prior research returned less than 10 per cent). We illustrate how one can use CTA models to construct staging systems for assessing severity of illness, and for identifying important directions for future research. In the context of the example, we discuss additional advantages of CTA versus linear alternatives that include treatment of missing data, control of experimentwise type I error, richness of the substantive findings, and ease of use.