ComeçarComece de graça

Fitting the model

You can use a linear regression model to estimate the avocado price elasticity. The regression formula should be:

Here, \(\beta_1\) will be the price elasticity, that is the impact of price on sales. You will assume that the elasticity is the same for regular and organic avocados. You also expect it to be negative: the higher the price, the lower the sales, that's the case for most goods. To incorporate this prior knowledge into the model, you decide to use a normal distribution with mean -80 as the prior for price. How would you build such a model?

NOTE: Recall that calling pm.sample() for the first time in a fresh Python session takes some time, as Python code is being compiled to C under the hood. To save you time, we only ask you to get the code right instead of executing it.

Este exercício faz parte do curso

Bayesian Data Analysis in Python

Ver curso

Exercício interativo prático

Transforme a teoria em ação com um de nossos exercícios interativos

Começar o exercício