Hello, all so in all our previous session, we have done some interactive analysis, so in this session
I'm going to have this assignment in which I have for of the statement, which is somehow related to
our hypothesis analysis.
So the very first one is I have to consider two hypotheses depending upon what statement I have.
So here I have the age of a person is going to be a factor in available loan or not.
And then I have to automate all the stuff.
So these are basically my advanced kind of analysis.
So here I'm going to show you how exactly you can perform all this stuff in a very simplest way.
So very first, I'm just going to call it scatterplot on my data points, on my features.
Here I'm going to say I have to float a scatterplot between age and, of course, between personal loan.
You will see this exactly is my personal loan.
So just start over here.
And this is exactly personal loan.
And let's say you have two data points on the basis of, let's say, family.
So here I'm going to say split it on the basis of Ramla.
So if you are going to execute it now, you will see your beautiful scatterplot and here you have family
status as well.
So now you have to simply perform your hypothesis.
So to perform your hypothesis, you have to import some of the library, because this is exactly part
of scientific by time so far this you have to import your Sappi module.
So here I'm going to say just import side by dot instead.
And let's say I'm going to create ideas as let's say instead just executed and using this instead.
So it is saying, yeah, it's not side by side by.
So again, executed and using this instead you have to perform some kind of test over here depending
upon your number of samples.
So very fast.
And is will define my two hypotheses over here.
So if you're not over to the basics of hypotheses, the different types of T-test, I would recommend
you to go to the back of this video and just clear your basic spec until I have uploaded a lectures
on hypotheses as well as on the test.
So very first I would define my two hypothesis.
Let's see.
The first one is my null hypothesis.
So here I'm going to say my null hypothesis is basically, let's say age doesn't have impact on available
personal loan.
So my alternate will be reverse of this.
And at that point, only one can be true.
So let's say my alternative achey or you can be presented as well.
So this is exactly my alternate hypothesis.
You have to present it and you have to just remove this.
Not so.
This is exactly my alternate hypothesis.
And now that if you need some data, you need some sample.
So here I'm going to say very first, I have to access my personal loan.
This one.
And the very first condition is I have to access all the data where my personal loan equal to zero.
So this is exactly my entire data.
And on this data frame, basically I have to access the each data and let's say to convert it into array.
I have to just call umpired or add it to convert all this stuff into.
So this is exactly my very first edit.
You can copy it, you can paste over here and that's it.
At this time I want for Ajita having both the loan equal to one.
So here I am going to say this is my let's say on underscore no.
And for this, let's say I'm going to see it on this call.
Yes.
So just executed and now your data is ready for your.
So just showing me gonged Azania here I have to assign underscored not a constant.
So now my data is ready, my sample is ready to perform to sample data.
So why does Hanbali test.
Because here I have two samples.
The very first one is my agent Schorno, and the second one is, of course, my age on the score.
Yes.
So two sample T dead will basically give me a quick overview of.
Yeah.
Whether there is a statistical difference between the mean of the board, the samples or not.
For this, I have to call some of the functions from my steps, so for this I'm going to say, is that
deep test not BASTABLE over here?
You can get your data underscore I and the surpass shift plus tab.
And here you have to pass here and B, which is exactly my data, which are exactly my sample for the
very first one is exactly my age under called No.
And the second one is exactly my age and a score.
Yes.
And now you have to pass your access parameter as well.
And so it will basically told me to value the first one is my D and the second one is, of course,
my B value, so that I'm going to say this is my business value and the first one is my destiny value.
The second one is my P value.
And P value is the most important value in this case.
For now I'm going to say I'm going to simply put a condition over here and here.
I'm going to say if P value is basically less than zero point zero five.
So this is my condition.
So in such case, I can say I have to print my this alternate hypothesis because then I will be valued
less than zero point zero five.
In such case, I have to reject my null hypothesis and to zero, which is exactly my null hypothesis.
That's why I had to reject this.
So now in the printed statement, I'm going to say I have to reject this at Ejiro and accept this edge.
So very first, let's say I'm going to print this very first Etch A and after it, I'm going to say,
as the P value is basically less than zero point zero five with the value of whatever value of B, I
will get over here for here, I'm going to add placeholder and this time I'm going to add my format's
function.
And whatever placeholder here, it will basically receive value from this format.
So here I'm going to say B, underscore value, whatever P value this will return.
So this will get over here.
And now in Ellsburg, basically I have to add a condition.
So in Allsburg, my value will be greater than zero point zero five.
And in such case, I have to print, let's say, at zero.
So this time I'm going to say print, just print at zero.
And now I have to print all this stuff together.
Then here I have to say p value is basically greater than zero point zero five with a value of whatever
value will be there to just execute it.
And you will see it will reflect me.
It doesn't have impact on our valving.
Personal loan as a P value is greater than zero point zero five.
It means our P value is basically greater than zero point zero five.
It means this condition will come in this block.
This as well.
And if this will come to us, blog might as zero, which is this one, this will get printed and then
this blocks of code will get printed with P value, whatever P value I will get receive from here.
So this is how exactly your all loop will work over here.
So let's move to the next problem statement in which I have to automate this hypothesis.
I have to automate this stuff.
So for this, let's say I'm going to say I'm going to define my function.
Let's say the function name is hypothesis.
So this function name is hypothesis.
And now this time, whatever code I have written over here, I have to just import it.
So very first, let's say I'm going to say I have to just import all this data.
So here I have to pasted.
And after that I have to also copy from here.
So now this time I have to pay as well.
So provide right indentation over here, here, here and here and here as well.
So now in Sinéad use deadly force.
I'm going to say columns on the second one is of course my column too.
And then let's say you have to assign some of the hypotheses as well.
So now I'm going to say my hypothesis is, let's say at zero and the first let's say at all, and the
first one is my actual and the second one, which is.
My alternate hypothesis I would represent it is Etch A and personal loan will get replaced by basically
my columns on similarly over here, my personal will get replaced by column one.
Similarly, this will get replaced by column two.
This will also get replaced by column two.
And now here you have to pass your added one and add it to let's say this is exactly why I added one
and let's say this is exactly my added to and here I have to pass both the add over here.
So the very first one is exactly why added one and the second one is exactly my area.
So it will return me my details and my P value.
And this is exactly my condition or what you can do, guys.
You can simply put all these blocks of code in print and it will basically receive value from, let's
say, a formula function similarly for at zero as well.
So just remove this and now you have to write over here as at zero or you can write here as a placeholder
and whatever value it will receive.
So here I'm going to say it is my exactly at zero comma P-value and here is my achee.
So similarly here you have to also assign your placeholder as well.
So just executed.
And now it is showing me Indentation Adder because here I have some in addition.
And so you can provide that indentation.
Similarly here provide right indentation because in addition added the will of course happen in Python
if you don't provide right.
Indentation.
So now you have to just call this function.
So here I'm going to say just call this function using hypotheses and just shift plus tab.
So that column one is basically my personal loan.
So here I'm going to see my personal loan is exactly my first column.
And on the basis of column, do I have to assign this each column and now I have to assign my alternate
hypotheses as well as null hypothesis.
Let's say the first one is exactly my null hypothesis, and this is exactly your null hypothesis.
Or you can copy from here.
And let's say I'm just going to paste over here and now it's time for your alternate hypothesis.
So although it will be this one and just copy from here and you can paste over here all these stuff
to just execute it and it will give you a solution at age.
Doesn't have impact on availing personal loan because here you will see your P value is greater than
zero point five.
That's why you have this type of confusion over here.
So how exactly will see this is a power of the automation.
You have a just call this function and you have to write this docs of code.
You don't have to write it blocks of code again and again.
Let's say you have to perform this hypothesis for.
Yeah.
Does income of a person have an impact on a willing loan or not?
So what you have to do, you have to just copy this.
Let's say I'm just going to copy this entire code and I'm just going to paste over here.
And now I have to just play with some of the parameters.
So here I'm going to say the first one column is exactly my personal loan, or you can assign it as
well.
So this is exactly my column one.
And now in case of column two, I have, of course, my income.
So I'm going to say income.
And now on my null hypothesis, I'm going to say income doesn't have impact on availing personal loan.
And in alternate, of course, I have income will impact.
So just execute it and it will say me.
Yeah.
Income impact on the available personal loan, because here you will see your P value is somewhere close
to zero.
So if you are going to plot this scatterplot between personal loan and income, you can simply rely
this effect of yeah.
Why income has an impact on availing Boston law in a similar way.
You can also do hypothesis for this one as well.
We are the family side makes them do our loan or not.
So just copy paste here.
And in column one, I have, of course, my personal loan, but in case of it, I have basically my
family.
So here.
I'm going to see my family and now here I'm going to say family doesn't have impact on of any personal
alone wedding.
In case of alternate hypothesis, I will say your family will definitely impact.
So just execute it and you will see it.
Will see my family will, of course, impact on our wedding lawn because you will see your P values,
of course, approx to zero.
You will see one point four into E to the power minus five.
So it will be very nil value.
That's why it is showing me our family have I impact on a really personal note.
So I hope you will love this, all this analysis, how I'm going to automate all of this stuff rather
than writing all this course again and again.
I'm just going to call this function or if you want to play with it, what you guys can do.
You guys simply autodidacts of code in your hypothesis function.
And once you have this printed statement, you can also get your visual as well.
So that's a pretty cool way.
How exactly you can analyze your data.
So hope you will love this analysis.
Thank you.
How nice day.
Keep learning.
Keep going.
Keep practicing.