1. Learn
  2. /
  3. Courses
  4. /
  5. Statistical Simulation in Python

Connected

Exercise

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.

Instructions

100 XP
  • Initialize rain as a Normal random variable with mean 50 and standard deviation 15.
  • In the corn_produced() function, model mean_corn as \( 100\times\text{cost}^{0.1}\times\text{rain}^{0.2} \).
  • Model corn as a Poisson random variable with mean mean_corn.
  • Simulate one outcome by storing the result of calling corn_produced() in corn_result and print your results.