From the course: R for Data Science: Analysis and Visualization

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Computing a linear regression

Computing a linear regression

- [Instructor] When working with data, one of the most interesting things you can do is start building models, that is statistical models, where you're trying to use a group of variables to predict a particular outcome. And the simplest and most flexible and often the most powerful way of doing this is with linear regression, and this is a very simple thing to do in R. Let's start by loading a couple of packages, and then let's read our dataset. Now what I'm going to do here is I'm going to pick the personality variables on a state-by-state basis, and all of the Google Trends variables. And when I do that, you can see that they've all loaded here, we've got a pretty big dataset, it's got 20 variables at the moment. Let's make a scatter plot of a subset of this. Let's take just the search term data science, so how much that term pops up relatively speaking from state to state, along with the five personality variables on a…

Contents