Bayesian Analysis with Python
eBook - ePub

Bayesian Analysis with Python

Introduction to statistical modeling and probabilistic programming using PyMC3 and ArviZ, 2nd Edition

  1. 356 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Bayesian Analysis with Python

Introduction to statistical modeling and probabilistic programming using PyMC3 and ArviZ, 2nd Edition

Book details
Book preview
Table of contents
Citations

About This Book

Bayesian modeling with PyMC3 and exploratory analysis of Bayesian models with ArviZ

Key Features

  • A step-by-step guide to conduct Bayesian data analyses using PyMC3 and ArviZ
  • A modern, practical and computational approach to Bayesian statistical modeling
  • A tutorial for Bayesian analysis and best practices with the help of sample problems and practice exercises.

Book Description

The second edition of Bayesian Analysis with Python is an introduction to the main concepts of applied Bayesian inference and its practical implementation in Python using PyMC3, a state-of-the-art probabilistic programming library, and ArviZ, a new library for exploratory analysis of Bayesian models.

The main concepts of Bayesian statistics are covered using a practical and computational approach. Synthetic and real data sets are used to introduce several types of models, such as generalized linear models for regression and classification, mixture models, hierarchical models, and Gaussian processes, among others.

By the end of the book, you will have a working knowledge of probabilistic modeling and you will be able to design and implement Bayesian models for your own data science problems. After reading the book you will be better prepared to delve into more advanced material or specialized statistical modeling if you need to.

What you will learn

  • Build probabilistic models using the Python library PyMC3
  • Analyze probabilistic models with the help of ArviZ
  • Acquire the skills required to sanity check models and modify them if necessary
  • Understand the advantages and caveats of hierarchical models
  • Find out how different models can be used to answer different data analysis questions
  • Compare models and choose between alternative ones
  • Discover how different models are unified from a probabilistic perspective
  • Think probabilistically and benefit from the flexibility of the Bayesian framework

Who this book is for

If you are a student, data scientist, researcher, or a developer looking to get started with Bayesian data analysis and probabilistic programming, this book is for you. The book is introductory so no previous statistical knowledge is required, although some experience in using Python and NumPy is expected.

Frequently asked questions

Simply head over to the account section in settings and click on ā€œCancel Subscriptionā€ - itā€™s as simple as that. After you cancel, your membership will stay active for the remainder of the time youā€™ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlegoā€™s features. The only differences are the price and subscription period: With the annual plan youā€™ll save around 30% compared to 12 months on the monthly plan.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, weā€™ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes, you can access Bayesian Analysis with Python by Osvaldo Martin in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming in Python. We have over one million books available in our catalogue for you to explore.

Information

Year
2018
ISBN
9781789349665
Edition
2

Modeling with Linear Regression

"In more than three centuries of science everything has changed except perhaps one thing: the love for the simple."
ā€“ Jorge Wagensberg
Musicā€”from classical compositions to Sheena is a Punk Rocker by The Ramones, passing through the unrecognized hit from a garage band and Piazzolla's Libertangoā€”is made from recurring patterns. The same scales, combinations of chords, riffs, motifs, and so on appear over and over again, giving rise to a wonderful sonic landscape capable of eliciting and modulating the entire range of emotions humans can experience. In a similar fashion, the universe of statistics and machine learning (ML) is built upon recurring patterns, small motifs that appear now and again. In this chapter, we are going to look at one of the most popular and useful of them, the linear model (or motif, if you want). This is a very useful model on its own and also the building block of many other models. If you ever took a statistics course (even a non-Bayesian one), you may have heard of simple and multiple linear regression, logistic regression, ANOVA, ANCOVA, and so on. All these methods are variations of the same underlying motif, the linear regression model. In this chapter, we will cover the following topics:
  • Simple linear regression
  • Robust linear regression
  • Hierarchical linear regression
  • Polynomial regression
  • Multiple linear regression
  • Interactions
  • Variable variance

Simple linear regression

Many problems we find in science, engineering, and business are of the following form. We have a variable
and we want to model/predict a variable
. Importantly, these variables are paired like
. In the most simple scenario, known as simple linear regression, both
and
are uni-dimensional continuous random variables. By continuous, we mean a variable represented using real numbers (or floats, if you wish), and using NumPy, you will represent the variables
or
as one-dimensional arrays. Because this is a very common model, the variables get proper names. We call the
variables the dependent, predicted, or outcome variables, and the
variables the independent, predictor, or input variables. When
is a matrix (we have different variables), we have what is known as multiple linear regression. In this and the following chapter, we will explore these and other linear regression models.
Some typical situations where linear regression models can be used are:
  • Model the relationship between factors like rain, soil salinity, and the presence/absence of fertilizer in crop productivity. Then, answer questions such as: is the relationship linear? How strong is this relationship? Which factors have the strongest effect?
  • Find a relationship between average chocolate consumption by country and the number of Nobel laureates in that country, and then understand why this relationshi...

Table of contents

  1. Title Page
  2. Copyright and Credits
  3. Dedication
  4. About Packt
  5. Foreword
  6. Contributors
  7. Preface
  8. Thinking Probabilistically
  9. Programming Probabilistically
  10. Modeling with Linear Regression
  11. Generalizing Linear Models
  12. Model Comparison
  13. Mixture Models
  14. Gaussian Processes
  15. Inference Engines
  16. Where To Go Next?
  17. Other Books You May Enjoy