Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Statistical Application Development with R and Python - Second Edition

You're reading from  Statistical Application Development with R and Python - Second Edition

Product type Book
Published in Aug 2017
Publisher
ISBN-13 9781788621199
Pages 432 pages
Edition 2nd Edition
Languages
Toc

Table of Contents (19) Chapters close

Statistical Application Development with R and Python - Second Edition
Credits
About the Author
Acknowledgment
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface
1. Data Characteristics 2. Import/Export Data 3. Data Visualization 4. Exploratory Analysis 5. Statistical Inference 6. Linear Regression Analysis 7. Logistic Regression Model 8. Regression Models with Regularization 9. Classification and Regression Trees 10. CART and Beyond Index

Packages and settings – R and Python


We will need four R packages in ridge, DAAG, splines, and MASS. The required Python packages are matplotlib, pandas, numpy, pylab, statsmodels, and sklearn:

  1. First set the working directory in R:

    setwd("MyPath/R/Chapter_06")
  2. Load the essential R packages:

    > library(RSADBE)
    > library(ridge)
    > library(DAAG)
    > library(splines)
    > library(MASS)
  3. Set the working directory and required packages and functions in Python now:

Using these packages and functions, we will be able to carry out the computations required in the rest of the chapter.

The overfitting problem

The limitation of the linear regression model is best understood through an example. I have created a hypothetical dataset for understanding the problem of overfitting. A scatterplot of the dataset is shown in the figure, A non-linear relationship displayed by scatter plot.

It appears from the scatterplot that, for x-values up to 6, there is a linear increase in y, and an eye-bird estimate of the...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime