ComeçarComece de graça

Plotting the growth curve

You saw in the previous exercise that the confidence interval on the growth curve is very tight. You will explore this graphically here by plotting several bootstrap lines along with the growth curve. You will use the plt.semilogy() function to make the plot with the y-axis on a log scale. This means that you will need to transform your theoretical linear regression curve for plotting by exponentiating it.

Este exercício faz parte do curso

Case Studies in Statistical Thinking

Ver curso

Instruções do exercício

  • Plot the data points using plt.semilogy(). The numpy arrays t and bac_area are again in your namespace.
  • Use np.array() to generate time values for plotting the bootstrap lines. Call this t_bs. The time should go from 0 to 14 hours.
  • Write a for loop to plot regression lines corresponding to the first 100 pairs bootstrap replicates. The numpy arrays growth_rate_bs_reps and log_a0_bs_reps that you computed in the last exercise are in your namespace.
    • Compute the growth curve by exponentiating the linear regression line using np.exp().
    • Plot the theoretical line using plt.semilogy() with keyword arguments linewidth=0.5, alpha=0.05, and color='red'.
  • Label the axes and show your plot. Appropriate labels for the respective x and y axes are 'time (hr)' and 'area (sq. µm)'.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Plot data points in a semilog-y plot with axis labeles
_ = ____(____, ____, marker='.', linestyle='none')

# Generate x-values for the bootstrap lines: t_bs
t_bs = ____([____, ____])

# Plot the first 100 bootstrap lines
for i in range(____):
    y = ____(____[i] * ____ + ____[i])
    _ = ____(____, ____, linewidth=____, alpha=____, color=____)
    
# Label axes and show plot
_ = plt.xlabel('____')
_ = plt.ylabel('____')
____
Editar e executar o código