Get startedGet started for free

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.

This exercise is part of the course

Statistical Simulation in Python

View Course

Exercise instructions

  • 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.

Hands-on interactive exercise

Have a go at this exercise by completing this sample 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(____))
Edit and Run Code