And after the session, it might take a some hours because it will depend because our session will end at eight and then, yeah, I will see when will I upload them if you have subscribed to my YouTube channel, you will get a notification when it gets uploaded. Please also, when you go and look at the recordings because I actually assist statistics students mostly. So there will be a lot of videos that I post on statistics. So don't get confused. Just go to the playlist. Under the playlist, there should be psych 3704 and you will only have the videos that relates to your modules there. So don't try and go and read the one that starts with STA 1610. Those are my statistics module classes. Okay, so let the games begin. Question number one, the process of finding a new a way to measure construct so that you can be represented by a variable. What is the answer to that question? Oh, that's the other thing. I don't give answers because I don't know the answers myself as well. So you can. Number one. Number one finding a way to measure it's number two. I would say number two as well. It's number two, ma'am. The answer. Number two is operationalization. Are we all happy? That's number two. Yes, the mean range variance and standard deviation are examples of. Number two. Examples of a descriptive analysis because descriptive analysis describes your data. And the mean gives you the location of the data the range gives you range variance and deviation standard deviation gives you how did how diverse is your data how far apart your data is from the. So it also gives you the location but in terms of discretion or variability. Are we doing. I did say that what paper we're doing is October November 2017. And I think it's you are able to see right there. A theory is a, or N is it number one? Number three. Number three. Because a theory accounts for facts. And it will explain why facts are as they are observed. Happy. Do we all agree? Yes. Remember, you need to you need to talk to me so that if people don't agree, we need to go and find information about that. So I'm going to assume for those ones like this. I don't know. I know certain things, but you guys need to assist me. The process of selecting a subset of population for a survey is known as is it known as a calculation. Number two sampling. So when we have a population, we can just create a sample by selecting. Your sub or a subset of your population. There's somebody whose mic is on and there's a background noise. We can't hear you. If you have a, if your background is not conducive enough to. Oh, sorry. Now it's me. I will put it on mute. Just give me a sec. Sorry about that. Okay. And inference is one, two, three, an explanation of why certain things are as they are observed to be an educated guess about how certain phenomena may be interrelated. Three, a generalization from a sample to a population which have a high probability of being true. One, two or three. It's three inference we make. Three is crazy about the population based on the sample. Okay. Number six, empirical or empirically means based on is it on theory, observation and faith. It's based on observations. Which of the following best describe latent. And this is one of those things that I don't know what is it. Because I know one should describe something that is hidden one should describe something that is not not hidden, which one is manifest. Number seven is two hidden. Let's make notes somewhere. Let's see to help those who don't know. So a light elated is invisible can be constructed by manifests. And a manifest is visible and can be observed. Okay. So now I know I need to remember that also for future. So the one that will be number two. So in a way it says a latent will be your dependent variable. Isn't it is the one that you want to also predict based on the observations. It's something that you don't like things like anxiety. You can see or depression. You can see. But you can predict or IQ or intelligence or emotional intelligence. You can see it but you can estimate. Yes. Okay. Now I got it. Okay. A psychologist number eight a psychologist has a theory that visualized perceptual ability influences the max. Oh, gosh, wait, let me read it again. A psychologist has a theory that visual perceptual ability influences the max that the learners will get in mathematics. In this example visual perceptual ability is what variable is it a dependent independent and hidden. Number two. It will be independent because it influences what the micro do so that will be your X observation and that will be your Y. That is your input. This is your outcome. And that is independent variable. When a construct is measured, the resulting quantity is referred to as variable as a variable. The mean is the sum of all the observations. The standard error is the deviation of the mean of the observations from the means. What number is this? A psychologist. Yes. I don't know if it's my connection but I can hardly hear you. You can hardly hear me. I don't know if it's. Yeah, I don't know if it's only me. And now, can you hear me? So you want me to speak loud? I am as loud as I can be actually. It's clear on my side. Yeah, I think it might be your connection. Okay, what I would suggest is to check the connection. Yeah, check your settings and increase your volume. Maybe. I'll put on earphones as well. I think sometimes they help. Okay, so question 10. Maybe it's the way that it's going. Oh, okay. Okay, so question 10. A psychologist is interested in studying the interaction between small groups of four to five people in each group. He suspects that the interaction between the groups can be described in a similar term to the interaction between the individual groups in order to be able to do a scientific study of this. A question. You would like, you would have to provide A or N definition of the called interaction. He's interested in studying interaction between small groups in each groups. He suspects that the interaction between such groups can be described similar or in a similar time to the interactions between individual group in order to do a scientific study of this. Question. I would like to provide definition of the called interaction. So is it A? Can I jump in there for interaction? Yes. I would say looking at the at C, interaction would be a construct. Lady that says to me C would be a construct and I only see construct in number one. So my answer would be number one there. My answer would also be number one because for the researcher to start, there needs to be a research question for a research to operate. I agree with that. The research question must be established before research starts. So the question would read if we select number one in order to be able to do a scientific study of this. A research question would have to provide an operational definition of the construct. Does it read much better? Yes, definitely it does because this one would have said if I take this one to do a scientific study of this experimental, you would have to provide a research definition of statistical interaction. No, doesn't sound right. Hypothetical question. No, also doesn't sound right because I have to provide an empirical definition. No, also doesn't. So number one is the right answer. And also based on what everybody has just said in order to identify which one will be correct because interaction will not be a statistical parameter. It can be, but in this instance, it's not because you're not going to define those ones that you can define your construct because it's those observations that you made. Okay, so question 11. The variable manipulated by the researcher in an experiment is called the. Is it an independent or is it a dependent? I would say two. I'd say two as well. It is called an independent variable because he will have to manipulate your independent variable when you use them in your model or any way where you want to test or you want to predict an outcome, which your outcome would be your dependent variable. The 10 population refers to. Number one. Number one, yes. Number one. One is correct because this one set is the subset and this one says the set of all variables because all variables from part of the group and we're not interested in the set of variable we interested in the set of the population, which is all set of all elements of interest and all elements of interest have variables that are characteristics that defines those. It's all that set. So it cannot be that. So number one is correct. The symbol X bar refers to while the symbol mu refers to. What when you answer this question, think of it this way, we have a population which is big and then we have a sample which is more. Always when it talks to the. Like symbols, always think of it complex simple. So complex complex in a way that you can even pronounce it simple in a way that you can actually even make sense out of it to say oh this letter represented X. So the simple X bar refers to and while the mu refers to. Number one. Number one. Number one. Number one. This is your sample mean, which is your simple X bar. And your Greek letter so I could have just said Greek. We use Greek letters. New is your population mean. That would have been correct, but this is wrong and that is not a standard deviation. A standard deviation is sigma for the population. Oh, that is the sample for the sample standard deviation is s. That would have been an s and for the population variance that would have been a sigma squared. You need to also know that that is a variance is sigma squared. That's population standard deviation would have been just the sigma. In probability theory. The number of distinct events that could possibly occur during a performance of an experiment is referred to us. Number three. Number one. Number one is not correct. Number three. Number three talking about the number of is a collection of all events. correct number 3 talking about the number of it's a collection of all events if you watch the last session that we had together I don't know when did we have it when we dealt with probabilities we spoke about the sample event which is a collection of all events in a simple uh sorry those who don't know me uh I don't have a good handwriting so you will bear with me you will just listen to my voice it's a collection of all events that is a sample space question 15 the table below gives the frequency distribution so this is a summary table of numerical information of exam of number of students in a psychology exam mark so they gave the range which starts at 40 and the above and ends at above 81 and they have your frequency count the question is what is the probability that a student will get a mark between mark between 51 and 70 51 and 70 which is those two together or maybe I should have extended the table this way what is the probability that a student will get a mark between those two so in a lecture what they are asking you is you need to add all these values calculate what we call here total so did you calculate you need to do the calculations so add them 8 plus 12 plus 20 plus 30 plus 22 plus 18 what do you get 110 now we need to come here and calculate the percentage actually not a percentage we need to calculate a relative frequency oh I need to get to the just of things so we need to come here and calculate what we call the relative frequency and we can use this relative frequency as our probability so how do we calculate that you need to add you need to say 8 divided by 110 what do you get it's 0 comma 0 7 I'm going to leave it at 2 decimal because I see our probabilities here as are two days in two decimal then we need to say 12 divide by I'm going the the long route anyway so but I'm just demonstrating the concept because we didn't cover this during our sessions 12 divide by 110 and that will be 0.11 0.11 you need to round off correctly as well because the answer there was 0.109 so if I round it off it will be 0.111 and then 20 divide by 20 divide by 110 you will say 20 divide by 110 0.18 0.18 the next one 30 divide 30 divide by 110 0.27 30 divide by 110 0.27 I'm not going to complete the whole table so you get the you get the just of things you understand what we were doing there so when you do all of them and complete that the total here at the bottom should be equals to one the answer for this should be equals to one and remember that the sum of all probabilities are equals to one so when you get one day you know that you have done the right calculation you can go ahead and do 22 divide by 110 and 18 divide by 110 and get the answer and add all the relative frequencies and see if you get one but I'm going to stop right there so that we can move on so what we need to do right now is to answer the question that we asked so the question says we need to find the probability that the mark which I'm going to connect my x value lies between 51 percent and 70 percent so if that is the case so therefore it means I'm going to have to find the relative frequency of my value where it is equals to 51 and 60 percent plus my relative frequency where it is 61 where x is equals to so I can put these things in the don't forget the percentages as well where x is equals to 61 percent please forgive me for my handwriting okay let me rewrite it nicely sorry my bad because I I can't even see what I am writing let's let's write it maybe I will second time around it will appear right working on a pdf it's difficult than when you work on a powerpoint okay it did remove that so we need to find the probability where x is between 51 percent to 60 percent plus we need to add because it says between 50 and 70 plus where x is equals to 61 percent to 70 percent which then we did calculate that remember I said these are our probabilities so we're going to take 0 comma 1 8 0 comma 1 8 plus we need to add 0 comma 2 7 and that will be 7 plus 8 is 5 carry 1 2 plus 1 is 3 plus 1 is 4 comma 0 you can take your calculator also calculate it which is 0 comma 4 5 or alternatively because I showed you the long way of doing it alternatively we could have just said I'm going to show you another way of doing the same thing let me use the site without complicating your lives so but you know that you need to share with people different ways and they need to select whichever one they feel comfortable with so because they said we need to find the probability of x lying between the two values so we could have went and got the values which is 20 plus 30 and divide that by 110 and the answer that we will get here would have been 50 divide by 110 do the calculation what is 50 divide by 110 0 comma 4 5 yeah 50 divide by 110 it will be 0 comma 4 5 0 comma 4 5 option one or option two those number one or number two whichever step you want to follow there is no right or wrong way of doing meds there are many ways to skin a cat so I've shown you one and the other one so choose whichever one you feel comfortable with I've shown you the statistical way of doing it and the easy way of doing it as well so the complex way and the simplest way but I needed to do the complex way first okay so that is one number 16 a test for short term memory capacity is normally distributed with the mean of 100 and the standard deviation of 10 what is the probability that a person is chosen at random now that's the other thing in your exam you need to also be in mind when you answer your question how do you identify what question and what you need to do with that question so how would how did I know that with this question when they are asking me about the probabilities I need I needed to do this it's because when they talk about frequency distribution and they ask about the probabilities I know that they are talking about discrete probabilities so and as long as they give me a table with my x observation and my frequency and they're asking me to calculate my probability which will be my probability of x then I know that this is my discrete probabilities now moving to this one it's also asked about the probabilities I need to know when they start talking about normally distributed and they give me the mean and the standard deviation then I need to know that yeah we're talking about the normal distribution and when they talk about normal distribution and they ask me about the probability what comes to my mind it means I need to also use the table we did cover this the last time we met so I hope you still remember we need to first calculate the z score because we need to first standardize the equation or the units of 125 we also need to bear in mind the sign of the question because it says what is the probability that a person chosen at random will have a score of 125 or more so it means greater than and when it's greater than there are a couple of things in your mind that you need to also remember when you go to the table what will happen if my answer is negative what will happen if my answer is positive what must happen you need to also have that in your mind so it says we need greater than and we know our formula it's the x bar minus the mean divide by the standard deviation our mean given our standard deviation given and our x always is the question so I want you to do the calculation so our x is 125 minus the mean of 100 divide by the standard deviation of a 10 do the calculation leave your answer to two decimals if possible let me know how much you get 2.5 2.5 2.5 okay so it seems everybody is getting the same 2.5 I'm gonna just put a zero there at the end then we need to go to the table but you also need to remember the following our sign says greater than so when it's greater than and our answer is positive which side of the table must we look for the smaller portion the smaller portion which is which is yes so let me show those who didn't attend and they didn't watch the recording so if it's greater than you can just throw like for example if you forgot you can just draw your normal distribution table or graph so it says greater than so it means it will fall on this side so if it is positive it will be from the smaller side if it's negative it will be larger side so we're gonna go to the table we're gonna scroll up that's where we find the tables so in this instance you should have another you can have another thing open next door to check your table maybe I should have opened another exam paper so we are here on their probability table we're looking for 2.50 so I must go to the two so this is 0.00 so we need to find 2. this is once and this is 2.03 2. we're looking for 2.5 right 2.5 so that is 55 so that is what we're looking for so where is we looking for the smaller portion or larger portion sorry smaller smaller portion so we're looking for the last column so we're not looking for that one so we can go to the last column which is that should be our answer 0.0062 let's go back to the question I'll open another exam paper and leave it there for so that we don't have to scroll so many times we can just save time oh there you go so the answer we found was quick question yes so if the the question remains same everything remains okay the question remains the same but x let's say it's less than 100 where it will give you a negative answer and they still want or more and meaning our answer will be negative so we'll only be we'll be looking at the the larger portion since that the answer is negative yes so if if the answer here was minus yes sorry on a pdf my thing it does that all the time I don't know why it flicks so sorry it will come back maybe let's see doesn't want to come back oh there we go give it some time okay so I don't know okay but you get the idea so when it's negative then you go to the larger portion so if it's negative there you are you will go to the larger portion so I'm not going to entertain that flicking around so the larger portion yeah we can move on yeah so that would yeah okay so moving on to number 17 suppose the weight of population military recruits are normally distributed with the mean of 64 and the standard deviation of eight different samples for these recruits each with the sample size of 16 are drawn we would expect the standard deviation of the sample means which is the standard error to be so yeah they're asking you to find the standard error so you also need to remember that remember now also we're still in the population so the minute they start introducing concepts like standard error then we moved away from normal distribution we are now in the sampling distribution of the means because then now we're talking about multiple samples on the other one when we were talking about normally distributed we were only talking about when we have only one thing here we say we have different samples so this is your sampling distributions so because we're talking about multiple samples then they're asking you to calculate the standard error if they were not asking you to calculate the standard error they would have asked you to calculate the z I'm just gonna write the z formula oh yeah z formula it says the sample mean it will find me minus the population mean divided by the standard error which is your population standard deviation come on while we started nicely and this happens it is Friday for this thing I guess so my my PC is telling me it's six o'clock you shouldn't be doing this so standard deviation divided by the square root of n it will come back okay so this part at the bottom of this formula gosh that part is what we call there standard error just give me a sec let me stop sharing and I'll come back and share again I'm not sure if it is my PC or the system itself I just want to see if I'm not sharing if things don't flick things don't flick so it's only when I am sharing then I don't know how to to handle that okay let's see so okay so this thing doesn't want me to to show you so what you see there at the bottom that's what I wanted to write there is your standard error so this is your standard error which is your standard deviation of the sample means so that's what they're asking you to calculate so in order to calculate that you just need the standard deviation of eight so because I wanted to write it here the square root of n standard deviation of eight divided by the square root of 16 do you know how to use your calculators on your calculator you have the square root button so I don't know the answer is two yes because the square root of 16 is four divided eight divided by four eight goes two times and the answer is two don't understand this and I can't write it down when it's flashing hey yes it's very disturbing and irritating you see the the the one that you wrote first and the the z formula first you put an s at the bottom is is s equal to sigma over the square root of n sigma it's not an s or on your side do you see it as an s is a sigma um oh is that a sigma yes so it's not visible nicely it looks like an s let's extend that my handwriting it's good that you are asking because my handwriting yes it's terrible I thought just because it's jumping my eyes are also jumping okay it looks like an s sigma that says that's your standard deviation I don't know why he's doing that why is it behaving like that okay so that is 17 18 oh we still have a long way to go we are only on 18 a marble is the visual things like this then you must know that this is basic probabilities if one marble is drawn at a box oh at random from the box what is the probability that it will be read so we need to add up all of them so that we know what our sample space is in this instance what our n is so each day six plus four plus five is equals two how many there are 15 that is our sample space and we know that the probability of x being read because they say only if one marble is read so we can say where x rate is one only one marble that is given by oh not the probability again but it's given by x number satisfying the outcome divided by how many there are 0.4 the answer is two 0.4 there are six red marbles over over 15 over 15 number two 0.4 0.4 okay there are 19 females and eight males in the in a group of psychology student after 19 females only four have no brothers while three of the males are only are the only children if a student is selected at random from the group what is the probability that it will be a female with no sibling now remember that time when we were doing the probability I said I like to use contingency tables as well because yeah we can have our females and our males and we can say there are 19 females and there are only eight males because that is our total but they also said brothers and no brothers brothers and no brothers so only four females have no brothers or sister so let's see no brothers or sister four of them that will be there while three of the males are only children are the only children which is exactly the same which is exactly the same which is no brother or sister if a student is selected at random from the group what is the probability that it will be a female with no sibling remember satisfying females no sibling divided by the total remember that will be a joint probability a probability of female and no sibling I don't know how to write that but we know that inside we create joint probabilities outside IO as that's where you calculate your simple probability what is 19 plus eight 27 so that will be four divided by 27 which is option number three three is it possible to not go to use this to not use table because I'm looking at the question and just by saying 19 plus eight it's 27 remember you don't have to use the table it's just to help you understand what the question is talking about so that then you don't have to always scratch your head so if they would have said what is the probability of females with siblings you would have done 19 minus four because here they say only has no brother and sister so therefore it means the remaining has at least a brother or sister a sibling yeah so it would have been 15 so you see you are able to just quickly populate and calculate what is missing and use what is missing to answer the question yeah so here we could have just taken the four and divided by 19 plus eight as well which is what we did here that's I didn't mind without using the table yes so yeah I'm just giving you tools as well so whichever one you feel comfortable with the easiest so you don't have to waste remember I told you in the beginning you have almost like 60 to 70 questions you're writing a two hour exam you don't have to find alternative ways of answering questions find the one that is easiest and then move to the next one move to the next one okay question 20 a variable is normally distributed with the mean of 50 and the standard deviation of 10 if this variable is transformed to a standardized normal distribution what will the value of the mean and the standard deviation of this distribution be so here they're asking you what are the properties of a normally distributed number one yes I say that with the mean of zero and the standard deviation of one there is nothing you can do about it because they just want to know what will be the mean and the standard deviation of this distribution hey 21 the probability of an event can be determined by remember we're talking about the probability one the set of all possible values of statistics when all possible values of a fixed size are taken from the population observing the number of times that an event occurs divide by the number of times that it could possibly occur during a specific experiment the distribution of means obtained from all possible samples which can be established by applying a central limit theorem one two or three I'm guessing but I said two that's one okay so why one is incorrect one is incorrect because it talks about the statistic and the possible values of a fixed taken from a population that would explain something else is not explaining the probabilities number three it's also not correct because it talks about the distribution of the sample means so this is a definition of sampling distribution because it talks about different sample size that can be established from a central limit theorem remember the central limit theorem will tell you when you increase the value of your standard deviation let's go back there when you increase the value of this standard deviation what happens to this when to the probability when you increase the value of your mean or your sample what happens that's what central limit theorem will do oh and going back there while we're still at that so this is the formula we use to calculate the sampling distribution of the mean z score and use this to find the probability as well and in the hypothesis we also use the same formula okay let's go something moved okay so that and that is not true what makes number two true is it talks about an event happening remember probability is a study of chances is a study of events okay probability that something will okay an event will happen and that's the correct answer is number two by convention the total area underneath the normal care is set to equal is it zero is it the standard deviation is it one we also dealt with this on Tuesday but the total area is your probability the area underneath the care that is this shaded area it's going as one and split it in to half the site will be 50 percent and that site will be through somebody's unless it's my bc later that's later okay yeah the mean and the standard deviation of a set of tests are 20 and 8 so this is our mean and this is our standard deviation if the z score which corresponds to the test score is 14 that's the set score or the test score of 14 is calculated which in which of the interval listed below will it fall so probably here they want you to go and find calculate the z or calculate the probability very difficult to tell which of the intervals so if we take our z score let's just calculate our z score because we used our z score to compare so we say the mean x bar minus the mean divided by the standard deviation so our x bar our x is 14 minus the mean is 20 and the standard deviation is eight calculate minus zero comma seven five so which interval will it fall in number two the distribution of sample means which is sampling distribution for the number of sample drones from the same population can be determined because of is it one the z distribution two isn't the central limit theorem three is it the statistical inference i would guess and say three i would guess and say two let's go to do do you have i keep on talking about sampling distributions and all that do you guys talk about sampling distributions on your in your module yes you do page 57 page 67 is it page 67 on your site told you there will be some places where we go back and look at and it's specified by we have shown this that the distribution of the sample means can be obtained for a very simple and specific question fortunately the general characteristic of the distribution of sample statistics such as the mean are specified by mathematical call central limit theorem it follows as such if a sample random sample of any selected from okay the sampling distribution of mean obtained from all possible sample is approximately normally distributed from all possible sample is approximately normal with the mean and the standard deviation the central gives you a precision of the distribution that will be obtained if you selected every possible sample okay so we have our answer and our answer is option number two and then we come to a symptotic property of a normal kef oh so what does that refer to the fact that so an asymptotic property of a normal kef refers to the fact that one number two the kef is barely kept to the endpoints of the kef gets closely to the x without touching it or three the kef is symmetrical it is number here number two symmetrical it will refer to that the mean and the median are equal the belly kef will just just talk to the distribution of the mean of zero and the standard deviation of one the asymptotic manner will tell you that this kef always come closer to the x exists but it will never touch the x exists that is an asymptotic property consider a hypothesis which describes a possible relationship between two variables now we're talking about a relationship between two variables the null hypothesis refers to which specific kind of a relationship between the two variable oh yeah right number one no relationship number two positive relationship number three significant relationship number one number one okay and that will be number one because when we state the hypothesis testing the null hypothesis will state that there is no relationship which means they are independent with the flicking flicking this they be me in the independent and your alternative will state that there is a relationship which was and now it was which will mean that they are dependent oh yeah right maybe probably in my afterlife I was supposed I'm gonna be a doctor I don't even have to independent independent statistical hypothesis are statements about one the population parameter two sample statistic three z distribution when we state the hypothesis testing do we use the sample or do we use the z distribution or do we use the population parameter when we always use population parameter for example when we state that for a null hypothesis we state that the mean is greater than 100 we use the population we don't say the null hypothesis says the mean bar is greater than 100 or we don't say the mean the z distribution is greater than 100 we don't do that we don't do that we use population parameters that is correct suppose we had have stated that the null hypothesis the mean is equals to 10 and the alternative the mean is less than 10 so you always remember that your null hypothesis always have an equal sign and your alternative helps you to make the decision because the sign in your alternative will tell you what type of a test you're doing are you doing a directional test or are you doing a non-directional test okay find the sample mean and find that the sample mean corresponds to the z of minus three this means that the corresponding p value would be so also based on what we have we can also go with our normal distribution and say if it's negative we use smaller portion negative smaller portion positive larger portion so now we have our z we need to go find the probability which is our p-ring we find it on the table the z score is minus three so therefore it means we go into go to the z normal distribution table and look for three without the minus because the minus helps us in knowing whether are we going into the smaller portion or the larger portion or if I can remember this we're looking for the smaller portion so it's the last column so you take your three and you go to the smaller section which is zero comma zero zero one three it is equals two I don't know why I'm giving you all the answers now and not letting you do this or tell me okay happy thank you yes ma'am moving a hypothesis which the alternative states that the mean is greater than 50 is a hypothesis and requires a statistical test I'm guessing number three you are correct three it is number three because it's a one directional test and when I'm saying it that way so I've already said it's a directional test which requires a one tail test it's number three the level of significance of a statistical test which is an alpha value refers the p-value such as the calculated from their test statistic indicates the maximum risk that the researcher is willing to take for a for making a type one error is used to indicate the probability of making an error by not rejecting the null hypothesis I think it's two I think it's two you think it's two let me open the note and I think it's something that we did right in the beginning did we no I didn't do it with you guys okay so I didn't do it with your class I did it with the IOP class it can be number three or number two let's let me just double check that um when do we make type one error so I want to open the notes it's the statistics so many notes so many notes that one error occurs when the null hypothesis is wrongly rejected so we type one error is when the null hypothesis is rejected but is true so what does the question is asking it says it indicates the probability of making an error by not rejecting the null hypothesis is the question about the is the question about the the error type or is it indicating what that p-value represents it asking you about no it's asking you about the error type because the level of significance let's let's go there where would we find it let's go for such fine from your notes fine where is fine there is fine we looking for the level of significance type one error I can find it it's not gonna find I'm not gonna find it there I think type 11 of significance what did we do this which section of the research analytics we did this in our session one maybe we can check page 105 page 105 oh it's on page 84 on the study guide page 84 yeah page 85 the second paragraph there we go so so the level of significance the alpha represents the maximum risk that we are willing to take to make a type one error of rejecting the null hypothesis so let's go there it's used by the probability of making it so that won't be right this will be the correct one because it's the same as is the maximum risk that the researcher is willing to take to make a type one error by rejecting the null hypothesis making a type one error which that one will be because this one is broad because it says making an error you can make either a type one error or a type what type two error which is type two type two error I know that it's a beta significance and type one error is alpha so the right answer is option two the answers are in the study guide I told you I'll open your study guide we'll always make reference to it so that we don't make any mistake when applying a statistical test if the p value is larger than the significance we the alternative so the decision this is the decision rule you always need to remember that we do not reject it the decision the decision to reject number two yeah so the decision rule says if the p value is less than alpha we reject the null hypothesis if the p value is greater than or equals to alpha we do not reject the null hypothesis we do not reject the null hypothesis but now we not talking about the null hypothesis so this is the rule but we're not talking about the null hypothesis they're talking about the alternative so based on the decision rule based on the decision rule it says if the p value is larger than the level of significance which is the second part if it's if it's bigger than the level of significance it says we reject the null hypothesis so if we do not reject sorry it says we do not reject the null hypothesis if we do not if we are not rejecting the null hypothesis therefore it means we are failing to do what should there alternative accept fail to reject no we fail to reject no no no no no we do not accept if it's not number one we do not accept we do not accept because we're not rejecting the null hypothesis so okay so we're saying the null hypothesis is true yeah if it's greater than therefore it means we're saying the alternative is not true oh now we're talking about the alternative yes we're talking about the alternative so if we're not rejecting the null hypothesis therefore we are we are not accepting the alternative so we do not accept the alternative so always need to go back to the room because that will give you a the base in terms of how you can answer the question because yeah they asking in relation to the alternative so if we were rejecting the null hypothesis if it was less than then we would have um sale uh one of the two either we fail to reject the alternative or we accept the alternative because we will be rejecting the null hypothesis okay now we go to type two era type two era okay is when this is one of the other section that i am i have forgotten about it because we did this in my first year of stats and now we no longer talk about it and the stats that i assist we don't even look at the type eras so it has been very long so a type two era let's first look at the question what the options are a type two era okay is when one the null hypothesis is rejected when it should not be rejected that won't be true number two the null hypothesis is not rejected when it should be rejected that sounds familiar the alternative hypothesis not accepted when it should be accepted number two it should be rejected type two era is not rejecting the null hypothesis when the null hypothesis is not true so that is straightforward it's not rejecting when it should be rejected yeah which one number number two number two number two number two uh good people can we take i need to go drink water can we take five minutes just we have been going on for almost one hour thirty minutes we still have one hour thirty minutes left are you going to drink just what ha i also need to use the bathroom okay see you at one time i'm also going i'm also going to stop the recording so that then this can be uploaded as part one and then we'll go and do part two later on okay so it's 632 now what time are we coming back uh at six let's let's uh let i'm i'm also going to change the kids had eaten wait


