In the compression of multilevel (color or gray) image data, effective compression is obtained economically by judicial selection of the predictor and the conditioning states or contexts which determine what probability distribution to use for the prediction error. The authors provide a cost-effective approach to the following two problems: (1) to reduce the number of coding parameters to describe a distribution when several contexts are involved, and (2) to choose contexts for which variations in prediction error distributions are expected. They solve Probblem 1 (distribution description) by a partition of the range of values of the outcomes into equivalence classes, called buckets. The result is a special decomposition of the error range. Cost-effectiveness is achieved by using the many contexts only to predict the bucket (equivalence class) probabilities. They solve Problem 2 (economical contexts) by using the buckets of the surrounding pixels as components of the conditioning class. The bucket values have the desirable properties needed for the error distributions.