From the course: Complete Guide to R: Wrangling, Visualizing, and Modeling Data
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Predicting outcomes with lasso regression
From the course: Complete Guide to R: Wrangling, Visualizing, and Modeling Data
Predicting outcomes with lasso regression
- [Instructor] When you're doing a regression model in R, you have more choices than just standard least squares linear regression. One of the more interesting alternatives of modern development, relatively speaking, is lasso regression. And I want to show you how that works here in R. Let's start by loading a few packages, including one called lars, which stands for at least angle regression. And I'm going to load those packages and then I'm going to come down and import a new dataset called wine quality. And what this is is an attempt to use the chemical properties of red wines to predict the perceived quality of them. I'm going to import that dataset. It's nearly 1,600 observations. We have 12 variables. Let's zoom in on that. So we have a number of measurements. Now, I do want to point out one thing here, because these variable names have spaces in them, R puts backticks around them. That works, I personally find it awkward 'cause it means anytime you refer to these variables, you…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
-
-
-
(Locked)
Predicting outcomes with linear regression8m 49s
-
(Locked)
Predicting outcomes with lasso regression7m 48s
-
(Locked)
Predicting outcomes with quantile regression6m 27s
-
(Locked)
Predicting outcomes with logistic regression12m 49s
-
(Locked)
Predicting outcomes with Poisson or log-linear regression3m 43s
-
(Locked)
Assessing predictions with blocked-entry models10m 35s
-
(Locked)
-
-