00:01
All right, so we're going to do some analysis here on a data set.
00:03
And the first we're going to do is we're going to know the range of one of the variables.
00:07
We find the range of educ, the education variable.
00:11
And then we also know the percent of men who completed 12th grade but no higher.
00:15
So percent that completed less than or equal to 12.
00:28
Well, and actually, just to be clear, i'll do both.
00:32
I'm not really sure if it means less than or equal to 12 or or if it means if they completed 12.
00:40
So it's a less than complete, complete the less equal to 12th, so like 10th, 11th, 6th, right? or exactly 12th.
00:48
So we'll do both.
00:50
And we want to also know do men or parents on average have higher levels of education.
00:55
So men be their parents in terms of education.
01:00
We're going to go ahead and do this in our.
01:04
All right.
01:05
So let's go ahead and get this going.
01:07
And so we've got our data set here in this library.
01:13
Let's go and view it to make sure we got it.
01:14
And here it is.
01:16
A lot of variables.
01:18
The columns, 12.
01:21
Oh, and if you do this, if you do question mark, htv, that'll give you this.
01:29
It gives you this description of it.
01:33
And it's 1 ,20030 observations, 203 variables.
01:37
All right, let's go and tackle this.
01:39
So the first thing we wanted to do in.
01:40
Know was the range of the education variable.
01:43
So we can do that by looking at, we can do the string.
01:48
This didn't tell you the range, but this tells you all the variables.
01:50
The types we have.
01:51
So integers, numbers, like real numbers here.
01:56
Numbers, integers, there you go.
01:59
That's a type of variables they have.
02:01
Now let's look education.
02:02
So summary, education, to the top here.
02:08
So the minimum is 12, the max is 20.
02:10
So the range is the difference.
02:12
So the range is 20, take away six, which if my math is correct, is 14.
02:20
So the range is 14.
02:21
Now one of the percent completed 12th, and again, we'll do both.
02:25
If it's equal, less equal to 12 or 12 exactly.
02:28
So we'll just do that.
02:29
So this, there's two ways you could do this.
02:33
You could do end row, and then this is the code to get all the number of rows where the education was equal to 12.
02:41
You can also do some, because this creates a data frame right here.
02:47
If you do this, this goes, it's all the data where the education was 12.
02:56
See, the education is still over here.
02:58
If you just want to, if you do it like this, it's a logical operator.
03:01
You're like, hey, does it have education equal to 12? and you can just sum those up and it sums up on.
03:09
So it's 512.
03:10
Either way, you get 512.
03:12
Okay, so that means there's 512 with equal.
03:15
To 12, less than or equal to 12, there's 698.
03:18
So the way you find the percentage is we do those values divided by 1230.
03:25
So the percentage of men who completed less that or equal, completed 12th, exactly 12th would be 41 % times times 100, right, if i want to talk percentages.
03:37
So 41 .62%.
03:39
And then less than equal to 12 is like up to, we'll take that divided by 1230.
03:45
Times 100 and 56 .7 less than equal to.
03:50
So just to, this is, we'll say that one if it's up to 12th.
03:59
All right, so it's that.
03:59
Now about men versus parents.
04:04
So the way we can do this is, as a few days you can do it.
04:09
I looked at, does the education, because the dataset is about the men, about 1, 230 men.
04:16
And we want to, okay, it said parents.
04:19
And so if we do, we could do some htv with education, is that how many are greater than the mother's education? and here's, so we look at that one.
04:33
So this is how many, so 568 have education greater than their mothers.
04:38
And if you look at the fathers, 537 have greater than their fathers.
04:42
We can also do both where we do an and, we do this and.
04:47
So it's the males is greater than the fathers and.
04:51
Than the mothers and there's 395.
04:53
So if we're going to look at this one as both parents.
04:57
So 395 had education greater than both parents and so is that that's not on average that's not greater than a half so it's so i'd say no we'd say no.
05:08
So no here no because as we observe there's 395 who have education greater than both their parents so we'd say no and that's 395 out of 12 hundred 30.
05:24
All right, you could just take 395 divided by 1230, get your percentage.
05:29
Or no, i guess times 100, right? 32%.
05:33
So not.
05:35
You can also equal to you.
05:36
This is kind of fun.
05:37
How many are equal? 405 equal their mother for 319 equal their father.
05:44
221 equaled both father and mother.
05:46
So that's kind of interesting thing.
05:48
Okay, there's that and then let's write on the percentage here.
05:53
I believe it was 56 .7 who completed 12th grade.
06:03
And this was up to 12th grade.
06:05
This was up to 12th grade, up to 12th grade.
06:13
Whereas equaled 12 was 41.
06:18
So is that.
06:19
Okay, next question is asking us to estimate a regression model.
06:25
Education equals beta not plus beta 1 mother's education.
06:34
I'm just a lowercase.
06:39
I'm just great mom.
06:42
Education plus beta 2, dad education.
06:49
The variables are called something else, but that's what we do.
06:52
We're going to make this model.
06:53
Oh, well, i'll just write it out.
06:55
Since we're dealing with variable names, we should probably write it out accurately.
07:00
Mudduc plus beta 2, eduke.
07:08
And then we have an error term here.
07:10
You.
07:12
So we're going to go ahead and estimate that using r.
07:15
So here it is.
07:19
So model equals lm, adjuk equals mother adjuke plus father education.
07:24
Data is hgtv.
07:28
And look at the summary and this is it.
07:31
And there's some other information we can get from this.
07:40
Okay, there's that.
07:42
We're going to interpret the coefficient of mother here.
07:47
So this is 0 .304.
07:52
So that's 0 .304 times the variable, we'll put m for mother.
08:00
So what it means is for every one unit increase in mother's education, the son's education goes up by 0 .3.
08:07
So this kind of goes along with what we said, like the mother's education doesn't add a lot to the son's education.
08:17
It had some, and it is significant, but that's how we interpret it.
08:24
Okay, now for part c, we want to know how much sample variation in education is explained...