WEBVTT

00:00.930 --> 00:07.050
In this video we are creating several categorical seaborne plots and they all have in common that we

00:07.050 --> 00:09.180
group our data by categories.

00:09.180 --> 00:14.570
So for example in our Titanic data frame we have the categories peak class and sex.

00:14.700 --> 00:20.730
So we split our data into groups and then we compare these groups for example by the H or by the fair

00:21.330 --> 00:24.240
and we can draw conclusions like that.

00:24.240 --> 00:30.630
The first class made a peasant us were older than the asset class female passengers and so on.

00:30.720 --> 00:36.840
So we are still in poverty PANDAS and the seaborne and met plot slip and we still have imparted our

00:36.840 --> 00:44.730
Titanic data frame and for all of our plots we set here the figure size to twelve eight and we increase

00:45.000 --> 00:52.480
the fun scale to a one point five and our very first blood should be a categoric set up a lot of it

00:52.480 --> 00:58.620
is a chipped plot so recall here as an escort to strip plot and that sort of a look here.

00:59.010 --> 01:05.130
So the strip blood actually draws a set up plot where one variable is categorical and also give you

01:05.140 --> 01:11.070
f apparently that data we have we have to pass them our data frame here Titanic and let's assume that

01:11.070 --> 01:12.640
you want to f on the x axis.

01:12.660 --> 01:14.320
Our categorical variables.

01:14.340 --> 01:19.680
So he has sex and on the y axis we want to f the H.

01:20.270 --> 01:22.220
So that's simply around the set here.

01:22.800 --> 01:28.230
So we splitting up our data into male and female A.A for each single male peasant.

01:28.260 --> 01:34.980
We have a dot to the corresponding to the eights and the same we f for females and you can see here

01:35.010 --> 01:37.740
that many points are overlapping.

01:37.740 --> 01:44.220
We feel the pyramid the Gita and by default it's set to false but we can also set this to true

01:47.140 --> 01:52.050
and by doing so we make you the plot of the points that are not overlapping.

01:52.090 --> 02:00.480
So now we can better see that the majority of made a presence us here around the 20 to 35 and we have

02:00.480 --> 02:06.550
some pretty young male peasants us and also some quite old peasant us here and the same we have fear

02:06.550 --> 02:14.980
for the female peasant us and also the strip plot provides for the option to further splitting our two

02:15.310 --> 02:18.070
categories into a more categories.

02:18.070 --> 02:24.370
So instead of having the only male and female we could also have fear may 1st class may 2nd classmates

02:24.380 --> 02:26.970
at class and the same for the females.

02:27.130 --> 02:29.660
And again here we ask for the pyramid a hue.

02:30.100 --> 02:37.580
And by default it said to none party we can pass also a categorical variable or a categorical column.

02:37.840 --> 02:46.700
And for example here we can pass the peak class column so that's running at the center and we can see

02:46.700 --> 02:53.510
here that for each point off each dot we have the additional information about the PE class.

02:53.510 --> 02:55.470
So most of the very old.

02:55.580 --> 02:57.290
Made a peasant Yes I actually blue.

02:57.300 --> 03:04.550
So this is the first class for example but it's actually pretty hard to differentiate between the class

03:04.580 --> 03:10.090
and between the classes and therefore we have the additional parameter dots.

03:10.340 --> 03:13.640
And by default it's to force but we can set it to a true

03:16.680 --> 03:19.030
and by doing so we actually separating here.

03:19.040 --> 03:22.250
The points are the dots for the PE classes.

03:22.350 --> 03:28.710
So now here we have for one line with the first class passenger dots source get us then we have here

03:28.710 --> 03:35.370
one line with the second class mates and so on and actually at a very first glance we can now see here

03:35.490 --> 03:43.260
that the far made us about four females it looks like that first class passengers are older than the

03:43.260 --> 03:47.300
second class passengers and that are older than the third class passengers.

03:47.310 --> 03:55.230
So you can see here that we have here a kind of decreasing trend and we not only can split our data

03:55.260 --> 03:57.930
by the six and the peak class column.

03:58.470 --> 04:02.910
So for example instead of having at the peak class column you can also pass here.

04:02.910 --> 04:07.080
These survived the information to the huge pair in meta

04:10.180 --> 04:18.940
and we have yet in blue all the passengers that did not survive and aren't all passengers that did survive.

04:18.980 --> 04:25.130
All right now let's go on and there is another categorically scatter plot called a swarm plot.

04:25.130 --> 04:26.750
So let's have a look here.

04:26.960 --> 04:32.560
And this one plot actually draws a categorical scatter plot with none overlapping points.

04:33.500 --> 04:40.210
So let's have a look and the swamp blood is pretty much the same as here.

04:40.210 --> 04:43.300
The strip plot with having to eat.

