Regression Analysis with R

Book description

Build effective regression models in R to extract valuable insights from real data

About This Book

  • Implement different regression analysis techniques to solve common problems in data science - from data exploration to dealing with missing values
  • From Simple Linear Regression to Logistic Regression - this book covers all regression techniques and their implementation in R
  • A complete guide to building effective regression models in R and interpreting results from them to make valuable predictions

Who This Book Is For

This book is intended for budding data scientists and data analysts who want to implement regression analysis techniques using R. If you are interested in statistics, data science, machine learning and wants to get an easy introduction to the topic, then this book is what you need! Basic understanding of statistics and math will help you to get the most out of the book. Some programming experience with R will also be helpful

What You Will Learn

  • Get started with the journey of data science using Simple linear regression
  • Deal with interaction, collinearity and other problems using multiple linear regression
  • Understand diagnostics and what to do if the assumptions fail with proper analysis
  • Load your dataset, treat missing values, and plot relationships with exploratory data analysis
  • Develop a perfect model keeping overfitting, under-fitting, and cross-validation into consideration
  • Deal with classification problems by applying Logistic regression
  • Explore other regression techniques – Decision trees, Bagging, and Boosting techniques
  • Learn by getting it all in action with the help of a real world case study.

In Detail

Regression analysis is a statistical process which enables prediction of relationships between variables. The predictions are based on the casual effect of one variable upon another. Regression techniques for modeling and analyzing are employed on large set of data in order to reveal hidden relationship among the variables.

This book will give you a rundown explaining what regression analysis is, explaining you the process from scratch. The first few chapters give an understanding of what the different types of learning are – supervised and unsupervised, how these learnings differ from each other. We then move to covering the supervised learning in details covering the various aspects of regression analysis. The outline of chapters are arranged in a way that gives a feel of all the steps covered in a data science process – loading the training dataset, handling missing values, EDA on the dataset, transformations and feature engineering, model building, assessing the model fitting and performance, and finally making predictions on unseen datasets. Each chapter starts with explaining the theoretical concepts and once the reader gets comfortable with the theory, we move to the practical examples to support the understanding. The practical examples are illustrated using R code including the different packages in R such as R Stats, Caret and so on. Each chapter is a mix of theory and practical examples.

By the end of this book you will know all the concepts and pain-points related to regression analysis, and you will be able to implement your learning in your projects.

Style and approach

An easy-to-follow step by step guide which will help you get to grips with real world application of Regression Analysis with R

Table of contents

  1. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  2. Getting Started with Regression
    1. Going back to the origin of regression
    2. Regression in the real world
    3. Understanding regression concepts
    4. Regression versus correlation
    5. Discovering different types of regression
    6. The R environment
    7. Installing R
      1. Using precompiled binary distribution
        1. Installing on Windows
        2. Installing on macOS
        3. Installing on Linux
      2. Installation from source code
    8. RStudio
    9. R packages for regression
      1. The R stats package
      2. The car package
      3. The MASS package
      4. The caret package
      5. The glmnet package
      6. The sgd package
      7. The BLR package
      8. The Lars package
    10. Summary
  3. Basic Concepts – Simple Linear Regression
    1. Association between variables – covariance and correlation
    2. Searching linear relationships
    3. Least squares regression
    4. Creating a linear regression model
      1. Statistical significance test
      2. Exploring model results
      3. Diagnostic plots
    5. Modeling a perfect linear association
    6. Summary
  4. More Than Just One Predictor – MLR
    1. Multiple linear regression concepts
    2. Building a multiple linear regression model
    3. Multiple linear regression with categorical predictor
      1. Categorical variables
      2. Building a model
    4. Gradient Descent and linear regression
      1. Gradient Descent
      2. Stochastic Gradient Descent
      3. The sgd package
      4. Linear regression with SGD
    5. Polynomial regression
    6. Summary
  5. When the Response Falls into Two Categories – Logistic Regression
    1. Understanding logistic regression
      1. The logit model
    2. Generalized Linear Model
      1. Simple logistic regression
    3. Multiple logistic regression
      1. Customer satisfaction analysis with the multiple logistic regression
      2. Multiple logistic regression with categorical data
    4. Multinomial logistic regression
    5. Summary
  6. Data Preparation Using R Tools
    1. Data wrangling
      1. A first look at data
      2. Change datatype
      3. Removing empty cells
      4. Replace incorrect value
      5. Missing values           
      6. Treatment of NaN values
    2. Finding outliers in data
    3. Scale of features
      1. Min–max normalization
      2. z score standardization
    4. Discretization in R
      1. Data discretization by binning
      2. Data discretization by histogram analysis
    5. Dimensionality reduction
      1. Principal Component Analysis
    6. Summary
  7. Avoiding Overfitting Problems - Achieving Generalization
    1. Understanding overfitting
      1. Overfitting detection – cross-validation
    2. Feature selection
      1. Stepwise regression
      2. Regression subset selection
    3. Regularization
      1. Ridge regression
      2. Lasso regression
      3. ElasticNet regression
    4. Summary
  8. Going Further with Regression Models
    1. Robust linear regression
    2. Bayesian linear regression
      1. Basic concepts of probability
      2. Bayes' theorem
      3. Bayesian model using BAS package
    3. Count data model
      1. Poisson distributions
      2. Poisson regression model
      3. Modeling the number of warp breaks per loom
    4. Summary
  9. Beyond Linearity – When Curving Is Much Better
    1. Nonlinear least squares
    2. Multivariate Adaptive Regression Splines
    3. Generalized Additive Model
    4. Regression trees
    5. Support Vector Regression
    6. Summary
  10. Regression Analysis in Practice
    1. Random forest regression with the Boston dataset
      1. Exploratory analysis
      2. Multiple linear model fitting
      3. Random forest regression model
    2. Classifying breast cancer using logistic regression
      1. Exploratory analysis
      2. Model fitting
    3. Regression with neural networks
      1. Exploratory analysis
      2. Neural network model
    4. Summary
  11. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Regression Analysis with R
  • Author(s): Giuseppe Ciaburro
  • Release date: January 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781788627306