Hi there, in this video we will discuss using counting techniques to find all the possible outcomes for probability questions. So one of the biggest obstacles is for instance when someone is having four kids, how do you know that there are 16 outcomes because oftentimes you don't want to have to go in and list all the outcomes to figure out how many are there. So that's where counting comes into play. The first counting rule is the fundamental counting rule and it says that if there are m ways of doing one thing and n ways of doing another, then there are m times n ways of doing both. So for instance you go to a restaurant and there's eight different entrees you can order and three different sides you can order that's eight times three or 24 different meals you're able to get right there for you and you can also think about this if you go someplace and they sell wings they got wings that are bone in or boneless they have different types of sauce different types of spice levels and you can find truly how many different ways you can get your wings done or you can order your wings. So Amy has the following colored shirts and pants. She has shirts that are red blue green white and teal and pants that are black blue and brown. So how many outfits where outfit consists of one shirt and one pair of pants can Amy choose from? What is the probability of Amy randomly selecting the red shirt and black pants? So option one is number of outfits that's part one of this question. How many outfits does Amy have? So she had how many shirts to pick from? Five times. How many pants to pick from? Three. So there's 15 outfits total. I mean you could go through and list them all and write red shirt, black pants, red shirt, blue pants, red shirt, brown pants but that's too much work. So that's 15 outfits. So what is the probability of Amy randomly selecting red shirt and black pants? Well that's one of the outfits. That's one of her possible outfits out of the 15 outfits. So the probability is one out of 15. So instead of listing all the outcomes in the sample space we literally learned that there's 15 of them. A thief stole Jenny's debit card. Her pin number can contain any of the numbers 0, 3, 9 and repetition of digits is allowed. What is the probability the thief will guess her pin on the first try? So a pin contains four digits. So that's four numbers we'll be multiplying together here. So digit 1, how many possibilities were there? Well 0 through 9 is 10 different numeric possibilities. Digit 2, repeats are allowed so there's still 10 digits to pick from. Digit 3, 10 digits to pick from. And digit 4 for her pin number, still 10 digits to pick from. So there's a total of 10,000 pin numbers available for Jenny to pick. What's the probability that the thief will guess the pin on the first try? That the thief will guess the pin number on the first try. Well out of 10,000 pin numbers that the thief could possibly guess from, how many are the correct one? Just a single one of them. This one pin number, that's all we have. So the probability is 1 out of 10,000. That's the probability that the thief will guess the pin number on the first try. Makes you wonder, maybe we need to have five digits in our pin, but then that's more numbers to remember. So next is a little note on notation. The factorial symbol is an explanation mark. It denotes the product of decreasing positive whole numbers. So for instance, if you see 4 with an explanation mark that doesn't mean 4, that means 4 factorial. Yeah, no one's ever that excited about numbers, I don't think. But 4 factorial means you start with the number 4 and you multiply by 1 less each time until you get down to 1. 4 times 3 times 2 times 1. So that's going to give you 24. And then by definition, 0 factorial is 1. Now that we know how factorials work, let's do some more counting principle rules. So our next stop is the factorial rule, where all objects are distinct. Distinct means they're not duplicates of each other. So the total number of different ways to arrange in distinct objects is in factorial. So for instance, if you were an elementary school teacher and you had 15 students in your class, the number of ways you could line them up is 15 factorial. Because you have 15 students, they're obviously all different than each other. They're not duplicates. And all the items are used, all 15 students are used. So the factorial rule, when some items are identical to each other, is you still calculate in factorial, however many items you have factorial. But then you divide by how many times does the first item repeat factorial? So number of times item or thing 1 repeats, and then you divide by how many times the second item repeats factorial, and so forth. So you divide by how many times each item repeats factorial. But you still start off with how many items do you have factorial? So if you have 15, if something is 15 factorial, then you divide by repeats factorial. So in my first example, I assume you have a teacher that likes to give pop quizzes. So a pop quiz is given in a history class. Students are asked to arrange the following presidents in chronological order. That's Jefferson, Grant, Madison, Washington, Jackson, and Lincoln. If a student totally guesses, because they were unprepared, was the probability of guessing correctly. So the probability that a student is correct is there's only one correct answer out of how many possible answers. How many ways to arrange those six presidents? Well, they're six presidents and they're all distinct. So it's simply just six factorials, 6 times 5 times 4 times 3 times 2 times 1. We're going to use a scientific calculator to do this calculation for us. So I'm going to use a Desmond scientific calculator. It's an online free calculator. But if you go to function f, u, n, c, and you type in 6, click the explanation mark. It does the calculation for you, telling you 6 factorial is equal to 720. So 6 factorial is equal to 720. So there's only one out of 720 answers that are correct. So 1 over 720 is the probability of guessing the answer correctly. I suppose if you have a teacher that likes to give pop quizzes, make sure you study. How many distinguishable arrangements of letters can be made from the word attract? So we're going to take all seven letters of attract and we're going to rearrange them and we want to figure out how many distinguishable arrangements are there. Well, I don't want you to sit here all day and just literally take the seven letters and move them around and make all these different arrangements. I'm going to use the factorial rule. So I have seven letters, but I do have repeats. I have two a's and I have what else repeats? Three t's. So number of arrangements, number of distinguishable arrangements will equal. Well, I have seven letters, so we start with seven factorial. But because I have repeats, I divide by two factorial, why two factorial? Because you had two a's. And I also divide by three factorial. Why three factorial? Because I had three t's. So we calculate seven factorial. Once again, feel free to use a calculator. Get 5,040 divided by two times six or 5,040 divided by 12. And you'll actually end up getting 420. There's 420 distinguishable arrangements of the letters from attract. But wait, there's more. There's the permutation rule. Suppose you only wanted to take some of some items and you want to arrange them in a specific order. For instance, maybe you have 10 contestants in a competition and you want to pick first prize, second prize, third prize. How many ways are there to do that? That's where the permutation comes in. So first off, all items have to be different. There have to be in different items available. Can't have anything identical to each other. You select some or are of the in items without replacement. And you consider rearrangements of the same items to be different sequences. So if you have ABC, it's different from CBA. So if you have Allen, Betty, and Charles in first, second, and third place, it's a totally different outcome than Charles, Betty, and Allen first, second, and third place. The order is different. Order does matter. So the actual permutation formula is to say NPRN is the number of items. P stands for permutation. R is how many you pick. And the formula is N factorial divided by N minus R factorial. And we'll use technology to aid us with this calculation. A combination is almost like a permutation except there's one major difference. So with the requirements, there's still in different items available. You still select R or some of the in items without replacement. And rearrangements of the same items tend to be that are the same thing. So the combination of ABC is the same as CBA. So maybe you're picking a three-person committee to make decisions about something in an organization. Well, Allen, Betty, and Charles being picked for the committee is the same as Charles, Betty, and Allen being picked for the committee. The order which they were picked does not matter. What matters is that they're serving on the committee. So if the proceeding requirements are satisfied, so order doesn't matter, then the combination formula is NCRN is number of items you have. C is for combination. R is how many items you're choosing. It's N factorial divided by N minus R factorial times R factorial. So it's a little bit more complicated than the permutation rule. And the reason why is because since order doesn't matter, you have a lot of repeat occurrences or repeat outcomes that you have to divide out, so to speak. Kind of like the factorial rule where you had repeats. So that's why we have a little extra in the denominator of our fraction. All right, so when different orderings of the same items are to be counted separately, we have a permutation problem. So permutation order matters. But when orderings are not to be counted, we have a combination problem. Order does not matter for a combination. Let's practice a little bit. Yeah, first, second, and third prizes are to be awarded to three different people. If there are 10 eligible candidates, how many outcomes are possible? So you're giving distinctive placings out. First, second, third. So as a result, when you're talking about placing, specifically first, second, third, order matters. Allen getting first, Betty getting second, and Charles getting third. It's different than if Betty gets first, Allen gets second, and Charles gets third. It's a totally different final placing there. So order matters, which means we have a permutation. How many people do we have? We have 10. How many people are we choosing? Well, first, second, and third prize. So three. So your job to find how many outcomes are possible is to calculate 10p3. 10 is how many items you have. P is for permutation. Three is how many items you're picking, or how many people. In this case, you're picking. So I'll use the Desmos Scientific Calculator. Once again, you want to be in the FUNC or function area, and you want to click the permutation button in PR, and you'll type 10, 3. How many items you have, comma, how many items you will pick? And you'll notice immediately that you get 720. So that's the answer. 720. There's 720 possible outcomes. So it's permutation because order matters when you're talking about first, second, and third place. Let's talk about the Pennsylvania Match Six Lotto. So winning the jackpot requires you to select six different numbers from one to 50. The winning numbers may be drawn in any order. They may be drawn in any order. Find the probability of winning if one ticket is purchased. So in this situation, because the numbers can be drawn in any order. So if one, two, three, four, five, and six are the winning numbers, it doesn't matter what order they're in. As long as you have one, two, three, four, five, and six as the numbers you selected, you're good. So order does not matter, which means this is a combination. So how many numbers can we pick from, well, 50? One to 50 is 50 numbers total. How many numbers are we choosing? Six. So your one and only job is to calculate 50, choose six, 50, see six. It's a combination that says order doesn't matter. The winning numbers may be drawn in any order. So if 50 choose six, we'll use our calculator. We'll choose the combination and see our button. We'll type in 50, comma, six. And look at that, 15,890,700. That's a lot of possibilities. So we have 15,890,700. They don't want to know just how many possible outcomes there are. They want to know the probability of winning if one ticket is purchased. Well, out of 15,890,700 possible tickets that could be created, that's six different numbers being selected from one to 50, only one of them will be the winning number. So that's the probability. One over 15,890,700. If you want, you can divide those two numbers to see truly how small that probability is. Yeah, it's definitely not likely that you're going to win, but it could always happen, right? So that's all I have for now. Thanks for watching.


