 good afternoon and welcome to today's session is it just the two of us it's just gonna be the two of us by now people should know that we have this sessions every Tuesday and if they need to be reminded then I don't know okay any who how are you doing I'm good and how are you I'm good you're just fairing the weather oh it's cold in Cape Town y'all it's cold today are you also from Cape Town yes oh yeah no it's very cold it's winter I chose that winter is yeah with us yeah okay so let's just continue with today's session okay so please also make sure that you complete the register they have posted the link on the church today we're going to look at chi-square test we're going to look at how we answer questions relating to the chi-square test because there are two ways of calculating the chi-square test so we can do chi-square test for goodness of fit test or we can do chi-square test for independence so both of them will require us to use a table to get the critical values and for making a decision because anyway we will be doing a hypothesis testing so looking at the session plan for this month today is the 10th so we're doing we learning the basic skills that we apply on chi-square test and the following three weeks we'll start looking at the non-parametric test where we look at the three parametric tests the none they will will concern ranked test and they will concern sign rank some test and the sign test and after that we're going to look at how we do calculations based on the relationship measures of relationship looking at linear regression and correlation as well and also how do we define the regression line and how do we determine the correlation coefficient and correlation and the determinant of the coefficient of determination and then the last session for me which will be on the 30 first we will then look at the forecasting and time series as well okay so if you have any questions before I start with the summary of what you need to learn now I don't have any questions I think I must just keep on practicing okay so then let's go dive in so the requirements for today you need to have your statistical tables with you you need to know which formulas we're going to use and you also just need a calculator so make sure that you will have all those three next to you if you don't know where to find it the statistical tables usually they are at the back of your textbook they are at the back of past exam paper sometimes they are also included as tutorial letter in the tutorial letter I'm not sure if your study guide has the the table statistical tables okay by the end of the session you should learn how and when to use the chi-square test for goodness fit test and how and when to use the chi-square test for contingency table which is for independence when we calculate the chi-square test either whether we doing it for goodness fit test or we doing it for independent we always going to calculate the test statistic and the test statistic for chi-square it's given by that sigma squared that chi-squared the collector chi-squared which is the sum of your observed frequencies minus your expected frequency squared divided by your expected frequency and going to use this to go find the degrees of freedom and the degrees of freedom because in some instances the degrees of freedom we will use your rows and columns and if we only have for goodness of fit test then they it will always be the degrees of freedom will always be or we will always use a two by one case which will give you a degrees of free a two by two case which will always give you a degrees of freedom of one and I will show you how to to calculate all that or how to find the critical values and so forth with any hypothesis testing that you do you always have to have some assumption so when you do your chi-square test we need to always make sure that each cell in the contingency table has the expected frequency of at least 15 percent at least five so not 15 percent at least five so at least the value the observed value within the contingency table should have a value of more than five then when we go and make a decision because this is a hypothesis testing that we're doing we are going to do or make a decision based on our critical value and test statistic if our test statistics is greater than the critical value we're going to reject the null hypothesis so we can also use the belly shaped calf in order to guide us where our critical value is at and where are we going to reject the null hypothesis or do not reject the null hypothesis so let's look at the chi-square test for goodness of fit test so if we given this example especially with the goodness of fit test then it means you will be given a table with only one measure for example like this this follows a sample of babies a born in a city in 2015 by month of birth so babies that were born in January they were 24 in February they were 23 and so on and so on until you get to December they were 29 babies born in December in 2015 in that city and as a researcher if you want to test a 2.5 level of significance whether the new the number of babies born in the city are evenly distributed throughout the year then we need to do a chi-square test of independent of goodness of fit test how do we then do that first step is to always state the null hypothesis and alternative always when you do hypothesis testing where we going to state it by saying the null hypothesis will state that the number of babies in the in the city is evenly distributed throughout the year that will be your null hypothesis the alternative will say the opposite and that will say the number of babies are not evenly distributed throughout the year and we have our null hypothesis and alternative and we will make decision to either see whether are we rejecting the null hypothesis at number two we need to do some calculation so we need to calculate the number of babies in the sample because if you look at our table they didn't calculate the total so when you receive a table like this and you know that this will be asking you questions about the chi-square you just need to create a column and call it the total or a row depending on how the data is given to you whether in a row or in a column format so you just create the total and add all of them and if you add 24 plus 23 plus 20 plus 18 you will find that they are 252 the way 252 babies born in that year step number three you just need to make sure that you're able to calculate the probabilities and the expected values so now the probabilities are just your percentages that you're going to be calculating using or the we can call them also the relative frequencies that we will calculate using the observed value because 24, 23, 20 are what we call observed values so the observed values divided by the total will give us the relative frequency and then that relative frequency we're going to multiply that so let's look at this so in January the probability will be oh sorry my bad the probability will calculate based on the number of days you have per month so for example January has 31 days February has February has 20 we're going to assume we we're not gonna use the leap year 28 days and March has 20 March has 31 April 30 May 31 like that like that so we calculate the probabilities by using the number of days we have and and then to calculate the expected value we're going to take we're going to take the probability and multiply it by the grand total and that will give us will give us the expected value for each month so let's do that so we're going to calculate and say 31 divide by the 31 divide by 365 31 divide by 365 that will give us 0,0849 and we multiply that with 252 and that answer will be 21.40 and that is the value we will write under January and we do the same 28 divide by 365 we'll get the answer multiply it by 252 we'll get 19.33 so all the days that have all the months that has 31 days we can just substitute the 21.4 and then we go to April has 30 days and we also say 30 divide by 365 times 254 is it will give us 20.71 and then we add for all the the demands that has 30 days and if we add the sum of all expected values we will get the same total as the sum of the observed values so now we have our observed value and our expected value so now we can do can calculate our test statistic and our test statistic remember it is given by the chi-square is equals to the sum of your observed minus your expected squared divide by the expected so what does that mean it means we're going to say this is the same as saying 24 minus 21.40 squared plus 19.33 minus sorry observed is not 19 observed is 23 23 minus 19 point oh sorry the other thing that I forget always is to divide by the expected value so you need to also divide by the expected value 19.33 squared divided by 19.33 plus until you do all of them until you get to 29 minus 21.40 squared divide by 21.40 and that after you have solved the whole equation it you will get 7.72 and that is our test statistic now we need to go and make a decision but first we need to go and find the critical value finding the critical value we use the degrees of freedom because there is only one one column so here the degrees of freedom will be made up of the number the number of cases minus one so the number of samples there are 12 from January to December if you count them there will be 12 12 minus one and that will be our degrees of freedom so we're going to use chi-square of the degrees of freedom and the alpha value and in this instance remember our alpha value was 2.5 was 2.5 percent and if we divide this by by a hundred so therefore you will have chi-square of 11 and 0 comma 0 to 5 so we need to go to the table so I'm going to keep everything and then I'm going to stop sharing now I want to go and share my entire screen at this point so that then we don't have to toggle okay and hide this then I can open this old tutorial and go to the right at the end let's make it bigger at the end of this to go to the table so we need to find our way these tables we need to go find critical values of chi like we have here critical values of t we need to go to critical values of chi-square and as you can see also the symbol here the this picture here it shows you where your critical value will be so remember at the moment we are doing 11 degrees of freedom and 0 comma 0 to 5 so there's 0 comma 0 to 5 we will find it at the top and 11 you will find it going down running down here so there is our 11 and we're going to look for 0 comma so it's 0.7 97 0.95 0.9 0.1 0.2 0.2 and there it is and I'm going to just use my 11 as a guide and our critical value is 21.9 so that's how you find 21.9 and that's how you find the critical value and once you have the critical value then you can draw yourself a picture so then we can make a decision and then conclude so for example if I have to draw this our critical value if we define it it's from here critical value which was 21.9 and anything that falls here we're going to reject the null hypothesis so we know that our test statistic was 7.2 so if this point here is 21.9 therefore 7.2 falls in there do not reject area so when we conclude let's I can just remove this okay so when we conclude we can say since our test statistic is in the region of acceptance or we say we do not reject the null hypothesis because it falls in the non-rejection area therefore our decision will be we fail to reject the null hypothesis or do if our decision might be we fail to reject the null hypothesis and in conclusion we can say this means that our data is not sufficient to claim that the number of babies in the city is not evenly distributed throughout the year and that is our chi-square for goodness fit test. Let's look at this exercise let's see if we can apply the same concept as that so on this exercise we are given the null hypothesis to be tested for this distribution states that the null hypothesis states that the proportions or the probabilities of all cell 1 to cell 4 those are the p1 is equal to 0.2 p2 is equals to 0.4 and p3 is equals to 0.3 and p4 is equals to 0.1 and the observed frequencies of the values of a variable from the random sample population are displayed in the table below and they have given us the table with cell number 1, 2, 3 and 4 and the frequencies of the 9, 78, 64 and 19 and those are our observed values at 5 percent level of significance use the goodness of fit to decide whether the distribution of the variable differs from the given distribution which one of the following statement is incorrect now if we need to think about this the question is asking us to find out which one of those statements the five statements is correct so number one it says the sample size is equals to hundred so we need to check if if we add all the frequencies we will get a number of hundred so you need to add all of them so that is your total your expected frequencies are so we need to calculate the expected frequency remember the expected frequencies are calculated by using the total multiply by the probabilities when do you find the probabilities here are your probabilities on your null hypothesis so you will have to come here and create some total and we're going to use that total multiply by the probability and see if the expected frequencies are correct number three it says the region of rejection at alpha of 5 percent is greater than 7.8 so it means we need to go find the critical value at 5 percent level of significance so therefore it means you need to say how many cells or how many observations that we have here in terms of that so that you can get your critical your your critical value which is your degrees of freedom and your level of significance will give you that so you go to the table and go find the critical value and see if it's 7.81 and also number four it says the critical value is 7.81 so you just need to make sure that you understand all that it's the same as what is asked in number three number five they ask you that the test statistic is 0.9371 so in order for us to answer this question let's do it the same way as we would have done a hypothesis test so our alternative hypothesis yeah we can even state it it will say they are not evenly like the statement as it says they differ so yeah we will say they do not they do not differ the distribution does not differ that is the alternative hypothesis so what else can we do let's go find the total so add calculate the total 39 plus 78 plus 64 plus 19 let's equals to 200 and let's calculate the expected so let's calculate the expected frequencies for this table so for cell number one going to take the probability multiplied by 200 so 0.2 multiplied by 200 that's 40 that will be 40 and this is those ones we call them observed this one i'm going to call them expected so let's do the second one 40 0.4 multiplied by 200 that will be 80 0.3 multiplied by 200 that is 60 0.1 multiplied by 200 20 so now we have step one step two step three let's go and find the critical value the critical value we find it by using the chi-squint and alpha our alpha is 0.05 and our our degrees remember it's n n minus one right the degrees of freedom it's n minus one how many do we have how many columns do we have you can have four yes so it will be four minus one therefore our degrees of freedom here will be equals to three so we need to go to keep we go to the table we look for what are we looking for 0.05 you're looking for 0.05 and three right that's what we said our degrees of freedom is three so our chi-squint we're looking for 0.05 and and three there is three go look for 0.05 which is 7.81 that is what we are looking for so our critical value is 7.81 the next one is to calculate the test statistic since i didn't remove that remember is the sum of your observed minus your expected squared divided by your expected so our observed are those frequencies there so you're going to say i'm going to give you some time to calculate 39 minus 40 because 40 is our expected squared divide by 40 plus 78 minus 80 squared divide by 80 plus 64 minus 60 squared divide by 60 plus 19 minus 20 squared divide by 20 find the one that is working are you winning still trying to get to open up a calculator on my site yeah you're not opening then i will have to calculate manually now so oh there we go why is it saying activate my license i got um not 0.441 it's recurring i can check with lindy when the meantime okay unfortunately my calculators don't want to work today so 39 minus 40 i just want to double check if you got the divide by 40 did you calculate manually it's 0.025 i did manually yeah so the first one would be 0.0 so this one 30 minus 40 39 minus 40 squared divide by 40 will give you 0.025 plus and do the rest 78 minus 80 equals squared divide by 80 is 0 comma 0.05 plus 64 minus 60 equal squared divide by 60 it's 0 comma 26 i'm gonna round it off to four decimals it will be 0.2667 plus the last one was 19 minus 20 squared divide by 20 it's 0 comma 0.5 0 comma 0.5 and you just add all of them 0.025 plus 0.05 plus 0.2667 plus 0.05 equals the answer is what did you get actually i need to revise my first answer it's not 0.39166 not 0.391 yes so if i leave it to four decimals since there they've got four decimals the answer for my chi-squared is 0 comma 3917 okay now let's answer the questions let's see yeah it says the sample size is 100 is it 100 we have four we have 100 or do we have only four samples only four so this one is incorrect i'm gonna skip and we are looking for the correct answer right and i think we have a problem usually most of the time these things we always have problems with this so the second question says well which one of the following statement is correct the expected frequencies are 40 80 60 and 20 what did we get expected frequencies yes they are 60 20 80 60 20 and that will be your your correct answer number three it says the region the rejection region at alpha of five percent or the five percent level of significance is chi-squared greater than 7.81 they say the rejection area is this 7.81 because it will be anything that falls on this side we're going to reject the null hypothesis and this is one of those cases where i am not sure what they expected you to do with this question are they saying are we rejecting the null hypothesis or not or are they asking you that question because if that is the question then that it would be incorrect because we're not rejecting the null hypothesis right because if this is our critical value our chi-squared test will fall in the do not reject area so therefore that statement will be incorrect statement number four it says the critical value is 7.18 we know that the critical value is 7.81 so they moved around 8 and 1 if you don't pay attention you will think that is the right one but that is not the correct one and the last one the test statistic is 0.9371 and you can see that there they also move around the values if you don't pay attention you might think that is the correct one so the only correct answer here is option number two now let's look at do you have any question before we move any question no i'm all right let's look at how we do chi-squared test of independence the the the previous one that we did was chi-squared test of goodness of fit test and you will know that this is chi-squared test of goodness of fit test because in the statement they will also tell you that this is a chi-squared or this is goodness of fit test and you will also recognize by things that you see like in the hypothesis it will give you the probabilities and they will give you also sometimes a cell with frequencies they might not also call themselves they might it might be months and also it might not be called frequencies they might say it's observations or something like that but we must know that that information you can use it to find the chi-squared test of goodness of fit test so let's look at independence with independence we want to see if there is a relationship between two categorical variable so your null hypothesis will state that they are independent and always it will state that they are independent or there is no relationship because if they are independent it means they don't have any relation so that will be your null hypothesis your alternative will state the opposite it will say they are dependent or it will state that there is a relationship between the two categorical variables so let's look at this or before we look at that so similar to the goodness of fit test you need to also calculate the test statistic and here the test statistic it's also your sum of observation or observed frequencies minus your expected frequencies quite divided by your expected frequency however this expected frequency we're going to calculate it differently to what we have been calculating the expected frequency previously and also to find the critical value we're going to use the degrees of freedom of the number of rows minus one times the number of columns minus one because here we're dealing with a contingency table so how do we calculate the expected frequencies we use this formula we need to make sure that on our contingency table we calculate the totals you must make sure that your table has totals because we're going to use the total columns and total rows to calculate the expected frequency and your grand total this is your grand total your grand total is the number of all your sample size so we're going to calculate the expected frequency by saying row total multiplied by column total divided by the grand total to make a decision also similarly to what we did previously since we're going to be using the test statistics and the critical value and a chi square test is a one tail test and is an upper tail tail test so it means if your critical if your test statistics is greater than your critical value we reject the null hypothesis otherwise we do not reject the null hypothesis so let's look at this example the meal plan selected for 200 students is shown below so we have class standing in terms of the levels freshmen so far junior and senior and the meals per week are selected those who prefer 20 meals per week those who prefer 10 per week those who prefer not to have any meals and you can see the totals are already calculated so there are 24 freshmen who prefer 20 meals per week and there are 14 juniors who prefer 10 meals per week and there are about 10 people who prefer or seniors who prefer non meals per week and there are 88 people who prefer 10 meals regardless of what standing they are in in terms of their class there are 88 and with regards to the so far some four there are 60 of those who who are in the class standing of some so far more okay so how do we then do chi square test related to this so the first step we need to state the null hypothesis an alternative hypothesis the null hypothesis the meal plan and the class standing because we do have those two categories are independent or we can say there is no relationship between meal plan and class standing the alternative will state that there is a relationship between meal plan or class standing or we can state it in this way meal plan and class standing are independent because we deal with contingency table and remember in order for us to calculate the expected frequencies we use the row total multiplied by column total divided by the grand total so this is our observed table we can create next to it a similar type of a table which will create a expected frequencies in order for us to calculate the expected frequency for freshman 20 weeks we're going to say the row total which is 70 multiplied by column total which is 70 of that the row total column total divided by the grand total which is 200 and the answer you will get will be 24.5 similar to if i need to calculate the expected frequency for junior for that that will be the row total which is 30 column total which is 70 divided by the grand total and i can complete the entire table of expected frequencies and that will help us to calculate the expected the test statistic now once you have your expected frequencies and your observed frequencies you can come and calculate your test statistic so our observed was 24 minus 24.5 remember that this the first one that we calculated squared divided by 24.4 and you do until get to 10 minus 84 squared divided by 8.4 and the answer after you have solved this you will get an answer of 0.709 now to go find the critical value we need to not forget to find the critical value we're going to use chi squared of degrees of freedom and alpha value and we know what the degrees of freedom is the degrees of freedom is our number of rows minus one times the number of columns minus one so what do i mean by that we come to the observed table you do not have to count the total so don't count this that doesn't count so we're going to count the number of rows so we have one two three four rows the number of columns one two three columns and we just come in substitute four rows three four rows three columns and four minus one is three three minus one is two three times two it's equals to six so therefore here we will have our critical value of six and zero comma zero five so we need to go to we need to go to the table six and zero comma zero five so critical value of six and zero comma zero five so we come here we look for six we come here we look for zero comma zero five which is that one so we they both meet so our our critical value is 12 comma six and that is our critical value of 12 comma six and now we are ready to make a decision based on the test statistic and the case uh the critical value so remember you can also draw yourself a table and define your critical value your critical value is 12 comma 12 comma six therefore anything that falls this side we go into reject the null hypothesis so where is zero comma seven nine it falls in the do not reject area so we can say in our decision the test statistic of zero comma seven zero nine it's less than the critical value of zero sorry our critical value of 12 comma nine uh 12 comma six so we do not reject the null hypothesis because it falls in the do not reject the null hypothesis and we can conclude that there is not sufficient evidence that the meal plan and the class dating are related at alpha of zero comma zero five and that's how you make a decision is it right or more complex so let's look at an example of how you get the questions in the exam so the question will look like this according to the center of disease control and prevention publication hrv and eight civilians report the number of eight cases in south africa in 2007 classified by race and gender is shown in the table of contingency yeah so yeah we've got two categories male uh sorry gender and female number one or the very important thing is the table has question marks and underneath that table it says yield complete the missing value so before you can even do anything to answer the questions below they tell him you complete this table first and then go and answer the question and the question asked is which one of the following statement is incorrect so it means we're going to have to find the incorrect answer before we find the incorrect answer let's complete the table easy to complete because this is a contingency table you can start by female because if i need to know how many of those this is the total therefore it means i can take one two five three four minus one zero five six three and complete that to complete the second one of the total you just add the two values and get the answer to complete this last one you just add all of them they will give you the answer now you will be left with that that and that so to complete it it will be easy to complete because if you have the answer here you can just add those two subtract them from the four to nine six that will give you this one and you can calculate that one and because you would have the female you can add all of them and calculate this or because you already have the answer here you can just subtract this from there to get this one okay i'm going to give you five minutes or two minutes actually to complete the whole table i will check back you will give me the numbers i will write them on the board complete it on your side and then we will talk are we winning yes still calculating are we winning are we done yes okay just give me the numbers tell me which one is it white female length in seven to one nine seven one which one is the easiest one as well so let's do males total of males sorry no problem and the other easy one is the black total two one four four three two one four four three and okay now we can complete the rest of the table and then Indian total that's eight five five one nine one nine and Indian female two zero four eight two 2048 is it 2048 yes i got the same as well okay total female okay one one two one five one one two one one five okay so now your table is complete let's answer the question you're missing a one one one two one five one one oh they didn't write that's why there's space in between okay so which one of the following statement is incorrect the now hypothesis states that the two variables are independent so always in your now hypothesis it should state independent right always remember that so this statement is correct but we're looking for the incorrect one so i'm just gonna take here to show that that one is the correct one alternative will say the opposite if the null hypothesis says independent so therefore the alternative will say it is dependent so those three statements are correct correct the number of cases that uh uh that were white female is 1971 is that true yes it is females yes it is the number of eight cases that were Indians there are eight five one nine is that correct yes it is yes it is because it is that one the expected frequency of black males is equals to 14247 so we cannot say whether it's right or wrong let's assume to calculate the expected frequency we say row total multiply by column total divide by the grand total we're looking for black female or black males black males that is the value that we are looking for so we go row total is 21 443 column total multiply by 31 281 divide by the grand total which is 42 496 what is the answer what answer do you get the answer is 15784.04 and therefore that is the incorrect answer let's look at the next question consider the chi-square test results given here so now yes this is the other thing they can give you a contingency table or they can give you information relating to a contingency table and this is one of those cases where they give you information relating to the contingency table and already they have calculated some of the measures and then they just expect you to understand and know how to conduct a hypothesis testing especially a chi-square test hypothesis testing whether it's for the independent or it's for the goodness of feed test so now in order for us to know that this is a goodness a chi-square test of independent is because they mentioned rows and columns if they didn't mention rows and columns they would have I mentioned number of observations and on the sample size and the degrees of freedom and then they give you all the other measures so because they mentioned number of rows and columns therefore it means we're doing a test for independent but also in the question they will also state like test the independent so you will know that you're doing a test for independent so consider this excel chi-square test results for three hotel guests satisfaction surveys that were conducted the test was conducted and this is the information given as per the two table one is the data part and the other one is the results part where it shows the calculation in terms of the case the test statistic and the critical value so we don't have to go to the table to look for the critical value they gave us all the information the manager wants to test independence of the two variables at one percent level of significance which one of the following statement is incorrect right so therefore it means we need to do certain things so we're looking for the correct statement which one of this following statement is correct number one says we failed to reject the null hypothesis so therefore it means we should look at the test statistic and the critical value so our bell shaped calf we create our critical value they gave us its 5.9915 that is our critical value our test statistic it's 40 so it will fall somewhere in there we're going to reject the null hypothesis right are you still here or am I here alone yes okay so therefore number one is incorrect number one is incorrect because number one says we failed to reject the null hypothesis would have failed to reject the null hypothesis if it falls in there do not reject area so number one is incorrect number two we reject the null hypothesis is that correct we reject the null hypothesis is that statement correct huh guys i just gave you number one you can give me number same as sorry same as number one no it's not the same number one says we failed to reject the null hypothesis therefore it means we do not reject we do not reject the null hypothesis number two says we are going to reject the null hypothesis and i'm asking is that statement correct oh yes it will because it will fall within the the the area the rejection area it falls in the if number one was not correct therefore it means number two should be correct because number one says it falls in here number two says it falls in here so this is the correct statement it falls in the rejection area then the other three statements let's we can just go through them in case number two was not correct the calculation of the degrees of freedom would be five so let's see if that will be correct so if we given number of rows that are two so number of columns minus oh number of rows minus one times number of columns minus one that would give us number of rows we've got two minus one number of columns we've got three minus one so two minus one is one three minus one is two one times two is two so therefore that would be incorrect that's how you will find the degrees of freedom number four it says the chi square test is a is a negatively skewed test this is a chi square test this side is positive this side is negative so it is always a positive skewed test it's not a negative skewed test you can check it from here and if you are not sure about that you can even go to the table because on the table you do have a graph that looks like this or a picture that looks like that the rejection area it's less than 5.99 but already they gave us the critical the critical value so we don't even have to and we know that the rejection area will be greater than because it's in the bigger side so this sign should say greater than not less than okay so that's how you will answer the question in the exam as they appear let's see more exercises of the previous activity I think this will be oh we still have more time consider a multinomial experiment involving n of 150 trials and k cells the observed frequency and the number of hypothesis to be tested are below okay so yeah they want you so they gave you the hypothesis testing and they give you the probabilities and the cell the table that has expected and not expected observed frequencies and they're asking you the critical value at alpha 0.05 and the test statistics are so you need to be doing two things you need to go find the critical value alpha and the degrees of freedom and you need to go and calculate chi-square test stat which is the sum of your observed minus your expected square divided by the expected therefore it means you need to go and calculate your expected frequencies as well one two three since this are your observed you need to go and calculate the expected but to calculate the expected you need to calculate the total here already they gave you the total it's 140 so your degrees of freedom here will be k minus degrees of freedom here will be k minus one it will be k minus one and what did they give alpha so you'll be going to 0.05 and k minus one is four minus one which is equals to three you go find that critical value and here you need to calculate the total by adding all of them so but probably they are 158 plus 50 plus 28 plus 24 it's 150 yes and they are asking you to calculate also the expected values remember expected value we use the probability times the total and you will write your expected value there and once you are done substitute i'm gonna give you time to wake it out and then we'll wake it out together please make sure that you are muted and there's no music playing in your background because then otherwise the videos won't be posted are you winning just doing the calculation now okay are we done are we winning just doing the last number okay let me know when you're done i'm done are you all done okay so let's are we all done silence means we are all done okay almost okay i'll give you time let me know when you're done and then okay so let's do the expected frequencies first um so the expected frequency here will be 0.15 times 150 what do you have 22.5 22.5 and 0.4 times 150 i've got 60 okay and 0.35 times 150 52.5 0.1 times 150 that's a 15 now let's substitute into the formula our observe is 38 minus 22.5 square divide by 22.5 plus 50 minus 60 square divide by 60 plus 88 minus 52.5 square divide by 52.5 plus 24 minus 15 square over 15 um the first one what did you get if you did calculate them manually individually i didn't do them individually okay i will get to you um those who calculated individually what did you get for number one for the first one i think it's 10.67 okay i'm gonna keep four decimals since here they have four decimals so it will be 10.6778 plus the second one just give me the values that you have don't worry i will add the decimals if you didn't keep four decimals the second one what did you get 1.667 okay so 1.667 and next 4.005 the last one i know is incorrect 4.0048 i'm just gonna keep that and then the last one what do you get what did you get you didn't calculate it it's 5.4 okay what is your answer when you add all of them that person who said they did this and they did it on their case you and found all of it what what is your answer my shop says it's 21.4778 21.4778 i'm rounding it eight rounding off not sure if i missed something and if we add them manually uh in terms of the values that we have in front of us 10.6778 plus 1.66 it's 217493 20 217493 so if we add them like this then we get 21 7 4 9 9 3 yeah so i'm not sure about about that let's go find the critical value come on i want to move off critical value remember it's 0.05 and 3 right we had 0.05 and 3 so there is 3 there is 0.05 where they both meet 7.81 7.81 that is the critical value so let's go back to our presentation 7.8 there is no 7.8 so 7.8 no 7.8 and this is very fairly close and i think because we we round off too quickly as well if we kept all the decimal probably that would be would be the same amount so the answer is 21.749 21.7493 that would be the correct answer so if you don't have a cashier and you are using a sharp calculator i will suggest that you do the same way as i have been doing it i'm using a cashier calculator they not the cashier a sharp calculator and because i know i don't have fractions and there are a lot of powers and an addition and division so you need to be able to know how to use your brackets correctly and where to place your brackets because you need to put everything on your calculator this whole part should be bracket oh and then you say open bracket again and you say 38 minus 22.5 and you close the bracket then you put the x-square and you press the division and you say it is 22.5 and then you close the bracket plus and then you do the same you will have two two brackets at the end with the division inside so you need to be able in order for you not to make a mistake don't try and solve it all at once on your sharp calculator use a cashier if you do have a cashier especially the fraction one then it makes it easy if time is up and you will be inputting the data as you see it there and then press the answer button or the equal and it should give you the right answer okay so we only have five minutes left and there's not much i can do with five minutes but these are some of the questions that you get from your exam paper or your past exam papers so where they can ask you to find to calculate the test statistic and remember also the test statistics is the longest formula to calculate you need to have patience when you do these questions as well you need to know how to state your non hypothesis and you need to know how to make a decision as well and this is another example so you need to be able to know how to calculate the expected frequencies remember your expected frequencies is your probabilities which are stated in your null hypothesis times the n and you are doing a contingency table test which is your car square test of independence remember you will be given you will be given an a observed frequencies and then sometimes they will give you an expected frequency already calculated if they do so maybe then they save you a whole lot of time but remember to calculate your expected frequency for any cell you say row total times column total divide by the grand total which is your sample size and then you should be able to know how to get to the table to calculate to find the critical value also always always remember that when you state the null hypothesis for the car square test for independence always know that the null hypothesis always has independent or you say they do not or they are not related and your alternative will state that there is a relationship or they are dependent or whether you can say there is no there is an association with your alternative hypothesis so already you can see that with statement number one would be incorrect for this one as well because it's vice versa and you should be able to know how to find the critical value by going to the table the critical values of chi and finding your critical value on that note so these are some of the questions I just went through so in conclusion by the end of this session you have learned how and when to use the chi square test of goodness fit test and how and when to use the chi square test for contingency table which is for independence there any questions how are you feeling any comments any last words please remember to complete the register I'm just going to share again the link to the register oh there is someone already shared that please make make sure that you complete the the register otherwise if there are no questions or comment thank you for coming through see you on Tuesday thank you Slesi bye bye thank you