Skip to Content
Pandas for Everyone: Python Data Analysis, First Edition
book

Pandas for Everyone: Python Data Analysis, First Edition

by Daniel Y. Chen
December 2017
Beginner to intermediate
410 pages
12h 45m
English
Addison-Wesley Professional
Content preview from Pandas for Everyone: Python Data Analysis, First Edition

13. Generalized Linear Models

13.1 Introduction

Not every response variable will be continuous, so a linear regression will not be the correct model in every circumstance. Some outcomes may contain binary data (e.g., sick, not-sick), or even count data (e.g., how many heads will I get). A general class of models called “generalized linear models” (GLM) can account for these types of data, yet still use a linear combination of predictors.

13.2 Logistic Regression

When you have a binary response variable, logistic regression is often used to model the data. Here’s some data from the American Community Survey (ACS) for New York.

import pandas as pd acs = pd.read_csv('../data/acs_ny.csv') print(acs.columns)

Index(['Acres', ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Pandas for Everyone: Python Data Analysis, 2nd Edition

Pandas for Everyone: Python Data Analysis, 2nd Edition

Daniel Y. Chen

Publisher Resources

ISBN: 9780134547046Purchase book