04:43.430 --> 04:44.560
It's true.

04:45.220 --> 04:46.470
So let's have again here.

04:46.480 --> 04:48.280
The PE class to compare it

04:53.060 --> 04:58.290
so these two plots are quite similar but still here with a swamp plot.

04:58.310 --> 05:01.630
We can even better see the distribution here.

05:01.670 --> 05:08.300
So for example here BFA subclass made peasant just that I here all at the same age.

05:08.750 --> 05:15.920
And the swamp plot actually locates all the dots side by side so we can even better see the distribution

05:15.920 --> 05:20.870
or the frequency distribution of the H for the six groups here.

05:21.470 --> 05:26.390
So the most frequent age for asset class made peasant just are here.

05:26.390 --> 05:32.600
And for example for first class my peasant us we can see that there is actually no single concentration

05:32.600 --> 05:33.230
here.

05:33.440 --> 05:39.920
So we have quite a stable distribution across all ages here and that's another plot where we can even

05:39.920 --> 05:43.200
better see the distribution.

05:43.280 --> 05:51.470
And this is the violin plot and again here we f on the x axis and the sex and on the y axis that the

05:51.470 --> 05:59.120
age and additionally we split the male and the female group and two of the three peasant classes.

05:59.720 --> 06:01.070
So let's have a look here.

06:04.010 --> 06:11.060
And instead of having here a setup plot we have here actually a line or a curve where we can see actually

06:11.060 --> 06:13.060
the frequency distribution.

06:13.220 --> 06:15.460
So let's have a look here.

06:16.280 --> 06:21.920
And the line or the curve that you can see here is actually called a kind of density estimate.

06:21.920 --> 06:28.780
So this is kind of a smooth and histogram where we can see actually the frequency distribution slow.

06:28.780 --> 06:29.000
Yeah.

06:29.020 --> 06:35.960
Flux harbor for First Class A made peasant us the highest the frequencies here are around 40 and for

06:35.960 --> 06:43.070
second class peasant just it's around 30 and for a subclass peasant yes that's around 20.

06:43.850 --> 06:47.180
And we can also see here that we have a warning message.

06:47.450 --> 06:49.990
So here a future warning message.

06:50.210 --> 06:56.030
And this has something to do with the interaction between symbol on and the stats library.

06:56.330 --> 07:01.430
So at this point here we can ignore it and actually we can also combine the plot.

07:01.440 --> 07:08.000
So here we have a violent plot and here we have a swarm plot and we can actually combine both plots

07:08.000 --> 07:09.010
into one plot.

07:09.020 --> 07:10.300
So we end Abel here.

07:10.310 --> 07:16.020
These swamp plot and in these swamp plot we have actually hear the same pirate leaders.

07:16.160 --> 07:21.280
So we have on the execs this the sixth column on the right access to the eight.

07:21.740 --> 07:28.180
Then we additionally split up into the peasants classes and in addition we want to have a black collar

07:28.190 --> 07:30.740
for all set us off for dots.

07:30.740 --> 07:31.810
So let's have a look here.

07:34.640 --> 07:40.970
So here we have now a combination of the violent plot and the swarm plot so we can even better see now

07:40.980 --> 07:47.300
that the highest frequency see a flat sample fourth up last May peasant passengers here around the 20th

07:48.200 --> 07:52.680
and for the violin plot there's actually another option here.

07:53.030 --> 07:59.690
So we can see here that on the x axis that we have two categories and for both categories we have sweet

07:59.690 --> 08:03.250
plots but actually a three year swap the lovers here.

08:03.260 --> 08:10.580
So if you FBA on the x axis then the three classes and for each class we have that plot.

08:10.580 --> 08:15.950
So for female and male then we can actually match the two plots.

08:15.980 --> 08:23.840
So yeah again we are creating a violin plot and then we exchange peak class and sex so we pass PE class

08:23.840 --> 08:29.250
to the experimenter and sex to the huge pair.

08:29.420 --> 08:30.850
So let's have a look here.

08:34.140 --> 08:41.470
So here we can see on the x axis the three categories and for each category we have two violin plots.

08:41.490 --> 08:43.750
So for male and female.

08:44.280 --> 08:48.180
And if you have two plots for each category we can also match them.

08:48.180 --> 08:54.450
So we can f you one violin plot and on the left hand side we have actually the distribution father made

08:54.450 --> 08:55.090
a peasant does.

08:55.110 --> 08:58.100
And on the right hand side for the female passengers.

08:58.690 --> 09:03.590
And therefore we have to pass here true to the split pair meet up.

09:04.080 --> 09:07.170
So by default it's set to false but we can set it to true.

09:07.800 --> 09:13.120
And let's see what happens so now here we have only three violins.

09:13.330 --> 09:17.990
So one for the first class one for the second and one for the third class.

