Book Image

Bayesian Analysis with Python

Book Image

Bayesian Analysis with Python

Overview of this book

The purpose of this book is to teach the main concepts of Bayesian data analysis. We will learn how to effectively use PyMC3, a Python library for probabilistic programming, to perform Bayesian parameter estimation, to check models and validate them. This book begins presenting the key concepts of the Bayesian framework and the main advantages of this approach from a practical point of view. Moving on, we will explore the power and flexibility of generalized linear models and how to adapt them to a wide array of problems, including regression and classification. We will also look into mixture models and clustering data, and we will finish with advanced topics like non-parametrics models and Gaussian processes. With the help of Python and PyMC3 you will learn to implement, check and expand Bayesian models to solve data analysis problems.
Table of Contents (15 chapters)
Bayesian Analysis with Python
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Multiple linear regression


In all previous examples we have been working with one dependent variable and one independent variable, but in many cases we will find that we have many independent variables we want to include in our model. Some examples could be:

  • Perceived quality of wine (dependent) and acidity, density, alcohol level, residual sugar, and sulphate content (independent variables)

  • Student average grades (dependent) and family income, distance home-school, and mother education (independent variables)

In such a cases, we will have the mean of the dependent variable modeled as:

Notice that this is not exactly the same as the polynomial regression we saw before. Now we have different variables instead of successive powers of the same variable.

Using linear algebra notation we can write a shorter version:

Where is a vector of coefficients of length m, that is, the number of dependent variables. The variable is a matrix of size if n is the number of observations and m is the number of...