The Almost Ideal Demand System is well suited to modelling food demand, and has a long history of successful applications, but when it is estimated from household survey data sets with latent variables in the form of censored data, the expression for maximum likelihood of the cost function takes an intractable form. The classical way to approach this difficulty is to divide a data set into ‘regimes’ or groups of households that all purchase the same subset of food goods, but there are difficulties in combining the estimates to achieve unbiased outcomes.\n\nIn this paper, a simulation of the marginal distribution of all the model parameters and all the latent variables is obtained by the Bayesian method known as Gibbs sampling. Parameters such as the price elasticity of demand are readily obtainable from the marginal distribution, in the Bayesian form of probability densities. It is also straightforward to apply constraints representing known properties of a cost function. Simulations have been carried out using World Bank Living Standards Measurement Survey data for Papua New Guinea and International Food Policy Research Institute data for Upper Egypt. The results show that the cost function is only just concave for regions of parameter space corresponding to data from households in the lowest expenditure quantiles. The stochastic nature of the sampling process leads to roughness in the concave surface; sample acceptance rates after applying the concavity test restriction are greatly enhanced by tolerating a small deviation from strict concavity.