09:18.010 --> 09:23.860
So on the left hand side we have the distribution of the HS form male and on the right hand side for

09:23.860 --> 09:26.020
female passengers.

09:26.020 --> 09:30.090
And so we can even better Compare male versus the female.

09:30.140 --> 09:31.330
All right.

09:31.360 --> 09:35.010
And that's in addition to Siebel unplugged called by plot.

09:35.050 --> 09:38.660
And again we pass the Titanic data frame to the perimeter data.

09:38.680 --> 09:45.370
Then on the exact sets we want to have the peak class on the buy access to the age and pass a six to

09:45.370 --> 09:46.840
the Hugh meet us.

09:46.840 --> 09:48.040
So let's have a look here

09:51.330 --> 09:52.950
slow here on the exact source.

09:52.980 --> 10:01.250
We have we peak classless and for each PE class we have female and male or female CRM and male as blue.

10:01.590 --> 10:08.620
And he the buy access that we have for the eights and by default the bomb plot Excelsior calculates.

10:08.670 --> 10:10.680
The mean age for six groups.

10:10.680 --> 10:15.040
So here we are six groups and the height of the Bosnia actually.

10:15.060 --> 10:17.200
The mean age.

10:17.310 --> 10:24.180
So you have a first class made a peasant just we have a mean age of 0 40 then for example for females

10:24.180 --> 10:28.480
here in the first class we have about 34 35.

10:28.620 --> 10:35.190
And these are so-called point estimates because you simply calculated the mean over all the passengers

10:35.220 --> 10:36.920
and the respective group.

10:36.930 --> 10:42.630
And in addition we can see here the black line with skiffs that's kind of a confidence interval.

10:43.050 --> 10:48.990
So instead of having only one point estimate and saying that the average age of first class made a peasant

10:48.990 --> 10:56.970
Justice 42 the confidence interval says that for example in 95 percent of all cases the mean age of

10:57.150 --> 11:02.130
first class passengers should be a B between these two points here.

11:02.140 --> 11:04.380
So this is a more statistical approach.

11:04.660 --> 11:11.740
And with this we can answer the question whether the system historically significant that here the male

11:11.740 --> 11:14.650
passengers are older than the female it hasn't us.

11:14.710 --> 11:21.430
So let's have a look here inside the brackets and we can see here that here we have a confidence interval

11:21.460 --> 11:26.860
of ninety five and we have 1000 simulations.

11:26.920 --> 11:33.760
So seaborne simulates the booking for the Titanic 1000 times and then creates a confidence interval

11:34.100 --> 11:39.760
where we can find for example the mean age of all the first class mail passengers and 95 percent of

11:39.760 --> 11:47.760
all cases so this is see the interpretation and as we can see here that there's hardly any overlapping

11:48.000 --> 11:54.870
so he could conclude that it is statistically significant that the first class made passengers were

11:54.900 --> 11:57.770
older than the first class female passengers.

11:57.870 --> 12:04.440
And for example if we have a look at the second class so here we have an overlapping of the confidence

12:04.440 --> 12:10.240
in the was and yet more hard to say that the difference in the point estimate.

12:10.250 --> 12:10.510
Yes.

12:10.510 --> 12:18.030
So he had the maids a bit older than the females that this is that really is statistically significant.

12:18.030 --> 12:23.970
And instead of having the a bomb plot we can also have the same as a point plot.

12:24.000 --> 12:28.210
So that's the addition of seaborne plot point plot.

12:28.470 --> 12:34.740
And also here we have the same pirate meet us and actually we hear the same plot but instead of having

12:34.740 --> 12:38.350
year pass for each group we have fear for example.

12:38.730 --> 12:44.580
So we ask you one line for the male passengers and we can see here the confidence interval for the mean

12:44.610 --> 12:47.100
age of first class mail passengers.

12:47.100 --> 12:49.550
And this is here the point estimate.

12:49.620 --> 12:54.410
So the mean age of all first class male passengers was this value here.

12:54.510 --> 13:01.620
But if you would repeat the Titanic booking 1000 times that then the mean age is in the 95 percent of

13:01.620 --> 13:02.400
all cases.

13:02.410 --> 13:04.580
And this confidence interval.

13:04.980 --> 13:11.760
And we can see here that there's no overlapping with the female confidence interval and therefore we

13:11.760 --> 13:19.110
could conclude here that the males are older than the female it's of statistical significance.

13:19.260 --> 13:25.770
And the same we could conclude here for the third class but we couldn't conclude this for the second

13:25.770 --> 13:27.590
class.

13:27.600 --> 13:28.070
All right.

13:28.070 --> 13:30.290
This was the the video on categorical plots.

13:30.300 --> 13:32.920
And I hope to see also in the next video by.
