# Introduction to Regression in R

Predict housing prices and ad click-through rate by implementing, analyzing, and interpreting regression analysis in R.

Start Course for Free4 Hours14 Videos52 Exercises16,337 Learners

4050 XP## Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA. You confirm you are at least 16 years old (13 if you are an authorized Classrooms user).## Loved by learners at thousands of companies

## Course Description

Linear regression and logistic regression are the two most widely used statistical models and act like master keys, unlocking the secrets hidden in datasets. In this course, you’ll gain the skills you need to fit simple linear and logistic regressions. Through hands-on exercises, you’ll explore the relationships between variables in real-world datasets, including motor insurance claims, Taiwan house prices, fish sizes, and more. By the end of this course, you’ll know how to make predictions from your data, quantify model performance, and diagnose problems with model fit.

- 1
### Simple Linear Regression

**Free**You’ll learn the basics of this popular statistical model, what regression is, and how linear and logistic regressions differ. You’ll then learn how to fit simple linear regression models with numeric and categorical explanatory variables, and how to describe the relationship between the response and explanatory variables using model coefficients.

A tale of two variables50 xpWhich one is the response variable?50 xpVisualizing two variables100 xpFitting a linear regression50 xpEstimate the intercept50 xpEstimate the slope50 xpLinear regression with lm()100 xpCategorical explanatory variables50 xpVisualizing numeric vs. categorical100 xpCalculating means by category100 xplm() with a categorical explanatory variable100 xp - 2
### Predictions and model objects

In this chapter, you’ll discover how to use linear regression models to make predictions on Taiwanese house prices and Facebook advert clicks. You’ll also grow your regression skills as you get hands-on with model objects, understand the concept of "regression to the mean", and learn how to transform variables in a dataset.

Making predictions50 xpPredicting house prices100 xpVisualizing predictions100 xpThe limits of prediction100 xpWorking with model objects50 xpExtracting model elements100 xpManually predicting house prices100 xpUsing broom100 xpRegression to the mean50 xpHome run!50 xpPlotting consecutive portfolio returns100 xpModeling consecutive returns100 xpTransforming variables50 xpTransforming the explanatory variable100 xpTransforming the response variable too100 xp - 3
### Assessing model fit

In this chapter, you’ll learn how to ask questions of your model to assess fit. You’ll learn how to quantify how well a linear regression model fits, diagnose model problems using visualizations, and understand the leverage and influence of each observation used to create the model.

Quantifying model fit50 xpCoefficient of determination100 xpResidual standard error100 xpVisualizing model fit50 xpResiduals vs. fitted values50 xpQ-Q plot of residuals50 xpScale-location50 xpDrawing diagnostic plots100 xpOutliers, leverage, and influence50 xpLeverage50 xpInfluence50 xpExtracting leverage and influence100 xp - 4
### Simple logistic regression

Learn to fit logistic regression models. Using real-world data, you’ll predict the likelihood of a customer closing their bank account as probabilities of success and odds ratios, and quantify model performance using confusion matrices.

Why you need logistic regression50 xpExploring the explanatory variables100 xpVisualizing linear and logistic models100 xpLogistic regression with glm()100 xpPredictions and odds ratios50 xpProbabilities100 xpMost likely outcome100 xpOdds ratio100 xpLog odds ratio100 xpQuantifying logistic regression fit50 xpCalculating the confusion matrix100 xpMeasuring logistic model performance100 xpAccuracy, sensitivity, specificity100 xpCongratulations50 xp

#### Richie Cotton

Curriculum Architect at DataCamp

Richie is a Learning Solutions Architect at DataCamp. He has been using R since 2004, in the fields of proteomics, debt collection, and chemical health and safety. He has released almost 30 R packages on CRAN and Bioconductor – most famously the assertive suite of packages – as well as creating and contributing to many others. He also has written two books on R programming, Learning R and Testing R Code.

## What do other learners have to say?

“I've used other sites—Coursera, Udacity, things like that—but DataCamp's been the one that I've stuck with.”

Devon Edwards Joseph

Lloyds Banking Group

“DataCamp is the top resource I recommend for learning data science.”

Louis Maiden

Harvard Business School

“DataCamp is by far my favorite website to learn from.”

Ronald Bowers

Decision Science Analytics, USAA

## Join over 8 million learners and start Introduction to Regression in R today!

### Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA. You confirm you are at least 16 years old (13 if you are an authorized Classrooms user).