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


excellent way to be able to see machines and lots of machines up close, see them in action, talk to the sales team, open up the control panels and really get an idea of whether or not that machine's going to work well in your space. The fact that something always new here is always nice to kind of come and see. The vendors that we're showing here, the locations. We do plan on being back in March in 2020.


Hello and welcome to a video from filmsbychris.com. That's Chris with the K, I'm Chris. And this is a script that I wrote as an example. Let me go ahead and run that. So here's the script in the top half of the screen in Vim. And now I'm just gonna run that command. And what does it do? Well, it outputs this. It has different lines with different characters, some texts, some more characters, lines. And what this script does is it draws those horizontal lines across the screen with whatever character you give it. And it automatically adjusts. So if I was to split the screen like this and I was to run that command again over here, you'll see that when it runs again, it puts the proper number of characters to draw that line without having them go down to the next line. So let's go ahead and close that. And let's go ahead and have a look at how the script works. So I have a main function here, which is the functions written here. And then we call it down here. And the reason I do that is because I have this line function that draws those lines based on what characters you give it. And to call a function has to be stated already. So if I was to just write line down here and run line up here, it's not gonna work. And I like to have my main function near the top. So I call main down here, little side note on all that. But what are we doing? So here we give it the function line. And what that's gonna do is it's going to print square characters or rectangular characters all the way across the screen because we didn't tell it what character to use. Then we're gonna print another line using the equal character. Then we're gonna print our text. And then here I give it a plus and minus as an example. So it doesn't print a plus and minus sign. If I run the script again, you'll see it just does the first character which is the plus sign. And I'll explain that in a moment. And again, here we have line with nothing. So it's gonna use that rectangular character and then it exits out of the program. So let's look at the magic here in the line function. What it's gonna do is it's gonna look at what's past. Okay, is it is the variable past, the argument that's past, is it greater than zero? So was something past? If nothing was past, I'm just looking at it, if it's less than one. So if nothing was past, well then just use this default rectangular character right here, which disappears when I highlight it. But it's right there. So if you don't pass anything, it's going to use that. Otherwise, it's going to look at that first variable and get the first character. This is saying start at zero and go to one. Why do I do that? So an example here, if you were to give it more than one character, it's going to throw things off. Because down here, we're using the tput command to tput columns. What does that command do? Let's go ahead and run that down here. What it does is it gives you the number of columns across the screen. So the number of characters across the screen. Again, if I was to split this and run that command again, well now it's gonna give us half that number because we just split the screen in half. And if I was to increase the text size, the font size and run it again smaller now. So it's taking into account everything and telling you how many columns or characters the screen width currently is. And what I'm doing here is I'm using the printf command to say print that character from up here that many times. That's basically what this is doing. It's saying print it that many times. But it's basing it on one character. So if we were to give it two characters, it would actually end up being double the length. So that's why we're making sure here that we're only grabbing the first character. And that's how we're drawing lines across the screen. And then I use the echo command to give us a new line character. I could probably build that into the printf command. This script probably could be cleaned up. I wrote this a long, long time ago and have had it on my list of tutorials to do. But I wanna give you an example here. If I was to like type my name, Chris, right? Save that. Come down here. I'm going to run our line script again. And you can see here, it just used the first letter and just prints the Ks all across the screen. And again, if I didn't do that, then it would go down the new line because it would print that variable this number of times. But we don't want that. We just want the one character. Anyway, if you want to print lines across your screen, there's different ways to do it. In fact, I've done a similar tutorial on this before, but I thought I'd share this function. I'll link to it in the, this whole script in the description of this video. But then you can throw this function into your scripts and at any time print lines as long as you have tput installed, which is fairly common, but not always. So you have to take that into mind, take that into account. Yeah, thanks for watching. Filmsbychrist.com, that's Chris the K. There's a link in the description. Again, to the script here, but also my website where you can find a support section. You can also search through all my videos. I also have a Patreon, you know, if you wanted to support me over there, I would love it. I would appreciate it so much, even if it's just a little tiny bit. And if you can't support financially, think about liking, sharing, subscribing, commenting, all that good stuff. I thank you for watching. And as again, as always, I hope that you have a great day.


