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

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…

Contents