 Welcome back. We were looking at the t distribution. Now we will be looking at the chi square distribution. Why should we learn this interesting probability distribution function? We were so far talking about the population mean parameter mu. Equally important was the population parameter sigma namely the standard deviation. Since sigma is also not known we have to estimate it and we use the sample variance to provide the estimate for the population variance sigma squared. So just as the population parameter mu we can talk about the estimation of the parameter sigma squared. We can also construct a 95% confidence interval for sigma squared based on the sample variance s squared or using the information contained in the random sample we can construct the 95% confidence interval. How we can do it? Will the distribution of the sample variances be normal? Will it follow the t distribution? These are the 2 distributions we have seen so far. The answer is a simple no. The distribution of the sample variances does not follow the t distribution, does not usually follow the normal distribution. It follows the chi squared distribution. So we will be looking at the properties of the chi square distribution. Some of the properties are very interesting. We will see them shortly. So the chi square distribution finds application in hypothesis testing and confidence interval construction for the standard deviation. We may require to report confidence intervals on the population variance sigma squared. The fundamental assumption we make is the population is normally distributed. This is not a very serious assumption as many populations do in fact tend towards the normal distribution and hence small deviations from this normality is not serious. So we are doing all this analysis based on a single sample of size n drawn from the population. So we have x1, x2 so on to xn be the members of a random sample taken from a normal distribution of mean mu and variance sigma squared. We can calculate the sample variance s squared once the sample is drawn. So until the sample is actually drawn, the sample is an abstract entity. We have a statistic s squared defined based on x1, x2 so on to xn. These things we have covered in the previous classes. Now we have to define a particular random variable called as the chi squared random variable. We have seen several random variables before. Then we also saw a standard normal variable for the random sample mean x bar. It was defined as x bar-mu by sigma by root n. When the population standard deviation was not known and the sample size was small, then we resorted to the t random variable, t was defined as x bar-mu by s by root n. Now we are talking about another population parameter namely sigma or sigma squared. We know that the sample variance s squared is an unbiased estimator of the population variance sigma squared. Now we are using the random sample variance to describe the population variance sigma squared. So far we have been talking about the population parameter mu which was represented by the sample mean x bar. The sample mean x bar was also an unbiased estimator of the population mean mu. S squared the sample variance is also an unbiased estimator of the population variance sigma squared. Now when you take many samples, all these samples may have different sample variances. The first sample may have a sample variance of 100. The second one may have a value of 120. The third one may have 90 and so on. So which of these is a true representation of the actual unknown population variance sigma squared? Since all of them may be thought of as true representations because the sample variance is an unbiased estimator of the population variance sigma squared. However, we can ask which of these is lying closer to the actual population variance for which we have to follow the confidence interval concepts. But before we go into all of them, we now understand that there may be several sample variances and these will follow a certain probability distribution. The sample variance s squared is itself a random variable. So it will follow a probability distribution. Now what probability distribution does the sample variance follow? It follows the chi square distribution. For that we have to define the chi square variable as n-1 s squared by sigma squared, okay. So s squared is the sample variance and sigma squared is the population variance. Sigma squared we do not know. S squared we know once we have drawn the sample and n-1 is the sample size minus 1. It represents the degrees of freedom and it was used in the computation of s squared. Recall that the sample variance s squared is equal to sigma xi-x bar whole squared by n-1. So we may think of n-1 s squared as the sum of the square of the deviations from the mean. Deviations of what? Deviations of the sample element attributes from the mean attribute value and that deviation is squared. So we have the chi square variable as n-1 s squared by sigma squared and this also depends upon the degrees of freedom. Let us see the probability distribution function for the chi square random variable. We will not be using this probability distribution function extensively in our analysis. We will be using the probability table for the chi square distribution rather than actually computing the probabilities using this function. We know by now that minus infinity to infinity f of x dx is equal to 1 generally but in the present case the x value are always positive. So this function is defined for x greater than 0 and so we have 0 to infinity f of x dx should be equal to 1. That may be shown. It is not required right now. It is beyond the scope of our current discussions. Here we have 1 by 2 power k by 2 gamma k by 2 x power k by 2-1 e power-x by 2. Here k is a parameter in the chi square distribution. It matches with the degrees of freedom. We were talking about with respect to the sample variance calculation. So this is gamma function. We are seeing this gamma function pretty frequently. We saw the gamma function also in the description for the t distribution. So I thought maybe I will just give a brief introduction to the gamma function as well. Before we do that we will see what the mean and variance of the chi square distribution are. The mean of the chi square distribution is k where k is the parameter referred to as the degrees of freedom. The variance of the chi square distribution is 2k. The gamma function is given by 0 to infinity x power p-1 e power-x dx where p is greater than 0. So this is the integral with p as the parameter. So it can be shown that gamma p is equal to p-1 gamma p-1 a kind of a recursive relationship. And if this is carried out fully for a positive integer p we get gamma p is equal to p-1 factorial. Gamma 1 is 0 factorial which is 1 and gamma half is root pi. These are some important properties of the gamma function. Coming back to the chi square distribution, the distribution is skewed to the left. In other words it is not symmetric. The skewness is pronounced for small values of k and the distribution is defined only for positive values of x. And we can see that as the degrees of freedom increase the distribution tends to more symmetric shape. As k tends to infinity as the degrees of freedom becomes quite large the distribution tends towards the normal distribution. Again taken to the extreme this skewed distribution tends to normal distribution. These are some typical representations of the chi square distribution generated with spreadsheet and this is the x value and f of x value is on the y axis. It can be seen that the distribution is quite skewed for small k here it is 5. If k becomes very small k is equal to 2 then it becomes more of an exponential kind of distribution. And when you go for k is equal to 10 it sort of becomes less skewed and for k is equal to 15 the spread is more but it is symmetric. And as k tends to infinity it goes towards the normal distribution. By now we should be familiar with these terminologies. Suppose we have a chi square distribution with k degrees of freedom. We may define the probability according to probability of chi square greater than a specified chi square alpha k. k is the degrees of freedom and alpha is chosen such that it is equal to the probability value. We have seen this alpha before in our discussion on confidence intervals and the t distribution. Alpha may take values typically like 0.01, 0.025, 0.05, 0.1 etc. So we are again talking about the upper tail probability. What is the probability of the chi square distribution for values beyond the chi square alpha k point. Suppose you have a chi square distribution curve the chi square alpha k are all values along the x axis. What is the probability that the chi square random variable will take a value greater than chi square alpha k and that value will be nothing but alpha. So this alpha and this alpha match. The chi square I repeat represents a point on the x axis of the chi square distribution curve. So the area of the probability density function below the curve beyond chi square alpha k is alpha. So formally we may talk in statistical language that chi square alpha k is an upper 100 alpha percentage point of the chi square distribution with k degrees of freedom. So you have alpha k, k refers to the degrees of freedom and alpha refers to the upper tail probability. So chi square alpha k is an upper 100 times alpha percent.