Let's kick off our exploratory data analysis.
Exploratory data analysis.
And we are going to do two things.
So the first one is that we're going to
do a correlation between caret and price.
And that will be super simple.
So data frame, we get the caret and then we get the price and we do dot core and
here you go.
We see that the correlation is 0 .94
which is huge, right?
Usually there can be an issue when you
have such high correlations because you cannot really distinguish between both
because there's something called mutual causality bias which is when A leads to B
and B leads to A.
However, in this case I think this is
just one direction.
I think the caret leads to the price and
the price does not really lead to the caret because it doesn't make sense that
the bigger the price then the caret increases because you cannot really make
it happen like that.
But if you have a bigger caret then you
have a higher price.
Or in other ways of putting it, you need
to start somewhere, right?
And I think you need to start with having
a bigger caret that will then lead to a higher price because the stone happened
first, not the price.
Therefore, the conclusion is that our
variables are very much tied together which is good from predictability perspective.
Let me isolate x and y because this will be easier as we go through the practice videos.
Isolate x and y. So the y equals our data frame dot price and then the x equals
data frame dot caret.
Here we go.
Control enter.
And I'm getting something.
Object has no attribute price.
That's because it is with a lowercase p
and a lowercase c.
Control enter and here we go.
Now we can do our scatter plot.
In its simplest form scatter plot plt dot
scatter and then we include x and y and then plt dot show.
So this is the simplest form and I can add as well that we are going to
definitely do some or add something to it.
Okay, so it is a lowercase y that I need
to include here.
So this is the simplest form of the
scatter plot.
But let's add a bit to it, right?
So we can add plt dot x label and then this is the caret plt dot y label and
this is the price and then we can add a title plt dot title and then this would
be the relationship of caret and price.
And here we go.
I have something here.
It should be a dot and here we go.
So here I'm customizing the graph.
Here we go.
Control enter and here we go.
So you can see that it's pretty linear,
the relationship, so it really goes in one direction.
You can see that when there is, or when caret equals one, there are a few
outliers, or the more carets you have, it kind of explodes, which would possibly
mean that we actually need a few of the other variables like color clarity or
certification to help us explain these more extreme values where it is exploding.
But one conclusion is that it is pretty linear and this is good to see because it
helps us again to say that we can use a linear regression to predict and it also
makes sense, right?
So the bigger the caret, then caret is
the size of the diamond, then the bigger the price.
So this is also connected.
We then see an inverse relationship somehow.
And this is it.
This is a very simple exploratory data
analysis and in the next video we're going to focus on the linear regression.
Until then, have fun.