Hey everyone, welcome to today's day trading recap for Monday, May 10th. Quick morning of trading done after about the first hour of trading and booked a little over $1,033 to be exact. So I like these. Book a thousand bucks and the first hour would be done. Here's what we did. Had three mighty 90 trades, all winners, small winner in Facebook for 50, Netflix plus 710, Roku's two different trades for 685. No pair of trades today and then just one runner in Piton.  So let me take a look at these and I'll show you what happened starting with Facebook. So in Facebook, we did a little long mighty 90 here. Get this opened up here for you. So we had this had this flushed down here. Got a little higher volume, not much, but got long right in this area here. Bounced up, got out of half for a nice little profit. Excuse me. For technically, we kind of had our second green bar.  So just booked 50 bucks on that trade, basically a scratch. Netflix was a beauty for plus 710. Similar timeframe here. A little bit later had this flushed down, nice spike in volume, got long right in this area, pushed down a little bit more, and then bounced up and closed out of our entire trade right there for a nice profit of 710. In Roku, this was actually two different trades. One was short, one was long, and so on the long side had this pushed down. So we got long right here, caught that bounce and got out of three-quarters of it up here. When it started to roll over, got out of my last piece, so booked a profit on that one, and then when it pushed up here, got short and caught this little move down. So net net plus 685 in Roku. And then lastly our runner in Piton. So had this kind of back-and-forth action started off, we can then pushed all the way up with some volume here. And so when it broke back down and broke below that bar, I was looking for a potential continuation lower, kind of what we call our volume reversal. Didn't happen, popped back up and just kind of chop-chop-chopped, and so finally I just cut out and took a loss on that one to 410. So plus 1,033 on the morning. I'm gonna be keeping an eye on things. I may add another trade in here later, and if so I will update in Discord. Otherwise, I may just call it a day on the day trading and take my money and run. So hope everybody else had a good Monday. Good start to the week. Look forward to seeing you in the live stream room tomorrow. Take care.