Everybody forced here. I've been 20 22 tops gold label baseball hobby 16 box full case number four random teams results on screen here. You can always find a late sports cards calm Let's go ahead and get started dropping another link for Bowman's best. It's just about halfway full guys It is at 15 to go pull extra The one of one holland already got pulled how like what come on now Yeah, I'm sure they do photo everything It was a shimmer that's not totally surprised. It's a true black fine. I got pulled China's gonna do what they want with cards. Yeah, wait was it out of a blaster was it the like gold power? Whatever was how they had in the um? You know the person would cup blaster one of one with the gold power. Oh, it's fine. I Dang the true true not the shimmer not the I don't think they have gold power and In Premier League, I didn't see it on check That's crazy. That's crazy The Jayrod class two to 150 blue class one Nolan Ryan Rangers Gore and Turner That's tough, man. Oh Well class three and no cruise. There's still lots of big stuff to pull out of that 75 Lattie jr. For the blue jays on the purple class two and another Jayrod each Wanderer class one rookie That's how it was last year to me like to like a whole box. I'm like you just need a microscope. Yeah to 50 class One Bobby Bayez Tigers What's better for their bones best bones best? But I mean they're both appropriate for the price But that's why moments best is price higher class three Bruhan Gonna say that we're gonna pull something insane Another Jayrod plus rookie auto for the Yankees to 50 Louise Heel I wouldn't put a pass while who's a start a mighty Ducks Chan though. I could see it Jose Siri Arkansas Arkansas Jayrod class two FAU or Tennessee class two Rondi Contreras Tennessee or UCLA That's a tough one He was eggs That was four, right? I remember read Detmer's rookie auto angels. It's a weird box. I think we're not I think it was like we're in parallel on that one It's true heck of a knuckle buck to win Josh low I mean if the great Britain players wanted to wear something other than what they had to wear I would I would have been mad to 25 Jake Myers rookie for the rain or for the ashros astros Will he maze it's a class three? I think we all are those are terrible ever Cabrera class three rookie Marlins Okay, if you guys want to wear something else, you guys don't want to put on like some some t-shirts, okay? Purple Hank Aaron numbered to 99 The Braves class one in a Jayrod rookie Royce Lewis class three so hard to read It's hurting my eyes. Honestly, this product hurts my face Jackson co-ar rookie auto Royals Thank you that legitimately hurts my eyes What's that? I mean if you find a rookie I'm trying to find out but like other than that like a trout class three is cool There's a Suzuki to 150 rookie for the Cubs Very nice one there Purple to 75 class to Miguel Cabrera Tigers Della Cruz like they don't even like the thing is a quack They don't have to be flashy jerseys like it just been anything, but it just did like the worst job like it's a tea It's a team great britain jerseys. You have to be anything flashy The 50 class three to ground Mets he must have been on a while Like it's even worse that doesn't even have to be like crazy fancy.  I'll rally class to Bobby wick class 1 a wick class 2 We got Abrams class 3 Wanderfranco rookie class 2 purple to 75 nice card for the Rays Really the hell on Frank Thomas class 3 Andre Jackson class of rookie Dodgers Josh Chisholm class 1 actually One of these is a relic I think yeah a relic coming here Is a jersey card of Tony Gwyn to 50 okay game use Gwyn for the Padres Okay, that's awesome. Mr. Padre jersey card and Rookie auto Alejo Lopez for the Reds I was like Nice the MOOC you got a Palo RPA nice Hey, hey getting first any head draft is is dumb no matter what you're picking Bobby wick class 1 Quit Bosnia be icing 3-0 wrecked Trade Turner class 3 Gavin sheets class 1 we're doing pretty good over here We're doing pretty well Josh Lowe class 2 and you'll cruise class 1 Ran class 1 J rod class 3 rookie purple to 75 Willie Mays class 2 Giants Class 3 big poppy Mackenzie Gore class 2 I'm not sure I haven't gotten to the case that I'm ripping today yet Had a Palo gold elevation yesterday Garrett Cole And rookie auto Red Sox Conor Siebold. I don't know what was hit today though Look Dolo class 1 sup Shane speeches Now Jeter class 3 Purple to 75 Frank Thomas class 2 White Sox Mark McGuire class 3 to 75 rookie class 1 Louise heal Yankees Holly class 1 12 to go on Bumman's best everybody Ryan Vellade rookie auto Rockies Not much man Doing the best I can over here. That's about it. I'm sitting in football Prison Premier League tomorrow everybody do a release day Do a release day PYT of city and all morning with Sam and there's a few It is and it's starting in the evening I'll be ripping some prison for really for you guys random team style all teams in so you get a chance at the man's city cards for 62 99 Also a lot of other big chases. That's not just it's not it's not just Erling Holland a Lot of good players in the Premier League Some good rookies this year. Hopefully hopefully some of these big rookies can Can step it up even more to 1 to 50 Mario in our favorite Yankees class 1. I think you are is I believe he is A little older though class 3 soda Royce Lewis class 1 They have said I'll be fun to color blast in both products tomorrow So I'll say earlier to a color blast release day rookie auto Kevin Smith blue Jays I'm gonna send a box and effort. This is like Back of the card is like lifted Not sure why It's like an edge here kind of see it not a bad idea Shane honestly Shane doesn't know anything about soccer joined tops Chrome Champions League four box random got Dortmund's the Bellingham auto 99 and Gold lava or is lava Holland or something like that like insert He's like are those good like Yeah, you're the best part in the break to 99 Austin Raleigh class 1 for the Braves everybody wishes those are theirs Manifestation for sure works. I've all always say you don't have to know anything to get big hits and breaks Class 2 purple Xander to 75 Red Sox This is a 105 a box to 50 Jacob de Grom class 2 blue Mets To ground with the bat in his hands class 3 Joe Ryan twins Wander class to raise Say it's a zoo key class one What is the zoo key supposed to be back this year? He's out for a little while one Ryan class 3 Yeah, it's just 2022 Yeah, we saw that CW we were looking at some of the hits Shepard y'all Cabrera or key auto Sammy long giants Yeah, yeah, well, I saw that was like back in about I didn't know he was on the checklist to be honest I hadn't seen one yet Let alone a red Starware mask while I break dude. That's what I'm saying. Although that might that might send not a great message by the way, junior Fortunately, that's a use in different ways a lot All the public lava that's what I'll wear Boba Shet class 3 and the base. All right. It's miles better than than last year's product. I would say Jeter class to 250 Jera nice 127 150 Mariners class one That's good stuff right there Chicken nugget card the dolo clash three reds pull some sauce later class to a bray you after the legends You got a Jersey number J. Oh, yeah, I was I was in chat. I was a chap when he pulled that Maybe not actually, but I was listening verlander class three and Gold nugget rookie auto six out of ten been manifested pirates with the Nuggy Grants pirates Look at that Look at that Mmm. Look at that delicious nugget right there Congrats, Landy six to ten O'Neill cruise gold nugget rookie auto. Yeah, good call Carl. Wow. I'll be a while There you go Box gets you a chance at that Yeah, I was saying Bowman's best is typically better, but I mean if you're just gonna pull a golden nugget then this is better But those that's that's a tough pull. That's a tough pull right there Yellow edge class three Manifestation it's a 99 Garrett Cole class two Yankees this prospect Interesting because it says rookie on the front. Maybe she's the Nate because I'm sure the wonder is the same thing Chunk of gold class three Ted Williams Matt Manning class one. Hey, Brennan. What's up, man? 250 rookie class one Torkelson Tigers nice torque Why are you staying at a blender a Devers class three and Posey and a Joe Ryan twins rookie framed auto Ryan class three to 75 Chipper Jones Braves things a class to pop the Florida's Orlando suburb To be class to wander class one on Ryan class three. Oh, yeah, you're not that far Brennan hop on the turnpike will be here Turnpike 429, I guess the quickest way Wanderfranko class one from there it is for sure I would think because you're right off Class three dentmers rookie angels into 150 blue mookie bets class one Dodgers Not super fractures. They go for the gold one-on-one in this It's literally it's not super fractured now. They're not chrome cards. They're like paper cards with like nice foil or gloss on them J rod Every Marswood up 15 minutes south of the shop It may take longer to get here than 15 minutes. I'm just let you know that right now from where you are to get in the blender You never know Rookie auto auto Lopez blue jays are you out of water? Yeah, at least there's like five lanes on each side of the turnpike You know, it's funny is We wanted to move back downtown to 99 rookie runs against Harris pirates class one I enjoyed that area more, but yeah, the commute would not be as fun Go from 20 to like 30 to 40 Oh No, definitely not. Nothing's as bad after Class three Willie Mays say a Suzuki class three nice What's up from Mars? All right, that's good, right? Yeah, as long as your hopes aren't up to your phone your phone. It's not that bad of a drive. It's it's You'll see what you get out here. It's a little a lot more open to 99 on our not oh class two The Cardinals yeah Kyle's here class three Roberto Clemente Class two Louise Heal. I'm excited for that 2021 Bowman's best in the mixer Excited for pretty much everything in the mixture though class one torque 20 boxes excited for 20 oh Secret McGuire and Matt Olson braves framed auto to 25 nice it for the Braves He doesn't have a ton of braves autos as it currently is 25 It's just two and five like oh no we went backwards We're going oh no 52 to go now Lonnie Chisholm Sam's gonna say that and leave Kyle's gonna ask him questions I'll have Donnie type up some questions for Kyle to ask Donnie Salieri get him We can get Donnie to come in ask some questions real quick the last 10 minutes of Donnie shift to just be in here asking questions J Rod rookie We'll be here now before we start tomorrow. So I'll be in it like two tomorrow. I think Korea class to wander class one I'll be I'll be here early for for my day, but that's alright Boss man Lane, and I got some stuff to go over purple the 99 jazz Chisholm class one Water Marlins I Wish it was that quack Class to wander Miguel Cabrera class three I wish Wonder Franco class one for the rays and a Dan's beast wants to now braves framed auto Sam you see D hops got a Ravens on his shortlist D hop to the Ravens if the Lamar will they keep Lamar Lamar will actually have her. Yeah, I think Lamar. Yeah, I was gonna say Those could really could absolutely use a number to receiver like D hop class three Big Mac for the A's Whenever he wants to go to the Patriots. No, B. O. B. Is there class two is Anderson 99 Red Sox at Oliver I mean heaven load up on defense. They're doing the right things to become a winning team Reggie Jackson class three for the Yankees They're doing the right things to try to win games now not just being shootouts So Devers class three Devers is only class three. I've only seen him in class three I guess isn't crazy that some guys are only in certain classes I've only under class three for the strews. Well, Brennan's coming on a Friday Shane to 75 out to be Astros Class one. Yeah, that's lame for a tour Just barge your way in security will think it's totally cool and Raise rookie out of Josh low. I forgot what they even it was like a Monday or something and I had There was I was literally bit of actually busy that night mom or something I don't even know. I forget everything nowadays. There was actually something I had to do to 75 Marinus Ken Griffey, Jr. I Do not know Timothy never pulled one I've never looked for one of those on eBay as well. Usually the canvas signatures are another products though from what I have from I remember Xander class two So I have I have no clue on that one It's at least I would say probably at least the three-figure redemption but other than that I don't know just based on the rarity of it Maybe a live card. It's it's worth three figures. I don't know show you a tiny class to class three ohtani class three sheets Freddie Freeman class three Jose Ramirez and a Jake burger rookie out of White Sox. What does what mean that had something going on in it? I don't have anything going on. I would have came up here. I've had people to shop before but Mostly it's when days that I like am here. I've also missed a lot of people that have come to the shop A lot All right, a Jersey card Tony Gwyn Autos of Josh Lowe Dan's be swanson Matt Olson a 25 auto Lopez Joe Ryan, Sammy long. I Think he is I think he is under Kevin Smith Ryan Vellade Connor Siebold Alejo Lopez Louis Heel Jackson Coar Three Denmers and Louise Heel to 50 As well as a gold nugget rookie out of O'Neill cruise the 10 rats the pirates that's sick Delicious nugget for you. That'll do it on to the mixer