Carlos Ortega Vázquez – AI Planet https://aiplanet.com/blog AI Planet (formerly DPhi) is a global ecosystem that aims to educate and empower individuals and organizations to build and utilize artificial intelligence (AI). With a community of over 300,000 AI specialists and enthusiasts, we offer a range of products and have helped drive innovative solutions for various industries. Our ultimate goal is to make AI education accessible to everyone and use AI to tackle important business and social challenges. Tue, 15 Nov 2022 10:13:37 +0000 en-US hourly 1 https://wordpress.org/?v=5.9.7 https://aiplanet.com/blog/wp-content/uploads/2022/11/Size48-Large-1.png Carlos Ortega Vázquez – AI Planet https://aiplanet.com/blog 32 32 How Mixed Models Can Boost your Taco Business https://aiplanet.com/blog/how-mixed-models-can-boost-your-taco-business/ https://aiplanet.com/blog/how-mixed-models-can-boost-your-taco-business/#respond Sun, 29 Dec 2019 00:19:42 +0000 https://dphi.tech/?p=77 Little note: the data presented below is simulated for the sake of the example

Second little note: I assume you have intermediate knowledge of statistics/econometrics, basic microeconomics background helps to fully understand.

Introduction & Least Squares

Imagine that your family has been already in the taco business for a while and you just graduated from Economics or Statistics program. Currently, there are ten shops around different districts but the family business wants to open up a new shop. Business expansion sounds great but they are unsure about the expected profits given the initial investment is huge. Remember that small to medium family businesses often struggle to get bank loans at decent interest rates, so they often rely on relatives/friends. Thus the business asks: What are the expected profits of opening a new shop in the same city? So you think of estimating the demand for tacos in your city so that at least you make a smart guess of the expected profits.

Microeconomics suggests that the basic demand for tacos at shop level is given by the following expression.

An economist, or just a layman with common sense, would expect that increasing the price of tacos lowers the demand, while a higher consumer income implies higher tacos consumption. The effect of related goods is a bit trickier as it depends on whether the good is complementary (e.g. sauce and fries) or substitute (e.g. BMW and Mercedes Benz).

The ten shops have the policy of a base price which is 7.75 Mexican Pesos: This is the default price. But you talk to your family about changing prices once every five weeks: in the first week, all shops set the price at one particular level, then the next week to a higher price and so on. This plan allows us to assume that income and related goods’ prices don’t change during the five weeks. That is, those elements collapse into the intercept of the demand equation. At the end of this period you get enough data to make this plot with a Least Squares line:

Estimated Demand
Figure 1: Estimated Demand

Now notice how the data don’t seem to fit a precise negative relationship in Figure 1 : lots of points lie outside of the confidence interval, even though the means per price levels (red dots) are inside the band. Maybe you can convince your family to trust your model but there’s a huge caveat: The model only represents the average demand of tacos at shop level across the districts. What’s even more alarming is that our estimated mean price elasticity is quite unstable. At 95% of confidence interval, we can argue that the mean price elasticity is between -1.08 and 0.16. Microeconomics states that price elasticity must be non-positive, and food is often inelastic (Andreyeva, Long & Brownell, 2010). In a nutshell, our recommendations for understanding the price elasticity for tacos, based on Least Squares, are at best non-informative.

Let’s talk about the profit, for simplicity we can define it as following:

Let’s assume that marginal cost is known (5$), zero fixed cost, and your family will set the default price (7.75$) if there’s a new shop. Using the Least Square, we can estimate the expected taco sales given the default price and we can plug it in the profit function. Considering the confidence interval of your estimated parameters, you can statistically argue that the new shop would make weekly between -764$ or 6,754$, even though the true expected profit remains at 2,526$. Such variability in the expected profit may deter your family to open a new shop but can we do better than Least Squares? The answer is yes.

A Smarter Approach: Mixed Models

Mixed Models, AKA random-effect or multilevel model, offer a smarter approach because it exploits information that Least Squares ignores: Dependence between observations. In the current example, we can think of every shop serving different consumers but of all them share common characteristics because they live in the same city. We can then argue that there’s a latent demand of the city and each shop can just perceive a random realization of it. Then the statistical model of the demand at the shop level, excluding income and other goods’ prices component, is given below:

The standard assumptions for mixed models is that the random effects Ui follow a bivariate normal distribution with mean zero, and covariance matrix G0. Let’s assume that there’s independence between random effects and error term (ϵij). We can argue these assumptions hold because the experiment only lasted five weeks, which is not enough for significant changes in consumers’ income and other goods’ prices.

We observe a clearer picture that each shop has its own demand in Figure 2. Interestingly, the shop 4 and 6 show a non-negative price effect which seems to break the Law of Demand. That’s not true because the data is simulated and their price effect is actually negative. If we wouldn’t know the true values, we should not be wary anyway because you can’t take at face value what a Least Squares on five observations says about the price effect: Economic theory should guide us on this one.

Estimated Demand per Shop
Figure 2: Estimated Demand per Shop

We can use the Restricted Maximum Likelihood (REML) to estimate the multilevel demand model. This estimator helps to stabilise each shop level estimated demand given prior to the general demand of the city. This property is key for giving more certainty in our recommendations to the family business. Figure 3 shows how much we improve by using a mixed model in terms of uncertainty, even though both Least Squares and REML include the true value (red line). In the case of REML, we provide different types of confidence interval, and bootstrap has good performance in small samples.

Confidence Intervals for the Price Effect
Figure 3: Confidence Intervals for the Price Effect

Now we can say that the mean price elasticity should be between -0.23 and -0.63 when the true value is -0.53. More importantly, you can suggest that the expected profit given the default price is between 1,917$ and 4,102$ at 95% of confidence interval. Now you don’t have to scare everyone with negative expected profits as before. The recommendation is straightforward: your family should open the new shop.

Bibliography

  • Andreyeva, T., Long, M. W., & Brownell, K. D. (2010). The Impact of Food Prices on Consumption: A Systematic Review of Research on the Price Elasticity of Demand for Food. American Journal of Public Health, 100(2), 216–222. http://doi.org/10.2105/AJPH.2008.151415

This article was originally published by Carlos Ortega Vázquez on thebayesianbird.netlify.com and kindly contribute to AI Planet (formerly DPhi) community on request.

]]>
https://aiplanet.com/blog/how-mixed-models-can-boost-your-taco-business/feed/ 0