Тёмный

Linear Regression, Clearly Explained!!! 

StatQuest with Josh Starmer
Подписаться 1,2 млн
Просмотров 220 тыс.
0% 0

The concepts behind linear regression, fitting a line to data with least squares and R-squared, are pretty darn simple, so let's get down to it! NOTE: This StatQuest comes with a companion video for how to do linear regression in R: • Linear Regression in R...
You can also find example code at the StatQuest github: github.com/StatQuest/linear_r...
If you'd like to support StatQuest, please consider...
Patreon: / statquest
...or...
RU-vid Membership: / @statquest
...buying my book, a study guide, a t-shirt or hoodie, or a song from the StatQuest store...
statquest.org/statquest-store/
...or just donating to StatQuest!
www.paypal.me/statquest
Lastly, if you want to keep up with me as I research and create new StatQuests, follow me on twitter:
/ joshuastarmer
0:00 Awesome song and introduction
0:37 The Main Ideas!!!
1:12 Review of fitting a line to data
4:00 Review of R-squared
12:13 R-squared for a multivariable model
14:16 Why adding variables will never reduce R-squared
16:08 Calculating a p-value for R-squared
25:26 The F-distribution
Correction:
25:39 I should have (Pfit - Pmean) instead of the other way around.
#statquest #regression

Опубликовано:

 

