MulaiMulai sekarang secara gratis

Is the mean equal to the variance?

Under the Poisson model one of the assumptions was that the mean should be the same as the variance. As you learned in the lecture, if this assumption is violated then there is overdispersion. Without adjusting for overdispersion you would wrongly interpret standard errors of the given model.

In this exercise you will first compute the mean and the variance of the number of satellites for the female crabs.

The crab dataset is loaded in your workspace.

Latihan ini adalah bagian dari kursus

Generalized Linear Models in Python

Lihat Kursus

Petunjuk latihan

  • Use numpy mean() to compute and print sample mean for number of satellites variable sat as sat_mean.
  • Use numpy var() to compute and print sample variance for number of satellites variable sat as sat_var.
  • Compute and print ratio of sat_var to sat_mean.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Compute and print sample mean of the number of satellites: sat_mean
____ = np.____(____.____)

print('Sample mean:', round(____, 3))

# Compute and print sample variance of the number of satellites: sat_var
____ = np.____(____.____)
print('Sample variance:', round(____, 3))

# Compute ratio of variance to mean
print('Ratio:', round(____/____, 3))
Edit dan Jalankan Kode