Thanks, Daniel. Well, as Daniel said, my name is Mitch Connors. I've been a software engineer at Google on the Istio project for three and a half years. Hello, everyone. I'm Mustafa Prodan. I'm a principal engineer at WeWorks, and I'm a flux and flagger maintainers for many years. All right. Well, let's get to it. Everyone here should probably already know that Istio makes your service mesh more secure. It's the leading reason for adoption among our users. They want the security. They want zero trust built on MTLS. They want the ability to set off N and off Z policies to have their certificates automatically rotated. And it makes all of that really easy and seamless. But there's a little bit of a catch. 88% of Istio installations are running known CVEs. So if you're using Istio to make your service mesh more secure, and then Istio that you're running has its own CVEs, some of them 9.9.8 on the CVE scale, that's problematic. In fact, your service mesh could be less secure because Istio is there rather than more secure. So why is this? Why are 88%? It's not that Istio is not patching their vulnerabilities. We have patch releases that come out at least once a month. Each of them covers a bunch of known CVEs. But it's still not being picked up in the community very quickly. So today, we're going to talk just for a brief time about why our users aren't upgrading. I'm going to rely on Stefan a lot to tell us how GitOps can help us with this problem. We'll have actually a handful of demos sprinkled throughout and some takeaways. So this is sort of a timeline, a history of what we thought was the problem with upgrades in the Istio project. And as you can see, it's changed a lot over time. We first noticed that no one was upgrading Istio in Q2 of 2020. And we thought, well, maybe they don't know. Maybe users don't realize that there are CVEs in their Istio installation. So we ran a survey and we did find a few users who were unaware and we built some tooling and some documentation to help boost that awareness. We found a lot more users who were aware that their service mesh was vulnerable, but they didn't feel like they had time to get to it. Istio is not the only thing that anyone is running in production. They've got their own apps. They've got telemetry systems. They've got maybe some EBPF systems that need to stay up to date. And staying on top of all of it is just so difficult. It's like a treadmill that you can never keep up with. So we decided, let's make Istio upgrades easier. This was a part of the 2021 roadmap. You see it now on the 2022 roadmap for the project. Istio upgrades should be easy. And we launched surveys that went along with every release asking users how easy was this. And we saw consistently, from one release to the next, Istio is getting easier to upgrade, easier to upgrade. Nothing huge, but consistent improvement from one release to the next. So a year later, we ran our production survey again and asked, OK, how much of Istio is up to date in production? And 88% of Istio installations still have known CVEs. So, OK, easiness and difficulty was not the problem. What else? Well, right now, as of last fall, you had to upgrade Istio four times a year. And that's a lot. So maybe we should move to something else. You know, Kubernetes has now the three times a year release process. We looked at that a little bit. The sweet spot we landed on was once every six months. And we kept our release process the same. So we still release four times a year. But you can now upgrade directly from, say, 1.10 to 1.12 or 1.11 to 1.13 without doing an intermediate upgrade along the way. And then we extended our support window so that 1.10 and 1.12 would overlap by six weeks, giving you that time to upgrade. So now, we just cut your work in half. It's really easy to upgrade Istio. And so we waited six months. And then we surveyed production. And we found out that 88% of all Istio installations still have known CVEs. So it's not that it's too difficult. It's not that our customers don't know they should. It's not that it's too frequent. We need a new hypothesis. So this one's really controversial. Our 2022 hypothesis for why Istio upgrades aren't happening is that humans are bad at repetitive monotonous labor. I know, I know, that super controversial in a group of programmers. We all love our monotonous repetitive tasks. But that's what we're going after this year. That's how we hope to move the needle down from 88%. Stefan's going to share with us how we're going to remove that monotonous repetitive labor from Istio installations with some products from Weaverx. There are not products of Weaverx. They are CNCF projects. OK, so I'm guessing everybody here knows what GitOps is. You've already seen this slide. And this event, 10 times per day probably, the idea behind GitOps is you let your cluster figure out its state from an external source. And with Flux, that can be, I don't know, Git repo story or an S3 bucket. Or we have many ways of how you can define your cluster state outside of the cluster. So instead of you having to run commands to upgrade your infrastructure or your applications, what you can do is define how those can be automatically upgraded in your Git repo, for example, with Kubernetes custom resources. And something, the cluster itself, something running on the cluster, sees that, OK, I need to upgrade myself from this source. And I'm going to do it automatically. Going to talk about the Flux projects. So in the Flux project, we have two main projects. One is Flux itself, which is a collection of Kubernetes controllers. We have 12 custom resource definitions. And what Flux aims to provide you is like a LEGO system where you can build your own continuous delivery solution that fits your use case. Flux is not operated in any way. We don't offer you a UI.  And besides Flux, we have a second project called Flagger. And the Flagger role is to decouple the deployment from the release process. So if Flux does the deployment automatically based on what's in Git, that doesn't mean that those things that are in Git should be automatically exposed to all your users. And Flagger role is to detect, oh, you want to deploy a new version of your application. Let me test the new version on some of your users. So with Flagger, you can say, OK, when there is a new version, move 1% of the traffic to the new version. See if that works. Measure SLOs, like error rates, latency, other custom metrics. And if that works, add more traffic, more traffic. And if everything goes OK, only then Flagger fully rolls out the new version to all your users. And that's called progressive delivery. So this is how Flux looks like and how the continuous delivery circle is. Flux's controllers are even based. So every time you push something to your repo, Flux will be notified. And it will reconcile the new state. But you can also ping it from CI. It also monitors your container images. It can upgrade your container applications inside the cluster. You can say, for example, I want for Envoy, every time there is a patch release, I don't want to go into Git and modify that patch release. And you can tell Flux, scan the Envoy container registry. If there is a new patch release version, commit that to Git and upgrade Envoy all over the cluster for me. And Flux can be run on a management cluster where you can target all your environments, like your production cluster or staging. Or you can deploy a Flux installation per cluster and make that cluster independent. It also works with cluster API very well. OK. Flagger, I mentioned about it. Besides integrating with Istio for routing traffic between versions, it works with a bunch of other service meshes and also ingress controllers. So if you are not into the service mesh hype, you just use an ingress controller. You can still do AB testing and progressive delivery for your front end applications. And of course, how Flagger detects that everything is working primarily with Prometheus, which comes with the Istio installation with Linkardy and everybody else. But it can also reach two things, like CloudWatch, what's it called, the Google product where you have metrics. Oh, Stackdriver. No, it's not Stackdriver anymore. They rebranded. Yeah. The new Stackdriver. Also Neuralic and other solutions. So OK, Flux can take care of shipping patches and automates the upgrade procedure of your apps and infrastructure who upgrades Flux. So we release Flux every two weeks. So it's a lot of work to keep our Flux up to date. We have a solution for this. Flux is able to upgrade itself. And how we can do that, we use the GitHub action or something in our CI that monitors the Flux GitHub releases when that action detects, oh, there is a new patch release for Flux. It will open a pull request for you where it can bump the Flux version directly in a branch. Then Flux is, oh, my definition from Git, my own definitions have changed. So now it's time to upgrade myself. It pulls the new version, starts a rolling deployment, and that's how you can keep Flux fully automated up to date. And unlike Istio, you can jump from any Flux version to any other Flux version. So we had Flux version to users. We installed it six months ago. They ran the upgrade last week, and it worked, even if we released, I don't know, 60 versions between then and now. So yeah, Flux is all about backwards compatibility and being able to upgrade itself, because we think that continuous upgrades is the way to do it with, you know, in Kubernetes. It's great for that. Okay, so I'm going to start a demo. This will be a three-part demo. What I'm going to show you now is how we can install Flux on the cluster and tell Flux to install Istio, install applications, install the Istio gateway, setup ingress, and all of that with a single command. Okay, so I have here the Flux bootstrap command, and this is a, we can bootstrap Flux on clusters using this generic command, which works with any kind of Git server. You pass it your SSH key, and that has read access to a repo, and what this command will do, the Flux CLI will clone the repo history, will write its own definitions in the repo, will commit its definitions to the upstream, and then will install itself on the cluster. And we also have flavors of bootstrap for GitHub, GitHub, Bitbucket, where you can save Flux bootstrap GitHub, and it creates the repo history for you, it sets up the deploy keys for you, and so on. But today, we are using this command that works with any kind of Git server. Okay, so I'm pressing enter, hopefully it will work. What's happening now? I'm cloning the repo history locally, it pushes all its definitions to Git through using SSH, go on, go on. We are really in a hurry, Flux. And yeah, after it talks to the Git repo, after it places there its configuration, next what it does is it configures itself for a particular path in the Git repo. So you can use a single Git repo history to manage your whole infrastructure flits. You can have a production cluster and a staging cluster in the same repo history, then you can migrate workloads from staging to production using that repo, or you can use dedicated repo stories for each cluster or each environment you have. Okay, after it has installed everything, now Flux is verifying itself. If all the controllers are running, then we have four controllers which are part of the base Flux installation. One is the source controller, which deals with all the Git operations, and another one is customize controller, which can apply Kubernetes plain resources or customize overlays. And finally, the Helm controller, which are using now for Istio, we are installing Istio, now Flux is installing Istio on the cluster using all the Istio Helm charts. And if we look at the, we can do a Flux minus send Istio system, get Helm releases, and we should see here what the Flux did. So first, we have a thing in Flux where we can define dependencies between our infrastructure items. In the case of Istio, this is critical, because Istio has several charts, one contains the CRDs, another one contains pilot, another one contains the gateway. I cannot install the gateway until I have the CRDs, I cannot install pilot and so on. So in the repo, we can define this declarative and say install all things in a particular order and also do the upgrade in that order. So when there is a new Istio release, we first upgrade the CRDs, then pilot, then gateway, and so on. And you see here, for example, dependencies, Istio D is not ready. So what Flux does, it checks, it looks at the health check of each deployment and blocks until all Istio components are ready and it employs them in the particular order. So now we should see that everything is done. Yes, so we have Istio installed on the cluster, all our applications are there, the gateway is set up. Okay, one of three demos. One of three demos. One of three demos. Let's go. Fast, fast, fast. All right, so that was a great introduction to how GitOps helps you manage the resources that are in a cluster and we saw a little bit of what's going on with Istio, but let's dig a little bit deeper into what's necessary to automate GitOps, to automate upgrades for Istio. And by the way, these principles should apply pretty fairly to just about any service mesh project. I work on Istio, so that's where I built this, but you should be able to take the principles and carry them over. But first, why did we choose to work with Flagger and Flux? The only progressive delivery API that I could find that worked directly on deployments so that I didn't need to change anything about how the customer was defining their workloads was Flagger. I've found other tools that will allow you to do progressive delivery with a pipeline where you define your own steps, but I didn't really wanna do that on behalf of the user. Also, Stefan already did most of the work. The GitOps repo that we're demoing today, you saw the link actually back here, Stefan brought on GitOps Istio, has been around for some time. I just recently joined Stefan in making some tweaks to it, which we'll be showing off this afternoon. So how is this gonna work for Istio? Well, Flux is gonna manage, what we're gonna see first is that Flux is managing the Istio control plane. So when you merge an update, which by the way can happen when someone makes a change to your Istio installation, or when GitHub actions notice that there is a new version of Istio available, we'll get a pull request, saying, hey, new version of Istio, go ahead and install it. And there's checks and tests that will run on that pull request just like you all should have for your CI systems. Once it gets approved, Flux will see it in the main branch and will reconcile it along with Flagger, Prometheus, et cetera. We already saw that work, but in a minute we're gonna see an upgrade. Also, I should take a step back as we've been talking about pilot or the control plane, and terminology can get really overwhelming really quickly in service mesh. I am almost certainly gonna slip up and say data plane, sidecar, and proxy interchangeably or the envoy. Those are all the same thing. It sounds like really overwhelming vocabulary, but we're really talking about one thing. It's a proxy that runs everywhere. Everywhere you have an application, you need a proxy right next to it. So it's in the pod, running alongside your application and managing things. We just like to give it four names because Istio. So Istio is divided between a control plane and a data plane. We just saw the control plane get installed, and now what we're going to demo is having a control plane upgrade. Oh, before the demo, I wanted to talk about this. Along the way we found, Stefan and I found that it is really difficult to integrate Istio control with GitHub Action. So we launched our own get Istio control action.  Strongly recommend using this for things like analyze, which we're not showing off today, but is in the repo. You can see that at the URI. We mentioned before, we have an analyze step that checks and makes sure your config is good. But let's get to the good part again. Okay. Oh, actually, no, I was already where I wanted to be. That's the problem. So this is where we're running our demo from. Again, I've forked this repo from Stefan's, and that's actually your first step in your process. If you'd like to do the same thing, fork Stefan's repo. Don't fork mine for various reasons. But you can see that we've got our Istio installation. We've got our apps installed here. We've got cluster definitions. And interestingly, if we look at pull requests, we have a pull request that was just created two hours ago. It says it was by me. It's actually using my credentials, but it was created by a GitHub action that downloaded Istio control, saw that there was a new version, and has updated our control plane specs. So let's take a look at this pull request. The only thing that's changing here is the version of the control plane. And you can see that from the diff here. We can also see that there are two automated checks that have run for this, and one that seems to still be running after... Oh, it's only been six minutes. Oh, because of the changes pushed by the bootstrap. Okay, I'm not gonna wait for the E2E test to pass because I know we've got a lot to go, but normally, obviously, you'd want all of your checks passing. We can see that all of the analyzers passed. So our config looks good. I think we can feel good about merging this pull request. So I'm gonna go ahead and do that. So what we've been doing, we've been running Kubernetes kind inside the GitHub Action Runner. And in there, we are streaming down Istio, bringing down the requests, the limits, everything down, so we can run everything in there and make sure that the new version of the control plane works. And we do that with flux. So flux is deployed inside kind, pulls the branch from the pull request and runs an end-to-end test suite for all the Istio components. Before everything goes out to our staging cluster, we'll do some real testing and only then to production cluster. So we're gonna revisit the cluster in a minute to show you that it actually worked, but it does take a few minutes. So I'm gonna move on and at the beginning of the next demo, we'll circle back to that. What went well here? Our control plane has now kept up to date as long as we're willing to approve pull requests on about a monthly basis. That's not too bad. We got everything tested before we ever pushed to production. So a pretty high degree of certainty that this configuration ought to work really well. And we got analyzers to run so that if we're changing our Istio config, we know before we break production that we had a typo in our virtual service. Which by the way, if you saw in the pull request, there was one called bad sidecar. I very specifically tried to merge some bad config and it's blocked by analyzer. Couple of disadvantages though, what version of the proxy is gonna be running or the data plane is gonna be running in my cluster? Well, the answer is it both ends. Yes, yes, both, maybe. Or one, or the other, we don't know. That version of your proxy in Istio by default is determined when the pod starts up. And that's a little bit problematic because it means all the way through your test infrastructure, your units, your integration test, your staging environment, you don't actually know what proxy you're gonna be running with. And it's a fairly important component. It's something you wanna test about again. So that's not great. Also, this doesn't yet use revision-based upgrades. That is a best practice across the Istio project that I just didn't have time to bake into this repo. Look for that coming in the next couple of months. So let's talk a little bit more about this problem with proxies, right? In the software development life cycle, the proxy is defined at the very end. It doesn't even necessarily result, isn't necessarily the result of a Kubernetes deployment. You could have a deployment that's running an old proxy. You upgrade the control plane.  The new pods will get the new proxy. The old pods will still have the old proxy. It's very unpredictable. And as you can see, that reduces determinacy in the whole process. It's very uncontrolled. And the way to fix that is you run global restarts on your cluster, which, like I don't really wanna recommend that you do in production. So let's talk about how we can make this better. What we wanna do is shift the declaration of that proxy or the specification of the proxy left in the software development life cycle to the point of GitOps. GitOps needs to happen at the test environment so that from test to release to deploy to operate, you have a consistent piece of software that you're operating across all those environments. Your test results are meaningful. And then, of course, your rollbacks are just a Git revert. If something goes wrong, you know how to get back. It's not quite so simple if you're using sidecar injection in Istio. How do you define a sidecar in Git? Well, it turns out there's been a command to help you do this for some time in the Istio community called kube-inject. It will take a YAML that could be a deployment or a job or a replica set or a stateful set and it will output a modified version of that deployment that includes a sidecar. Pretty simple. And so we've built that in and baked it into a GitHub action. So what we've already seen is a new version of Istio was available so we upgraded our control plane YAML in Git. They created a pull request. We had kind tests and our analyzed tests. We approved the pull request and it got committed and deployed to Kubernetes. But that commit now, hopefully, we're gonna see in just a second, has triggered a second GitHub action which saw, oh, your control plane version now does not match your data plane version. Let's go ahead and fix that. And so we are going to see a new pull request that updates our workload YAMLs. Actually, it doesn't even update that. It updates a file next to the workload YAML which is gonna go through exactly the same test and release process. Let's take a look. Moment of truth here. Pull requests. All right, update Istio Sidecar to 113.4. Again, our end-to-end test hasn't passed. It's extremely thorough. It actually does a rollout that goes through the entire Canary process and you don't want Canaries to run terribly quickly. But for that reason, I'm not gonna stand around and wait for the end-to-end test to pass today. I wanna upgrade my data plane. Let's go ahead and confirm that. Now I'm gonna double back and show you that our control plane actually did upgrade. What was the command there? IstioD. I didn't show you the before, which was a mistake. The before, oh, actually we did. Here, we were at 113.3 on IstioBase before and now we're still at 113.4. Do a flux get. Run the, am I in the wrong cluster? No, run the command again. Let's see what flux does. Okay, so it only upgraded the CRDs and yeah, we can do a minus, minus, wait. Oops, can type it, wait. No, watch, watch, sorry. I wrote the command and I don't know the name. Okay, so now what flux does slowly moves through all the releases. So it takes, okay, I've upgraded the CRDs and it waits for all the CRDs to be reconciled by the cluster APA. Now it does, okay, has upgraded the gateway, which is the custom resource of the gateway that worked and now it's doing what is doing. Constellation in progress, still the gateway. So you see the revision, how it moves from three through four. And for all these upgrades that flux is doing, once it has upgraded something or it started to upgrade something to let you know through Slack channels, Microsoft Teams and so on. So you can actually see those if you have other things sorted out. Okay, so I'll be. 113.4, yay. And the good news about a nail biter like that is it's given me enough time that I think I should be able to check our data plane and see the same thing updated. We should be at 113, 113.4. So we've gone ahead and done a live upgrade of Istio. We'd separated between the control plane and the data plane. Also one added benefit of having the proxy defined actually in the deployment spec is that Flagger will do progressive delivery across your deployment. So if I check Flagger's canaries, I think it hasn't been too long, they should still be in progress. So on our backend service, we currently have 5% of our traffic going to the new version of the proxy and 95% of our traffic going to the old version. And it's going to periodically check with Prometheus and ask is the service still healthy, shift a little bit more, is the service still healthy, shift a little bit more. And it's going to be really boring, which is one of our favorite things to be in Istio. So let's take a look at our advantages and disadvantages now. Our proxy is now maintained up to date within a semver range. We can automatically apply updates if we want to, like patch updates can roll out without a pull request or they could be stuck with a pull request. It just depends on how your operational like security and safety, how much, how paranoid you want to be. I want to be pretty paranoid personally. Canaries are controlling the rollback and we have automated rollback. If something is wrong with that proxy, the 113.4 proxy will stop executing in the cluster. The canary will fail back to 113.3 and our cluster will stay up even if our Istio upgrade was not great. We still haven't fixed that revision based problem. But when once we do, this is what the new workflow should look like. When a new version of the control plane becomes available, we don't replace the control plane YAML. Instead we create a new revision. This is what you all should be doing if you're upgrading Istio, it's much more secure. It means that they'll run side by side. Two control planes, two different versions. We'll go through the same pull request process and then we will move tags. Tags are like sim links for your revisions. So you might have like a first wave, second wave, third wave. The first wave is gonna get updates first, second wave, second. What we're gonna do is we're gonna find the first wave tag and say first wave tag used to be 113.3. Now first wave tag is 113.4 and all of those proxies as soon as that PR finishes, we'll get moved over and we'll get canary just as in the past. So we think that this will be a good way to keep Istio up to date in production. We obviously, it's still very much a work in progress and there will be continued updates to it over the coming months. But you're welcome to fork the repo and kick the tires on it. If there's any takeaways, if there is one thing that you leave this room with today, I would like for it to be, and I said Istio here, I think we can just replace that with service mesh. Automate your service mesh upgrades. Please, please, please. Or consider paying a vendor to do it. If this is overwhelming to you, Google and many other vendors in this space will take care of your upgrades on your behalf and that is a totally fine way of doing things. If you're not willing to do either of those things, you need to budget engineering time to upgrade Istio. Don't take an open source project, make it core to the application that you're running and then forget about it and not have any operations budget for it. Maybe the 88% of Istio users. Yes, yes. If you're upgrading it, you are now in the top 12%. So congratulations. We want to widen that quite a bit. With that being said, here's some links where you can find more information and I think we actually still have a few minutes for questions, didn't expect that. Really nice talk. We've been upgrading Istio religiously with the Istio operator. How would Istio operator work together with Flux and Fliger? Thank you. You're saying do they work together with Flux and Fliger? I mean, if I've been maintaining it with Istio operator, how would I use Flux and Fliger? I can answer that. So the first version of my repository was using Istio operator and that works great because Fliger and Flux can do with any kind of custom resource, right? It was the same experience, but yeah, so Istio team said, Istio have a chance because the operator all it does inside are doing is the same thing, is running a Helm upgrade and so on and Flux has a dedicated Helm controller which does all things Helm way better than wrapping it out and hiding it. So you have the Helm experience, you can debug it with Helm and so on. So it adds more observability to the whole process. Like you do Flux and get Helm releases then you can actually see, oh, it's stuck at the CRDs or there is a problem with the gateway. The operator will just hide all of that under a single upgrade operation. So that being said, if you're happy with the operator, stick with it and you can look in the repo about three weeks ago, that was what we were doing in the repo. If you're not currently upgrading and you're looking for a way to do that, probably don't look at the operator. We would recommend that new users go to Helm charts. We're still gonna keep maintaining and fixing bugs in the operator, but the future direction is definitely Helm. Any other questions? All right, so we are at the top of our... Okay, one last question. Hello, nice talk, thank you. I just have one question. Would you say that this GitOps approach is better than doing it on infrastructure as code because sometimes for cluster-wide or infrastructure-wide components we usually put these installations in Terra-Firm. But what would you say is an advantage of having it here in GitOps? Why would you use Terra-Firm if you are deploying on Kubernetes? I'm asking you.  I guess I'll probably have a little bit of a different opinion than Stefan does on this particular topic. For my part, I want to make sure that you're comfortable doing it in the way that you do other upgrades. Istio should not be something that is unique and special in your environment. It should upgrade the same way that every other piece of infrastructure that you have. So if Terra-Firm is your tool of choice for all of your infrastructure, there are Istio... Is it charts or I'm not a Terra-Firm person? There's Terra-Firm stuff for Istio that you can use and you should look at investing there. But if you're already using GitOps or if you're not using anything, then I would encourage you to look at GitOps. So the main difference from my perspective is the fact that Terra-Firm you run it once, but Flux will keep monitoring what's happening. So the difference between GitOps and just doing once and planning is the fact that GitOps does a reconciliation all the time. So if something breaks or something goes on the cluster, someone goes on the cluster, does a kubectl edit of some pilot deployment, and that goes wrong. Flux will just undo it automatically because Flux does not allow divergency, a drift inside the cluster. I'm guessing you don't run Terra-Firm apply every couple of seconds. Well, Flux can do that because it's right there in the cluster and can monitor all the changes that were done outside of Git and it will correct that change and it will let you know. Hey, someone modified Istio, I'm putting it back in the same thing, in the same way it was described there in the Git repo. You're welcome. That was it, right? All right, so we are top of our road and thanks for joining today and a great presentation and demo mission step on. Yeah, I hope you guys stay for fly back and enjoy the rest of the KubeCon.