1 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 235   
@statquest
@statquest Год назад
NOTE: <a href="#" class="seekto" data-time="1539">25:39</a> I should have (Pfit - Pmean) instead of the other way around. Support StatQuest by buying my book The StatQuest Illustrated Guide to Machine Learning or a Study Guide or Merch!!! statquest.org/statquest-store/
@tonysvlogs881
@tonysvlogs881 8 месяцев назад
I struggled understanding this topic through a textbook/ professor videos online, and this was just a great explanation. It was like watching this video, made all the pieces finally fit
@statquest
@statquest 8 месяцев назад
Hooray! :)
@Bang-_-Bang
@Bang-_-Bang 5 месяцев назад
Yo bruh seriously I don't understand anything 😭😞
@infamousprince88
@infamousprince88 Год назад
This assisted me in delivering a presentation for a job interview -- landed the opportunity. Thanks!
@statquest
@statquest Год назад
TRIPLE BAM!!! Congratulations!!! :)
@user-xn5ut5pn2h
@user-xn5ut5pn2h 9 месяцев назад
I'm an electrical engineer who wanted to learn about machine learning, and your videos helped me understand all the fundamentals of this field. Thank you so much, sir
@statquest
@statquest 9 месяцев назад
Happy to help! :)
@undeadsatan3317
@undeadsatan3317 Год назад
I'm in my stats class but watching this instead of listening to my professor lol 💀
@statquest
@statquest Год назад
bam!
@bread_enjoyer
@bread_enjoyer Год назад
Double bam!
@thejasnair9424
@thejasnair9424 4 месяца назад
Ternary Bam!!!
@Alappavan
@Alappavan 4 месяца назад
Qudary bam!!!!
@justhydr
@justhydr 3 месяца назад
Penta bam!
@fooballers7883
@fooballers7883 4 месяца назад
I wish I had your lecture 50 yrs ago.... never too late learning it again today. thank you
@statquest
@statquest 4 месяца назад
Thanks!
@ioanamihai4368
@ioanamihai4368 Год назад
Wow...i was searching for this on your channel last week and I was so sad I didnt find it... luckily i still have time to study for the test. Thank you!
@statquest
@statquest Год назад
Good luck! :)
@imakechannel
@imakechannel Год назад
I struggle understanding this topic but it is Great to learn from someone who can explain things in a simple manner with eloquence
@statquest
@statquest Год назад
Thanks!
@awaisqaisar6696
@awaisqaisar6696 11 месяцев назад
@@statquest Agreed. You articulate well and make the subject simple and easy to understand.
@NaderNabilart
@NaderNabilart Год назад
Great work! The graphics made it super easy to understand.
@statquest
@statquest Год назад
Glad it helped!
@user-dm3vd7ig1e
@user-dm3vd7ig1e 4 месяца назад
Love the musical introduction. Such a nice touch to prime you beforehand :)
@statquest
@statquest 4 месяца назад
Thank you!
@user-bz7fj1fk2m
@user-bz7fj1fk2m Год назад
10QUVM for your valuable presentation!!! You made me feel proud in my STAT!!!
@statquest
@statquest Год назад
BAM! :)
@jamesahn3865
@jamesahn3865 Год назад
I had to buy a study guide book after watching this video...! This is a great video!!
@statquest
@statquest Год назад
Thank you so much for your support!
@bhargav1811
@bhargav1811 Год назад
This was truly advanced concept for me !!! :)
@statquest
@statquest Год назад
You can do it! :)
@krishnendusinha4409
@krishnendusinha4409 Год назад
Your videos are awesome! Thanks a lot for making complex concepts simpler. It will be helpful if you clearly explained Discrete probability distributions
@statquest
@statquest Год назад
I cover the binomial here: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-J8jNoF-K8E8.html
@muntazirabidi
@muntazirabidi 8 месяцев назад
Thank you. Wonderfully explained!!
@statquest
@statquest 8 месяцев назад
Glad it was helpful!
@penguinmonk7661
@penguinmonk7661 Год назад
I always have a good time with Statquest :3
@statquest
@statquest Год назад
bam!
@lizs7827
@lizs7827 28 дней назад
Awesome video, thank you Prof. Josh!!!!!
@statquest
@statquest 28 дней назад
Thank you!
@kimiko495
@kimiko495 3 месяца назад
wow this make so much sense! I'm pissed why college professors don't teach like this, it was a waste of time to sit in their classes being so confused right from the start. I can't thank you enough for your videos!
@statquest
@statquest 3 месяца назад
Thank you!
@fabslyrics
@fabslyrics 3 месяца назад
thank you friendly folks of the genetics departement of NC Chapel Hill , greetings from Paris France.
@statquest
@statquest 3 месяца назад
Thank you!
@12PEN12
@12PEN12 Год назад
Hats off to StatQuest!!!
@statquest
@statquest Год назад
Thank you!
@anlinli6463
@anlinli6463 Год назад
Thank you Josh! You are truly helping me with the difficult reviewers' comments🤣.
@statquest
@statquest Год назад
Good luck!
@AbhiSarangan
@AbhiSarangan 23 дня назад
I would be lost without this channel
@statquest
@statquest 23 дня назад
bam! :)
@DSharma117
@DSharma117 Месяц назад
Thanks Josh, your channel is recommended from Murdoch University,Australia lecturers. Worth watching your channel
@statquest
@statquest Месяц назад
Thanks!
@SofiaBuyanova
@SofiaBuyanova Год назад
Thank you for the great video! Please note that from the second <a href="#" class="seekto" data-time="1549">25:49</a> the degrees of freedom for the numerator should be (Pfit-Pmean), otherwise it is less than 0.
@statquest
@statquest Год назад
Thanks! In theory RU-vid is supposed to alert people of that typo, but maybe it doesn't always work. (I just tried it and it worked for me).
@lynnamanda4093
@lynnamanda4093 10 месяцев назад
Thank you so much Josh !
@statquest
@statquest 9 месяцев назад
Thanks!
@marm_sam_bamb
@marm_sam_bamb 3 месяца назад
Awesome channel! I just bought your book too!
@statquest
@statquest 3 месяца назад
TRIPLE BAM!!! Thank you very much for supporting StatQuest!!!
@kushagrastripathi
@kushagrastripathi Год назад
Very helpful. Thank you
@statquest
@statquest Год назад
Thanks!
@ashutoshshrivastava1305
@ashutoshshrivastava1305 Год назад
Amazing explanation
@statquest
@statquest Год назад
Thanks!
@muhammedfarispk1687
@muhammedfarispk1687 8 месяцев назад
I am enjoying this teaching method 😍
@statquest
@statquest 8 месяцев назад
Thank you!
@anelazikic5114
@anelazikic5114 4 дня назад
Thank you so much for this video
@statquest
@statquest 4 дня назад
Happy to help!
@catcen9631
@catcen9631 Год назад
insanely good video
@statquest
@statquest Год назад
Thank you! :)
@user-gv7fs7hv3b
@user-gv7fs7hv3b 2 месяца назад
thank you. that was very clear
@statquest
@statquest 2 месяца назад
Thanks!
@utku_bambu
@utku_bambu Год назад
thank you for this
@statquest
@statquest Год назад
Thanks!
@theolau7335
@theolau7335 Год назад
Very nice, thank you
@statquest
@statquest Год назад
:)
@mmkvhornet7522
@mmkvhornet7522 Месяц назад
thanks for the video
@statquest
@statquest Месяц назад
You're welcome!
@antonyshadowbanned
@antonyshadowbanned Год назад
You are indeed a God among mortals. And as such you shall be praised. Tons of gratitude for blessing us with your pristine insight Father Majesty.
@statquest
@statquest Год назад
Wow, thank you!
@aitorolaso1352
@aitorolaso1352 6 месяцев назад
absolute masterpiece
@statquest
@statquest 6 месяцев назад
Thank you!
@B-hooktuber
@B-hooktuber 3 месяца назад
Cool merch you could probably easily create would be a workbook to pair with your book where we could practice calculating R2 for exemple in different scenarios. That way, everytime you learn a new concept you can practice doing the formulas :) i'd totally buy that 😏 and maybe links to extra videos or explainations on the concepts that are a little harder to comprehend for people that are completely new to this field and a little slow lol(like linear regression 😅)
@statquest
@statquest 3 месяца назад
That's a great idea!
@muhammadomarkhayyamkhan3593
@muhammadomarkhayyamkhan3593 2 месяца назад
Your explanations are wonderful. Please just recommend the book should be studied with your videos. Please make videos on chi-Squared distribution, Monte Carlo Simulations and Hypotheses testing. Thanks for your valuable help.
@statquest
@statquest 2 месяца назад
My favorite book to go along with my videos is The StatQuest Illustrated Guide To Machine Learning. You can get it here: statquest.org/statquest-store/
@joshuaaddo1609
@joshuaaddo1609 5 месяцев назад
This is great
@statquest
@statquest 5 месяцев назад
Thanks!
@user-qy3xv8lp6j
@user-qy3xv8lp6j Год назад
Thank you ever so much!
@statquest
@statquest Год назад
You're very welcome!
@user-co6pu8zv3v
@user-co6pu8zv3v Год назад
Thank you :)
@statquest
@statquest Год назад
You're welcome!
@stevinbrat
@stevinbrat 5 месяцев назад
you are a genius!
@statquest
@statquest 5 месяцев назад
Thanks!
@abdullahs9500
@abdullahs9500 Год назад
That was a really mice explanation.. Thank you!
@statquest
@statquest Год назад
Ha! Nice one! :)
@abdullahs9500
@abdullahs9500 Год назад
🌹😄
@jenwilson7779
@jenwilson7779 10 месяцев назад
Thanks!
@statquest
@statquest 10 месяцев назад
BAM!!! Thank you so much for supporting StatQuest!!!
@jenwilson7779
@jenwilson7779 10 месяцев назад
Of course! I am the person who is embarrassed on the inside that I don't get the stats terms when thrown around at work, but know that I'm memorized them so know what they are, but really don't understand the "why" or how it all relates. Thank you so much for speaking slowly in your videos, reiterating concepts, sometimes with additional concepts in between, and your humor. It's fun. I'm grateful. @@statquest
@lattoufj
@lattoufj 2 месяца назад
Hi Josh, Very nice video! Shouldn't the distances from the points to the line be a perpendicular?
@statquest
@statquest 2 месяца назад
If they were perpendicular, than we would lose the relationship between the variable on the x-axis and the variable on the y-axis, and the whole point is to use an x-axis value to predict a y-axis value. Thus, the residuals are parallel with the y-axis - this preserves the relationship that we want to use to make predictions.
@timbui5556
@timbui5556 10 месяцев назад
Thank you for making this series of statistic videos. One question please: I want to calculate the least squares growth rate of sales for a company. Would I have "higher quality" growth rate by using quarterly sales (40 pieces of data) vs. annual sales (10 pieces of data). Would the seasonality (Christmas sales higher) affects of quarterly sales and distort the growth rate? Thanks,
@statquest
@statquest 10 месяцев назад
It sort of depends on how exactly you want to model and what you want to get out of the model. If you want to take seasonality into account, then you need to fit a periodic function (like a sine function) to your quarterly data. That said, the easiest thing to do would be to start with annual sales and see how useful that is.
@timbui5556
@timbui5556 10 месяцев назад
@@statquest Thank you so much for taking the time to answer my question!
@apak-iw3jp
@apak-iw3jp 4 месяца назад
u just earned a subcriber
@statquest
@statquest 4 месяца назад
bam! :)
@simplemindedperson
@simplemindedperson 9 месяцев назад
Thank you for the nice video! I wonder for your explanation to the F curves around <a href="#" class="seekto" data-time="1553">25:53</a>, shouldn't it be (p_{fit} - p_{mean})=1? In addition, would you please provide the link to your video about the degrees of freedom if that is already available?
@statquest
@statquest 9 месяцев назад
Yes, that is a typo. And, unfortunately, I haven't made the degrees of freedom video yet. However, it's still on the todo list.
@simplemindedperson
@simplemindedperson 9 месяцев назад
@@statquest Thank you! I look foreward to your new ones
@jix8874
@jix8874 5 месяцев назад
@@statquest looking forward to the degrees of freedom video too!
@kartikeysingh6550
@kartikeysingh6550 Год назад
Around which point do we rotate the line ???????? Beautiful lecture..really easy to understand
@statquest
@statquest Год назад
There are two different ways to fit the line to data. The one most commonly used is to simply do the math and solve for the optimal fit (take the derivative with respect to the squared residuals and solve for where it is equal to 0). However, that method only works in this specific situation. A more general method is based on the "rotate the line approach" that I illustrate in this video. To learn more about it (how to rotate the line), see my video on Gradient Descent: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-sDv4f4s2SB8.html
@looklook6075
@looklook6075 5 месяцев назад
I was always wondering why the model chooses to use R2 rather than absolute value of R, until you draw that polynomial out of all sum of squares. It makes sense now
@statquest
@statquest 5 месяцев назад
Hooray!
@gnosmik
@gnosmik Год назад
This is an excellent video Josh, thank you! I understand all well until you explain about p-value <a href="#" class="seekto" data-time="1438">23:58</a>. So we were using a dataset of mouse size/weight and weight/tail length/body length, but I'm confusing where the 'random dataset' comes from when you calculate p-value. Could you explain a bit further about this please?
@statquest
@statquest Год назад
The idea is to give you an intuitive sense of what the p-values associated with linear regression represent. So, to start with, we had 9 data points (9 pairs of weight/height measurements) and fitted a line to it and calculated the F value. That is the "observed" F value generated from the original, raw data. Now pair 9 random values for height (and these could be any reasonable values for height that you randomly select) with 9 random values for weight (and these could be any reasonable values for weight). Calculate the F for those pairs of random values and put that in a histogram. Then repeat until we've done that a lot of times and compare the observed F value from the original data to the histogram.
@gnosmik
@gnosmik Год назад
@@statquest Thanks for explaining all. Much appreciate it. So those 'random values' are completely random, just made up within the range of the normal dataset, right? Then when we are calculating F and p values in SPSS or R, do those softwares go through this process? It might be a bit silly questions, hopefully I'm not too far away!
@statquest
@statquest Год назад
@@gnosmik That's the idea. However, as mentioned at 25:26, in practice, people (and software) just use an F-distribution (which is an equation for a curved line) to calculate the p-value. The idea of using random data is just to give you an intuition of what the curved line created by the F-distribution represents.
@gnosmik
@gnosmik Год назад
@@statquest Excellent! Thanks Josh
@exarchoskanelis84
@exarchoskanelis84 Год назад
Legend
@statquest
@statquest Год назад
Thanks!
@user-ch4mj2tr3c
@user-ch4mj2tr3c 10 дней назад
Hello, I had one doubt. For calculating multiple F values, are we taking random samples from our original dataset itself? As in, if there are 100 data points in total, we will take 80, 70 and any random data points from 100 to plot F values on histogram? Could you please help me with this?
@statquest
@statquest 10 дней назад
The example where we use random data is just an example of the concepts behind how the p-value is calculated. In practice, we use a curve generated by the F distribution (see 25:26) that represents what would happen if we had generated an infinite number of random datasets.
@khoiphamang4166
@khoiphamang4166 Год назад
I have a question, in <a href="#" class="seekto" data-time="324">5:24</a> why the variance is calculated dividing by n instead of n-1, I thought all the observed data points are just a sample of a bigger population includes data points which we haven't observed yet. I'm sorry if my English confuse you because it isn't my mother tongue
@statquest
@statquest Год назад
In this context, the way we use variation means that denominator will cancel out, so it really doesn't matter which one (n or n-1) we use.
@mahammadodj
@mahammadodj Год назад
Does n equals to the number of data points in F equation? For example, we should take 9 for n in <a href="#" class="seekto" data-time="1360">22:40</a> ?
@statquest
@statquest Год назад
Yes
@Tatya1905
@Tatya1905 2 месяца назад
What is the value n (that was mentioned while explaining the degrees of freedom)?
@statquest
@statquest 2 месяца назад
n = the number of data points in the graph.
@prachirahate1631
@prachirahate1631 4 месяца назад
awesoommeeeeee!
@statquest
@statquest 4 месяца назад
Thanks!
@ajalanbrown2200
@ajalanbrown2200 5 месяцев назад
i had to like just because of the song
@statquest
@statquest 5 месяцев назад
bam! :)
@lilysun1296
@lilysun1296 Год назад
Thanks for the video. Could you please explain more why SS(fit)/(n-pfit) instead of n here <a href="#" class="seekto" data-time="1368">22:48</a>? Thanks a lot.
@statquest
@statquest Год назад
This has to do with "degrees of freedom" and one day I hope to cover that topic in full.
@zauraiz
@zauraiz Год назад
@@statquest Looking forward to the degrees of freedom video! Parameters have always been a confusing topic for me
@alabenmed4661
@alabenmed4661 Год назад
hello i love watcing your video they are entertaining and educaional but i saw some other videos of ways to determine intercept and slope of a line im wondering if you have a video about that or is there a better approach ?
@statquest
@statquest Год назад
There are a number of ways to do it. One is to use an analytical solution. Take the derivatives of the equation with respect to the different variables (in this case, the slope and the intercept) and then solve for when those derivatives are equal to 0. For linear regression, this is a fine way to solve the problem, but it only works in this one case. A more general solution is to use something called Gradient Descent. This works on regression problems and many, many more. For details about Gradient Descent, see: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-sDv4f4s2SB8.html
@alabenmed4661
@alabenmed4661 Год назад
@@statquest thanks man have ag reat day
@prithvidhyani2002
@prithvidhyani2002 3 месяца назад
Great video overall! But I'm a little confused with your description of calculating a p-value for the R^2. Does this mean we are treating R^2 as a random variable itself and looking at its distribution? Because to me it seems like it is the f-statistic that follows an f-distribution, hence we are calculating a p-value for the f-stat, not the R^2 itself, which(correct me if I'm wrong) does not follow any specific distribution. So what exactly is the connection between the R^2 and the f-stat and its corresponding p-value?
@statquest
@statquest 3 месяца назад
The f-statistic is what we use to calculate the p-value for the r-squared.
@JasonKaros
@JasonKaros Год назад
Why was the original Linear Regression video removed for this one? Is the information of this more accurate or clearer?
@statquest
@statquest Год назад
Without telling me, RU-vid put the original video behind a paywall, so re-uploaded it so it would still be free
@sopeadaralegbe8077
@sopeadaralegbe8077 Год назад
is residual the difference between the observed value of the dependent variable and the predicted value or the difference between the overall mean of the dependent and the observed value
@statquest
@statquest Год назад
The residual is the difference between the observed and predicted values.
@rahoolmahool-programming5499
I got pregnant two times while learning SGD from you. This is the hundredth time i'm jumping from a video to another video.
@statquest
@statquest Год назад
ok
@johnlemon1595
@johnlemon1595 10 месяцев назад
Hi josh, while getting to R^2, you give the formula y= (data-mean)^2. This contradicts your StatQuest "Fitting a line to the data", where your formula was "(b-y1)^2+(b-y2)^2+...", meaning "(intersect-data)^2. Now i already understood that by squaring the difference you get the same positive value, so the order doesn't matter for this purpose. Is there another reason why you put it in the order "(data-mean)^2" in this video? Thanks. Love the videos, just watching for fun
@statquest
@statquest 10 месяцев назад
Since order doesn't matter, it's hard for me to remember to be consistent.
@johnlemon1595
@johnlemon1595 10 месяцев назад
Okay great, just was wondering if i was missing something here @@statquest
@apak-iw3jp
@apak-iw3jp 4 месяца назад
its like years since u uploaded this
@statquest
@statquest 4 месяца назад
I know! This one is classic! It might even be "pre BAM!"
@Phi_AI
@Phi_AI 23 дня назад
This is implementation of Linear regression from scratch in NumPy only. In-depth explanation of key concepts like Cost Function and Gradient Descent ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-wxCQxZKo4hU.html
@streampunksheep
@streampunksheep 9 месяцев назад
I am going to statquest Isle!~
@AutoDisheep
@AutoDisheep 9 месяцев назад
The greatest island on earth!
@statquest
@statquest 9 месяцев назад
Bam!!
@kuraldeepdives9319
@kuraldeepdives9319 Год назад
@<a href="#" class="seekto" data-time="1581">26:21</a> Should the curves say ( P fit- P mean)=1 ?
@statquest
@statquest Год назад
Yes! That's funny that it's been like that forever, but you finally caught it. Thanks!
@kuraldeepdives9319
@kuraldeepdives9319 Год назад
@@statquest Haha the credit goes to you for teaching the concepts so well to a newbie! BAM! 😁
@user-xs9ug2tw5c
@user-xs9ug2tw5c 5 месяцев назад
Question. Why are we calculating R2 value and the p value? Is it the industry standard? Or else What led to the decision that you included it with linear regression. Theoretically Lin reg is complete before that right?(Making concepts clear)
@statquest
@statquest 5 месяцев назад
If you just want to fit a line to data, you can used the method of least squares. However, if you want to quantify how well that line fits your data, then you use Linear Regression. Linear Regression consists of using least squares to fit the line to the data and then calculating r^2 and its p-value to evaluate how well that line fits the data.
@user-xs9ug2tw5c
@user-xs9ug2tw5c 5 месяцев назад
@@statquest still confused.. as you said 'how well it fits the data', so the r2 and p value are tests for evaluation right? dont they have alternatives? or is it necessary to do exactly these steps. I'll still get a logistic regression model but it may not be the best one without them? Or are you saying that these, or some other alternatives tests are necessary to do, to assess the model and this repeats iteratively until best fit?
@statquest
@statquest 5 месяцев назад
@@user-xs9ug2tw5c They do have alternatives, so, as you say, you might think of r^2 and its corresponding p-values as the 'industry standards'. Pretty much every program that offers a linear regression function will give you those as outputs. However, there are alternatives, and you can read more about them here: developer.nvidia.com/blog/a-comprehensive-overview-of-regression-evaluation-metrics/ among other places.
@user-xs9ug2tw5c
@user-xs9ug2tw5c 5 месяцев назад
@@statquest Thanks a lot for clearing that
@derekc.5063
@derekc.5063 Месяц назад
At <a href="#" class="seekto" data-time="915">15:15</a>, how does least squares cause any useless variable to be multiplied by 0? I thought Lasso regression excludes variables.
@statquest
@statquest Месяц назад
Least squares can do it in principle, but not very well. Lasso is much more effective, and lasso also works when there are more variables than data.
@daraghfarnan1204
@daraghfarnan1204 Год назад
Bam! Bam! Bam!
@statquest
@statquest Год назад
Triple bam!!! :)
@mathematics6199
@mathematics6199 3 месяца назад
Hey hi, R squared can be negative as well right?
@statquest
@statquest 3 месяца назад
Not in the context of linear regression. In other contexts, though, it can be.
@mathematics6199
@mathematics6199 3 месяца назад
@@statquest R^2 is just a metric right, and I can set the coefficients of independent variables in such a way that variance(error) exceeds variance(y),( as variance(error) = variance(y* - y), (where y* is the infered value, and y is the actual value) , I can always make y*-y infinitely high for one datapoint, by choosing appropriate coefficients ), or am I wrong? Please correct me.
@statquest
@statquest 3 месяца назад
@@mathematics6199 Yes, in theory, you can do that - but that's not linear regression. In linear regression we don't just set the coefficients to whatever we want. We set them so that they minimize the sum of the squared residuals. And this is why R^2 isn't negative in this context. However, in other contexts, where you can do whatever you want, yes, it can be negative.
@mathematics6199
@mathematics6199 3 месяца назад
@@statquest Thank you so much.
@user-xn5ut5pn2h
@user-xn5ut5pn2h 9 месяцев назад
This video is BAMMMMMMMMMM
@statquest
@statquest 9 месяцев назад
Thanks! :)
@ritubhatt7367
@ritubhatt7367 Год назад
I am not able to find the video 'Fitting a line to the data'
@statquest
@statquest Год назад
I have contacted RU-vid about this problem, but, unfortunately, they are all on vacation until next week. :( The good news is that this video does a pretty good job summarizing the concepts in that other video.
@puneetkumarsingh1484
@puneetkumarsingh1484 6 месяцев назад
Not that it matters here but the shouldn't the sample variance formula have n-1 instead of n?
@statquest
@statquest 6 месяцев назад
In this case it doesn't matter.
@VirtuosicBeats
@VirtuosicBeats Год назад
Awesome, but can we do this without squaring? Why can't we just sum the residuals without any squaring, it looks like it should give us the sum of all distances and then we could plot it in the same way and pick the rotation that gives us the least sum of non-squared residuals and it should still work, curious why do we choose to square it, thank you so much for the video
@statquest
@statquest Год назад
If the "distances" below the line are negative, they will cancel out the ones above them, so that's a problem. However, we could then take the absolute value so that everything is positive. This could work if Linear Regression was actually solved the way I've presented it here. However, in practice, when you square the distances, you can solve for the optimal parameters directly by taking the derivative of the squared residuals with respect to each parameter, setting those derivatives equal to 0 and then solving for the parameter values.
@VirtuosicBeats
@VirtuosicBeats Год назад
@@statquest Thank you so much , it makes sense now
@user-cr6zu5mm5j
@user-cr6zu5mm5j Год назад
I don't understand why least squares can cause any term that will make ss(fit) worse to be multiplied by 0. Is it because mean squares differential the equation? <a href="#" class="seekto" data-time="920">15:20</a>
@user-cr6zu5mm5j
@user-cr6zu5mm5j Год назад
or is it because things like ridge regression can shrink the coefficients to 0?
@statquest
@statquest Год назад
Least squares minimizes the sum of the squared residuals and if setting a parameter = 0 reduces the SSR, then that's what will happen.
@atharvigupta4250
@atharvigupta4250 2 месяца назад
so is mouse size a confounder?
@statquest
@statquest 2 месяца назад
What time point, minutes and seconds, are you asking about?
@hoanglexuan7861
@hoanglexuan7861 4 месяца назад
can you do Quantile Regression?
@statquest
@statquest 4 месяца назад
I'll keep that in mind.
@atharvigupta4250
@atharvigupta4250 2 месяца назад
how do you come with the equation
@statquest
@statquest 2 месяца назад
What time point, minutes and seconds, are you asking about?
@sopeadaralegbe8077
@sopeadaralegbe8077 Год назад
what's the difference between RSS and SS(fit) ?
@statquest
@statquest Год назад
They are the same. However, I changed notation so that I could specify when which model we were using to make the predictions. SS(fit) is the RSS around the fitted line and the SS(mean) is the RSS around the mean.
@vatanrangani8033
@vatanrangani8033 9 месяцев назад
so is R square , a correlation coefficient?
@statquest
@statquest 9 месяцев назад
It is the square of the correlation coefficient.
@demalegabi
@demalegabi Год назад
I think at ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-7ArmBVF2dCs.html the slide meant to say (SS(mean) - SS(fit))/(p_fit - p_mean) for the numerator?
@statquest
@statquest Год назад
Yep
@apak-iw3jp
@apak-iw3jp 4 месяца назад
wow
@statquest
@statquest 4 месяца назад
:)
@Perfectfluid
@Perfectfluid 4 месяца назад
What is the difference between this video and the previous one in 2017? ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-nk2CQITm_eo.html
@statquest
@statquest 4 месяца назад
I don't think there's a difference - I had to re-release this video (and my other linear models videos) because RU-vid made an error.
@alexandrumatei6800
@alexandrumatei6800 Год назад
i lov u josh starmer
@statquest
@statquest Год назад
Thanks!
@alexandrumatei6800
@alexandrumatei6800 Год назад
@@statquest y- you too
@apak-iw3jp
@apak-iw3jp 4 месяца назад
could i ask u my doubts in this video
@statquest
@statquest 4 месяца назад
Sure!
@apak-iw3jp
@apak-iw3jp 4 месяца назад
dude u are funny
@statquest
@statquest 4 месяца назад
Thanks!
@396me
@396me 5 месяцев назад
I didn’t get what is actual R
@statquest
@statquest 5 месяцев назад
It's the correlation coefficient. For details, see: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-xZ_z8KWkhXE.html and ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-2AQKmw14mHM.html
@apak-iw3jp
@apak-iw3jp 4 месяца назад
u sound like technoblade
@statquest
@statquest 4 месяца назад
Thanks!
@WankhadeTejasSuresh
@WankhadeTejasSuresh Год назад
Please add this video to the linear regression playlist and remove the existing video from there as it doesn't open
@statquest
@statquest Год назад
I'm working on getting the original video out from behind the paywall. I've contacted RU-vid but they're on holiday until next week.
@apak-iw3jp
@apak-iw3jp 4 месяца назад
yo how did u respond to me
@statquest
@statquest 4 месяца назад
I keep track of all of my videos. bam! :)
@TheFunofMusic
@TheFunofMusic Год назад
First :)
@statquest
@statquest Год назад
BAM! :)
@journalofmytwenties
@journalofmytwenties 19 дней назад
HONESTLY IF YOU STARTED A NEW RELIGION. I WOULD CONVERT
@statquest
@statquest 19 дней назад
bam! :)
@PINEDARONALD
@PINEDARONALD 4 месяца назад
i don't understand anything :(
@statquest
@statquest 4 месяца назад
What time point, minutes and seconds, did you get confused?
@PINEDARONALD
@PINEDARONALD 4 месяца назад
@@statquest stop watching because I didn't understand from the very beginning but I want to understand I am not math expert
@statquest
@statquest 4 месяца назад
@@PINEDARONALD Try starting with this video: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-PaFPbb66DxQ.html or maybe this one: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-2AQKmw14mHM.html
@PINEDARONALD
@PINEDARONALD 4 месяца назад
@@statquest is myself bro that I have struggled with math I will watch both videos again until I understand
@second1799
@second1799 3 месяца назад
nah bro def made it harder
@statquest
@statquest 3 месяца назад
Sorry about that. Is there a time point (minutes and seconds) where things got confusing?
@gamingtitan0
@gamingtitan0 2 месяца назад
Damn, this makes no sense 😢😢
@statquest
@statquest 2 месяца назад
What time point, minutes and seconds, did things get confusing?
@ProfessorQwQ
@ProfessorQwQ Год назад
good video but god this is so cringe
@statquest
@statquest Год назад
:)
Далее
BABYMONSTER - ‘FOREVER’ M/V
03:54
Просмотров 21 млн
I Built a SECRET Soccer Field in My Room!
24:15
Просмотров 12 млн
Regularization Part 1: Ridge (L2) Regression
20:27
How I think about Logistic Regression - Part 1
12:36
Просмотров 1,5 тыс.
R-squared, Clearly Explained!!!
11:01
Просмотров 169 тыс.
How To Perform Simple Linear Regression In Excel
14:51
Просмотров 414 тыс.
Linear Regression, Clearly Explained!!!
27:27
Просмотров 1,3 млн
Regression Analysis | Full Course
45:17
Просмотров 779 тыс.
Regression Trees, Clearly Explained!!!
22:33
Просмотров 615 тыс.
BABYMONSTER - ‘FOREVER’ M/V
03:54
Просмотров 21 млн