00:01
All right, so some data here, and we're going to do some analysis with it.
00:05
The first thing we do is prepare a scatterplot.
00:08
Let's see if a linear relation appears adequate.
00:10
And so we need r to do this.
00:13
It's a nice programming language for statistics.
00:16
So here's the x and the y.
00:18
We'll load those.
00:20
And then c means a column vector.
00:24
You just put them in just like even a spreadsheet.
00:27
We just have to put commas there between the values.
00:29
And then to make our, here's our plot of x and y.
00:36
And we see, it appears to be pretty, you know, pretty good fit.
00:41
And if we make the model, so if model equals lm is a linear model, y, given x, plot that.
00:48
And if we plot with the line, abline, you put the model in it, it'll automatically put the line in your line you've made.
00:56
And so it's a pretty decent fit.
00:57
We're going to see if we can do a little better.
00:58
Because if we look at the residuals versus the fitted values for a model, we see that it's kind of doing this fan in this plot.
01:07
And so that gives you evidence that there might be some heteroscadasticity, some unequal variance go along because it kind of fans out a little bit.
01:21
And to be more explicit on that, or more visual, i mean.
01:27
When i say fan out, i mean, it appears to be doing something like this.
01:36
And ideally, you'd want something that doesn't do that.
01:41
So what we're going to do is use the box -cox procedure in synchronization to find the appropriate power, transformation of y, specifically 0 .3, 4, 5 .6, and 0 .7.
01:51
And we're going to get the sum of the square of error for those.
01:53
And based on that, what transformation of y should be used.
01:56
So lambda are the possible transformations of y.
01:59
So this is, let's do the box box, box, transform, so it's y lambda equals y, y lambda minus one, but lambda.
02:17
Or, and this is if lambda is not equal to zero.
02:23
But if you want to choose the lambda is zero, you would do the natural log of y.
02:29
Because, so this actually be a piece so i would sort of function here.
02:34
Because if you have lambda is zero, you can't divide by zero.
02:38
All right, so there's that.
02:41
So what does this mean? so we're going to pick a, let's do the transformation for 0 .3 first to kind of see how it works.
02:48
So we do y with lambda is 0 .3.
02:53
What that means, lambda is not 0.
02:55
So we're going to use this piece.
02:56
So what we're going to do is we're going to take.
02:57
Y raised to the 0 .3 power minus 1 divided by 0 .3.
03:06
So this means we're going to take each of the y values, raise it to the 0 .3 power minus 1 divided by 0 .03.
03:14
So to give you an example, take this 98.
03:17
It's 98 to the 0 .3 power minus 1 divided by 0 .3 .3.
03:22
That's what we do for each of these values.
03:26
And then we need to get the and then the standardization piece and what we do is we take this transformed y's and then what we do is we standardize it with the following transform c is equal to the given value of y zero point this will do the general lambda minus the mean of all of those transformed values raised to the lambda power all over the standard deviation, sigma of those transformed values.
04:19
And you might see this as s -d because it's a sigma reserve for the population standard evasion.
04:26
So we'll do, kind of go through with this piece -by -piece, you can see how it works.
04:28
So the first thing we do is transform the values.
04:31
So we'll do 0 .3 first.
04:33
Slam is 0 .3.
04:33
So here is y to the 0 .3 power minus 1 divided by 0 .3.
04:39
And so this vector is now each of the y values where you do that.
04:45
If we take 98, parentheses 98 to the 0 .3, take away 1.
04:53
And you divide that by 0 .3.
04:55
That's where you get the 9 .85672.
04:57
And this formula does it all for you in r, which is nice.
05:01
Here's the mean of that vector, the standardvation of the vector.
05:06
So what we're going to do then is we want to standardize those values here.
05:11
This is the standardized piece.
05:12
This is the transformation piece right here.
05:18
This is the transformation.
05:27
And this is the standardization.
05:36
All right.
05:38
And let's finish this up.
05:39
And then, so do that, these are the standardized values of those transformed values.
05:51
And then what we're going to do is build a model with this z vector, where you have z is equal to beta 0 plus beta 1, x.
06:06
And this would be your estimators here.
06:08
So you're going to build a model.
06:09
We'll use the x as the input, just the regular x -5s that we have.
06:17
And then we have our slope intercept term.
06:19
We're building on the z.
06:22
And let's go ahead and do that.
06:23
And then the sum of squares, s -s -e, this is equal to the sum of all of the predicted z scores minus the actual z -scores.
06:41
So it's z minus the hat squared.
06:49
All right, so let's go back here and do this.
06:52
So we did that.
06:54
So here's the model, lm z3 for the z3.
06:57
I put z3 means .3, lambda is .3.
07:00
Tilda x.
07:01
So there's the model.
07:03
There's our slope, there's our intercept.
07:06
And then to get the sums of square, sum of square to errors, if we look at, i called this model 3 for model .3.
07:23
What we do, so we do this, model 3 residual, this is each of the residual.
07:30
Values, which is actually the residuals is, that's what these are, this is z minus z bar, the actual, and z hat is the predicted...