Modeling Corn Production
Suppose that you manage a small corn farm and are interested in optimizing your costs. In this illustrative exercise, we will model the production of corn. We'll abstract away from details like units and focus on the process.
For simplicity, let's assume that corn production depends on only two factors: rain, which you don't control, and cost, which you control. Rain is normally distributed with mean 50 and standard deviation 15. For now, let's fix cost at 5,000. Let's assume that corn produced in any season is a Poisson random variable and that the average corn production is governed by the equation:
\(100\times(\text{cost})^{0.1}\times(\text{rain})^{0.2}\)
Let's model this production function and simulate one outcome.
Cet exercice fait partie du cours
Statistical Simulation in Python
Instructions
- Initialize
rain
as a Normal random variable with mean 50 and standard deviation 15. - In the
corn_produced()
function, modelmean_corn
as \( 100\times\text{cost}^{0.1}\times\text{rain}^{0.2} \). - Model
corn
as a Poisson random variable with meanmean_corn
. - Simulate one outcome by storing the result of calling
corn_produced()
incorn_result
and print your results.
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Initialize variables
cost = 5000
rain = np.random.____
# Corn Production Model
def corn_produced(rain, cost):
mean_corn = ____
corn = np.random.____
return corn
# Simulate and print corn production
corn_result = ____
print("Simulated Corn Production = {}".format(____))