Exercise

Linear Model in Cosmology

Less than 100 years ago, the universe appeared to be composed of a single static galaxy, containing perhaps a million stars. Today we have observations of hundreds of billions of galaxies, each with hundreds of billions of stars, all moving.

The beginnings of the modern physical science of cosmology came with the publication in 1929 by Edwin Hubble that included use of a linear model.

In this exercise, you will build a model whose slope will give Hubble's Constant, which describes the velocity of galaxies as a linear function of distance from Earth.

Hubble's Plot

Instructions

100 XP
  • Use the pre-loaded DataFrame with columns names, distances, and velocities.
  • Build and fit a model using ols().fit() with formula="velocities ~ distances" and data=df.
  • Extract the parameter estimates for the intercept and slope using model_fit.params, passing these to a0 and a1 respectively.
  • Repeat the process for the corresponding uncertainty values, this time using model_fit.bse.