# Looking for an universal utility function

I'm trying to build a computer simulation of an economy which separate simulation for each household and I'm trying to figure out what utility function should I use to model the households behavior. I want to model goods as falling into categories (e.g. food category consisting of vegetables and fruits)

My criterias for ideal utility function (in order of importance):

1. Cause total consumption of goods in certain "basic" groups to be non-zero (here Cobb-Douglas is enough: $$U=ln(food)+ln(cloths)$$)
2. Encourage diversity within group (e.g. $$U=ln(\sqrt{fruits}+\sqrt{vegetables})+ln(clothes)$$)
3. Allows consumption in certain groups to be zero (e.g. $$U=ln(\sqrt{fruits}+\sqrt{vegetables})+ln(clothes)+\sqrt{tourism}$$)
4. Has a (readable and convenient) closed form optimization solution for budget constraint $$\sum{price_i*good_i=budget}$$
5. Allows certain goods or categories of goods to be complementary (honestly have no idea how to incorporate this)

I understand that no objective answer is possible here, but I'd like to learn if there are some utilities functions that satisfy some of criterias above and/or learn what multi-goods universal utility functions are used in practice (I was taught only two-good task specific utility functions in university).

• 4. Since you are running a computer simulation, why do you need a closed form solution? These are convex functions, seems like you could get a pretty good approximate solution with the gradient method. Commented Mar 14, 2021 at 12:24
• 5. The utility representation for perfect complements $x_1,x_2$ is $U(x_1,x_2) = \min(x_1,x_2)$. Commented Mar 14, 2021 at 12:28
• I'd recommend looking into the empirical industrial organization literature a bit and see some of the work they've done regarding functional forms for demand estimation. For now, have you looked into nested functional forms? (For example, you might be able to use a couple of different nested CES utility functions: U=aCES(1)+bCES(2)... where CES(1) CES(2) etc are different CES functions where each parameterize different types of goods.) Overall though, I think the main key is going to be having different households' parameter values be drawn from a distribution to generate heterogeneity. Commented Mar 16, 2021 at 14:15
• @1muflon1 I agree, this comment actually helps a lot, and given that there are no answers, I'd be happy to award @ AndrewC with the points Commented Mar 19, 2021 at 21:27
• @1muflon1 and kandi--glad it helped! I'll expand it tonight or early tomorrow morning, since I want to actually add more useful leads (especially for a bountied question, it's only fair that you get more than a vague ''try looking at these types of functions, perhaps'' answer!) Commented Mar 20, 2021 at 0:44

Here is an example where $$x_i$$s are necessities and will always be consumed in positive quantities and $$y$$ and $$z$$ will be consumed in positive quantity only when income of the individual is above a certain threshold.
Problem. Suppose the utility function is $$\displaystyle u(x_1,\ldots,x_L, y,z) =\left(\sum_{i=1}^{L}\alpha_i\ln x_i\right)+y^\beta z^{1-\beta}$$, where $$\displaystyle\sum_{i=1}^{L}\alpha_i = 1$$ and $$\alpha_i > 0$$ for all $$i\in\{1,2,\ldots,L\}$$, and $$\beta\in (0,1)$$. What is the solution to this consumer's problem?
$$\displaystyle\max_{x_1,x_2,\ldots,x_L,y,z} \ \left(\sum_{i=1}^{L}\alpha_i\ln x_i\right)+y^\beta z^{1-\beta}$$ $$\displaystyle\text{s.t.} \ \sum_{i=1}^{L}p_ix_i+(p_Yy+p_Zz)\leq M$$ $$\text{and } x_1> 0, \ x_2> 0, \ldots, x_L> 0, y\geq 0, z\geq 0$$ where $$L \in\mathbb{N}$$, $$p_1>0$$, $$p_2>0,\ldots, p_L>0$$, $$p_Y>0$$, $$p_Z>0$$ and $$M> 0$$
Solution. Solving this problem we get the demand for $$x_i$$ as: $$\displaystyle x_i^d(p_1,p_2,\ldots,p_L,p_Y,p_Z,M) = \begin{cases} \dfrac{\alpha_iM}{p_i} & \text{if } \displaystyle M\leq \dfrac{p_Y^\beta p_Z^{1-\beta}}{\beta^\beta (1-\beta)^{1-\beta}} \\ \dfrac{\alpha_ip_Y^\beta p_Z^{1-\beta}}{p_i\beta^\beta (1-\beta)^{1-\beta}} & \text{if } \displaystyle M> \dfrac{p_Y^\beta p_Z^{1-\beta}}{\beta^\beta (1-\beta)^{1-\beta}} \end{cases}$$ and demand for $$y$$ and $$z$$ as: $$\displaystyle y^d(p_1,p_2,\ldots,p_L,p_Y,p_Z,M) = \begin{cases} 0 & \text{if } \displaystyle M \leq \dfrac{p_Y^\beta p_Z^{1-\beta}}{\beta^\beta (1-\beta)^{1-\beta}} \\ \dfrac{\beta}{p_Y}\left(M - \dfrac{p_Y^\beta p_Z^{1-\beta}}{\beta^\beta (1-\beta)^{1-\beta}}\right) & \text{if } \displaystyle M > \dfrac{p_Y^\beta p_Z^{1-\beta}}{\beta^\beta (1-\beta)^{1-\beta}} \end{cases}$$ $$\displaystyle z^d(p_1,p_2,\ldots,p_L,p_Y,p_Z,M) = \begin{cases} 0 & \text{if } \displaystyle M \leq \dfrac{p_Y^\beta p_Z^{1-\beta}}{\beta^\beta (1-\beta)^{1-\beta}} \\ \left(\dfrac{1-\beta}{p_Z}\right)\left(M - \dfrac{p_Y^\beta p_Z^{1-\beta}}{\beta^\beta (1-\beta)^{1-\beta}}\right) & \text{if } \displaystyle M > \dfrac{p_Y^\beta p_Z^{1-\beta}}{\beta^\beta (1-\beta)^{1-\beta}} \end{cases}$$ respectively.