ComenzarEmpieza gratis

Do neonicotinoid insecticides have unintended consequences?

As a final exercise in hypothesis testing before we put everything together in our case study in the next chapter, you will investigate the effects of neonicotinoid insecticides on bee reproduction. These insecticides are very widely used in the United States to combat aphids and other pests that damage plants.

In a recent study, Straub, et al. (Proc. Roy. Soc. B, 2016) investigated the effects of neonicotinoids on the sperm of pollinating bees. In this and the next exercise, you will study how the pesticide treatment affected the count of live sperm per half milliliter of semen.

First, we will do EDA, as usual. Plot ECDFs of the alive sperm count for untreated bees (stored in the NumPy array control) and bees treated with pesticide (stored in the NumPy array treated).

Este ejercicio forma parte del curso

Statistical Thinking in Python (Part 2)

Ver curso

Instrucciones del ejercicio

  • Use your ecdf() function to generate x,y values from the control and treated arrays for plotting the ECDFs.
  • Plot the ECDFs on the same plot.
  • The margins have been set for you, along with the legend and axis labels. Hit submit to see the result!

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# Compute x,y values for ECDFs
x_control, y_control = ____
x_treated, y_treated = ____

# Plot the ECDFs
plt.plot(____, ____, marker='.', linestyle='none')
plt.plot(____, ____, marker='.', linestyle='none')

# Set the margins
plt.margins(0.02)

# Add a legend
plt.legend(('control', 'treated'), loc='lower right')

# Label axes and show plot
plt.xlabel('millions of alive sperm per mL')
plt.ylabel('ECDF')
plt.show()
Editar y ejecutar código