Uploaded February 2021 | Updated November 2026, 2 hours ago
This lesson covers the basics of linear regression in R. It includes a discussion of basic linear regression, polynomial regression and multiple linear regression as well as some assumptions and potential sources of problems when making linear regression models.
This is lesson 27 of a 30-part introduction to the R programming language for data analysis and predictive modeling. Link to the code notebook below:
Intro to R: Linear Regression
kaggle.com/hamelg/intro-to-r-part-27-Linear-Regression
This guide does not assume any prior exposure to R, programming or data science. It is intended for beginners with an interest in data science and those who might know other programming languages and would like to learn R.
I will create the videos for this guide such that you should be able to learn a lot just watching on YouTube, but to get the most out of the guide, it is recommended that you create a Kaggle account so that you can fork and edit each lesson so that you can follow along and run code yourself.
Introduction to R Playlist:
youtube.com/playlist?list=PLiC1doDIe9rDjk9tSOIUZJU4s5NpEyYtE
This lesson covers the basics of linear regression in R. It includes a discussion of basic linear regression, polynomial regression and multiple linear regression as well as some assumptions and potential sources of problems when making linear regression models.
This is lesson 27 of a 30-part introduction to the R programming language for data analysis and predictive modeling. Link to the code notebook below:
Intro to R: Linear Regression
kaggle.com/hamelg/intro-to-r-part-27-Linear-Regression
This guide does not assume any prior exposure to R, programming or data science. It is intended for beginners with an interest in data science and those who might know other programming languages and would like to learn R.
I will create the videos for this guide such that you should be able to learn a lot just watching on YouTube, but to get the most out of the guide, it is recommended that you create a Kaggle account so that you can fork and edit each lesson so that you can follow along and run code yourself.
Introduction to R Playlist:
youtube.com/playlist?list=PLiC1doDIe9rDjk9tSOIUZJU4s5NpEyYtE






![How To Use all() and any() in Python
any() and all() are Python built in functions that let you check whether some iterable object like al ist contains any true values or all true values, respectively. This can be a useful operation when you want to check whether some large sequence conforms to a logical check. any() and all() also treat 0s as false and 1s as true, so they can be run on lists, arrays and pandas data frame columns encoded as indicator variables to check whether any or all of the values are equal to 1.
Code used in the video:
# Check if all elements of an iterable are true with all()
x = [True, True, True]
y = [True, False, True]
z = [False, False, False]
print(all(x))
print(all(y))
print(all(z))
# Check if any elements of an iterable are true with any()
print(any(x))
print(any(y))
print(all(z))
# any() and all() work on 0s and 1s
# 0 = False
# 1 = True
x = [0, 0, 0, 1]
print(any(x))
print(all(x))
# Useful when used with logical operations
import numpy as np
power_level_list = np.array([1000, 4000, 150, 9001, 1500])
any(power_level_list > 9000)
* Note: YouTube does not allow greater than or less than symbols in the text description, so the code above will not be exactly the same as the code shown in the video! I will use Unicode large < and > symbols in place of the standard sized ones. How To Use all() and any() in Python](https://i.ytimg.com/vi/QmcpDSFzsAA/mqdefault.jpg)



