00:00Hi guys, so in this
00:02video we're going to look
00:03at the coefficient of determination
00:04which is or squared and
00:06essentially what it does or
00:08what it's similar to the
00:10or value or Pearson's product
00:11moment correlation that you might
00:13remember from the near regression.
00:17It essentially tells us how
00:18well a graph or a
00:21curve fits to a set
00:23of data and a bit
00:24like the or value the
00:26closer to one it is.
00:28the the closer the fit
00:31unlike the or value because
00:33it's our squared it has
00:35to be positive so you're
00:36gonna have a negative number
00:37is going to be between
00:370 and 1 and actually
00:40the I mean the square
00:41root of this is or
00:43that will give you the
00:43or value that you are
00:44familiar with with from linear
00:49regression. So what I'm going
00:52to do is I'm going
00:54to show you how to
00:55do this
00:56fairly easily and with the
00:58calculator and then I'm going
01:00to show you how we
01:03actually find the r squared
01:06value using this formula here.
01:10This formula is not in
01:12the formula book that you
01:13actually don't need to know.
01:15You don't need to know
01:18how to do what I'm
01:19about to show you in
01:20an exam. However, well, the
01:23bit, the bit that
01:24I'm about to show you
01:25that's not using the character.
01:26Yes, you do need to
01:27know how to do it
01:28using your calculator, but it
01:30is definitely useful to know
01:32how to do it for
01:34your I .A. But in
01:35general, to understand why this
01:38is even a thing, I
01:40think it's worth going through
01:42it in full. So let's
01:44get cracking. So it says,
01:45here's some data I haven't
01:47gotten to much effort in
01:48a real life example. I've
01:49just given us an X
01:50value and a Y value
01:51and I want us to
01:52find a quadratic regression curve
01:54on the coefficient of determination
01:55for this curve. So here's
01:58my data. I have, I've
02:01already put in the data,
02:03I've called this x and
02:03I've called this y. Now
02:06what I can do is
02:07I can go press menu,
02:11statistics, stuck calculations, quadratic regression.
02:16The x list is x,
02:18the y list is y.
02:20keep all this the same.
02:23Press okay and I get
02:24this. So I get A,
02:26B and C. That's my
02:29A x squared plus B
02:31x plus C. And then
02:32I get the or squared
02:33value here, which is your
02:34point nine and five seven,
02:36et cetera. So these values,
02:38guys, well, they're here, A,
02:41B and C. If you
02:42want to see what the
02:43full value is, it's there,
02:46right? I always recommend six,
02:47put six
02:48significant figures. And then you
02:52can round it at the
02:53end if you want to,
02:55or if you need to.
02:57So, okay, so the quadratic
03:00regression curve is y equals,
03:05and we're just going to
03:06put in a, so 0
03:07.67857, 0 .67857, I did
03:14say six significant figures.
03:16M1, x squared plus, although
03:22I think it's minus. So
03:24it's minus 8 .2. So
03:25it's actually, I can actually
03:26just put 8 .2 there
03:28because it's minus 8 .19
03:30and 9 and 9 and
03:319. So I'll just put
03:32minus 8 .2x. And then
03:36finally plus 32 .4, and
03:38that's similar situation, it's not
03:40actually almost. It's probably not
03:43exactly 32 .4.
03:44But it's so close to
03:46that sort of thing. So
03:47that is my regression curve,
03:50my quadratic. It's the quadratic
03:52that best fits the data.
03:54And I'll show you what
03:55it actually looks like now.
03:57Because here, once I'm here,
03:59I can go, well, let's
04:04write down the R squared
04:04value. Actually, the first one
04:06I'm here, R squared equals,
04:08so R squared equals,
04:120 .957, 438, 0 .957,
04:19438, perhaps you might want
04:22to go to three significant
04:23figures, 0 .957. Now it's
04:27nice to keep this one
04:28like to more than three
04:29significant figures because you might
04:30want to use this if
04:31you're going to use this
04:32to make a prediction or
04:34something then you don't want
04:35to use the rounded value.
04:38Anyway, I'm going to show
04:38you on the calculator here
04:40if I go document
04:40insert data and statistics and
04:45in here I'm going to
04:46put my x and in
04:49here I'm going to put
04:50my y. So this is
04:52my, I'm going to actually
04:53see it does look a
04:54bit like a quadratic and
04:55then I'm going to go
04:56menu analyze regression show quadratic
05:01and that's the quadratic. So
05:02it's the a bit like
05:04the line of best fit.
05:05This is the quadratic of
05:06best fit the quadratic that
05:08minimizes
05:08these, these, um, these residuals
05:11that I'm going to talk
05:12about in a second, but
05:13it's like your best fit.
05:16Okay, so that's it. That's
05:17kind of basically all you
05:18need to know how to
05:19do for an exam with
05:21the calculator, easy, very straightforward,
05:24but this now I'm going
05:26to go into a bit
05:27more detail and explain what
05:29it means or it comes
05:30from and how you can
05:31calculate it. So I have
05:35gone to some
05:36I'm effort and prepared this
05:39earlier. So this is my,
05:42these are the points, my
05:43axis and my way. There's
05:47my 220, there's my 4,
05:499, etc. This is the
05:51curve that we just found,
05:53the quadratic of best fit.
05:56This is, so my function
06:00is the quadratic. This is
06:02f of 2, f of
06:034, f of 6, f
06:04of 8, f of
06:0410, F of 12. For
06:07example, F of 12 is
06:0931 .7, which is here.
06:12It's where the graph wears
06:14the graph at 12. So
06:15at 12, it's there, which
06:17is 31 .7, et cetera.
06:20Okay, this thing then is
06:24Y minus the, this is
06:28Y minus F of X
06:31squared. So if we remember,
06:33What we had is what
06:35we're trying to do is
06:37minimize these. So these are
06:40what we call the residuals.
06:44This is like the error
06:46in the graph. So it
06:50doesn't fit perfectly. There is
06:52a bit of an error
06:55between each point and the
06:58curve. And what we do
06:59is we subtract it. We
07:00do what we do.
07:01y minus f of x,
07:02so we get that distance.
07:04And we square it because
07:06otherwise you're going to have
07:07some positive and some negative
07:09values and they're all going
07:11to count so it won't
07:12make sense. So we square
07:13it and this is what
07:14we call the residual sum
07:19of squares. There's sum of
07:20square residuals and this is
07:23actually here. This is S,
07:28S.
07:29for some of squares and
07:32residuals. And it's when we
07:34add up all the squares
07:37of the residuals. That's what
07:38that is. And that's what
07:39that is that this part
07:40of the formula. And as
07:42I say, I'm going to
07:43get to exactly what this
07:44means. Next part is y
07:50minus the mean squared. And
07:52we're going to sum it
07:53up. Now you might remember
07:54this as the variance.
07:57So this is actually the
07:59variance of the y values.
08:02And what it means is
08:03if I draw, so this
08:04is the mean, 16 .167.
08:06So somewhere here, close to
08:1016. Let me just draw
08:12this here. Okay, so this
08:15is a straight line across.
08:16This is the mean line,
08:1716 .167. What these values
08:22give us is
08:25This distance, the distance between
08:28the distance between the point
08:32and the mean. And we're
08:35going to sum them all
08:36up. Clearly, this is going
08:40to be, when we square
08:43them and add them up,
08:44we get the variance. This
08:46is the variance. And clearly,
08:47it's going to be bigger
08:48than, it's going to be
08:50bigger than the residual sum
08:53of squares.
08:53And this is called the
08:57total sum of squares, hence
08:59S, S, T, O, T
09:02for total. The total sum
09:03of squares. It is the,
09:07well, it is the variance.
09:09You can see it is
09:10the sum of the squares
09:12of the distance of each
09:13point from the mean. Now,
09:18what does that all mean?
09:19And why are we doing
09:19one minus this?
09:21Well, essentially what we're saying
09:23is this is the variance.
09:27It is how much the
09:29y values are varying from
09:32the mean, if you like.
09:33So it does the variation
09:35of the y values. So
09:38what we want to know
09:39is, well, we're saying right,
09:41the y values are varying,
09:43they're changing. But why is
09:46that? And how much is
09:48it to do
09:49this curve. So we're saying
09:51how much of the variation
09:53is accounted for by the
09:56curve. Now, what we can
09:59say is, well, we don't
10:02know yet exactly how much
10:03of the variation is accounted
10:05for by the curve, but
10:06we do know how much
10:07of the variation is not
10:09accounted for by the curve,
10:11because we know that there's
10:13a small amount of variation
10:15here, which is the residual
10:17sum of
10:17squares, we know like this
10:19little bit of variation is
10:22not the spit and the
10:24spit and the spit. This
10:27is not accounted for by
10:29the curve. And here, etc.
10:33So all these little bits,
10:35this is like the error.
10:38So what we actually do
10:39is we say, well, okay,
10:41what percentage of the total
10:43sum of squares is this
10:45residual sum
10:45of squares. And we say,
10:47well, it's 17 .17 point.
10:53And let me do it
10:54over here. We say 17
10:57.4857 over 410 .83. And
11:09this is equal to, let
11:10me get out my calculator.
11:13This is equal to 17
11:16.4857 divided by 410 .83
11:22and I get 0 .04256158
11:270 .042424255856158 which is obviously
11:40M
11:414 % if you like.
11:44So we can say about
11:464 % of this variation,
11:494 % of this variation
11:51is not accounted for by
11:58the model. Because this is
12:00the error that we're saying
12:01is not accounted for by
12:02the model. So about 4
12:03% is not accounted for
12:04by the model. So how
12:06much is accounted for by
12:07the model? Well, that's where
12:09this formula
12:09comes into play. We can
12:11say, or squared is equal
12:15to 1 minus this minus
12:180 .4256158, which is, I'm
12:26going to do a cheeky
12:27trick here guys and just
12:28do answer minus 1. Obviously
12:33it's negative, but it's 1
12:36minus this I want to
12:37do. So it's the positive
12:37of a version of this.
12:39So 0 .957, 438, 0
12:43.957, 438. Let me just
12:49put down 4, 2 as
12:50well. 4, 2. And this
12:54gives us, which is approximately
12:56equal to 0 .957. This
13:00gives us the r squared
13:01value. And it's the, it's,
13:03you can think of it
13:05as the percentage
13:06percentage of this variation that
13:08is accounted for by the
13:11model. Let's go and have
13:13a look at our our
13:15um, let us look at
13:19our our value. What was
13:20it? If we can remember
13:230 .95743 0 .95743. So
13:29it's pretty much bang on.
13:32I did a little bit
13:32of rounding like through
13:34this here. So it's not
13:36going to be absolutely perfect
13:36but it's certainly to, well,
13:38it's correct to like five
13:39decimal places. So that's pretty
13:41good. Okay, that's it guys.
13:44Look, obviously as I said
13:45in an exam, they're not
13:46going to ask you to
13:46do out all of this.
13:49But I think it's definitely
13:50helpful to understand where it
13:52comes from, what it means,
13:53why R squared is even
13:55a thing. And it obviously
13:58works for straight lines as
14:01well. The main
14:02main thing that you need
14:03to know though is definitely
14:05how to just find this
14:07with the calculator which I
14:09think is straightforward. Okay hopefully
14:12that's all good guys, make
14:13sense if not let me
14:15know and I'll see you
14:17in the next lesson.