text stringlengths 270 6.81k |
|---|
no information about the parameter. In such a situation, it 534 Section 10.2: Categorical Response and Predictors makes sense to choose all the parameters of the Dirichlet to be 1, so that the priors are all uniform. There are many characteristics of a Dirichlet distribution that can be evaluated in closed form, e.g., the expectation of any polynomial (see Problem 10.2.20). But still there will be many quantities for which exact computations will not be available. It turns out that we can always easily generate samples from Dirichlet distributions, pro vided we have access to a generator for beta distributions. This is available with most statistical packages. We now discuss how to do this. 1 EXAMPLE 10.2.3 Generating from a Dirichlet The technique we discuss here is a commonly used method for generating from multi variate distributions. If we want to generate a value of the random vector X1 then we can proceed as follows. First, generate a value x1 from the marginal distrib ution of X1 Next, generate a value x2 from the conditional distribution of X2 given x1 Then generate a value x3 from the conditional distribution of X3 given that X1 x1 and X2 X1 k Distribution x2 etc. Xk If the distribution of X is discrete, then we have that the probability of a particular xk arising via this scheme is vector of values x1 x2 P X1 x1 P X2 x2 X1 x1 P Xk xk X1 x1 Xk 1 xk 1 Expanding each of these conditional probabilities, we obtain x1 P X1 Xk 1 xk 1 Xk Xk 1 xk 1 is and so x1 x2 which equals P X1 a value from the joint distribution of X1 Xk This approach also works for ab solutely continuous distributions, and the proof is the same but uses density functions instead. P X1 x1 X2 x2 P X1 x1 Xk 1 xk 1 Xk P X1 x1 P X1 x1 x1 xk xk xk In the case of X1 lenge 10.2.23) X1 Beta has the same distribution as 1 Xk 1 2 1 x1 Dirichlet 1 k and Xi given X1 xi 1 Ui where k we have that (see Chal xi 1 Xi 1 x |
1 Ui Beta i i 1 k 1 X1 Xk 1 for any 2 1 X1 U2 generate U3 Beta 1 k, generate U2 3 4 and U2 Dirichlet distribution So we generate X1 Beta Uk 1 are independent Note that Xk Beta k and put X2 3 2 k and put X3 X1 Below, we present a table of a sample of n X2 U3 etc. 1 5 values from a Dirichlet 2 3 1 1 5 distribution. X1 0 116159 0 166639 0 411488 0 483124 0 117876 X2 0 585788 0 566369 0 183686 0 316647 0 147869 X3 0 229019 0 056627 0 326451 0 115544 0 418013 X4 0 069034 0 210366 0 078375 0 084684 0 316242 1 2 3 4 5 Appendix B contains the code used for this. It can be modified to generate from any Dirichlet distribution. Chapter 10: Relationships Among Variables 535 Summary of Section 10.2 In this section, we have considered the situation in which we have a categorical response variable and a categorical predictor variable. We distinguished two situations. The first arises when the value of the predictor variable is not assigned, and the second arises when it is. In both cases, the test of the null hypothesis that no relationship exists involved the chisquared test. EXERCISES 10.2.1 The following table gives the counts of accidents for two successive years in a particular city. Year 1 Year 2 June 60 80 July August 100 100 80 60 Is there any evidence of a difference in the distribution of accidents for these months between the two years? 10.2.2 The following data are from a study by Linus Pauling (1971) (“The significance of the evidence about ascorbic acid and the common cold,” Proceedings of the National Academy of Sciences, Vol. 68, p. 2678), concerned with examining the relationship between taking vitamin C and the incidence of colds. Of 279 participants in the study, 140 received a placebo (sugar pill) and 139 received vitamin C. Placebo Vitamin C No Cold Cold 109 122 31 17 Assess the null hypothesis that there is no relationship between taking vitamin C and the incidence of the common cold. 10.2.3 A simulation experiment is carried |
out to see whether there is any relationship between the first and second digits of a random variable generated from a Uniform[0 1] distribution. A total of 1000 uniforms were generated; if the first and second digits were in 0 1 2 3 4 they were recorded as a 0, and as a 1 otherwise. The crossclassified data are given in the following table. First digit 0 First digit 1 Second digit 0 240 255 Second digit 1 250 255 Assess the null hypothesis that there is no relationship between the digits. 10.2.4 Grades in a firstyear calculus course were obtained for randomly selected stu dents at two universities and classified as pass or fail. The following data were ob tained. University 1 University 2 Fail 33 22 Pass 143 263 536 Section 10.2: Categorical Response and Predictors Is there any evidence of a relationship between calculus grades and university? 10.2.5 The following data are recorded in Statistical Methods for Research Workers, by R. A. Fisher (Hafner Press, New York, 1922), and show the classifications of 3883 Scottish children by gender (X and hair color (Y ). X m f X Y Y fair 592 544 red 119 97 Y medium Y 849 677 Y dark 504 451 jet black 36 14 (a) Is there any evidence for a relationship between hair color and gender? (b) Plot the appropriate bar chart(s). (c) Record the residuals and relate these to the results in parts (a) and (b). What do you conclude about the size of any deviation from independence? 10.2.6 Suppose we have a controllable predictor X that takes four different values, and we measure a binaryvalued response Y A random sample of 100 was taken from the population and the value of X was randomly assigned to each individual in such a way that there are 25 sample members taking each of the possible values of X Suppose that the following data were obtained. Y Y 0 1 X 1 12 13 X 2 10 15 X 3 16 9 X 4 14 11 (a) Assess whether or not there is any evidence against a cause–effect relationship existing between X and Y (b) Explain why it is possible in this example to assert that any evidence found that a relationship exists is evidence that a cause–effect relationship exists. 10. |
2.7 Write out in full how you would generate a value from a Dirichlet 1 1 1 1 distribution. and we 10.2.8 Suppose we have two categorical variables defined on a population conduct a census. How would you decide whether or not a relationship exists between X and Y? If you decided that a relationship existed, how would you distinguish between a strong and a weak relationship? 10.2.9 Suppose you simultaneously roll two dice n times and record the outcomes. Based on these values, how would you assess the null hypothesis that the outcome on each die is independent of the outcome on the other? 10.2.10 Suppose a professor wants to assess whether or not there is any difference in the final grade distributions (A, B, C, D, and F) between males and females in a particular class. To assess the null hypothesis that there is no difference between these distributions, the professor carries out a chisquared test. (a) Discuss how the professor carried out this test. (b) If the professor obtained evidence against the null hypothesis, discuss what con cerns you have over the use of the chisquared test. 10.2.11 Suppose that a chisquared test is carried out, based on a random sample of n from a population, to assess whether or not two categorical variables X and Y are Chapter 10: Relationships Among Variables 537 independent. Suppose the Pvalue equals 0.001 and the investigator concludes that there is evidence against independence. Discuss how you would check to see if the deviation from independence was of practical significance. PROBLEMS 10.2.12 In Example 10.2.1, place a uniform prior on the parameters (a Dirichlet distri bution with all parameters equal to 1) and then determine the posterior distribution of the parameters. 10.2.13 In Example 10.2.2, place a uniform prior on the parameters of each population (a Dirichlet distribution with all parameters equal to 1) and such that the three priors are independent. Then determine the posterior distribution. 10.2.14 In a 2 are independent if and only if 2 table with probabilities i j prove that the row and column variables 11 22 12 21 1 ab fi j 11 j 0 for every i in (10.2.1) is given by i j namely, we have independence if and only if the |
crossratio equals 1. 10.2.15 Establish that the likelihood in (10.2.1) is correct when the population size is infinite (or when we are sampling with replacement from the population). 10.2.16 (MV) Prove that the MLE of fi j n Assume that function on this parameter space must achieve its maximum at some point in and that, if the function is continuously differentiable at such a point, then all its first order partial derivatives are zero there. This will allow you to conclude that the unique solution to the score equations must be the point where the loglikelihood is maximized. Try the case where a 2 first.) 10.2.17 (MV) Prove that the MLE of by i Use the hint in Problem 10.2.16.) 10.2.18 (MV) Prove that the MLE of in (10.2.2) is given j (Hint: (Hint: Use the facts that a continuous f j n Assume that fi b 0 for every i 1 0 f j fi n and 2 b a 1 j 1 X 1 0 for every i b X a in (10.2.3) is given by j. (Hint: Use the hint in Problem fi j ni Assume that fi j j X i 10.2.16.) 10.2.19 (MV) Prove that the MLE of Assume that f j 10.2.20 Suppose that X X lk E X l1 k 1 0 for every i X1 b in (10.2.4) is given by j j (Hint: Use the hint in Problem 10.2.16.) 1 f j n. Dirichlet in terms of the gamma function, when li Xk 1 1 0 for i k. Determine 1 k. COMPUTER PROBLEMS 2 1 10.2.21 Suppose that as in Exercise 10.2.7. 3 104 from this distribution and use this to estimate the Generate a sample of size N expectations of the i. Compare these estimates with their exact values. (Hint: There is some relevant code in Appendix B for the generation; see Appendix C for formulas for the exact values of these expectations.) Dirichlet 1 1 1 1 4 538 Section 10.3: Quantitative Response and Predict |
ors 104 from the posterior 10.2.22 For Problem 10.2.12, generate a sample of size N distribution of the parameters and use this to estimate the posterior expectations of the cell probabilities. Compare these estimates with their exact values. (Hint: There is some relevant code in Appendix B for the generation; see Appendix C for formulas for the exact values of these expectations.) CHALLENGES 10.2.23 (MV) Establish the validity of the method discussed in Example 10.2.3 for generating from a Dirichlet k distribution. 1 10.3 Quantitative Response and Predictors When the response and predictor variables are all categorical, it can be difficult to for mulate simple models that adequately describe the relationship between the variables. We are left with recording the conditional distributions and plotting these in bar charts. When the response variable is quantitative, however, useful models have been formu lated that give a precise mathematical expression for the form of the relationship that may exist. We will study these kinds of models in the next three sections. This section concentrates on the situation in which all the variables are quantitative. 10.3.1 The Method of Least Squares The method of least squares is a general method for obtaining an estimate of a distribu tion mean. It does not require specific distributional assumptions and so can be thought of as a distributionfree method (see Section 6.4). Suppose we have a random variable Y and we want to estimate E Y based on a yn The following principle is commonly used to generate estimates. sample y1 The leastsquares principle says that we select the point t y1 in the set of possible values for E Y that minimizes the sum of squared 2 deviations (hence, “least squares”) given by Such an estimate is called a leastsquares estimate. n i 1 yi t y1 yn yn Note that a leastsquares estimate is defined for every sample size, even n To implement least squares, we must find the minimizing point t y1 n i 1 yi haps a first guess at this value is the sample average y Because t y1 0 we have t y1 n y yn yn y n i 1 yi 1 yn. Per yi yi yi t y1 2 yn n i 1 |
yi y y t y1 2 yn y 2 2 n i 1 yi y y t y1 yn n i 1 y t y1 2 yn y 2 n y t y1 2 yn (10.3.1) Chapter 10: Relationships Among Variables 539 n and this is assumed i 1 yi Therefore, the smallest possible value of (10.3.1) is by taking t y1 y Note, however, that y might not be a possible value for E Y and that, in such a case, it will not be the leastsquares estimate In general, (10.3.1) says that the leastsquares estimate is the value t y1 yn that is closest to y and is a possible value for E Y. y2 yn Consider the following example. EXAMPLE 10.3.1 Suppose that Y has one of the distributions on S 0 1 given in the following table p1 y p2 y Then the mean of Y is given by E1 Y 0 1 2 1 1 2 1 2 or E2 Y 0 1 3 1 2 3 2 3. Now suppose we observe the sample 0 0 1 1 1 and so y possible values for E Y are in 1 2 2 3 we see that t 0 0 1 1 1 3 5 0 004 while 3 5 1 2 2 2 3 2 0 01 3 5 Because the 2 3 because a b Whenever the set of possible values for E Y is an interval a b however, and P Y a b This implies that y is the leastsquares estimator of E Y So we see that in quite general circumstances, y is the leastsquares estimate. There is an equivalence between least squares and the maximum likelihood method 1 then y when we are dealing with normal distributions. EXAMPLE 10.3.2 Least Squares with Normal Distributions Suppose that y1 known. Then the MLE of is obtained by finding the value of yn is a sample from an N 2 0 distribution, where is un that maximizes L y1 yn exp n 2 2 0 y 2 Equivalently, the MLE maximizes the loglikelihood l y1 yn n 2 2 0 y 2 So we need to find the value of that minimizes y 2 just as with least squares In the case of the normal location model, we see that the leastsquares estimate and the MLE |
of agree. This equivalence is true in general for normal models (e.g., the locationscale normal model), at least when we are considering estimates of location parameters. Some of the most important applications of least squares arise when we have that indicates that the response is a random vector Y Rn (the prime Y1 Yn 540 Section 10.3: Quantitative Response and Predictors we consider Y as a column), and we observe a single observation y Rn The expected value of Y component random variables, namely, Rn is defined to be the vector of expectations of its y1 yn E Y E Y1 E Yn Rn The leastsquares principle then says that, based on the single observation y yn, we must find y1 t y t y1 yn t1 y1 yn tn y1 yn in the set of possible values for E Y (a subset of Rn), that minimizes n i 1 yi ti y1 2 yn (10.3.2) So t y is the possible value for E Y that is closest to y as the squared distance between two points x y Rn is given by 2. n i 1 xi yi As is common in statistical applications, suppose that there are predictor variables that may be related to Y and whose values are observed. In this case, we will replace E Y by its conditional mean, given the observed values of the predictors. The least squares estimate of the conditional mean is then the value t y1 in the set of possible values for the conditional mean of Y that minimizes (10.3.2). We will use this definition in the following sections. yn Finding the minimizing value of t y in (10.3.2) can be a challenging optimization problem when the set of possible values for the mean is complicated. We will now apply least squares to some important problems where the leastsquares solution can be found in closed form. 10.3.2 The Simple Linear Regression Model Suppose we have a single quantitative response variable Y and a single quantitative predictor X e.g., Y could be blood pressure measured in pounds per square inch and X could be age in years. To study the relationship between these variables, we examine the conditional distributions of Y given X x to see how these change as we change x We might choose to examine a particular characteristic of these distributions to see how it varies with |
x Perhaps the most commonly used characteristic is the conditional mean of Y given X x (see Section 3.5). x or E Y X In the regression model (see Section 10.1), we assume that the conditional distrib utions have constant shape and that they change, as we change x at most through the conditional mean. In the simple linear regression model, we assume that the only way the conditional mean can change is via the relationship E Y X x 1 2x Chapter 10: Relationships Among Variables 541 R1 (the intercept term) and 2 for some unknown values of coefficient). We also refer to 1 and 2 as the regression coefficients. 1 R1 (the slope Suppose we observe the independent values x1 y1 using the simple linear regression model, we have that xn yn for X Y Then, E Y1 Yn X1 x1 Xn xn 1 1 2x1 2xn. (10.3.3) Equation (10.3.3) tells us that the conditional expected value of the response Y1 Yn is in a particular subset of Rn Furthermore, (10.3.2) becomes n i 1 yi ti y 2 n i 1 yi 1 2 2xi (10.3.4) and we must find the values of called the leastsquares estimates of 1 and 2. 1 and 2 that minimize (10.3.4). These values are Before we show how to do this, consider an example. EXAMPLE 10.3.3 Suppose we obtained the following n 10 data points xi yi. 3 9 8 9 5 4 12 10 4 5 6 4 1 10 In Figure 10.3.1, we have plotted these points together with the line y 1 x 10 y 0 10 5 0 x 5 Figure 10.3.1: A plot of the data points xi yi (+) and the line y 1 x in Example 10.3.3. Notice that with 1 1 and 2 1 then yi 1 2 2xi yi 1 2 xi 542 Section 10.3: Quantitative Response and Predictors is the squared vertical distance between the point xi yi and the point on the line with the same x value. So (10.3.4) is the sum of these squared deviations and in this case equals 141 15 1 1 and 2 If 1 were the least |
squares estimates, then 141.15 would be equal to the smallest possible value of (10.3.4). In this case, it turns out (see Example 10.3.4) that the leastsquares estimates are given by the values 2 06, and the minimized value of (10.3.4) is given by 8 46 which is much smaller than 141 15 1 33 1 2 So we see that, in finding the leastsquares estimates, we are in essence finding 2x that best fits the data, in the sense that the sum of squared vertical the line deviations of the observed points to the line is minimized. 1 Scatter Plots As part of Example 10.3.3, we plotted the points x1 y1 xn yn in a graph. This is called a scatter plot, and it is a recommended first step as part of any analysis of the relationship between quantitative variables X and Y. A scatter plot can give us a very general idea of whether or not a relationship exists and what form it might take. It is important to remember, however, that the appearance of such a plot is highly dependent on the scales we choose for the axes. For example, we can make a scatter plot look virtually at (and so indicate that no relationship exists) by choosing to place too wide a range of tick marks on the yaxis. So we must always augment a scatter plot with a statistical analysis based on numbers. LeastSquares Estimates, Predictions, and Standard Errors For the simple linear regression model, we can work out exact formulas for the least squares estimates of 1and 2 Theorem 10.3.1 Suppose that E Y X pendent values x1 y1 of 1 and 2 are given by 2x and we observe the inde xn yn for X Y Then the leastsquares estimates x 1 b1 y b2x and b2 n x i 1 xi n i 1 xi y yi x 2 respectively, whenever n i 1 xi x 2 0 PROOF The proof of this result can be found in Section 10.6. We call the line y is the leastsquares estimate of E Y X only if x1 b1 b2x the leastsquares line, or bestfitting line, and b1 b2x 0 if and 1 and x |
n. In such a case we cannot use least squares to estimate x. Note that n i 1 xi x 2 2 although we can still estimate E Y X x (see Problem 10.3.19). Chapter 10: Relationships Among Variables 543 Now that we have estimates b1 b2 of the regression coefficients, we want to use 1 and 2 These estimates have the unbiasedness property. these for inferences about xn yn for X Y x 2x and we observe the independent 1 then Theorem 10.3.2 If E Y X values x1 y1 (i) E B1 X1 (ii) E B2 X1 Xn Xn x1 x1 xn xn 1 2. PROOF The proof of this result can be found in Section 10.6. Note that Theorem 10.3.2 and the theorem of total expectation imply that E B1 and E B2 2 unconditionally as well. 1 Adding the assumption that the conditional variances exist, we have the following theorem. x Theorem 10.3.3 If E Y X and we observe the independent values x1 y1 2 1 n x1 (i) Var B1 X1 2 (ii) Var B2 X1 x1 (iii) Cov B1 B2 X1 xn xn Xn Xn Xn xn x1 1 2x Var Y X x 2 for every x xn yn for X Y then x 2 n i 1 xi 2x n i 1 xi x 2 n i 1 xi x 2 x 2 PROOF See Section 10.6 for the proof of this result. For the leastsquares estimate b1 b2x of the mean E Y X x 1 2x, we have the following result. Corollary 10.3.1 Var B1 B2x X1 x1 Xn xn 2 1 n x 2 x n i 1 xi x 2 (10.3.5) PROOF See Section 10.6 for the proof of this result. A natural predictor of a future value of Y when X x is given by the conditional 1and 2 we mean E Y X 1 use the estimated mean b1 x 2x Because we do not know the values of b2x as the predictor. When we are predicting Y at an x value that lies within the range of the observed values of X, we refer to this as |
an interpolation. When we want to predict at an x value that lies outside this range, we refer to this as an extrapolation. Extrapolations are much less reliable than interpolations. The farther away x is from the observed range of X values, then, intuitively, the less reliable we feel such a prediction will be. Such considerations should always be borne in mind. From (10.3.5), we see that the variance of the prediction at the value X x increases as x moves away from x So to a certain extent, the standard error does reect this increased uncertainty, but note that its form is based on the assumption that the simple linear regression model is correct. 544 Section 10.3: Quantitative Response and Predictors Even if we accept the simple linear regression model based on the observed data (we will discuss model checking later in this section), this model may fail to apply for very different values of x and so the predictions would be in error. We want to use the results of Theorem 10.3.3 and Corollary 10.3.1 to calculate standard errors of the leastsquares estimates. Because we do not know 2 however, we need an estimate of this quantity as well. The following result shows that s2 n 1 n 2 i 1 yi b1 2 b2xi (10.3.6) is an unbiased estimate of 2. Theorem 10.3.4 If E Y X and we observe the independent values x1 y1 x 1 2x Var Y X x 2 for every x xn yn for X Y, then E S2 X1 x1 Xn xn 2 PROOF See Section 10.6 for the proof of this result. Therefore, the standard error of b1 is then given by s 1 n x 2 n i 1 xi x 2 1 2, and the standard error of b2 is then given by xi x 2 1 2. s n i 1 Under further assumptions, these standard errors can be interpreted just as we inter preted standard errors of estimates of the mean in the location and locationscale nor mal models. EXAMPLE 10.3.4 (Example 10.3.3 continued) Using the data in Example 10.3.3 and the formulas of Theorem 10.3.1, we obtain b1 1 33 b2 So the leastsquares line is given by 1 33 2 as the estimate of 2 06 |
as the leastsquares estimates of the intercept and slope, respectively. 1 06 2 06x Using (10.3.6), we obtain s2 Using the formulas of Theorem 10.3.3, the standard error of b1 is 0 3408, while the standard error of b2 is 0 1023 The prediction of Y at X 2 0 is given by 1 33 2 06 2 5 45 Using Corollary 10.3.1, this estimate has standard error 0 341 This prediction is an interpolation. The ANOVA Decomposition and the FStatistic The following result gives a decomposition of the total sum of squares n i 1 yi y 2. Chapter 10: Relationships Among Variables 545 Lemma 10.3.1 If x1 y1 xn yn are such that n i 1 xi x 2 0 then n i 1 yi y 2 b2 2 n i 1 xi x 2 n i 1 yi b1 b2xi 2. PROOF The proof of this result can be found in Section 10.6. We refer to b2 2 n i 1 xi x 2 as the regression sum of squares (RSS) and refer to n i 1 yi b1 2 b2xi as the error sum of squares (ESS). If we think of the total sum of squares as measuring the total observed variation in the response values yi, then Lemma 10.3.1 provides a decomposition of this variation into the RSS, measuring changes in the response due to changes in the predictor, and the ESS, measuring changes in the response due to the contribution of random error. It is common to write this decomposition in an analysis of variance table (ANOVA). Source X Error Total Df 1 n n 2 1 b2 2 Sum of Squares n i 1 xi x 2 n i 1 yi n i 1 yi b2xi b1 y 2 Mean Square n i 1 xi x 2 b2 2 s2 2 Here, Df stands for degrees of freedom (we will discuss how the Df entries are cal culated in Section 10.3.4). The entries in the Mean Square column are calculated by dividing the corresponding sum of squares by the Df entry. To see the significance of the ANOVA table, note that, from Theorem 10.3.3, E B2 2 n i 1 xi x 2 X1 |
x1 Xn xn 2 n 2 2 i 1 xi x 2 (10.3.7) which is equal to 2 if and only if 0 (we are always assuming here that the xi 2 0 if vary). Given that the simple linear regression model is correct, we have that and only if there is no relationship between the response and the predictor. Therefore, b2 0 Because s2 2 2 (Theorem 10.3.4), a sensible statistic to use in is always an unbiased estimate of 0, is given by assessing H0 : x 2 is an unbiased estimator of 2 if and only if n i 1 xi 2 2 2 F RSS ESS n 2 b2 2 n i 1 xi s2 x 2, (10.3.8) 546 Section 10.3: Quantitative Response and Predictors 2 when H0 is true. We then conclude as this is the ratio of two unbiased estimators of that we have evidence against H0 when F is large, as (10.3.7) also shows that the numerator will tend to be larger than 2 when H0 is false. We refer to (10.3.8) as the Fstatistic. We will subsequently discuss the sampling distribution of F to see how to determine when the value F is so large as to be evidence against H0. EXAMPLE 10.3.5 (Example 10.3.3 continued) Using the data of Example 10.3.3, we obtain n i 1 n i 1 yi xi b2 2 y 2 x 2 437 01 428 55 n i 1 and so yi b1 2 b2xi 437 01 428 55 8 46 b2 2 F x 2 n i 1 xi s2 428 55 1 06 404 29 Note that F is much bigger than 1, and this seems to indicate a linear effect due to X. The Coefficient of Determination and Correlation Lemma 10.3.1 implies that R2 b2 2 n i 1 xi n i 1 yi x 2 y 2 R2 1 Therefore, the closer R2 is to 1, the more of the observed total satisfies 0 variation in the response is accounted for by changes in the predictor. In fact, we interpret R2 called the coefficient of determination, as the proportion of the observed variation in the response explained by changes in the predictor via the simple linear |
regression. The coefficient of determination is an important descriptive statistic, for, even if we conclude that a relationship does exist, it can happen that most of the observed variation is due to error. If we want to use the model to predict further values of the response, then the coefficient of determination tells us whether we can expect highly accurate predictions or not. A value of R2 near 1 means highly accurate predictions, whereas a value near 0 means that predictions will not be very accurate. EXAMPLE 10.3.6 (Example 10.3.3 continued) Using the data of Example 10.3.3, we obtain R2 0 981 Therefore, 98.1% of the ob served variation in Y can be explained by the changes in X through the linear relation. This indicates that we can expect fairly accurate predictions when using this model, at least when we are predicting within the range of the observed X values. Chapter 10: Relationships Among Variables 547 Recall that in Section 3.3, we defined the correlation coefficient between random variables X and Y to be XY Corr X Y Cov X Y Sd X Sd Y. In Corollary 3.6.1, we proved that Y of the extent to which a linear relationship exists between X and Y cX for some constants a 1 if and only if 0 So XY can be taken as a measure 1 R1 and c 1 with XY XY a If we do not know the joint distribution of X Y xn yn XY Based on the observations x1 y1 then we will have to estimate the natural estimate to use is the sample correlation coefficient where rx y sx y sx sy sx y n 1 n 1 i 1 xi x yi y is the sample covariance estimating Cov X Y, and sx sy are the sample standard rx y deviations for the X and Y variables, respectively. Then 1 1 with rx y if and only if yi 0 for every i (the proof is the same as in Corollary 3.6.1 using the joint distribution that puts probability mass 1 n at each point xi yi — see Problem 3.6.16). cxi for some constants a 1 R1 and c a The following result shows that the coefficient of determination is the square of the correlation between the observed X and Y values. The |
orem 10.3.5 If x1 y1 y 2 0 then R2 n i 1 yi xn yn are such that r 2 x y. n i 1 xi x 2 0 PROOF We have r 2 x y n i 1 xi x n i 1 xi x 2 y 2 yi n i 1 yi y 2 b2 2 n i 1 xi n i 1 yi x 2 y 2 R2 where we have used the formula for b2 given in Theorem 10.3.1. Confidence Intervals and Testing Hypotheses We need to make some further assumptions in order to discuss the sampling distribu tions of the various statistics that we have introduced. We have the following results. 548 Section 10.3: Quantitative Response and Predictors x, is distributed N 1 2 and we ob 2x xn yn for X Y, then the conditional x1 x 2 xn are as follows. Xn Theorem 10.3.6 If Y, given X serve the independent values x1 y1 distributions of B1 B2 and S2 given X1 2 1 n (i) B1 2 (ii) B2 (iii) B1 (iv) n N 1 N 2 B2x 2 S2 x 2 n i 1 xi 2x n i 1 xi xi x 2 2 independent of B1 B2 PROOF The proof of this result can be found in Section 10.6. Corollary 10.3.2 (i) B1 (ii) B2 (iii) 1 2 S 1 n n i 1 xi x 2 n i 1 xi 2x 1 n i 1 xi (iv) If F is defined as in (10.3.8), then H0 : F 1 n B2x x 2 B1 is true if and only if F PROOF The proof of this result can be found in Section 10.6. Using Corollary 10.3.2(i), we have that b1 s 1 n x 2 1 2 xi is an exact confidence interval for 1. Also, from Corollary 10.3.2(ii), b2 s n i 1 1 2 xi x 2 t 1 2 n 2 is an exact confidence interval for From Corollary 10.3. |
2(iv), we can test H0 : 2. 0 by computing the Pvalue 2 P F b2 2 n i 1 xi s2 x 2, (10.3.9) F 1 n where F 2, to see whether or not the observed value (10.3.8) is surprising. This is sometimes called the ANOVA test. Note that Corollary 10.3.2(ii) implies that we can also test H0 : 0 by computing the Pvalue 2 P T b2 n i 1 xi s x 2 1 2, (10.3.10) Chapter 10: Relationships Among Variables 549 where T (10.3.10) are equal. t n 2. The proof of Corollary 10.3.2(iv) reveals that (10.3.9) and EXAMPLE 10.3.7 (Example 10.3.3 continued) Using software or Table D.4, we obtain t0 975 8 Example 10.3.3, we obtain a 0.95confidence interval for 1 as 2 306 Then, using the data of b1 s 1 n x 2 1 2 xi 33 0 3408 2 306 [0 544 2 116] and a 0.95confidence interval for 2 as b2 s n i 1 1 2 xi x 2 t 1 2 n 2 2 06 0 1023 2 306 [1 824 2 296] The 0.95confidence interval for 2 does not include 0, so we have evidence against the null hypothesis H0 : 0 and conclude that there is evidence of a relationship between X and Y This is confirmed by the Ftest of this null hypothesis, as it gives the Pvalue P F 0 000 when F 404 29 F 1 8 2 Analysis of Residuals In an application of the simple regression model, we must check to make sure that the assumptions make sense in light of the data we have collected. Model checking is based on the residuals yi b2xi (after standardization), as discussed in Section 9.1. Note that the ith residual is just the difference between the observed value yi at xi and the predicted value b1 b2xi at xi. b1 From the proof of Theorem 10.3.4, we have the following result. Corollary 10 |
.3.3 (i) E Yi (ii) Var Yi B1 B1 B2xi X1 x1 Xn xn 0 B2xi X1 x1 Xn xn 2 1 1 n x 2 xi n i 1 xi x 2 This leads to the definition of the i th standardized residual as yi b1 b2xi s 1 1 n xi 10.3.11) Corollary 10.3.3 says that (10.3.11), with replacing s is a value from a distri bution with conditional mean 0 and conditional variance 1. Furthermore, when the conditional distribution of the response given the predictors is normal, then the con ditional distribution of this quantity is N 0 1 (see Problem 10.3.21). These results 550 Section 10.3: Quantitative Response and Predictors are approximately true for (10.3.11) for large n. Furthermore, it can be shown (see Problem 10.3.20) that Cov Yi B1 B2xi Y j B1 B2x j X1 x1 Xn xn 2 1 n xi x j x n k 1 xk x x 2. Therefore, under the normality assumption, the residuals are approximately indepen dent when n is large and xi x n k 1 xk x 2 0 This will be the case whenever Var X is finite (see Challenge 10.3.27) as n or, in the design context, when the values of the predictor are chosen accordingly. So one approach to model checking here is to see whether the values given by (10.3.11) look at all like a sample from the N 0 1 distribution. For this, we can use the plots discussed in Chapter 9. EXAMPLE 10.3.8 (Example 10.3.3 continued) Using the data of Example 10.3.3, we obtain the following standardized residuals. 0 49643 0 17348 0 43212 0 75281 1 73371 0 28430 1 00487 1 43570 0 08358 1 51027 These are plotted against the predictor x in Figure 10.3.21 2 5 0 x 5 Figure 10.3.2: Plot of the standardized residuals in Example 10.3.8. It is recommended that we plot the standardized residuals against the predictor, as this may reveal some underlying relationship that has |
not been captured by the model. This residual plot looks reasonable. In Figure 10.3.3, we have a normal probability plot of the standardized residuals. These points lie close to the line through the origin with slope equal to 1, so we conclude that we have no evidence against the model here. Chapter 10: Relationships Among Variables 551 1 2 1 0 1 Standardized Residual Figure 10.3.3: Normal probability plot of the standardized residuals in Example 10.3.8. What do we do if model checking leads to a failure of the model? As discussed in Chapter 9, perhaps the most common approach is to consider making various trans formations of the data to see whether there is a simple modification of the model that will pass. We can make transformations, not only to the response variable Y but to the predictor variable X as well. An Application of Simple Linear Regression Analysis The following data set is taken from Statistical Methods, 6th ed., by G. Snedecor and W. Cochran (Iowa State University Press, Ames, 1967) and gives the record speed Y in miles per hour at the Indianapolis Memorial Day car races in the years 1911–1941, excepting the years 1917–1918. We have coded the year X starting at 0 in 1911 and incrementing by 1 for each year. There are n 29 data points xi yi The goal of the analysis is to obtain the leastsquares line and, if warranted, make inferences about the regression coefficients. We take the normal simple linear regression model as our statistical model. Note that this is an observational study. Year 0 1 2 3 4 5 8 9 10 11 Speed Year 12 13 14 15 16 17 18 19 20 21 74.6 78.7 75.9 82.5 89.8 83.3 88.1 88.6 89.6 94.5 Speed Year 22 23 24 25 26 27 28 29 30 91.0 98.2 101.1 95.9 97.5 99.5 97.6 100.4 96.6 104.1 Speed 104.2 104.9 106.2 109.1 113.6 117.2 115.0 114.3 115.1 Using Theorem 10.3.1, we obtain the leastsquares line as y This line, together with a scatter plot of the values xi yi 77 5681 1 27793x is plotted |
in Figure 10.3.4. 552 Section 10.3: Quantitative Response and Predictors The fit looks quite good, but this is no guarantee of model correctness, and we must carry out some form of model checking. Figure 10.3.5 is a plot of the standardized residuals against the predictor. This plot looks reasonable, with no particularly unusual pattern apparent. Figure 10.3.6 is a nor mal probability plot of the standardized residuals. The curvature in the center might give rise to some doubt about the normality assumption. We generated a few samples of n 29 from an N 0 1 distribution, however, and looking at the normal probabil ity plots (always recommended) reveals that this is not much cause for concern. Of course, we should also carry out model checking procedures based upon the standard ized residuals and using Pvalues, but we do not pursue this topic further here. Regression Plot Speed = 77.5681 + 1.27793 Year S = 2.99865 RSq = 94.0 % RSq(adj) = 93.8 % d e e p S 120 110 100 90 80 70 0 10 20 30 Year Figure 10.3.4: A scatter plot of the data together with a plot of the leastsquares line. Residuals Versus Year (response is Speed1 2 0 10 20 30 Year Figure 10.3.5: A plot of the standardized residuals against the predictor. Chapter 10: Relationships Among Variables 553 Normal Probability Plot of the Residuals (response is Speed1 2 2 1 0 1 2 3 Standardized Residual Figure 10.3.6: A normal probability plot of the standardized residuals. Based on the results of our model checking, we decide to proceed to inferences about the regression coefficients. The estimates and their standard errors are given in 2 999 2, the following table, where we have used the estimate of to compute the standard errors. We have also recorded the tstatistics appropriate for testing each of the hypotheses H0 : 2 given by s2 0 and H0 : 0 1 2 Coefficient Estimate 77 568 1 278 1 2 Standard Error 1 118 0 062 tstatistic 69 39 20 55 From this, we see that the Pvalue for assessing H0 : 0 is given by 2 P T |
20 55 0 000 t 27, and so we have strong evidence against H0 It seems clear that there when T is a strong positive relationship between Y and X. Since the 0.975 point of the t 27 distribution equals 2 0518 a 0.95confidence interval for 2 is given by 1 278 0 062 2 0518 [1 1508 1 4052]. The ANOVA decomposition is given in the following table. Source Regression Error Total Df 1 27 28 Sum of Squares Mean Square 3797 0 9 0 3797 0 242 8 4039 8 Accordingly, we have that F 421 888 0 is true, P F H0 : what we got from the preceding ttest. 2 3797 0 9 0 421 888 and, as F F 1 27 when 0 000 which simply confirms (as it must) The coefficient of determination is given by R2 0 94 There fore, 94% of the observed variation in the response variable can be explained by the 3797 0 4039 8 554 Section 10.3: Quantitative Response and Predictors changes in the predictor through the simple linear regression. The value of R2 indicates that the fitted model will be an excellent predictor of future values, provided that the value of X that we want to predict at is in the range (or close to it) of the values of X used to fit the model. 10.3.3 Bayesian Simple Linear Model (Advanced) For the Bayesian formulation of the simple linear regression model with normal error, we need to add a prior distribution for the unknown parameters of the model, namely, 2 and 2 There are many possible choices for this. A relevant prior is dependent 1 on the application. To help simplify the calculations, we reparameterize the model as follows. Let 1 1 n i 1 2x and 2 2 It is then easy to show (see Problem 10.3.24) that yi 1 2 2xi n i 1 n i 1 n i 1 yi yi 1 y 2 xi x 2 1 y 2 xi x 2 yi xi x 2 2 2 xi x yi y (10.3.12) i 1 The likelihood function, using this reparameterization, then equals 2 2 n 2 exp 1 2 2 n i 1 yi 1 2 xi x 2 From (10.3.12), |
and setting c2 x c2 y cx xi yi xi x 2 y 2 x yi y we can write this as Chapter 10: Relationships Among Variables 555 2 2 n 2 exp c2 y 2 2 exp n 2 2 y 2 1 exp 1 2 2 2 2 n 2 exp 2c2 2 x c2 y 2 2cx y c2 x a2 2 2 exp n 2 2 y 2 1 exp c2 x 2 2 a 2, 2 where the last equality follows from 2 cx y/c2 x 2c2 x 2 2cx y c2 x 2 a 2 x a2 with a c2 2 are independent given This implies that, whenever the prior distribution on 1 and 1 and 2 are also independent given 2 Note also that y and a are the leastsquares estimates (as well 1 and 2 respectively (see Problem 10.3.24). as the MLE’s) of 2 then the posterior distributions of 2 is such that 1 Now suppose we take the prior to be Gamma Note that 1 and 2 are independent given 2 As it turns out, this prior is conjugate, so we can easily determine an exact form for 2 the posterior distribution (see Problem 10.3.25). The joint posterior of is given by c2 x Gamma 1 1 n y c2 c2 where x y 1 2 c2 y x a2 c2 n y2 x a2 c2 2 2 2 2 2 1 2 1 c2 ny c2. 556 Section 10.3: Quantitative Response and Predictors Of course, we must select the values of the hyperparameters to fully specify the prior. 1 1 2 2 and Now observe that for a diffuse analysis, i.e., when we have little or no prior infor 0 and the posterior and 2 mation about the parameters, we let converges to c2 x Gamma n 2 x y where x y the hyperparameter the analysis when n is not too small. x a2. But this still leaves us with the necessity of choosing c2 1 2 c2 y. We will see, however, that this choice has only a small effect on We can easily work out the marginal posterior distribution of the i For example, in the diffuse case, the marginal posterior density of 2 is proportional to 1 2 exp 1 2 n 2 1 2 c2 exp x y 1 2 c2 x 2 n 2 1 exp. Making the change of variable 1 |
2 x y where c2 x 2 a 2 2 1 2 in the preceding integral, shows that the marginal posterior density of to 2 is proportional 1 c2 x 2 x y a 2 2 which is proportional to n 1 2 n 2 1 2 exp d 0 1 c2. This establishes (see Problem 4.6.17) that the posterior distribution of by 2 is specified 2 n 2 a 2 x y c2 x t 2 n So a HPD (highest posterior density) interval for 2 is given by a 1 2 n 2 x y c2 x t 1 2 2 n Chapter 10: Relationships Among Variables 557 Note that these intervals will not change much as we change too small. provided that n is not We consider an application of a Bayesian analysis for such a model. EXAMPLE 10.3.9 Haavelmo’s Data on Income and Investment The data for this example were taken from An Introduction to Bayesian Inference in Econometrics, by A. Zellner (Wiley Classics, New York, 1996). The response variable Y is income in U.S. dollars per capita (deated), and the predictor variable X is invest ment in dollars per capita (deated) for the United States for the years 1922–1941. The data are provided in the following table. Year 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 Income 433 483 479 486 494 498 511 534 478 440 Investment Year 1932 39 1933 60 1934 42 1935 52 1936 47 1937 51 1938 45 1939 60 1940 39 1941 41 Income 372 381 419 449 511 520 477 517 548 629 Investment 22 17 27 33 48 51 33 46 54 100 In Figure 10.3.7, we present a normal probability plot of the standardized residuals, obtained via a leastsquares fit. In Figure 10.3.8, we present a plot of the standardized residuals against the predictor. Both plots indicate that the model assumptions are reasonable. Suppose now that we analyze these data using the limiting diffuse prior with 64993 c2 x 483 c2 y 5710 55 and cx y 17408 3 2 64993 2 17408 3 so that 23792 35 The 3 05 and x y Here, we have that y a posterior is then given by 17408 3 5710 55 1 2 2 2 2 2 1 2 20 N 48 |
3 2 5710 55 N 3 05 Gamma 12 23792 35 The primary interest here is in the investment multiplier 2, using t0 975 24 0.95HPD interval for 2 0639 is given by 2 By the above results 23792 35 5710 55 t0 975 24 3 05 0 589 2 0639 3 05 24 1 834 4 266 558 Section 10.3: Quantitative Response and Predictors Normal Probability Plot of the Residuals (response is Income1 2 2 1 0 1 Standardized Residual Figure 10.3.7: Normal probability plot of the standardized residuals in Example 10.3.91 In vestm en t Figure 10.3.8: Plot of the standardized residuals against the predictor in Example 10.3.9. 10.3.4 The Multiple Linear Regression Model (Advanced) We now consider the situation in which we have a quantitative response Y and quanti tative predictors X1 Xk For the regression model, we assume that the conditional distributions of Y given the predictors, have constant shape and that they change, as the predictors change, at most through the conditional mean E Y X1 xk. For the linear regression model, we assume that this conditional mean is of the form Xk x1 E Y X1 x1 Xk xk 1x1 k xk (10.3.13) This is linear in the unknown i R1 for i 1 k Chapter 10: Relationships Among Variables 559 We will develop only the broad outline of the analysis of the multiple linear regres sion model here. All results will be stated without proofs provided. The proofs can be found in more advanced texts. It is important to note, however, that all of these results are just analogs of the results we developed by elementary methods in Section 10.3.2, for the simple linear regression model. Matrix Formulation of the LeastSquares Problem For the analysis of the multiple linear regression model, we need some matrix concepts. We will briey discuss some of these here, but also see Appendix A.4. Let A Rm n denote a rectangular array of numbers with m rows and n columns, j th and let ai j denote the entry in the ith row and j th column (referred to as the i entry of A). For example R2 3 denotes a 2 3 matrix and, for |
example, a22 0 2 We can add two matrices of the same dimensions m and n by simply adding their elements componentwise. So if A B bi j. Furthermore, we can multiply a matrix by a real number c by simply multiplying every entry in the matrix by c So if A cai j. We will sometimes write a matrix A Rm n and bi j c A Rm n in terms of its columns as A Rm n, then B B, then ci j ai j A Rm n and C a1 an so that here ai define the product of A times b as Ab Suppose now that Y Rm Finally, if A Rn then we bnan Rn and that E Y is constrained to lie in a set of the form b1a1 Rm n and b Rm S 1 1 k k : i R1 i 1 k where 1 Rn. When k are fixed vectors in Rn A set such as S is called a linear subspace of 1 k has the linear independence property, namely, 1 1 k k 0 k 0 then we say that S has dimension k and 1 k if and only if is a basis for S If we set 1 V 1 k 11 21 12 22 n1 n2 1k 2k nk Rn k then we can write E Y 1 1 k k 1 11 1 21 2 12 2 22 k 1k k 2k V 1 n1 2 n2 k nk 560 Section 10.3: Quantitative Response and Predictors for some unknown point 1 leastsquares estimate of E Y is obtained by finding the value of. When we observe y 2 k Rn, then the that minimizes n i 1 yi 1 i1 2 i2 2. k i k k 1 It can be proved that a unique minimizing value for Rk exists whenever is a basis. The minimizing value of will be denoted by b and is called V b is the leastsquares the leastsquares estimate of estimate of E Y and is sometimes called the vector of fitted values. The point y V b is called the vector of residuals.. The point b1 1 bk k We now consider how to calculate b. For this, we need to understand what it means Rk n The matrix Rm k on the right by the matrix B to multiply the matrix A product AB is defined to be |
the m n matrix whose i j th entry is given by k l 1 ailbl j Notice that the array A must have the same number of columns as the number of rows Rm k is defined to of B for this product to be defined. The transpose of a matrix A be a11 am1 A Rk m a1k amk namely, the ith column of A becomes the i th row of A. For a matrix A matrix inverse of A is defined to be the matrix A 1 such that Rk k, the A A 1 A 1 A I Rk k has 1’s along its diagonal and 0’s everywhere else; it is called the k k where I Rk k has an inverse, but when it does identity matrix. It is not always the case that A it can be shown that the inverse is unique. Note that there are many mathematical and statistical software packages that include the facility for computing matrix products, transposes, and inverses. We have the following fundamental result. Theorem 10.3.7 If E Y and the columns of V V V 1 exists, the leastsquares estimate of 1 1 S 1 k k have the linear independence property, then k k : 1 i R1 i is unique, and it is given by b b1 bk V V 1 V y (10.3.14) Chapter 10: Relationships Among Variables 561 LeastSquares Estimates, Predictions, and Standard Errors For the linear regression model (10.3.13), we have that (writing Xi j for the jth value of Xi ) E Y1 Yn Xi j xi j for all i j 1x11 1xn1 1 1 k k k x1k k xnk V where 1 V and k 1 2 k x11 xn1 x1k xnk Rn k k of V have the linear indepen We will assume, hereafter, that the columns dence property. Then (replacing expectation by conditional expectation) it is immediate that the leastsquares estimate of is given by (10.3.14). As with the simple linear regression model, we have a number of results concerning 1 the leastsquares estimates. We state these here without proof. Theorem 10.3.8 If the xi1 n and the linear regression model applies, then xi k y |
i are independent observations for i 1 E Bi Xi j xi j for all i j i for i 1 k So Theorem 10.3.8 states that the leastsquares estimates are unbiased estimates of the linear regression coefficients. If we want to assess the accuracy of these estimates, then we need to be able to compute their standard errors. Theorem 10.3.9 If the xi1 n from the linear regression model, and if Var Y X1 for every x1 xi k yi are independent observations for i xk xk then Xk x1 1 2 Cov Bi B j Xi j xi j for all i j 2ci j (10.3.15) where ci j is the i j th entry in the matrix V V 1. We have the following result concerning the estimation of the mean E Y X1 x1 Xk xk 1x1 k xk by the estimate b1x1 bk xk 562 Section 10.3: Quantitative Response and Predictors Corollary 10.3.4 Var B1x1 k 2 Bk xk Xi j xi j for all i j x 2 i ci i 2 xi x j ci j 2x V V 1x (10.3.16) i 1 i j where x x1 xk. We also use b1x1 Xk x1 X1 xk bk xk b x as a prediction of a new response value when We see, from Theorem 10.3.9 and Corollary 10.3.4, that we need an estimate of 2 to compute standard errors The estimate is given by s2 n 1 n k i 1 yi b1xi1 bk xik 2 1 n k and we have the following result. y Xb y Xb (10.3.17) Theorem 10.3.10 If the xi1 1 n from the linear regression model, and if Var Y X1 xi k yi are independent observations for i xk Xk x1 2 then E S2 Xi j xi j for all i j 2. Combining (10.3.15) and (10.3.17), we deduce that the standard error of bi is s ci i. Combining (10.3.16) and (10.3.17), we deduce that the standard error of b |
1x1 bk xk is s k i 1 x 2 i ci i 2 xi x j ci j i j 1 2 s x V V 1x 1 2. The ANOVA Decomposition and FStatistics When one of the predictors X1 Xk is constant, then we say that the model has an intercept term. By convention, we will always take this to be the first predictor. So 1 and 1 is the when we want the model to have an intercept term, we take X1 intercept, e.g., the simple linear regression model. Note that it is common to denote the intercept term by 0 so that X0 Xk denote the predictors that actually change. We will also adopt this convention when it seems appropriate. 1 and X1 Basically, inclusion of an intercept term is very common, as this says that, when the predictors that actually change have no relationship with the response Y, then the intercept is the unknown mean of the response. When we do not include an intercept, then this says we know that the mean response is 0 when there is no relationship be tween Y and the nonconstant predictors. Unless there is substantive, applicationbased evidence to support this, we will generally not want to make this assumption. Denoting the intercept term by 1 so that X1 1 we have the following ANOVA decomposition for this model that shows how to isolate the observed variation in Y that can be explained by changes in the nonconstant predictors. Chapter 10: Relationships Among Variables 563 xi k yi are such that the Lemma 10.3.2 If, for i matrix V has linearly independent columns, with 1 equal to a column of ones, then b1 n the values xi1 bk xk and b2x2 1 y n i 1 yi y 2 n b2 xi2 x2 bk xi k xk 2 i 1 n i 1 yi b1xi1 bk xik 2 We call RSS X2 Xk n i 1 b2 xi2 x2 bk xi k xk 2 the regression sum of squares and ESS n i 1 yi b1xi1 bk xi k 2 the error sum of squares. This leads to the following ANOVA table. Source Df X2 Error Total Xk k n n Sum of Squares Xk 1 RSS X2 ESS k n i 1 |
yi 1 y 2 Mean Square RSS X2 s2 Xk k 1 When there is an intercept term, the null hypothesis of no relationship between the response and the predictors is equivalent to H0 : 0 As with the simple linear regression model, the mean square for regression can be shown to be an 2 if and only if the null hypothesis is true. Therefore, a sensible unbiased estimator of statistic to use for assessing the null hypothesis is the Fstatistic 2 k F RSS X2 Xk k 1 s2 with large values being evidence against the null. Often, we want to assess the null hypothesis H0 : l 1 equivalently, the hypothesis that the model is given by k 0 or, E Y X1 x1 Xk xk 1x1 l xl where l relationship with the response. k This hypothesis says that the last k l predictors Xl 1 Xk have no If we denote the leastsquares estimates of 1 l obtained by fitting the smaller model, by b1 bl then we have the following result. 564 Section 10.3: Quantitative Response and Predictors n are values for which the Lemma 10.3.3 If the xi1 for i matrix V has linearly independent columns, with 1 equal to a column of ones, then xi k yi 1 RSS X2 Xk n i 1 n b2 xi2 x2 bk xik xk 2 b2 xi2 i 1 RSS X2 x2 Xl bl xil 2 xl (10.3.18) On the right of the inequality in (10.3.18), we have the regression sum of squares obtained by fitting the model based on the first l predictors. Therefore, we can interpret the difference of the left and right sides of (10.3.18), namely, RSS Xl 1 Xk X2 Xl RSS X2 Xk RSS X2 Xl Xk to the regression sum of squares as the contribution of the predictors Xl 1 Xl are in the model. We get the following ANOVA ta when the predictors X1 ble (actually only the first three columns of the ANOVA table) corresponding to this decomposition of the total sum of squares. Source Xl Xk X2 Xl Df 1 l k 1 l k n n X2 Xl 1 Error Total Sum of Squares |
Xl Xk X2 Xl y 2 RSS X2 RSS Xl 1 ESS n i 1 yi It can be shown that the null hypothesis H0 : l 1 k 0 holds if and only if is an unbiased estimator of null hypothesis is the Fstatistic RSS Xl 1 Xk X2 k 2. Therefore, a sensible statistic to use for assessing this Xl l RSS Xl 1 F Xk X2 s2 Xl k l with large values being evidence against the null. The Coefficient of Determination The coefficient of determination for this model is given by R2 RSS X2 n i 1 yi Xk y 2 which, by Lemma 10.3.2, is always between 0 and 1. The value of R2 gives the propor tion of the observed variation in Y that is explained by the inclusion of the nonconstant predictors in the model. Chapter 10: Relationships Among Variables 565 It can be shown that R2 is the square of the multiple correlation coefficient between Xk However, we do not discuss the multiple correlation coefficient in Y and X1 this text. Confidence Intervals and Testing Hypotheses For inference, we have the following result. 2 and if we observe the independent values xi1 k xk n, then the conditional distributions of the Bi and S2 given Theorem 10.3.11 If the conditional distribution of Y given X1 xk xik yi Xi j (i) Bi (ii) B1x1 is N 1x1 for i 1 xi j for all i N i 2cii Bk xk is distributed j are as follows. Xk x1 N 1x1 2 k xk k i 1 x 2 i cii 2 xi x j ci j i j (iii) n k S2 2 2 n k independent of B1 Bk Corollary 10.3.5 (i) Bi (ii) sc1 2 ii i B1x1 t n k Bk xk 1x1 S k i 1 x 2 i ci i 2 j xi x j ci j i k xk 1 2 t n k (iii) H0 : l 1 RSS X2 F k Xk 0 is true if and only if RSS X2 S2 Xl k l F k l n |
k Analysis of Residuals In an application of the multiple regression model, we must check to make sure that the assumptions make sense. Model checking is based on the residuals yi b1xi1 bk xi k (after standardization), just as discussed in Section 9.1. Note that the ith xi k and residual is simply the difference between the observed value yi at xi1 the predicted value b1xi1 bk xi k at xi1 xik We also have the following result (this can be proved as a Corollary of Theorem 10.3.10). 566 Section 10.3: Quantitative Response and Predictors Corollary 10.3.6 (i) E Yi B1xi1 (ii) Cov Yi di j is the i Bk xi k V 0 B1xi1 Bk xik Y j j th entry of the matrix I B1x j1 V V V 1V. Bk x jk V 2di j, where Therefore, the standardized residuals are given by y j b1x j1 sd1 2 ii bk x jk. (10.3.19) When s is replaced by in (10.3.19), Corollary 10.3.6 implies that this quantity has conditional mean 0 and conditional variance 1. Furthermore, when the conditional distribution of the response given the predictors is normal, then it can be shown that the conditional distribution of this quantity is N 0 1. These results are also approxi mately true for (10.3.19) for large n. Furthermore, it can be shown that the covariances between the standardized residuals go to 0 as n under certain reasonable con ditions on distribution of the predictor variables. So one approach to model checking here is to see whether the values given by (10.3.19) look at all like a sample from the N 0 1 distribution. What do we do if model checking leads to a failure of the model? As in Chapter 9, we can consider making various transformations of the data to see if there is a simple modification of the model that will pass. We can make transformations not only to the response variable Y but to the predictor variables X1 Xk as well. An Application of Multiple Linear Regression Analysis The computations needed to implement a multiple linear regression analysis cannot be carried out by hand. These are much too time |
consuming and errorprone. It is therefore important that a statistician have a computer with suitable software available when doing a multiple linear regression analysis. We consider the model Y x1 x2 x3 The data in Table 10.1 are taken from Statistical Theory and Methodology in Sci ence and Engineering, 2nd ed., by K. A. Brownlee (John Wiley & Sons, New York, 1965). The response variable Y is stack loss (Loss), which represents 10 times the per centage of ammonia lost as unabsorbed nitric oxide. The predictor variables are X1 air ow (Air), X2 the concentration of temperature of inlet water (Temp), and X3 nitric acid (Acid). Also recorded is the day (Day) on which the observation was taken. 2. Note that we have included an intercept term. Figure 10.3.9 is a normal probability plot of the 2 63822 that standardized residuals. This looks reasonable, except for one residual, diverges quite distinctively from the rest of the values, which lie close to the 45degree line. Printing out the standardized residuals shows that this residual is associated with the observation on the twentyfirst day. Possibly there was something unique about this day’s operations, and so it is reasonable to discard this data value and refit the model. Figure 10.3.10 is a normal probability plot obtained by fitting the model to the first 20 observations. This looks somewhat better, but still we might be concerned about at least one of the residuals that deviates substantially from the 45degree line. N 0 3x3 1x1 2x2 Chapter 10: Relationships Among Variables 567 Day Air Temp Acid Loss Day Air Temp Acid Loss 13 11 12 8 7 8 8 9 15 15 58 58 58 50 50 50 50 50 56 70 12 13 14 15 16 17 18 19 20 21 17 18 19 18 18 19 19 20 20 20 88 82 93 89 86 72 79 80 82 91 1 2 3 4 5 6 7 8 9 10 11 80 80 75 62 62 62 62 62 58 58 58 27 27 25 24 22 23 24 24 23 18 18 89 88 90 87 87 87 93 93 87 80 89 42 37 37 28 18 18 19 20 15 14 14 Table 10.1: Data for Application of Multiple Linear Regression Analysis Normal Probability Plot of the Residuals |
(response is Loss1 2 3 2 1 0 1 2 Standardized Residual Figure 10.3.9: Normal probability plot of the standardized residuals based on all the data. Normal Probability Plot of the Residuals (response is Loss1 2 1 0 1 2 3 Standardized Residual Figure 10.3.10: Normal probability plot of the standardized residuals based on the first 20 data values. 568 Section 10.3: Quantitative Response and Predictors Following the analysis of these data in Fitting Equations to Data, by C. Daniel and F. S. Wood (WileyInterscience, New York, 1971), we consider instead the model ln Y x1 x2 x3 N 0 1x1 2x2 3x3 2, (10.3.20) i.e., we transform the response variable by taking its logarithm and use all of the data. Often, when models do not fit, simple transformations like this can lead to major im provements. In this case, we see a much improved normal probability plot, as provided in Figure 10.3.11. Normal Probability Plot of the Residuals (response is Loss1 2 2 1 0 1 2 Standardized Residual Figure 10.3.11: Normal probability plot of the standardized residuals for all the data using ln Y as the response. We also looked at plots of the standardized residuals against the various predic tors, and these looked reasonable. Figure 10.3.12 is a plot of the standardized residuals against the values of Air. Residuals Versus Air (response is Loss1 2 50 60 70 80 Air Figure 10.3.12: A plot of the standardized residuals for all the data, using ln Y as the response, against the values of the predictor Air. Chapter 10: Relationships Among Variables 569 Now that we have accepted the model (10.3.20), we can proceed to inferences about the unknowns of the model. The leastsquares estimates of the i their standard errors (Se), the corresponding tstatistics for testing the i 0, and the Pvalues for this are given in the following table. Coefficient 0 1 2 3 Estimate 0 948700 0 034565 0 063460 0 002864 Se |
0 647700 0 007343 0 020040 0 008510 tstatistic 1 46 4 71 3 17 0 34 Pvalue 0 161 0 000 0 006 0 742 The estimate of 2 is given by s2 0 0312. To test the null hypothesis that there is no relationship between the response and 0, we have the following 1 2 3 the predictors, or that, equivalently, H0 : ANOVA table. Source X1 X2 X3 Error Total Df 3 17 20 Sum of Squares Mean Square 4 9515 0 5302 5 4817 1 6505 0 0312 52 900 52 900 and when F The value of the Fstatistic is given by 1 6505 0 0312 F 3 17 we have that P F 0 000 So there is substantial evidence against the null hypothesis. To see how well the model explains the variation in the response, we computed the value of R2 86 9% Therefore, approximately 87% of the observed variation in Y can be explained by changes in the predictors in the model. While we have concluded that a relationship exists between the response and the predictors, it may be that some of the predictors have no relationship with the response. For example, the table of tstatistics above would seem to indicate that perhaps X3 (acid) is not affecting Y. We can assess this via the following ANOVA table, obtained N 0 by fitting the model ln Y x1 x2 x3 2x2 1x1 2 Source X1 X2 X3 X1 X2 Error Total Df 2 1 17 20 Sum of Squares Mean Square 4 9480 0 0035 0 5302 5 4817 2 4740 0 0035 0 0312 4 9480 3 0 112 4 9515 0 is 0 0035 0 0312 0 0035 The value of the Fstatistic Note that RSS X3 X1 X2 F 1 17 we for testing H0 : 0 742 So we have no evidence against the null hypothesis have that P F and can drop X3 from the model. Actually, this is the same Pvalue as obtained via the ttest of this null hypothesis, as, in general, the ttest that a single regression coefficient is 0 is equivalent to the Ftest. Similar tests of the need to include X1 and X2 do not lead us to drop these variables from the model. 0 112 and |
when F So based on the above results, we decide to drop X3 from the model and use the equation E Y X1 x1 X2 x2 0 7522 0 035402X1 0 06346X2 (10.3.21) 570 Section 10.3: Quantitative Response and Predictors to describe the relationship between Y and the predictors. Note that the leastsquares estimates of 1 and 2 in (10.3.21) are obtained by refitting the model without X3 0 Summary of Section 10.3 In this section, we examined the situation in which the response variable and the predictor variables are quantitative. In this situation, the linear regression model provides a possible description of the form of any relationship that may exist between the response and the predic tors. Least squares is a standard method for fitting linear regression models to data. The ANOVA is a decomposition of the total variation observed in the response variable into a part attributable to changes in the predictor variables and a part attributable to random error. If we assume a normal linear regression model, then we have inference methods available such as confidence intervals and tests of significance. In particular, we have available the Ftest to assess whether or not a relationship exists between the response and the predictors. A normal linear regression model is checked by examining the standardized residuals. EXERCISES 10.3.1 Suppose that x1 distribution, where [0 1] is unknown. What is the leastsquares estimate of the mean of this distribu xn is a sample from a Bernoulli tion? 10.3.2 Suppose that x1 ], where unknown. What is the leastsquares estimate of the mean of this distribution? 10.3.3 Suppose that x1, where unknown. What is the leastsquares estimate of the mean of this distribution? 10.3.4 Consider the n xn is a sample from the Exponential xn is a sample from the Uniform[0 11 data values in the following table. 0 is 0 is Observation 1 2 3 4 5 6 X 5 00 4 00 3 00 2 00 1 00 0 00 Y 10 00 8 83 9 15 4 26 0 30 0 04 Observation 7 8 9 10 11 X 1 00 2 00 3 00 4 00 5 00 Y 3 52 5 64 7 28 7 62 8 51 Suppose we consider the simple |
normal linear regression to describe the relationship between the response Y and the predictor X (a) Plot the data in a scatter plot. Chapter 10: Relationships Among Variables 571 (b) Calculate the leastsquares line and plot this on the scatter plot in part (a). (c) Plot the standardized residuals against X (d) Produce a normal probability plot of the standardized residuals. (e) What are your conclusions based on the plots produced in parts (c) and (d)? (f) If appropriate, calculate 0.95confidence intervals for the intercept and slope. (g) Construct the ANOVA table to test whether or not there is a relationship between the response and the predictors. What is your conclusion? (h) If the model is correct, what proportion of the observed variation in the response is explained by changes in the predictor? (i) Predict a future Y at X Determine the standard error of this prediction. (j) Predict a future Y at X Determine the standard error of this prediction. (k) Predict a future Y at X 20 0 Is this prediction an extrapolation or an interpola tion? Determine the standard error of this prediction. Compare this with the standard errors obtained in parts (i) and (j) and explain the differences. 11 data values in the following table. 10.3.5 Consider the n 6 0 Is this prediction an extrapolation or an interpolation? 0 0 Is this prediction an extrapolation or an interpolation? Observation 1 2 3 4 5 6 X 5 00 4 00 3 00 2 00 1 00 0 00 Y 65 00 39 17 17 85 7 74 2 70 0 04 Observation 7 8 9 10 11 X 1 00 2 00 3 00 4 00 5 00 Y 6 52 17 64 34 28 55 62 83 51 Suppose we consider the simple normal linear regression to describe the relationship between the response Y and the predictor X (a) Plot the data in a scatter plot. (b) Calculate the leastsquares line and plot this on the scatter plot in part (a). (c) Plot the standardized residuals against X (d) Produce a normal probability plot of the standardized residuals. (e) What are your conclusions based on the plots produced in parts (c) and (d)? (f) If appropriate, calculate 0.95confidence intervals for the intercept and slope. (g) Do the results |
of your analysis allow you to conclude that there is a relationship between Y and X? Explain why or why not. (h) If the model is correct, what proportion of the observed variation in the response is explained by changes in the predictor? 10.3.6 Suppose the following data record the densities of an organism in a containment vessel for 10 days. Suppose we consider the simple normal linear regression to describe the relationship between the response Y (density) and the predictor X (day) 572 Section 10.3: Quantitative Response and Predictors Day Number/Liter Day Number/Liter 1341 6 2042 9 7427 0 15571 8 33128 5 1 6 16 7 65 2 23 6 345 3 6 7 8 9 10 1 2 3 4 5 (a) Plot the data in a scatter plot. (b) Calculate the leastsquares line and plot this on the scatter plot in part (a). (c) Plot the standardized residuals against X (d) Produce a normal probability plot of the standardized residuals. (e) What are your conclusions based on the plots produced in parts (c) and (d)? (f) Can you think of a transformation of the response that might address any problems found? If so, repeat parts (a) through (e) after performing this transformation. (Hint: The scatter plot looks like exponential growth. What transformation is the inverse of exponentiation?) (g) Calculate 0.95confidence intervals for the appropriate intercept and slope. (h) Construct the appropriate ANOVA table to test whether or not there is a relationship between the response and the predictors. What is your conclusion? (i) Do the results of your analysis allow you to conclude that there is a relationship between Y and X? Explain why or why not. (j) Compute the proportion of variation explained by the predictor for the two models you have considered. Compare the results. 12 Is this prediction an extrapolation or an interpolation? (k) Predict a future Y at X 10.3.7 A student takes weekly quizzes in a course and receives the following grades over 12 weeks. Week Grade Week Grade 1 2 3 4 5 6 65 55 62 73 68 76 7 8 9 10 11 12 74 76 48 80 85 90 grade. (a) Plot the data in a scatter plot with X week and Y (b) Calculate the leastsquares line and plot this on the scatter plot in part ( |
a). (c) Plot the standardized residuals against X. (d) What are your conclusions based on the plot produced in (c)? (e) Calculate 0.95confidence intervals for the intercept and slope. (f) Construct the ANOVA table to test whether or not there is a relationship between the response and the predictors. What is your conclusion? (g) What proportion of the observed variation in the response is explained by changes in the predictor? Chapter 10: Relationships Among Variables 573 x Y exp 1 0 (Hint: Write Z E Y X 0 E Y X and use Theo Z, where X Y and Z are random variables. 10.3.8 Suppose that Y (a) Show that E Z X (b) Show that Cov E Y X Z rems 3.5.2 and 3.5.4.) (c) Suppose that Z is independent of X Show that this implies that the conditional distribution of Y given X depends on X only through its conditional mean. (Hint: Evaluate the conditional distribution function of Y given X 10.3.9 Suppose that X and Y are random variables such that a regression model de 2 X, then discuss scribes the relationship between Y and X If E Y X whether or not this is a simple linear regression model (perhaps involving a predictor other than X). 10.3.10 Suppose that X and Y are random variables and Corr(X Y 1 Does a simple linear regression model hold to describe the relationship between Y and X? If so, what is it? 10.3.11 Suppose that X and Y are random variables such that a regression model de 2 X 2, then discuss scribes the relationship between Y and X If E Y X whether or not this is a simple linear regression model (perhaps involving a predictor other than X). 10.3.12 Suppose that X Z. N 2 3 independently of Z Does this structure imply that the relationship between Y and X can be summarized by a simple linear regression model? If so, what are 1 10.3.13 Suppose that a simple linear model is fit to data. An analysis of the residuals indicates that there is no reason to doubt that the model is correct; the ANOVA test indicates that there is substantial evidence against the null hypothesis of no relationship between the response and predictor. The value of R2 is found to be 0.05. What is the interpretation of this number |
and what are the practical consequences? 2, and 2? N 0 1 and Y X 1 COMPUTER EXERCISES 10.3.14 Suppose we consider the simple normal linear regression to describe the re lationship between the response Y (income) and the predictor X (investment) for the data in Example 10.3.9. (a) Plot the data in a scatter plot. (b) Calculate the leastsquares line and plot this on the scatter plot in part (a). (c) Plot the standardized residuals against X (d) Produce a normal probability plot of the standardized residuals. (e) What are your conclusions based on the plots produced in parts (c) and (d)? (f) If appropriate, calculate 0.95confidence intervals for the intercept and slope. (g) Do the results of your analysis allow you to conclude that there is a relationship between Y and X? Explain why or why not. (h) If the model is correct, what proportion of the observed variation in the response is explained by changes in the predictor? 574 Section 10.3: Quantitative Response and Predictors 10.3.15 The following data are measurements of tensile strength (100 lb/in2) and hard ness (Rockwell E) on 20 pieces of diecast aluminum. Sample 1 2 3 4 5 6 7 8 9 10 Strength Hardness 293 349 340 340 340 354 322 334 247 348 53 70 78 55 64 71 82 67 56 86 Sample 11 12 13 14 15 16 17 18 19 20 Strength Hardness 298 292 380 345 257 265 246 286 324 282 60 51 95 88 51 54 52 64 83 56 Suppose we consider the simple normal linear regression to describe the relationship between the response Y (strength) and the predictor X (hardness). (a) Plot the data in a scatter plot. (b) Calculate the leastsquares line and plot this on the scatter plot in part (a). (c) Plot the standardized residuals against X (d) Produce a normal probability plot of the standardized residuals. (e) What are your conclusions based on the plots produced in parts (c) and (d)? (f) If appropriate, calculate 0.95confidence intervals for the intercept and slope. (g) Do the results of your analysis allow you to conclude that there is a relationship between Y and X? Explain why or why |
not. (h) If the model is correct, what proportion of the observed variation in the response is explained by changes in the predictor? 10.3.16 Tests were carried out to determine the effect of gas inlet temperature (degrees Fahrenheit) and rotor speed (rpm) on the tar content (grains/cu ft) of a gas stream, producing the following data. Observation 1 2 3 4 5 6 7 8 9 10 Tar 60 0 65 0 63 5 44 0 54 5 26 0 54 0 53 5 33 5 44 0 Speed Temperature 2400 2450 2500 2700 2700 2775 2800 2900 3075 3150 54 5 58 5 58 0 62 5 68 0 45 5 63 0 64 5 57 0 64 0 Suppose we consider the normal linear regression model Y W X x N 1 2 2 3x Chapter 10: Relationships Among Variables 575 to describe the relationship between Y (tar content) and the predictors W (rotor speed) and X (temperature). (a) Plot the response in scatter plots against each predictor. (b) Calculate the leastsquares equation. (c) Plot the standardized residuals against W and X (d) Produce a normal probability plot of the standardized residuals. (e) What are your conclusions based on the plots produced in parts (c) and (d)? (f) If appropriate, calculate 0.95confidence intervals for the regression coefficients. (g) Construct the ANOVA table to test whether or not there is a relationship between the response and the predictors. What is your conclusion? (h) If the model is correct, what proportion of the observed variation in the response is explained by changes in the predictors? (i) In an ANOVA table, assess the null hypothesis that there is no effect due to W given that X is in the model. (j) Estimate the mean of Y when W 2750 and X 50 0 If we consider this value as a prediction of a future Y at these settings, is this an extrapolation or interpolation? 10.3.17 Suppose we consider the normal linear regression model Y X x N 1 2x 3x 2 2 for the data of Exercise 10.3.5. (a) Plot the response Y in a scatter plot against X. (b) Calculate the leastsquares equation. (c) Plot the standardized residuals against X (d) Produce a |
normal probability plot of the standardized residuals. (e) What are your conclusions based on the plots produced in parts (c) and (d)? (f) If appropriate, calculate 0.95confidence intervals for the regression coefficients. (g) Construct the ANOVA table to test whether or not there is a relationship between the response and the predictor. What is your conclusion? (h) If the model is correct, what proportion of the observed variation in the response is explained by changes in the predictors? (i) In an ANOVA table, assess the null hypothesis that there is no effect due to X 2 given that X is in the model. (j) Compare the predictions of Y at X and using the linear model with a linear and quadratic term. 6 using the simple linear regression model PROBLEMS 10.3.18 Suppose that x1 xn is a sample from the mixture distribution 0 5Uniform[0 1] 0 5Uniform[2 ] where distribution? 2 is unknown. What is the leastsquares estimate of the mean of this 576 Section 10.3: Quantitative Response and Predictors 10.3.19 Consider the simple linear regression model and suppose that for the data col lected, we have 0 Explain how, and for which value of x, you would estimate E Y X 10.3.20 For the simple linear regression model, under the assumptions of Theorem 10.3.3, establish that n i 1 xi x 2 x Cov Yi B1 B2xi Y j B1 B2x j X1 x1 Xn xn 2 i j 2 1 n xi x j x n k 1 xk x x 2 1 when i j and is 0 otherwise. (Hint: Use Theorems 3.3.2 and 10.3.3.) in the where i j 10.3.21 Establish that (10.3.11) is distributed N 0 1 when S is replaced by denominator. (Hint: Use Theorem 4.6.1 and Problem 10.3.20.) 10.3.22 (Prediction intervals) Under the assumptions of Theorem 10.3.6, prove that the interval b1 b2x s 1 1 n 1 2 x 2 xi n k 1 xk x 2 t 1 2 n 2 based on independent x1 y1 for a future independent X Y with |
X xn yn will contain Y with probability equal to x (Hint: Theorems 4.6.1 and 3.3.2 and Corollary 10.3.1.) 10.3.23 Consider the regression model with no intercept, given by E Y X x R1 is unknown. Suppose we observe the independent values x1 y1 x,where xn yn (a) Determine the leastsquares estimate of (b) Prove that the leastsquares estimate b of 2 prove that is unbiased and, when Var Y X x Var B X1 x1 Xn xn 2 n i 1 x 2 i (c) Under the assumptions given in part (b), prove that s2 n 1 n 1 i 1 yi 2 bxi 2 is an unbiased estimator of (d) Record an appropriate ANOVA decomposition for this model and a formula for R2 measuring the proportion of the variation observed in Y due to changes in X (e) When Y X xn yn and we observe the independent values x1 y1 2 x prove that f) Under the assumptions of part (e), and assuming that n 1 independent of B (this can be proved), indicate how you would test the null hypothesis of no relationship between Y and X 1 S2 2 2 n Chapter 10: Relationships Among Variables 577 (g) How would you define standardized residuals for this model and use them to check model validity? 10.3.24 For data x1 y1 then prove that if 2x and 2 2 equals xn yn 2 1 1 1 2xi n i 1 yi n i 1 yi xi x 2 2 2 n i 1 xi x yi y. 2 n i 1 xi n i 1 xi y x yi N 1 1 and 2 respectively. From this, deduce that y and a squares of 10.3.25 For the model discussed in Section 10.3.3, prove that the prior given by 1 2 2 2 leads to the posterior distribution stated there. Conclude that this prior is conjugate with the poste rior distribution, as specified. (Hint: The development is similar to Example 7.1.4, as detailed in Section 7.5.) 10.3.26 For the model specified in Section 10.3.3, prove that when 1 Gamma |
N 2 and 1 x 2 are the least 2 1 2 2 2 2 2, and 2 x y n 2 0 the posterior distribution of n 1 2 Z, where Z t 2 2 1 is given by the distribution of y a2c2 x 2 c2 y n and x y CHALLENGES 10.3.27 If X1 that Xn is a sample from a distribution with finite variance, then prove Xi X n k 1 Xk 2 X a s 0 10.4 Quantitative Response and Categorical Predictors In this section, we consider the situation in which the response is quantitative and the predictors are categorical. There can be many categorical predictors, but we restrict our discussion to at most two, as this gives the most important features of the general case. The general case is left to a further course. 10.4.1 One Categorical Predictor (OneWay ANOVA) Suppose now that the response Y is quantitative and the predictor X is categorical, a. With the regression model, we assume that taking a values or levels denoted 1 the only aspect of the conditional distribution of Y, given X x that changes as x changes, is the mean. We let E Y X i i denote the mean response when the predictor X is at level i. Note that this is immedi ately a linear regression model. 578 Section 10.4: Quantitative Response and Categorical Predictors We introduce the dummy variables Xi 1 0 X X i i 1 a. Notice that, whatever the value is of the response Y, only one of the for i dummy variables takes the value 1, and the rest take the value 0. Accordingly, we can write E Y X1 x1 Xa xa 1x1 a xa because one and only one of the xi 1 whereas the rest are 0. This has exactly the same form as the model discussed in Section 10.3.4, as the Xi are quantitative. As such, all the results of Section 10.3.4 immediately apply (we will restate relevant results here). Inferences About Individual Means Now suppose that we observe ni values yi1 i and all the re sponse values are independent. Note that we have a independent samples. The least squares estimates of the i are obtained by minimizing yini when X a ni i 1 j 1 yi j 2 i The leastsquares estimates are then equal to (see Problem 10. |
4.14) bi yi 1 ni ni j 1 yi j These can be shown to be unbiased estimators of the i. Assuming that the conditional distributions of Y given X x all have variance equal to 2 we have that the conditional variance of Yi is given by 2 ni and the conditional covariance between Yi and Y j when i is 0. Furthermore, under these 2 is given by conditions, an unbiased estimator of j s2 1 N a a ni i 1 j 1 yi j 2 yi where N n1 nk If, in addition, we assume the normal linear regression model, namely then Yi Definition 4.6.2, 2 ni independent of N a S2 2 2 N a Therefore, by T Yi S i ni t N a, Chapter 10: Relationships Among Variables 579 which leads to a confidence interval of the form yi s ni t 1 2 N a for i Also, we can test the null hypothesis H0 : P T yi s i0 ni 2 1 G i yi s i0 by computing the Pvalue i0 ni N a N a is the cdf of the t N a distribution. Note that these inferences where G are just like those derived in Section 6.3 for the locationscale normal model, except we now use a different estimator of 2 (with more degrees of freedom). Inferences about Differences of Means and Two Sample Inferences Often we want to make inferences about a difference of means E Yi Y j j and i i j. Note that Var Yi Y j Var Yi Var Y j 2 1 ni 1 n j because Yi and Y j are independent. By Theorem 4.6.1, Yi Y j N i 2 1 ni j 1 n j. Furthermore, independent of N a S2 Yi Y j 1 ni. Therefore, by Definition 4.6.2, T Yi Y j 1 ni i 1 n j j 1 2 N a S2 2 N a Yi Y j S 1 ni 10.4.1) This leads to the confidence interval yi y j s 1 ni 1 n j t 1 2 N a for the difference of means that the difference in the means equals 0, by computing the Pvalue j. We can test the null hypothesis H0 : i i j, i.e., P T yi y j s 1 ni 1 n |
j 2 1 G yi y j s 1 ni 1 n j N a. 580 Section 10.4: Quantitative Response and Categorical Predictors When a 2 i.e., there are just two values for X we refer to (10.4.1) as the twosample tstatistic, and the corresponding inference procedures are called the two sample tconfidence interval and the twosample ttest for the difference of means. In this case, if we conclude that 2, then we are saying that a relationship exists between Y and X 1 The ANOVA for Assessing a Relationship with the Predictor 2 we are interested in assessing whether or not Suppose, in the general case when a there is a relationship between the response and the predictor. There is no relationship if and only if all the conditional distributions are the same; this is true, under our assumptions, if and only if a i.e., if and only if all the means are equal. So testing the null hypothesis that there is no relationship between the response and the predictor is equivalent to testing the null hypothesis H0 : for some unknown a 1 1 If the null hypothesis is true, the leastsquares estimate of is given by y the overall average response value. In this case, we have that the total variation decomposes as (see Problem 10.4.15) a ni i 1 j 1 yi j y 2 a i 1 ni yi y 2 a ni i 1 j 1 yi j 2 yi and so the relevant ANOVA table for testing H0 is given below. Source X Error Total Df a 1 N a N 1 Sum of Squares a y 2 i 1 ni yi a i a i ni j 1 yi j ni j 1 yi j 2 yi y 2 Mean Square a i 1 ni yi y 2 a 1 s2 To assess H0 we use the Fstatistic F a i 1 ni yi y 2 a 1 s2 because, under the null hypothesis, both the numerator and the denominator are un 2 When the null hypothesis is false, the numerator tends to be biased estimators of larger than 2. When we add the normality assumption, we have that F 1 N F a a, and so we compute the Pvalue P F a i 1 ni yi y 2 a 1 s2 to assess whether the observed value of F is so large as to be surprising. Note |
that when a 2, this Pvalue equals the Pvalue obtained via the twosample ttest. Chapter 10: Relationships Among Variables 581 Multiple Comparisons If we reject the null hypothesis of no differences among the means, then we want to see where the differences exist. For this, we use inference methods based on (10.4.1). Of course, we have to worry about the problem of multiple comparisons, as discussed in Section 9.3. Recall that this problem arises whenever we are testing many null hypotheses using a specific critical value, such as 5%, as a cutoff for a Pvalue, to decide whether or not a difference exists. The cutoff value for an individual Pvalue is referred to as the individual error rate. In effect, even if no differences exist, the probability of concluding that at least one difference exists, the family error rate, can be quite high. There are a number of procedures designed to control the family error rate when making multiple comparisons. The simplest is to lower the individual error rate, as the family error rate is typically an increasing function of this quantity. This is the approach we adopt here, and we rely on statistical software to compute and report the family error rate for us. We refer to this procedure as Fisher’s multiple comparison test. Model Checking To check the model, we look at the standardized residuals (see Problem 10.4.17) given by yi j s 1 yi 1 ni (10.4.2) We will restrict our attention to various plots of the standardized residuals for model checking. We now consider an example. EXAMPLE 10.4.1 A study was undertaken to determine whether or not eight different types of fat are absorbed in different amounts during the cooking of donuts. Results were collected based on cooking six different donuts and then measuring the amount of fat in grams absorbed. We take the variable X to be the type of fat and use the model of this section. The collected data are presented in the following table. Fat 1 Fat 2 Fat 3 Fat 4 Fat 5 Fat 6 Fat 7 Fat 8 164 172 177 178 163 163 150 164 177 197 184 196 177 193 179 169 168 167 187 177 144 176 146 155 156 161 169 181 165 172 141 149 172 180 179 184 166 176 169 170 195 190 197 191 178 178 183 167 A normal probability plot of the standardized residuals is provided in Figure 10.4.1. A plot of the standardized residuals against |
type of fat is provided in Figure 10.4.2. 582 Section 10.4: Quantitative Response and Categorical Predictors Neither plot gives us significant grounds for concern over the validity of the model, although there is some indication of a difference in the variability of the response as the type of fat changes. Another useful plot in this situation is a sidebyside boxplot, as it shows graphically where potential differences may lie. Such a plot is provided in Figure 10.4.3. The following table gives the mean amounts of each fat absorbed. Fat 1 172 00 Fat 2 177 83 Fat 3 182 17 Fat 4 184 50 Fat 5 165 50 Fat 6 176 33 Fat 7 161 33 Fat 8 162 33 The grand mean response is given by 172.81 2 2 1 0 Normal Score 1 2 Figure 10.4.1: Normal probability plot of the standardized residuals in Example 10.4.11 2 1 2 3 4 5 6 7 8 Type of Fat Figure 10.4.2: Standardized residuals versus type of fat in Example 10.4.1. Chapter 10: Relationships Among Variables 583 200 190 180 Y 170 160 150 140 1 2 3 4 5 6 7 8 Type of Fat Figure 10.4.3: Sidebyside boxplots of the response versus type of fat in Example 10.4.1. To assess the null hypothesis of no differences among the types of fat, we calculate the following ANOVA table. Source Df 7 40 47 X Error Total Sum of Squares Mean Square 3344 5799 9143 478 145 Then we use the Fstatistic given by F under H0 we obtain the Pvalue P F there is a difference among the fat types at the 0.05 level. 478 145 3 3 3 3 Because F F 7 40 0 007 Therefore, we conclude that To ascertain where the differences exist, we look at all pairwise differences. There are 8 7 2 28 such comparisons. If we use the 0.05 level to determine whether or not a difference among means exists, then software computes the family error rate as 0.481, which seems uncomfortably high. When we use the 0.01 level, the family error rate falls to 0.151. With the individual error rate at 0.003, the family error rate is 0.0546. Using the individual error rate of 0.003, the only differences |
detected among the means are those between Fat 4 and Fat 7, and Fat 4 and Fat 8. Note that Fat 4 has the highest absorption whereas Fats 7 and 8 have the lowest absorptions. Overall, the results are somewhat inconclusive, as we see some evidence of dif ferences existing, but we are left with some anomalies as well. For example, Fats 4 and 5 are not different and neither are Fats 7 and 5, but Fats 4 and 7 are deemed to be different. To resolve such conicts requires either larger sample sizes or a more refined experiment so that the comparisons are more accurate. 584 Section 10.4: Quantitative Response and Categorical Predictors 10.4.2 Repeated Measures (Paired Comparisons) Consider k quantitative variables Y1 Suppose that our purpose is to compare the distributions of these variables. Typically, these will be similar variables, all measured in the same units. Yk defined on a population EXAMPLE 10.4.2 Suppose that is a set of students enrolled in a firstyear program requiring students to take both calculus and physics, and we want to compare the marks achieved in these subjects. If we let Y1 denote the calculus grade and Y2 denote the physics grade, then we want to compare the distributions of these variables. EXAMPLE 10.4.3 Suppose we want to compare the distributions of the duration of headaches for two treatments A and B) in a population of migraine headache sufferers. We let Y1 denote the duration of a headache after being administered treatment A and let Y2 denote the duration of a headache after being administered treatment B. Yk involves taking a random sample The repeatedmeasures approach to the problem of comparing the distributions of i, Y1 obtaining the kdimensional value Y1 yi k. This gives a sample of n from a kdimensional distribution. Obviously, this is called repeated i on the same measures because we are taking the measurements Y1 n from and, for each 1 Yk yi1 Yk i i i i. An alternative to repeated measures is to take k independent samples from and, for each of these samples, to obtain the values of one and only one of the vari ables Yi. There is an important reason why the repeatedmeasures approach is pre ferred: We expect less variation in the values of differences, like Yi Y j under repeatedmeasures sampling, |
than we do under independent sampling because the val ues Y1 are being taken on the same member of the population in re Yk peated measures. To see this more clearly, suppose all of the variances and covariances exist for the joint distribution of Y1 Yk. This implies that Var Yi Y j Var Yi Var Y j 2 Cov Yi Y j. (10.4.3) Because Yi and Y j are similar variables, being measured on the same individual, we expect them to be positively correlated. Now with independent sampling, we have that Var Yi, so the variances of differences should be smaller Var Yi with repeated measures than with independent sampling. Var Yi Y j When we assume that the distributions of the Yi differ at most in their means, then it j In the repeatedmeasures context, makes sense to make inferences about the differences of the population means using the differences of the sample means yi we can write y j i yi y j 1 n n l 1 yli yl j. Chapter 10: Relationships Among Variables 585 Because the individual components of this sum are independent and so, Var Yi Y j Var Yi Var Y j n 2 Cov Yi Y j We can consider the differences d1 y1i y1 j dn yni of n from a onedimensional distribution with mean i yi (10.4.3). Accordingly, we estimate j by d i j and variance y j and estimate ynj to be a sample 2 given by 2 by s2 n 1 n 1 i 1 di 2. d (10.4.4) If we assume that the joint distribution of Y1 Yk is multivariate normal (this means that any linear combination of these variables is normally distributed — see 2. Problem 9.1.18), then this forces the distribution of Yi Accordingly, we have all the univariate techniques discussed in Chapter 6 for inferences about Y j to be N i j i j The discussion so far has been about whether the distributions of variables differed. Assuming these distributions differ at most in their means, this leads to a comparison of the means. We can, however, record an observation as X Y where X takes values k and X in 1 Yi Then the conditional distribution of Y i is the same as the distribution of Yi. Therefore, if we conclude that the given X distributions of the Yi are different, we can conclude that a relationship exists between Y and X In Example 10.4.2, this |
means that a relationship exists between a student’s grade and whether or not the grade was in calculus or physics. In Example 10.4.3, this means that a relationship exists between length of a headache and the treatment. i means that Y When can we assert that such a relationship is in fact a cause–effect relationship? Applying the discussion in Section 10.1.2, we know that we have to be able to assign the value of X to a randomly selected element of the population. In Example 10.4.2, we see this is impossible, so we cannot assert that such a relationship is a cause–effect In Example 10.4.3, however, we can indeed do this — namely, for a relationship. randomly selected individual, we randomly assign a treatment to the first headache experienced during the study period and then apply the other treatment to the second headache experienced during the study period. A full discussion of repeated measures requires more advanced concepts in statis 2 tics. We restrict our attention now to the presentation of an example when k which is commonly referred to as paired comparisons. EXAMPLE 10.4.4 Blood Pressure Study The following table came from a study of the effect of the drug captopril on blood pressure, as reported in Applied Statistics, Principles and Examples by D. R. Cox and E. J. Snell (Chapman and Hall, London, 1981). Each measurement is the difference in the systolic blood pressure before and after having been administered the drug. 9 31 23 4 17 33 21 26 19 3 26 19 20 10 23 586 Section 10.4: Quantitative Response and Categorical Predictors Figure 10.4.4 is a normal probability plot for these data and, because this looks rea sonable, we conclude that the inference methods based on the assumption of normality are acceptable. Note that here we have not standardized the variable first, so we are only looking to see if the plot is reasonably straight1 2 32 24 8 Blood pressure difference 16 0 Figure 10.4.4: Normal probability plot for the data in Example 10.4.4. The mean difference is given by d 9 03 Accordingly, the standard error of the estimate of the difference in the means, using (10.4.4), is given by s 2 33 A 0 95confidence interval for the difference in the mean systolic blood pressure |
, before and after being administered captopril, is then 18 93 with standard deviation s 15 d s n t0 975 n 1 18 93 2 33 t0 975 14 23 93 13 93 Because this does not include 0, we reject the null hypothesis of no difference in the means at the 0.05 level. The actual Pvalue for the twosided test is given by P T 18 93 2 33 0 000 because T t 14 under the null hypothesis H0 that the means are equal. Therefore, we have strong evidence against H0. It seems that we have strong evidence that the drug is leading to a drop in blood pressure. 10.4.3 Two Categorical Predictors (TwoWay ANOVA) Now suppose that we have a single quantitative response Y and two categorical pre dictors A and B where A takes a levels and B takes b levels. One possibility is to consider running two onefactor studies. One study will examine the relationship be tween Y and A, and the second study will examine the relationship between Y and B There are several disadvantages to such an approach, however. First, and perhaps foremost, doing two separate analyses will not allow us to de termine the joint relationship A and B have with Y This relates directly to the concept Chapter 10: Relationships Among Variables 587 of interaction between predictors. We will soon define this concept more precisely, but basically, if A and B interact, then the conditional relationship between Y and A given B j, changes in some substantive way as we change j. If the predictors A and B do not interact, then indeed we will be able to examine the relationship between the response and each of the predictors separately. But we almost never know that this is the case beforehand and must assess whether or not an interaction exists based on collected data. A second reason for including both predictors in the analysis is that this will often lead to a reduction in the contribution of random error to the results. By this, we mean that we will be able to explain some of the observed variation in Y by the inclusion of the second variable in the model. This depends, however, on the additional variable having a relationship with the response. Furthermore, for the inclusion of a second variable to be worthwhile, this relationship must be strong enough to justify the loss in degrees of freedom available for the estimation of the contribution of random error to the experimental results. As we will see, including the second variable in |
the analysis results in a reduction in the degrees of freedom in the Error row of the ANOVA table. Degrees of freedom are playing the role of sample size here. The fewer the degrees of freedom in the Error row, the less accurate our estimate of 2 will be. When we include both predictors in our analysis, and we have the opportunity to determine the sampling process, it is important that we cross the predictors. By this, we mean that we observe Y at each combination A B i j 1 a 1 b. Suppose, then, that we have ni j response values at the A B predictors. Then, letting i j setting of the E Y A B i j i j be the mean response when A i and B j, and introducing the dummy variables Xi j 1 0 A A j i B i or B j we can write E Y Xi j 11x11 21x21 abxab xi j for all i b a j i j xi j i 1 j 1 The relationship between Y and the predictors is completely encompassed in the changes in the i j as i and j change. From this, we can see that a regression model for this sit uation is immediately a linear regression model. 588 Section 10.4: Quantitative Response and Categorical Predictors Inferences About Individual Means and Differences of Means Now let yi jk denote the kth response value when Xi j the leastsquares estimate of i j is given by 1 Then, as in Section 10.4.1, bi j yi j 1 ni j ni j k 1 yi jk the mean of the observations when Xi j 1 If in addition we assume that the condi tional distributions of Y given the predictors all have variance equal to 2, then with N nab we have that n11 n21 s2 1 N ab a b ni j i 1 j 1 k 1 yi jk 2 yi j (10.4.5) is an unbiased estimator of ni j given by s 2 Therefore, using (10.4.5), the standard error of yi j is of With the normality assumption, we have that Yi j N i j 2 ni j independent N ab S2 2 2 N ab This leads to the confidence intervals for i j and yi j yi j ykl s s ni j 1 ni j t 1 2 N ab 1 nkl t 1 2 N ab for the |
difference of means i j kl The ANOVA for Assessing Interaction and Relationships with the Predictors We are interested in whether or not there is any relationship between Y and the pre dictors. There is no relationship between the response and the predictors if and only if all the i j are equal. Before testing this, however, it is customary to test the null hypothesis that there is no interaction between the predictors. The precise definition of no interaction here is that i j i j i and j for all i and j for some constants i.e., the means can be expressed additively. j and let A vary, then these response curves (a response curve Note that if we fix B is a plot of the means of one variable while holding the value of the second variable fixed) are all parallel. This is an equivalent way of saying that there is no interaction between the predictors. Chapter 10: Relationships Among Variables 589 In Figure 10.4.5, we have depicted response curves in which the factors do not in teract, and in Figure 10.4.6 we have depicted response curves in which they do. Note that the solid lines, for example, joining 11 and 21 are there just to make it easier to display the parallelism (or lack thereof) and have no other significance. E(Y | A, B) 12 11 • • 1 • • 2 • B = 2 • B = 1 3 A Figure 10.4.5: Response curves for expected response with two predictors, with A taking three levels and B taking two levels. Because they are parallel, the predictors do not interact. E(Y | A, B) 12 11 • • 1 • • 2 B = 2 B = 1 • • 3 A Figure 10.4.6: Response curves for expected response with two predictors, with A taking three levels and B taking two levels. They are not parallel, so the predictors interact. i j i j To test |
the null hypothesis of no interaction, we must first fit the model where i.e., find the leastsquares estimates of the i j under these constraints. We will not pursue the mathematics of obtaining these estimates here, but rely on software to do this for us and to compute the sum of squares relevant for testing the null hypothesis of no interaction (from the results of Section 10.3.4, we know that this 590 Section 10.4: Quantitative Response and Categorical Predictors is obtained by differencing the regression sum of squares obtained from the full model and the regression sums of squares obtained from the model with no interaction). If we decide that an interaction exists, then it is immediate that both A and B have an effect on Y (if A does not have an effect, then A and B cannot interact — see Problem 10.4.16); we must look at differences among the yi j to determine the form of the relationship. If we decide that no interaction exists, then A has an effect if and only if the j vary. We can test the null hypothesis H0 : a of no effect due to A and the null hypothesis b of no effect due to V separately, once we have decided that no H0 : 1 interaction exists. i vary, and B has an effect if and only if the 1 The details for deriving the relevant sums of squares for all these hypotheses are not covered here, but many statistical packages will produce an ANOVA table, as given below. Source Df A B A Error 1 1 1 b a b a N ab B Total N 1 1 Sum of Squares RSS A RSS B RSS ni j k 1 yi jk ni j k 1 yi jk 2 yi j y 2 Note that if we had included only A in the model, then there would be N of freedom for the estimation of a b 2 By including B, we lose N a 2 1 degrees of freedom for the estimation of a degrees N ab Using this table, we first assess the null hypothesis H0 : no interaction between A and B using F F a 1 b 1 N ab under H0 via the Pvalue RSS A B P F a s2 1 b 1 where s2 is given by (10.4.5). If we decide that no interaction exists, then we assess the null hypothesis H0 : no effect due to A using F ab under H0, |
via the Pvalue 1 N F a RSS A a 1 P F and assess H0 : no effect due to B using F Pvalue RSS B P F Model Checking s2 s2 F b 1 N ab under H0 via the b 1. To check the model, we look at the standardized residuals given by (see Problem 10.4.18) yi jk s 1 yi j 1 ni j (10.4.6) Chapter 10: Relationships Among Variables 591 We will restrict our attention to various plots of the standardized residuals for model checking. We consider an example of a twofactor analysis. EXAMPLE 10.4.5 The data in the following table come from G. E. P. Box and D. R. Cox, “An analysis of transformations” (Journal of the Royal Statistical Society, 1964, Series B, p. 211) and represent survival times, in hours, of animals exposed to one of three different types of poisons and allocated four different types of treatments. We let A denote the treatments 12 different A B combinations. and B denote the type of poison, so we have 3 Each combination was administered to four different animals; i.e., ni j 4 for every i and j 4 A1 A2 8 2 11 12 4 3 0 3 7 3 8 2 9 A3 A4 10 B1 B2 B3 A normal probability plot for these data, using the standardized residuals after fit ting the twofactor model, reveals a definite problem. In the above reference, a trans formation of the response to the reciprocal 1 Y is suggested, based on a more sophis ticated analysis, and this indeed leads to much more appropriate standardized residual plots. Figure 10.4.7 is a normal probability plot for the standardized residuals based on the reciprocal response. This normal probability plot looks reasonable1 2 2 1 0 Normal Scores 1 2 Figure 10.4.7: Normal probability plot of the standardized residuals in Example 10.4.5 using the reciprocal of the response. Figure 10.4.8 is a plot of the standardized residuals against the various A B j with j 1 2 3 This coding assigns a unique integer to each j and is convenient when comparing scatter plots of the response for combinations, where we have coded the combination i b 3 i combination i 1 2 3 4 and j as b i 1 592 Section |
10.4: Quantitative Response and Categorical Predictors each treatment. Again, this residual plot looks reasonable1 2 1 2 3 5 4 6 (Treatment, Poison) 7 8 9 10 11 12 Figure 10.4.8: Scatter plot for the data in Example 10.4.5 of the standardized residuals against each value of A B using the reciprocal of the response. Below we provide the leastsquares estimates of the i j for the transformed model. A1 0 24869 0 32685 0 48027 A2 0 11635 0 13934 0 30290 A3 0 18627 0 27139 0 42650 A4 0 16897 0 17015 0 30918 B1 B2 B3 The ANOVA table for the data, as obtained from a standard statistical package, is given below. Source Df 3 A 2 B 6 A 36 Error 47 Total B Sum of Squares Mean Square 0 20414 0 34877 0 01571 0 08643 0 65505 0 06805 0 17439 0 00262 0 00240 From this, we determine that s errors of the leastsquares estimates are all equal to s 2 0 00240 4 89898 10 2, and so the standard 0 0244949 To test the null hypothesis of no interaction between A and B, we have, using F F 6 36 under H0 the Pvalue P F 0 00262 0 00240 P F 1 09 0 387 We have no evidence against the null hypothesis. So we can go on to test the null hypothesis of no effect due to A and we have, using F F 2 36 under H0 the Pvalue P F 0 06805 0 00240 P F 28 35 0 000 Chapter 10: Relationships Among Variables 593 We reject this null hypothesis. Similarly, testing the null hypothesis of no effect due to B, we have, using F F 2 36 under H0 the Pvalue P F 0 17439 0 00240 P F 72 66 0 000 We reject this null hypothesis as well. Accordingly, we have decided that the appropriate model is the additive model j (we are still using the transformed j given by E 1 Y A B response 1 Y ) We can also write this as for any choice of Therefore, there is no unique estimate of the additive effects due to A or B However, we still have unique leastsquares estimates of the means, which are obtained (using software) by fitting the model with |
constraints on the i j corresponding to no interaction existing. These are recorded in the following table. A1 0 26977 0 31663 0 46941 A2 0 10403 0 15089 0 30367 A3 0 21255 0 25942 0 41219 A4 0 13393 0 18080 0 33357 B1 B2 B3 As we have decided that there is no interaction between A and B we can assess singlefactor effects by examining the response means for each factor separately. For example, the means for investigating the effect of A are given in the following table. A1 0 352 A2 0 186 A3 0 295 A4 0 216 We can compare these means using procedures based on the tdistribution. For exam ple, a 0.95confidence interval for the difference in the means at levels A1 and A2 is given by y1 y2 s 12 t0 975 36 0 352 0 186 0 00240 12 2 0281 0 13732 0 19468 (10.4.7) This indicates that we would reject the null hypothesis of no difference between these means at the 0 05 level. Notice that we have used the estimate of 2 based on the full model in (10.4.7). Logically, it would seem to make more sense to use the estimate based on fitting the additive model because we have decided that it is appropriate. When we do so, this is referred to as pooling, as it can be shown that the new error estimate is calculated by adding RSS A B degrees of freedom and the error degrees of freedom. Not to pool is regarded as a somewhat more conservative procedure. B to the original ESS and dividing by the sum of the A 594 Section 10.4: Quantitative Response and Categorical Predictors 10.4.4 Randomized Blocks With twofactor models, we generally want to investigate whether or not both of these factors have a relationship with the response Y Suppose, however, that we know that a factor B has a relationship with Y, and we are interested in investigating whether or not another factor A has a relationship with Y. Should we run a singlefactor experiment using the predictor A or run a twofactor experiment including the factor B? The answer is as we have stated at the start of Section 10.4.2. Including the factor B will allow us, if B accounts for a lot of the observed variation, to make more accurate comparisons. |
Notice, however, that if B does not have a substantial effect on Y then its inclusion will be a waste, as we sacrificed a b 1 degrees of freedom that would otherwise go toward the estimation of 2. So it is important that we do indeed know that B has a substantial effect. In such a case, we refer to B as a blocking variable. It is important again that the blocking variable B be crossed with A Then we can test for any effect due to A by first testing for an interaction between A and B; if no such interaction is found, then we test for an effect due to A alone, just as we have discussed in Section 10.4.3. A special case of using a blocking variable arises when we have ni j 1 for all i and ab so there are no degrees of freedom available for the estimation j In this case, N of error. In fact, we have that (see Problem 10.4.19) s2 0 Still, such a design has practical value, provided we are willing to assume that there is no interaction between A and B This is called a randomized block design. For a randomized block design, we have that s2 RSS A a 1 b B 1 (10.4.8) 2, and so we have a is an unbiased estimate of 1 degrees of freedom for the estimation of error. Of course, this will not be correct if A and B do interact, but when they do not, this can be a highly efficient design, as we have removed the effect of the variation due to B and require only ab observations for this. When the randomized block design is appropriate, we test for an effect due to A, using F F a 1 under H0 via the Pvalue 1 b 1 b 1 a P F RSS A a 1 s2. 10.4.5 One Categorical and One Quantitative Predictor It is also possible that the response is quantitative while some of the predictors are categorical and some are quantitative. We now consider the situation where we have one categorical predictor A taking a values, and one quantitative predictor W. We assume that the regression model applies. Furthermore, we restrict our attention to the situation where we suppose that, within each level of A the mean response varies as E Y A W i i1 i2 Chapter 10: Relationships Among Variables 595 so that we have a simple linear regression model within each level of A. If |
we introduce the dummy variables Xi j W j 1 0 A A i i for i 1 a and j 1 2 then we can write the linear regression model as E Y Xi j xi j 11x11 12x12 a1xa1 a2xa2 i1 is the intercept and i2 is the slope specifying the relationship between Y and i The methods of Section 10.3.4 are then available for inference about Here, W when A this model. We also have a notion of interaction in this context, as we say that the two pre dictors interact if the slopes of the lines vary across the levels of A So saying that no interaction exists is the same as saying that the response curves are parallel when graphed for each level of A If an interaction exists, then it is definite that both A and W have an effect on Y Thus the null hypothesis that no interaction exists is equivalent to H0 : a2 12 If we decide that no interaction exists, then we can test for no effect due to W by testing the null hypothesis that the common slope is equal to 0, or we can test the null hypothesis that there is no effect due to A by testing H0 : a1 i.e., that the intercept terms are the same across the levels of A 11 We do not pursue the analysis of this model further here. Statistical software is available, however, that will calculate the relevant ANOVA table for assessing the var ious null hypotheses. Analysis of Covariance Suppose we are running an experimental design and for each experimental unit we can measure, but not control, a quantitative variable W that we believe has an effect on the response Y If the effect of this variable is appreciable, then good statistical practice suggests we should include this variable in the model, as we will reduce the contri bution of error to our experimental results and thus make more accurate comparisons. Of course, we pay a price when we do this, as we lose degrees of freedom that would otherwise be available for the estimation of error. So we must be sure that W does have a significant effect in such a case. Also, we do not test for an effect of such a variable, as we presumably know it has an effect. This technique is referred to as the analysis of covariance and is obviously similar in nature to the use of blocking variables. Summary of Section 10.4 We considered the situation involving a quantitative response and categorical predictor variables. By the introduction of |
dummy variables for the predictor variables, we can con sider this situation as a particular application of the multiple regression model of Section 10.3.4. 596 Section 10.4: Quantitative Response and Categorical Predictors If we decide that a relationship exists, then we typically try to explain what form this relationship takes by comparing means. To prevent finding too many statistically significant differences, we lower the individual error rate to ensure a sensible family error rate. When we have two predictors, we first check to see if the factors interact. If the two predictors interact, then both have an effect on the response. A special case of a twoway analysis arises when one of the predictors serves as a blocking variable. It is generally important to know that the blocking variable has an effect on the response, so that we do not waste degrees of freedom by including it. Sometimes we can measure variables on individual experimental units that we know have an effect on the response. In such a case, we include these variables in our model, as they will reduce the contribution of random error to the analysis and make our inferences more accurate. EXERCISES 10.4.1 The following values of a response Y were obtained for three settings of a categorical predictor A A A A 1 2 3 2 9976 0 7468 2 1192 0 3606 1 3308 2 3739 4 7716 2 2167 0 3335 1 5652 0 3184 3 3015 Suppose we assume the normal regression model for these data with one categorical predictor. (a) Produce a sidebyside boxplot for the data. (b) Plot the standardized residuals against A (if you are using a computer for your cal culations, also produce a normal probability plot of the standardized residuals) Does this give you grounds for concern that the model assumptions are incorrect? (c) Carry out a oneway ANOVA to test for any difference among the conditional means of Y given A (d) If warranted, construct 0.95confidence intervals for the differences between the means and summarize your findings. 10.4.2 The following values of a response Y were obtained for three settings of a categorical predictor A A A A 1 2 3 0 090 5 120 5 080 0 800 1 580 3 510 33 070 1 760 4 420 1 890 1 740 1 |
190 Suppose we assume the normal regression model for these data with one categorical predictor. (a) Produce a sidebyside boxplot for the data. Chapter 10: Relationships Among Variables 597 (b) Plot the standardized residuals against A (if you are using a computer for your cal culations, also produce a normal probability plot of the standardized residuals) Does this give you grounds for concern that the model assumptions are incorrect? (c) If concerns arise about the validity of the model, can you “fix” the problem? (d) If you have been able to fix any problems encountered with the model, carry out a oneway ANOVA to test for any differences among the conditional means of Y given A (e) If warranted, construct 0.95confidence intervals for the differences between the means and summarize your findings. 10.4.3 The following table gives the percentage moisture content of two different types of cheeses determined by randomly sampling batches of cheese from the production process. Cheese 1 Cheese 2 39 02 38 79 35 74 35 41 37 02 36 00 38 96 39 01 35 58 35 52 35 70 36 04 Suppose we assume the normal regression model for these data with one categorical predictor. (a) Produce a sidebyside boxplot for the data. (b) Plot the standardized residuals against Cheese (if you are using a computer for your calculations, also produce a normal probability plot of the standardized residuals). Does this give you grounds for concern that the model assumptions are incorrect? (c) Carry out a oneway ANOVA to test for any differences among the conditional means of Y given Cheese Note that this is the same as a ttest for the difference in the means. 10.4.4 In an experiment, rats were fed a stock ration for 100 days with various amounts of gossypol added. The following weight gains in grams were recorded. 0.00% Gossypol 0.04% Gossypol 0.07% Gossypol 0.10% Gossypol 0.13% Gossypol 228 229 218 216 224 208 235 229 233 219 224 220 232 200 208 232 186 229 220 208 228 198 222 273 216 198 213 179 193 183 180 143 204 114 188 178 134 208 196 130 87 135 116 118 165 151 59 126 64 78 94 150 160 122 110 178 154 130 |
118 118 118 104 112 134 98 100 104 Suppose we assume the normal regression model for these data and treat gossypol as a categorical predictor taking five levels. (a) Create a sidebyside boxplot graph for the data. Does this give you any reason to be concerned about the assumptions that underlie an analysis based on the normal regression model? (b) Produce a plot of the standardized residuals against the factor gossypol (if you are using a computer for your calculations, also produce a normal probability plot of the standardized residuals). What are your conclusions? 598 Section 10.4: Quantitative Response and Categorical Predictors (c) Carry out a oneway ANOVA to test for any differences among the mean responses for the different amounts of gossypol. (d) Compute 0.95confidence intervals for all the pairwise differences of means and summarize your conclusions. 10.4.5 In an investigation into the effect of deficiencies of trace elements on a variable Y measured on sheep, the data in the following table were obtained. Control Cobalt Copper Cobalt + Copper 13 2 13 6 11 9 13 0 14 5 13 4 11 9 12 2 13 9 12 8 12 7 12 9 14 2 14 0 15 1 14 9 13 7 15 8 15 0 15 6 14 5 15 8 13 9 14 4 Suppose we assume the normal regression model for these data with one categorical predictor. (a) Produce a sidebyside boxplot for the data. (b) Plot the standardized residuals against the predictor (if you are using a computer for your calculations, also produce a normal probability plot of the standardized residuals). Does this give you grounds for concern that the model assumptions are incorrect? (c) Carry out a oneway ANOVA to test for any differences among the conditional means of Y given the predictor (d) If warranted, construct 0.95confidence intervals for all the pairwise differences between the means and summarize your findings. 10.4.6 Two diets were given to samples of pigs over a period of time, and the following weight gains (in lbs) were recorded. Diet A 8 4 14 15 11 10 6 12 13 7 Diet B 7 13 22 15 12 14 18 8 21 23 10 17 Suppose we assume the normal regression model for these data. (a) Produce a |
sidebyside boxplot for the data. (b) Plot the standardized residuals against Diet. Also produce a normal probability plot of the standardized residuals. Does this give you grounds for concern that the model assumptions are incorrect? (c) Carry out a oneway ANOVA to test for a difference between the conditional means of Y given Diet (d) Construct 0.95confidence intervals for differences between the means. 10.4.7 Ten students were randomly selected from the students in a university who took firstyear calculus and firstyear statistics. Their grades in these courses are recorded in the following table. Student Calculus Statistics 1 66 66 2 61 63 3 77 79 4 62 63 5 66 67 6 68 70 7 64 71 8 75 80 9 59 63 10 71 74 Suppose we assume the normal regression model for these data. Chapter 10: Relationships Among Variables 599 (a) Produce a sidebyside boxplot for the data. (b) Treating the calculus and statistics marks as separate samples, carry out a oneway ANOVA to test for any difference between the mean mark in calculus and the mean mark in statistics. Produce the appropriate plots to check for model assumptions. (c) Now take into account that each student has a calculus mark and a statistics mark and test for any difference between the mean mark in calculus and the mean mark in statistics. Produce the appropriate plots to check for model assumptions. Compare your results with those obtained in part (b). (d) Estimate the correlation between the calculus and statistics marks. 10.4.8 The following data were recorded in Statistical Methods, 6th ed., by G. Snedecor and W. Cochran (Iowa State University Press, Ames, 1967) and represent the average number of orets observed on plants in seven plots. Each of the plants was planted with either high corms or low corms (a type of underground stem). Corm High Corm Low Plot 1 11 2 14 6 Plot 2 13 3 12 6 Plot 3 12 8 15 0 Plot 4 13 7 15 6 Plot 5 12 2 12 7 Plot 6 11 9 12 0 Plot 7 12 1 13 1 Suppose we assume the normal regression model for these data. (a) Produce a sidebyside boxplot for the data. (b) Treating the Corm High and Corm Low measurements as separate samples, carry out a |
oneway ANOVA to test for any difference between the population means. Pro duce the appropriate plots to check for model assumptions. (c) Now take into account that each plot has a Corm High and Corm Low measurement. Compare your results with those obtained in part (b). Produce the appropriate plots to check for model assumptions. (d) Estimate the correlation between the calculus and statistics marks. 10.4.9 Suppose two measurements, Y1 and Y2, corresponding to different treatments, are taken on the same individual who has been randomly sampled from a population. Suppose that Y1 and Y2 have the same variance and are negatively correlated. Our goal is to compare the treatment means. Explain why it would have been better to have randomly sampled two individuals from and applied the treatments to these Y2 in these two sampling situations.) individuals separately. (Hint: Consider Var Y1 10.4.10 List the assumptions that underlie the validity of the oneway ANOVA test discussed in Section 10.4.1. 10.4.11 List the assumptions that underlie the validity of the paired comparison test discussed in Section 10.4.2. 10.4.12 List the assumptions that underlie the validity of the twoway ANOVA test discussed in Section 10.4.3. 10.4.13 List the assumptions that underlie the validity of the test used with the ran domized block design, discussed in Section 10.4.4, when ni j 1 for all i and j. 600 Section 10.4: Quantitative Response and Categorical Predictors PROBLEMS 10.4.14 Prove that i yi yi1 10.4.15 Prove that a i 1 yini ni j 1 yi j ni for i i 1 2 is minimized as a function of the i by a a ni i 1 j 1 yi j y 2 a i 1 ni yi y 2 a ni i 1 j 1 yi j 2 yi yi1 yi ni ni and y is the grand mean. where yi 10.4.16 Argue that if the relationship between a quantitative response Y and two cat egorical predictors A and B is given by a linear regression model, then A and B both have an effect on Y whenever A and B interact. (Hint: What does it mean in terms of response curves for an interaction to exist, for an effect due to A to exist?) 10 |
.4.17 Establish that (10.4.2) is the appropriate expression for the standardized resid ual for the linear regression model with one categorical predictor. 10.4.18 Establish that (10.4.6) is the appropriate expression for the standardized resid ual for the linear regression model with two categorical predictors. 10.4.19 Establish that s2 predictors when ni j 10.4.20 How would you assess whether or not the randomized block design was ap propriate after collecting the data? 0 for the linear regression model with two categorical 1 for all i and j COMPUTER PROBLEMS 10.4.21 Use appropriate software to carry out Fisher’s multiple comparison test on the data in Exercise 10.4.5 so that the family error rate is between 0.04 and 0.05. What individual error rate is required? 10.4.22 Consider the data in Exercise 10.4.3, but now suppose we also take into ac count that the cheeses were made in lots where each lot corresponded to a production run. Recording the data this way, we obtain the following table. Cheese 1 Cheese 2 Lot 1 39 02 38 79 38 96 39 01 Lot 2 35 74 35 41 35 58 35 52 Lot 3 37 02 36 00 35 70 36 04 Suppose we assume the normal regression model for these data with two categorical predictors. (a) Produce a sidebyside boxplot for the data for each treatment. (b) Produce a table of cell means. (c) Produce a normal probability plot of the standardized residuals and a plot of the standardized residuals against each treatment combination (code the treatment combi nations so there is a unique integer corresponding to each). Comment on the validity of the model. Chapter 10: Relationships Among Variables 601 (d) Construct the ANOVA table testing first for no interaction between A and B and, if necessary, an effect due to A and an effect due to B (e) Based on the results of part (d), construct the appropriate table of means, plot the corresponding response curve, and make all pairwise comparisons among the means. (f) Compare your results with those obtained in Exercise 10.4.4 and comment on the differences. 10.4.23 A twofactor experimental design was carried out, with factors A and B both categorical variables taking three values. Each |
treatment was applied four times and the following response values were obtained. B B B 1 2 3 A 19 86 20 15 15 35 21 86 4 01 21 66 1 20 88 25 44 15 86 26 92 4 48 25 93 A 26 37 24 87 22 82 29 38 10 34 30 59 2 24 38 30 93 20 98 34 13 9 38 40 04 A 29 72 30 06 27 12 34 78 15 64 36 80 3 29 64 35 49 24 27 40 72 14 03 42 55 Suppose we assume the normal regression model for these data with two categorical predictors. (a) Produce a sidebyside boxplot for the data for each treatment. (b) Produce a table of cell means. (c) Produce a normal probability plot of the standardized residuals and a plot of the standardized residuals against each treatment combination (code the treatment combi nations so there is a unique integer corresponding to each). Comment on the validity of the model. (d) Construct the ANOVA table testing first for no interaction between A and B and, if necessary, an effect due to A and an effect due to B (e) Based on the results of part (d), construct the appropriate table of means, plot the corresponding response curves, and make all pairwise comparisons among the means. 10.4.24 A chemical paste is made in batches and put into casks. Ten delivery batches were randomly selected for testing; then three casks were randomly selected from each delivery and the paste strength was measured twice, based on samples drawn from each sampled cask. The response was expressed as a percentage of fill strength. The col lected data are given in the following table. Suppose we assume the normal regression model for these data with two categorical predictors. Cask 1 Cask 2 Cask 3 Cask 1 Cask 2 Cask 3 Batch 1 62 8 62 6 60 1 62 3 62 7 63 1 Batch 6 63 4 64 9 59 3 58 1 60 5 60 0 Batch 2 60 0 61 4 57 5 56 9 61 1 58 9 Batch 7 62 5 62 6 61 0 58 7 56 9 57 7 Batch 3 58 7 57 5 63 9 63 1 65 4 63 7 Batch 8 59 2 59 4 65 2 66 0 64 8 64 1 Batch 4 57 1 56 4 56 9 58 6 64 7 64 5 Batch 9 54 8 54 8 64 0 64 0 57 7 56 8 Batch 5 55 |
1 55 1 54 7 54 2 58 5 57 5 Batch 10 58 3 59 3 59 2 59 2 58 9 56 8 602 Section 10.5: Categorical Response and Quantitative Predictors (a) Produce a sidebyside boxplot for the data for each treatment. (b) Produce a table of cell means. (c) Produce a normal probability plot of the standardized residuals and a plot of the standardized residuals against each treatment combination (code the treatment combi nations so there is a unique integer corresponding to each). Comment on the validity of the model. (d) Construct the ANOVA table testing first for no interaction between Batch and Cask and, if necessary, no effect due to Batch and no effect due to Cask (e) Based on the results of part (d), construct the appropriate table of means and plot the corresponding response curves. 10.4.25 The following data arose from a randomized block design, where factor B is the blocking variable and corresponds to plots of land on which cotton is planted. Each plot was divided into five subplots, and different concentrations of fertilizer were ap plied to each, with the response being a strength measurement of the cotton harvested. There were three blocks and five different concentrations of fertilizer. Note that there is only one observation for each block and concentration combination. Further discussion of these data can be found in Experimental Design, 2nd ed., by W. G. Cochran and G. M. Cox (John Wiley & Sons, New York, 1957, pp. 107–108). Suppose we assume the normal regression model with two categorical predictors. A A A A A 36 54 72 108 144 1 B 7 62 8 14 7 70 7 17 7 46 2 B 8 00 8 15 7 73 7 57 7 68 3 B 7 93 7 87 7 74 7 80 7 21 (a) Construct the ANOVA table for testing for no effect due to fertilizer and which also removes the variation due to the blocking variable. (b) Beyond the usual assumptions that we are concerned about, what additional as sumption is necessary for this analysis? (c) Actually, the factor A is a quantitative variable. If we were to take this into ac count by fitting a model that had the same slope for each block but possibly different intercepts, then what benefit would be gained? (d) Carry out |
the analysis suggested in part (c) and assess whether or not this model makes sense for these data. 10.5 Categorical Response and Quantitative Predictors We now consider the situation in which the response is categorical but at least some of the predictors are quantitative. The essential difficulty in this context lies with the quantitative predictors, so we will focus on the situation in which all the predictors Chapter 10: Relationships Among Variables 603 are quantitative. When there are also some categorical predictors, these can be han dled in the same way, as we can replace each categorical predictor by a set of dummy quantitative variables, as discussed in Section 10.4.5. For reasons of simplicity, we will restrict our attention to the situation in which the response variable Y is binary valued, and we will take these values to be 0 and 1 Suppose, then, that there are k quantitative predictors X1 0 1, we have Xk Because Y E Y X1 x1 Xk xk P Y 1 X1 x1 Xk xk [0 1]. Therefore, we cannot write E Y x1 some unnatural restrictions on the i to ensure that xk 1x1 1x1 Perhaps the simplest way around this is to use a 1–1 function l : [0 1] write so that l P Y 1 X1 x1 Xk xk 1x1 k xk k xk without placing [0 1]. k xk R1 and P Y 1 X1 x1 Xk xk l 1 1x1 k xk. We refer to l as a link function. There are many possible choices for l. For example, it is immediate that we can take l to be any inverse cdf for a continuous distribution. If we take l 1 i.e., the inverse cdf of the N 0 1 distribution, then this is called the probit link. A more commonly used link, due to some inherent mathematical simplicities, is the logistic link given by l p ln p 1 p. (10.5.1) The righthand side of (10.5.1) is referred to as the logit or log odds. The logistic link is the inverse cdf of the logistic distribution (see Exercise 10.5.1). We will restrict our discussion to the logistic link hereafter. The logistic link implies that (see Exercise 10.5. |
2) P Y 1 X1 x1 Xk xk exp 1x1 1 exp 1x1 k xk k xk (10.5.2) which is a relatively simple relationship. We see immediately, however, that Var Y X1 P Y x1 1 X1 Xk x1 xk Xk xk 1 P Y 1 X1 x1 Xk xk so the variance of the conditional distribution of Y, given the predictors, depends on the values of the predictors. Therefore, these models are not, strictly speaking, regression models as we have defined them. Still when we use the link function given by (10.5.1), we refer to this as the logistic regression model. Now suppose we observe n independent observations xi1 xik yi for i 1 n We then have that, given xi1 xik the response yi is an observation 604 Section 10.5: Categorical Response and Quantitative Predictors from the Bernoulli P Y implies that the conditional likelihood, given the values of the predictors, is 1 X1 distribution. Then (10.5.2) Xk x1 xk n i 1 exp 1x1 1 exp 1x1 yi k xk k xk 1 1 yi 1 exp 1x1 k xk Inference about the i then proceeds via the likelihood methods discussed in Chap ter 6. In fact, we need to use software to obtain the MLE’s, and, because the exact sampling distributions of these quantities are not available, the large sample methods discussed in Section 6.5 are used for approximate confidence intervals and Pvalues. Note that assessing the null hypothesis H0 : 0 is equivalent to assessing the null hypothesis that the predictor Xi does not have a relationship with the response. i We illustrate the use of logistic regression via an example. EXAMPLE 10.5.1 The following table of data represent the (number of failures, number of successes) for ingots prepared for rolling under different settings of the predictor variables, U soaking time and V heating time, as reported in Analysis of Binary Data, by D. R. Cox (Methuen, London, 1970). A failure indicates that an ingot is not ready for rolling after the treatment. There were observations at 19 different settings of these variables 10 0 17 0 7 0 12 0 9 V 0 31 0 43 2 31 0 |
31 0 19 14 V 27 V 51 1 55 4 40 0 21 1 21 1 15 3 10 0 1 0 1 0 0 0 1 Including an intercept in the model and linear terms for U and V leads to three predictor variables X1 1 X2 U X3 V and the model takes the form P Y 1 X2 x2 X3 x3 exp 1 2x2 3x3 1 exp 1 2x2 3x3 Fitting the model via the method of maximum likelihood leads to the estimates given in the following table. Here, z is the value of estimate divided by its standard error. Because this is approximately distributed N 0 1 when the corresponding i equals 0, the Pvalue for assessing the null hypothesis that z with Z 0 is P Z N 0 1. i Coefficient 1 2 3 Estimate 5 55900 0 05680 0 08203 Std. Error 1 12000 0 33120 0 02373 z 4 96 0 17 3 46 Pvalue 0 000 0 864 0 001 Of course, we have to feel confident that the model is appropriate before we can i In this case, we note that the number proceed to make formal inferences about the Chapter 10: Relationships Among Variables 605 of successes s x2 x3 in the cell of the table, corresponding to the setting X2 X3 x2 x3, is an observation from a Binomial m x2 x3 P Y 1 X2 x2 X3 x3 distribution, where m x2 x3 is the sum of the number of successes and failures in that cell. So, for example, if X2 10 and 1 0 and X3 s 1 0 7 obtained by plugging in the MLE, we have that (see Problem 10.5.8) 7 then m 1 0 7 x2 X3 10 Denoting the estimate of P Y x3 by p x2 x3 V 1 X2 U X 2 x2 x3 s x2 x3 m x2 x3 p x2 x3 2 m x2 x3 p x2 x3 (10.5.3) 2 19 2 16 distribution when the model is is asymptotically distributed as a 3 correct. We determine the degrees of freedom by counting the number of cells where there were observations (19 in this case, as no observations were obtained when U 2 8 V X 2 evidence that the model is incorrect and can proceed to make |
inferences about the based on the logistic regression model. 51) and subtracting the number of parameters estimated. For these data, 0 633 Therefore, we have no 13 543 13 543 and the Pvalue is P 2 16 i From the preceding table, we see that the null hypothesis H0 : rejected. Accordingly, we drop X2 and fit the smaller model given by 2 0 is not P Y 1 X3 x3 exp 1 3x3 1 exp 1 3x3 This leads to the estimates 0 08070 Note that these are only marginally different from the previous estimates. In Figure 10.5.1, we present a graph of the fitted function over the range where we have observed X3. 5 4152 and 3 1 1.0 0.9 0. 10 30 V Figure 10.5.1: The fitted probability of obtaining an ingot ready to be rolled as a function of heating time in Example 10.5.1. 50 40 20 606 Section 10.5: Categorical Response and Quantitative Predictors Summary of Section 10.5 We have examined the situation in which we have a single binaryvalued re sponse variable and a number of quantitative predictors. One method of expressing a relationship between the response and predictors is via the use of a link function. If we use the logistic link function, then we can carry out a logistic regression analysis using likelihood methods of inference. EXERCISES R1, defined by f x R1 is a density function with distribution function given by F x 10.5.1 Prove that the function f : R1 x and inverse cdf given by F 1 p logistic distribution. 10.5.2 Establish (10.5.2). 10.5.3 Suppose that a logistic regression model for a binaryvalued response Y is given by e x 1 [0 1] This is called the 2 for 1 p for p e x 1 e x ln 1 ln p P Y 1 x exp 1 2x 1 exp 1 2x 2x x is given by 1 Prove that the log odds at X 10.5.4 Suppose that instead of the inverse logistic cdf as the link function, we use the inverse cdf of a Laplace distribution (see Problem 2.4.22). Determine the form of P Y 10.5.5 Suppose that instead of the |
inverse logistic cdf as the link function, we use the inverse cdf of a Cauchy distribution (see Problem 2.4.21). Determine the form of P Y 1 X1 xk. Xk x1 1 X1 xk. Xk x1 COMPUTER EXERCISES 10.5.6 Use software to replicate the results of Example 10.5.1. 10.5.7 Suppose that the following data were obtained for the quantitative predictor X and the binaryvalued response variable a) Using these data, fit the logistic regression model given by P Y 1 x exp 1 2x 1 exp 1 2x 3x 2 3x 2 (b) Does the model fit the data? (c) Test the null hypothesis H0 : 0 3 Chapter 10: Relationships Among Variables 607 (d) If you decide there is no quadratic effect, refit the model and test for any linear effect. (e) Plot P Y 1 x as a function of x PROBLEMS 10.5.8 Prove that (10.5.3) is the correct form for the chisquared goodnessoffit test statistic. 10.6 Further Proofs (Advanced) Proof of Theorem 10.3.1 We want to prove that, when E Y X values x1 y1 are given by b1 b2x and y 1 xn yn for X Y then the leastsquares estimates of 2x and we observe the independent 1 and 2 x b2 n x i 1 xi n i 1 xi y yi x 2 whenever n i 1 xi x 2 0 We need an algebraic result that will simplify our calculations. Lemma 10.6.1 If x1 y1 n i 1 yi q r R1, then b1 PROOF We have xn yn are such that r xi b2xi q 0 n i 1 xi x 2 0 and n i 1 yi b1 b2xi ny nb1 nb2x n y y b2x b2x 0 which establishes that formulas in Theorem 10.3.1, we obtain b1 n i 1 yi n yi b1 b2xi xi i 1 n yi yi i 1 n i 1 b1 b2xi xi x y b2 xi |
x xi x This establishes the lemma. b2xi q 0 for any q Now using this, and the n i 1 yi y xi x n i 1 yi y xi x 0 608 Section 10.6: Further Proofs (Advanced) Returning to the proof of Theorem 10.3.1, we have n i 1 yi n 1 2 2xi n i 1 yi b1 2 b2xi 2 b1 b2xi 1 b1 b2 xi 2 2 yi b1 b2xi 1 b1 2 b2 xi yi b1 b2 xi 2 2 yi b1 i 1 2 b2xi n i 1 1 b1 b2xi 2 2 as the middle term is 0 by Lemma 10.6.1. Therefore, n i 1 yi 1 2 2xi n i 1 yi b1 2 b2xi and n i 1 yi 1 2xi n 2 takes its minimum value if and only if 1 b1 b2 xi 2 0. 2 i 1 This occurs if and only if not all the same value, this is true if and only if the proof. b1 2 1 b2 xi 1 Proof of Theorem 10.3.2 We want to prove that, if E Y X values x1 y1 (i) E B1 X1 (ii) E B2 X1 1 xn yn for X Y then xn xn Xn Xn x1 x1 x 1 2. 0 for every i Because the xi are b2, which completes b1 and 2 2x and we observe the independent From Theorem 10.3.1 and E Y X1 x1 Xn xn 1 2x we have that E B2 X1 x1 Xn xn n i 1 xi x 1 n i 1 xi 2xi x 2 1 2x n i 1 xi n i 1 xi 2 x 2 x 2 2 Also, from Theorem 10.3.1 and what we have just proved, E B1 X1 x1 Xn xn 1 2x 2x 1 Chapter 10: Relationships Among Variables 609 Proof of Theorem 10.3.3 x We want to prove that, if E Y X x and we observe the independent values x1 y1 x1 (i) Var B1 X1 (ii) Var B2 X1 x1 (iii) |
Cov B1 B2 X1 xn xn Xn 2 1 n 2 Xn Xn 1 x 2 n i 1 xi 2x 2x Var(Y X x xn yn for X Y then n x 2 i 1 xi x 2 n i 1 xi x 2 x1 xn We first prove (ii). Observe that b2 is a linear combination of the yi y values, so we can evaluate the conditional variance once we have obtained the conditional variances and covariances of the Yi Y values. We have that 2 for every Yi Y 1 1 n Yi 1 n j Y j i so the conditional variance of Yi Y is given by 2 1 2 1 n 2 n 1 n2 2 1 1 n When i j we can write Yi Y 1 1 n Yi 1 n Y j 1 n k i j Yk and the conditional covariance between Yi Y and Y j Y is then given by n2 2 n (note that you can assume that the means of the expectations of the Y ’s are 0 for this calculation). Therefore, the conditional variance of B2 is given by Var B2 x1 xn 2 1 1 n 2 n i 1 xi x 2, n i 1 xi n i 1 xi x 2 x 2 2 2 n i j xi n i 1 xi x x j x x 2 2 because xi x x j x i j xi x 2 n i 1 xi x 2 xi x 2. n i 1 n i 1 610 Section 10.6: Further Proofs (Advanced) For (iii), we have that Cov B1 B2 X1 Cov Y x1 B2 X B2 X1 Cov Y B2 X1 x1 and xn Xn x1 Xn Xn xn xn x Var B2 X1 x1 Xn xn Cov Y B2 X1 i 1 xi x1 x Cov Yi 2 1 1 n i 1 xi n i 1 xi Xn xn Y Y X1 x 2 n i 1 xi x x 2 0. x1 Xn xn Therefore, Cov B1 B2 X1 Finally, for (i), we have, x1 Xn xn 2x n i 1 xi x 2. Var B1 X1 x1 Xn xn Var Y X1 x1 2 Cov Y B2 X1 Xn x1 Var Y |
B2x X1 x 2 Var B2 X1 x1 x1 xn Xn xn Xn xn Xn xn where Var Y X1 xn (iii) completes the proof of the theorem. Xn x1 2 n Substituting the results for (ii) and Proof of Corollary 10.3.1 We need to show that Var B1 B2x X1 x1 Xn xn For this, we have that Var B1 B2x X1 x1 Xn xn 2 1 n x 2 x n i 1 xi x 2 Var B1 X1 x1 Xn xn x 2 Var B2 X1 x1 Xn xn 2x Cov B1 B2 X1 x 2 2 x 2 n i 1 xi x1 xn Xn 1 n 2 x 2 x n i 1 xi x 2 2x x x 2 1 n Proof of Theorem 10.3.4 We want to show that, if E Y X x and we observe the independent values x1 y1 x 1 2x Var Y X x xn yn for X Y then 2 for every E S2 X1 x1 Xn xn 2 Chapter 10: Relationships Among Variables 611 We have that S2 X1 n Yi B1 i 1 x1 Xn xn B2xi 2 X1 x1 Xn xn E Yi Y B2 xi x 2 X1 x1 Xn xn Var Yi Y B2 xi x X1 x1 Xn xn because Now, E Yi Y B2 xi 1 2xi 1 x X1 2x x1 2 xi Xn xn x 0 x1 Xn xn Var Yi Y Var Yi 2 xi xi x X1 B2 xi Y X1 x1 x Cov Yi x 2 Var B2 X1 Xn xn Y B2 X1 x1 Xn xn x1 Xn xn and, using the results established about the covariances of the Yi Theorem 10.3.3, we have that Y in the proof of Var Yi Y X1 x1 Xn xn 2 1 1 n and Cov Yi Y B2 X1 n x 2 j 1 1 n i 1 xi 2 n i 1 xi x 2 x1 x j Xn xn x Cov Yi Y Y j Y X1 x1 Xn |
xn 1 1 n xi x 1 n j i x j x 2 xi n i 1 xi x x 2 because i x j j x xi x Therefore, Var Yi Y B2 xi X1 2 xi n i 1 xi x 2 xi n i 1 xi x 2 x1 x 2 x 2 xn Xn 2 xi n i 1 xi x 2 x 2 612 and Section 10.6: Further Proofs (Advanced) E S2 X1 x1 Xn xn 2 n n 2 i 1 1 1 n xi n i 1 xi x 2 x 2 2 as was stated. Proof of Lemma 10.3.1 We need to show that, if x1 y1 n xn yn are such that n i 1 xi x 2 0 then n i 1 xi x 2 n i 1 yi b1 2 b2xi y 2 b2 2 yi y 2 i 1 We have that n yi y2 i n y2 yi yi b1 b2xi b1 2 b2xi ny2 b1 2 b2xi n i 1 b1 2 b2xi ny2 n because i 1 yi 10.3.1, we have n b1 b2xi i 1 b1 b2xi b1 b2xi 0 by Lemma 10.6.1. Then, using Theorem 2 ny2 n i 1 y b2 xi x 2 n y2 b2 2 n i 1 xi x 2 and this completes the proof. Proof of Theorem 10.3.6 We want to show that, if Y given X observe the independent values x1 y1 distributions of B1 B2 and S2 given X1 n i 1 xi xi (i) B1 (ii) B2 (iii) x is distributed N 1 2 and we xn yn for X Y, then the conditional 2x Xn xn are as follows. x1 x 2 B1 B2x N 1 2 2x 1 n x 2 x n i 1 xi x 2 2 n 2 S2 2 2 independent of B1 B2 (iv) n We first prove (i). Because B1 can be written as a linear combination of the Yi, Theorem 4.6.1 implies that the distribution of B1 must be normal. The result then follows from Theore |
ms 10.3.2 and 10.3.3. A similar proof establishes (ii) and (iii). The proof of (iv) is similar to the proof of Theorem 4.6.6, and we leave this to a further course in statistics. Chapter 10: Relationships Among Variables 613 Proof of Corollary 10.3.2 We want to show (i) B1 1 S 1 n (ii) B2 (iii) 2 n i 1 xi x 2 n i 1 xi B1 2x 1 n i 1 xi (iv) If F is defined as in (10.3.8), then H0 : F 1 n B2x is true if and only if F We first prove (i). Because B1 and S2 are independent B1 1 n i 1 xi independent of n have 2 S2 2 2 n 2 Therefore, applying Definition 4.6.2, we xi B1 1 n i 1 xi 1 B1 x 2 1 2 n 2 S2 For (ii), the proof proceeds just as in the proof of (i). For (iii), the proof proceeds just as in the proof of (i) and also using Corollary 10.3.1. We now prove (iv). Taking the square of the ratio in (ii) and applying Theorem 4.6.11 implies G S2 B2 n i 1 xi 2 2 1 x 2 B2 2 2 n i 1 xi x 2 S2 F 1 n 2. Now observe that F defined by (10.3.8) equals G when 2 F further course. 0 The converse that 0 is somewhat harder to prove and we leave this to a 2 only if F 1 n 2 Chapter 11 Advanced Topic — Stochastic Processes CHAPTER OUTLINE Section 1 Simple Random Walk Section 2 Markov Chains Section 3 Markov Chain Monte Carlo Section 4 Martingales Section 5 Brownian Motion Section 6 Poisson Processes Section 7 Further Proofs In this chapter, we consider stochastic processes, which are processes that proceed randomly in time. That is, rather than consider fixed random variables X, Y, etc., or even sequences of independent and identically distributed (i.i.d.) random variables, we where Xn represents some random shall instead consider sequences X0 X1 X2 quantity at |
time n. In general, the value Xn at time n might depend on the quantity Xn 1 at time n 1, or even the values Xm for other times m n. Stochastic processes have a different “avor” from ordinary random variables — because they proceed in time, they seem more “alive.” We begin with a simple but very interesting case, namely, simple random walk. 11.1 Simple Random Walk Simple random walk can be thought of as a model for repeated gambling. Specifically, suppose you start with $a, and repeatedly make $1 bets. At each bet, you have proba 1. If Xn is the bility p of winning $1 and probability q of losing $1, where p a, amount of money you have at time n (henceforth, your fortune at time n), then X0 1 depending on whether you win or lose your first while X1 could be a bet. Then X2 could be a 2 (if you win your first two bets), or a (if you win once and 2 (if you lose your first two bets). Continuing in this way, we obtain lose once), or a 1 or a q 615 616 Section 11.1: Simple Random Walk a whole sequence X0 X1 X2 times 0 1 2. of random values, corresponding to your fortune at We shall refer to the stochastic process Xn as simple random walk. Another way p and P Zi to define this model is to start with random variables Zi 1 1 the ith bet, while Zi we set q, where 0 1 if you lose the ith bet.) We then set X0 p 1 p that are i.i.d. with P Zi 1. (Here, Zi 1 if you win 1 a, and for n Xn a Z1 Z2 Zn. The following is a specific example of this. EXAMPLE 11.1.1 Consider simple random walk with a 1 3, so you start with $8 and have probability 1 3 of winning each bet. Then the probability that you have $9 after one bet is given by 8 and p P X1 9 P 8 Z1 9 P Z1 1 1 3, as it should be. Also, the probability that you have $7 after one bet is given by P |
X1 7 P 8 Z1 7 P Z1 1 2 3. On the other hand, the probability that you have $10 after two bets is given by P X2 10 P 8 Z1 Z2 10 P Z1 Z2 1 1 3 1 3 1 9. EXAMPLE 11.1.2 Consider again simple random walk with a that you have $7 after three bets is given by 8 and p 1 3. Then the probability P X3 7 P 8 Z1 Z2 Z3 7 P Z1 Z2 Z3 1. 1, while Z2 Now, there are three different ways we could have Z1 Z1 while Z1 Hence, 1, namely: (a) 1, Z3 1. Each of these three options has probability 1 3 2 3 2 3. 1; or (c) Z3 1, while Z1 1; (b) Z2 Z2 Z3 Z2 Z3 P X3. If the number of bets is much larger than three, then it becomes less and less con venient to compute probabilities in the above manner. A more systematic approach is required. We turn to that next. 11.1.1 The Distribution of the Fortune We first compute the distribution of Xn, i.e., the probability that your fortune Xn after n bets takes on various values. Chapter 11: Advanced Topic — Stochastic Processes 617 Theorem 11.1.1 Let Xn be simple random walk as before, and let n be a positive k integer. If k is an integer such that k is even, then n and n n P Xn a k n n k 2 p n k 2q n k 2. For all other values of k, we have P Xn a n 2 p 1 a k 0. Furthermore, E Xn PROOF See Section 11.7. This theorem tells us the entire distribution, and expected value, of the fortune Xn at time n. EXAMPLE 11.1.3 Suppose p 1 3 n n 5 the other hand, 8 and a 1. Then P Xn 6 13 is not even. Also, P Xn 13 0 because 13 1 0 because 6 1 12 and 12 5, and n. On P Xn 5 P Xn 1 4 n n 4 2 p n 4 2q 0256. Also, E Xn. Regarding E Xn, we immediately obtain the following corollary. |
Corollary 11.1.1 If p E Xn a for all n 1 2, then E Xn a for all n 1. If p 1 2, then E Xn a for all n 0. If p 1. 1 2, then This corollary has the following interpretation. If p 1 2, then the game is fair, i.e., both you and your opponent have equal chance of winning each bet. Thus, the corollary says that for fair games, your expected fortune E Xn will never change from its initial value, a. On the other hand, if p 1 2, then the game is subfair, i.e., your opponent’s chances are better than yours. In this case, the corollary says your expected fortune will decrease, i.e., be less than its initial value of a. Similarly, if p 1 2 then the game is superfair, and the corollary says your expected fortune will increase, i.e., be more than its initial value of a. Of course, in a real gambling casino, the game is always subfair (which is how the casino makes its profit). Hence, in a real casino, the average amount of money with which you leave will always be less than the amount with which you entered! EXAMPLE 11.1.4 3n 4 Hence, 10 and p Suppose a we always have E Xn 14. That is, your expected fortune is never more than your initial value of $10 and in fact is negative after 14 or more bets. 1 4. Then E Xn 10, and indeed E Xn 0 if n n 2 p 10 10 1 618 Section 11.1: Simple Random Walk Finally, we note as an aside that it is possible to change your probabilities by chang ing your gambling strategy, as in the following example. Hence, the preceding analysis applies only to the strategy of betting just $1 each time. EXAMPLE 11.1.5 Consider the “double ’til you win” gambling strategy, defined as follows. We first bet $1. Each time we lose, we double our bet on the succeeding turn. As soon as we win once, we stop playing (i.e., bet zero from then on). It is easily seen that, with this gambling strategy, we will be up $1 as soon as we 0). Hence, with probability 1 win |
a bet (which must happen eventually because p we will gain $1 with this gambling strategy for any positive value of p. p This is rather surprising, because if 0 1 2 then the odds in this game are against us. So it seems that we have “cheated fate,” and indeed we have. On the other hand, we may need to lose an arbitrarily large amount of money before we win our $1, so “infinite capital” is required to follow this gambling strategy. If only finite capital is available, then it is impossible to cheat fate in this manner. For a proof of this, see more advanced probability books, e.g., page 64 of A First Look at Rigorous Probability Theory, 2nd ed., by J. S. Rosenthal (World Scientific Publishing, Singapore, 2006). 11.1.2 The Gambler’s Ruin Problem The previous subsection considered the distribution and expected value of the fortune Xn at a fixed time n. Here, we consider the gambler’s ruin problem, which requires the consideration of many different n at once, i.e., considers the time evolution of the process. Let Xn be simple random walk as before, for some initial fortune a and some probability p of winning each bet. Assume a is a positive integer. Furthermore, let c a be some other integer. The gambler’s ruin question is: If you repeatedly bet $1, then what is the probability that you will reach a fortune of $c before you lose all your money by reaching a fortune $0? In other words, will the random walk hit c before hitting 0? Informally, what is the probability that the gambler gets rich (i.e., has $c) before going broke? More formally, let 0 c min n min n 0 : Xn 0 : Xn 0, c be the first hitting times of 0 and c, respectively. That is, reaches 0, while c is the first time your fortune reaches c. 0 is the first time your fortune The gambler’s ruin question is: What is P c 0, the probability of hitting c before hitting 0? This question is not so easy to answer, because there is no limit to how long it might take until either c or 0 is hit. Hence, it is not suf |
ficient to just compute the probabilities after 10 bets, or 20 bets, or 100 bets, or even 1,000,000 bets. Fortunately, it is possible to answer this question, as follows. Chapter 11: Advanced Topic — Stochastic Processes 619 Theorem 11.1.2 Let Xn be simple random walk, with some initial fortune a and probability p of winning each bet. Assume 0 c. Then the probability P c 0 of hitting c before 0 is given by. PROOF See Section 11.7 for the proof. Consider some applications of this result. EXAMPLE 11.1.6 Suppose you start with $5 (i.e., a (i.e., c 10). If p p 0 499, then your probability of success is given by 0 500, then your probability of success is a c 5) and your goal is to win $10 before going broke 0 500. If 1 5 0 501 0 499 1 10 1, 0 501 0 499 which is approximately 0 495. If p by 0 501, then your probability of success is given 1 5 0 499 0 501 1 10 1, 0 499 0 501 which is approximately 0 505. We thus see that in this case, small changes in p lead to small changes in the probability of winning at gambler’s ruin. EXAMPLE 11.1.7 Suppose now that you start with $5000 (i.e., a before going broke (i.e., c is a c of success is given by 10 000). If p 0 500, same as before. On the other hand, if p 5000) and your goal is to win $10,000 0 500, then your probability of success 0 499, then your probability 1 0 501 0 499 5000 1 0 501 0 499 10,000 1, which is approximately 2 then your probability of success is given by 10 9, i.e., two parts in a billion! Finally, if p 0 501, 1 0 499 0 501 5000 1 0 499 0 501 10,000 1, which is extremely close to 1. We thus see that in this case, small changes in p lead to extremely large changes in the probability of winning at gambler’s ruin. For example, even a tiny disadvantage on each bet can lead to a very large disadvantage in the long 620 Section 11.1: Simple Random Walk run! The reason for this is that, to get from 5000 to 10,000, many bets must |
be made, so small changes in p have a huge effect overall. Finally, we note that it is also possible to use the gambler’s ruin result to compute, the probability that the walk will ever hit 0 (equivalently, that you will P 0 ever lose all your money), as follows. Theorem 11.1.3 Let Xn be simple random walk, with initial fortune a probability p of winning each bet. Then the probability P 0 will ever hit 0 is given by 0 and that the walk. PROOF See Section 11.7 for the proof. 2 and p EXAMPLE 11.1.8 Suppose a 2 3. Then the probability that you will eventually lose all your money is given by q p a 1 4. Thus, starting with just $2, we see that 3/4 of the time, you will be able to bet forever without ever losing all your money. 2 3 2 1 3 On the other hand, if p 1 2, then no matter how large a is, it is certain that you will eventually lose all your money. Summary of Section 11.1 1 1 p Xn A simple random walk is a sequence Xn of random variables, with X0 P Xn 1 P Xn 1 n It follows that P Xn n k 2 n 2 p 4 2 If 0 to a c if p 1. c, then the gambler’s ruin probability of reaching c before 0 is equal p p a 1 and n n p n k 2q n k 2 for k 1 2, otherwise to 1 n, and E Xn p p c. Xn EXERCISES 12 and probability x for the following values of n and 1 3 of winning each bet. Compute P Xn 11.1.1 Let Xn be simple random walk, with initial fortune a p x. (a) n (b) n (c) n (d) n (e) n (f) n (g) n (h 13 12 13 11 14 12 13 14 Chapter 11: Advanced Topic — Stochastic Processes 621 8. 8. 5. 5. 18 10 1000 and p 15 15 16 5 and probability 7 and probability X3 6 X3 8. 6 X2 4 X2 5. 2 5 of winning each bet. 1 6 of winning each bet. 2 x 20 x 20 x 20 x 20 x (i) n (j) n (k) n (l) n ( |
m) n 11.1.2 Let Xn be simple random walk, with initial fortune a p (a) Compute P X1 (b) Compute P X1 (c) Compute P X2 (d) What is the relationship between the quantities in parts (a), (b), and (c)? Why is this so? 11.1.3 Let Xn be simple random walk, with initial fortune a p (a) Compute P X1 (b) Compute P X1 (c) Compute P X3 (d) What is the relationship between the quantities in parts (a), (b), and (c)? Why is this so? 11.1.4 Suppose a (a) Compute E Xn for n (b) How large does n need to be before E Xn 11.1.5 Let Xn be simple random walk, with initial fortune a and probability p 0 499 of winning each bet. Compute the gambler’s ruin probability P c following values of a and c. Interpret your results in words. (a) a (b) a (c) a (d) a (e) a (f) a 11.1.6 Let Xn be simple random walk, with initial fortune a of winning each bet. Compute P 0 Interpret your results in words. 11.1.7 Let Xn be simple random walk, with initial fortune a p (a) Compute P X1 (b) Compute P X1 (c) Compute P X2 (d) Compute P X2 (e) Compute P X2 (f) Compute P X1 (g) Explain why the answer to part (f) equals what it equals. 9 c 90 c 900 c 9000 c 90,000, c 900,000, c 10 and probability p 0 6. 6. 4. 7. 7 X1 7 X1 6 X2 100 1000 10,000 0 1 2 10 20 100, and 1000. 1 4 of winning each bet. 100,000 1,000,000 0 4 and also where p 5, and probability 6. 4. 7. 0 for the, where p 0 49. 10 0? 622 Section 11.1: Simple Random Walk 2 5 of winning each bet. 11.1.8 Let Xn be simple random walk, with initial fortune a p (a) Compute E X1. (b) Comp |
ute E X10. (c) Compute E X100. (d) Compute E X1000. (e) Find the smallest value of n such that E Xn 11.1.9 Let Xn be simple random walk, with initial fortune a p (a) Compute P X1 (b) Compute P X2 (c) Compute P X3 P Xn (d) Guess the value of limn (e) Interpret part (d) in plain English. 18 38 of winning each bet (as when betting on Red in roulette). 1000 and probability 100 and probability PROBLEMS 11.1.10 Suppose you start with $10 and repeatedly bet $2 (instead of $1), having prob ability p of winning each time. Suppose your goal is $100, i.e., you keep on betting until you either lose all your money, or reach $100. (a) As a function of p, what is the probability that you will reach $100 before losing all your money? Be sure to justify your solution. (Hint: You may find yourself dividing both 10 and 100 by 2.) (b) Suppose p (c) Compare the probabilities in part (b) with the corresponding probabilities if you bet just $1 each time. Which is larger? (d) Repeat part (b) for the case where you bet $10 each time. Does the probability of success increase or decrease? 0 4. Compute a numerical value for the solution in part (a). CHALLENGES 11.1.11 Prove that the formula for the gambler’s ruin probability P c continuous function of p, by proving that it is continuous at p that is a 1 2. That is, prove 0 lim 1 2 p DISCUSSION TOPICS 11.1.12 Suppose you repeatedly play roulette in a real casino, betting the same amount each time, continuing forever as long as you have money to bet. Is it certain that you will eventually lose all your money? Why or why not? 11.1.13 In Problem 11.1.10, parts (c) and (d), can you explain intuitively why the probabilities change as they do, as we increase the amount we bet each time? 11.1.14 Suppose you start at a and need to reach c, where c 0. You must keep gambling until you reach either c or 0. Suppose you are playing a subfair game |
(i.e., a Chapter 11: Advanced Topic — Stochastic Processes 623 1 2), but you can choose how much to bet each time (i.e., you can bet $1, or $2, p or more, though of course you cannot bet more than you have). What betting amounts do you think1 will maximize your probability of success, i.e., maximize P c 0? (Hint: The results of Problem 11.1.10 may provide a clue.) 11.2 Markov Chains Intuitively, a Markov chain represents the random motion of some object. We shall write Xn for the position (or value) of the object at time n. There are then rules that give the probabilities for where the object will jump next. A Markov chain requires a state space S, which is the set of all places the object top, bottom, or S is the set of all 1 2 3, or S can go. (For example, perhaps S positive integers.) A Markov chain also requires transition probabilities, which give the probabilities for where the object will jump next. Specifically, for i S, the number pi j is the probability that, if the object is at i, it will next jump to j. Thus, the collection pi j : i S of transition probabilities satisfies pi j 0 for all i S, and j j j pi j 1 j S for each i S. We also need to consider where the Markov chain starts. Often, we will simply S. More generally, we could have an initial 0 for i. In this case, we need i s for some particular state s S where P X0 i : i i set X0 distribution each i S, and 1. i i S To summarize, here S is the state space of all places the object can go; i represents the probability that the object starts at the point i; and pi j represents the probability that, if the object is at the point i, it will then jump to the point j on the next step. In terms of the sequence of random values X0 X1 X2, we then have that P Xn 1 j Xn i pi j for any positive integer n and any i probability does not depend on the chain’s previous history. That is, we require S. Note that we also require that this jump j P Xn 1 j Xn i Xn 1 x |
n 1 X0 x0 pi j for all n and all i j x0 xn 1 S. 1For more advanced results about this, see, e.g., Theorem 7.3 of Probability and Measure, 3rd ed., by P. Billingsley (John Wiley & Sons, New York, 1995). 624 Section 11.2: Markov Chains 11.2.1 Examples of Markov Chains We present some examples of Markov chains here. EXAMPLE 11.2.1 1 2 3 consist of just three elements, and define the transition probabilities Let S 1 4, 1 3, p22 0, p12 by p11 p32 1 2. This means that, for example, if the chain is at the state 3, 1 4, and p33 then it has probability 1 4 of jumping to state 1 on the next jump, probability 1 4 of jumping to state 2 on the next jump, and probability 1 2 of remaining at state 3 on the next jump. 1 3, p23 1 3, p31 1 2, p21 1 2, p13 This Markov chain jumps around on the three points 1 2 3 in a random and interesting way. For example, if it starts at the point 1, then it might jump to 2 or to 3 (with probability 1 2 each). If it jumps to (say) 3, then on the next step it might jump to 1 or 2 (probability 1 4 each) or 3 (probability 1 2). It continues making such random jumps forever. Note that we can also write the transition probabilities pi j in matrix form, as pi so that p31 matrix representation is convenient sometimes. 1 4, etc.). The matrix pi j is then called a stochastic matrix. This EXAMPLE 11.2.2 Again, let S form, as 1 2 3. This time define the transition probabilities pi j in matrix pi 01 0 01 0 98. This also defines a Markov chain on S. For example, from the state 3, there is proba bility 0.01 of jumping to state 1, probability 0.01 of jumping to state 2, and probability 0.98 of staying in state 3. EXAMPLE 11.2.3 Let S form by bedroom, kitchen, den. Define the transition probabilities pi j in matrix pi j 1 4 0 1 4 0 0 01 0 01 |
0 98 1 2 1. This defines a Markov chain on S. For example, from the bedroom, the chain has probability 1 4 of staying in the bedroom, probability 1 4 of jumping to the kitchen, and probability 1 2 of jumping to the den. Chapter 11: Advanced Topic — Stochastic Processes 625 EXAMPLE 11.2.4 This time let S form, as 1 2 3 4, and define the transition probabilities pi j in matrix pi. This defines a Markov chain on S. For example, from the state 4, it has probability 0 4 of jumping to the state 1, but probability 0 of jumping to the state 2. EXAMPLE 11.2.5 This time, let S matrix form, as 1 2 3 4 5 6 7, and define the transition probabilities pi j in pi j 1 1 2 0 0 1 10 10 0 1 5 1 0 0 1 0 0. This defines a (complicated!) Markov chain on S. 0 1 2 1 3 for all i EXAMPLE 11.2.6 Random Walk on the Circle Let S d pii around the circle. That is, pi j pd 1 0 p0 d 1 1 S, and also pi j 1 3. Otherwise, pi j and define the transition probabilities by saying that 1 3 whenever i and j are “next to” each other 1. Also, 1 3 whenever j 1, or j i, or j i i 0. If we think of the d elements of S as arranged in a circle, then our object, at each step, either stays where it is, or moves one step clockwise, or moves one step counter clockwise — each with probability 1 3. (Note in particular that it can go around the “corner” by jumping from d 1, with probability 1 3.) 1 to 0, or from 0 to d EXAMPLE 11.2.7 Ehrenfest’s Urn Consider two urns, urn #1 and urn #2, where d balls are divided between the two urns. Suppose at each step, we choose one ball uniformly at random from among the d balls and switch it to the opposite urn. We let Xn be the number of balls in urn #1 at time n. Thus, there are d Xn balls in urn |
#2 at time n. Here, the state space is S 0 1 2 d because these are all the possible numbers of balls in urn #1 at any time n. Also, if there are i balls in urn #1 at some time, then there is probability i n that we next choose one of those i balls, in which case the number of balls in urn #1 goes down to i 1. Hence, Similarly, pi i 1 i d. pi i 1 d i d 626 Section 11.2: Markov Chains i because there is probability d balls in urn #2. Thus, this Markov chain moves randomly among the possible numbers 0 1 i d that we will instead choose one of the d d of balls in urn #1 at each time. One might expect that, if d is large and the Markov chain is run for a long time, there would most likely be approximately d 2 balls in urn #1. (We shall consider such questions in Section 11.2.4.) The above examples should convince you that Markov chains on finite state spaces come in all shapes and sizes. Markov chains on infinite state spaces are also important. Indeed, we have already seen one such class of Markov chains. EXAMPLE 11.2.8 Simple Random Walk Let S cannot write the transition probabilities pi j 1 0 1 2 2 in matrix form. be the set of all integers. Then S is infinite, so we 1 p for each i S, and let X0 a. Fix a real number p with 0 1, and let pi i 1 p Fix a and pi i 1 1. Thus, this Markov chain begins at the point a (with probability 1) and at each step either increases by 1 p). It is easily seen that (with probability p) or decreases by 1 (with probability 1 this Markov chain corresponds precisely to the random walk (i.e., repeated gambling) model of Section 11.1.2. Z, with pi j 0 if j p i Finally, we note that in a group, you can create your own Markov chain, as follows (try it — it’s fun!). EXAMPLE 11.2.9 Form a group of between 5 and 50 people. Each group member should secretly pick out two other people from the group, an “A person” and “B person.” Also, |
each group member should have a coin. Take any object, such as a ball, or a pen, or a stuffed frog. Give the object to one group member to start. This person should then immediately ip the coin. If the coin comes up heads, the group member gives (or throws!) the object to his or her A person. If it comes up tails, the object goes to his or her B person. The person receiving the object should then immediately ip the coin and continue the process. (Saying your name when you receive the object is a great way for everyone to meet each other!) Continue this process for a large number of turns. What patterns do you observe? Does everyone eventually receive the object? With what frequency? How long does it take the object to return to where it started? Make as many interesting observations as you can; some of them will be related to the topics that follow. 11.2.2 Computing with Markov Chains Suppose a Markov chain Xn has transition probabilities pi j and initial distribution i? We have the i for all states i. What about P X1 i i. Then P X0 following result. Chapter 11: Advanced Topic — Stochastic Processes 627 Theorem 11.2.1 Consider a Markov chain Xn with state space S, transition prob abilities pi j, and initial distribution i. Then for any i S, P X1 i k pki. k S PROOF From the law of total probability, P X1 i P X0 k X1 i. k S But P X0 follows. k X1 i P X0 k P X1 i X0 k k pki and the result Consider an example of this. EXAMPLE 11.2.10 Again, let S 1 2 3, and pi 01 0 01 0 98. Suppose that P X0 1 1 7, P X0 2 2 7, and P X0 3 4 7. Then P X1 3 k pk3 98 0 73. k S Thus, about 73% of the time, this chain will be in state 3 after one step. To proceed, let us write Pi A P A X0 i for the probability of the event A assuming that the chain starts in the state i, that is, assuming that is the probability that, if the chain starts in state i and is run for n steps, it will end up in state j. Can we compute this? i |
. We then see that Pi Xn 0 for j 1 and j j i For n Pi X0 j 0, we must have X0 j. 0 if i i. Hence, Pi X0 j 1 if i j, while For n 1, we see that Pi X1 j pi j. That is, the probability that we will be at the state j after one step is given by the transition probability pi j. What about for n 2? If we start at i and end up at j after 2 steps, then we have to be at some state after 1 step. Let k be this state. Then we see the following. Theorem 11.2.2 We have Pi X1 k X2 j pi k pk j. PROOF If we start at i, then the probability of jumping first to k is equal to pi k. Given that we have jumped first to k, the probability of then jumping to j is given by 628 pk j. Hence, Pi X1 k X2 j Section 11.2: Markov Chains k X2 k X0 i j X0 i P X2 k X1 j X0 i P X1 P X1 pi k pk j. Using this, we obtain the following. Theorem 11.2.3 We have Pi X2 j k S pi k pk j PROOF By the law of total probability, Pi X2 j Pi X1 k X2 j, k S so the result follows from Theorem 11.2.2. EXAMPLE 11.2.11 Consider again the chain of Example 11.2.1, with S 1 2 3 and pi. Then P1 X2 3 p1k pk3 p11 p13 p12 p23 p13 p33 12. By induction (see Problem 11.2.18), we obtain the following. Theorem 11.2.4 We have Pi Xn j pii1 pi1i2 pi2i3 pin 2in 1 pin 1 j i1 i2 in 1 S PROOF See Problem 11.2.18. Theorem 11.2.4 thus gives a complete formula for the probability, starting at a state i at time 0, that the chain will be at some other state j at time n. We see from Theorem 11.2.4 that, once we know the transition probabilities pi j for all i S, S and all positive |
then we can compute the values of Pi Xn integers n. (The computations get pretty messy, though!) The quantities Pi Xn j are sometimes called the higherorder transition probabilities. for all i j j j Consider an application of this. Chapter 11: Advanced Topic — Stochastic Processes 629 EXAMPLE 11.2.12 Consider once again the chain with S 1 2 3 and pi. Then P1 X3 3 p1k pk p 3 p11 p11 p13 k S S p11 p12 p23 p11 p13 p33 p12 p21 p13 p12 p22 p23 p12 p23 p33 p13 p31 p13 0 0 1 2 p13 p32 p23 0 1 2 1 3 p13 p33 p33 31 72. i i P X0 Finally, we note that if we write A for the matrix pi j, write 0 for the row vec, then Theo tor, and write 1 for the row vector P X1 rem 11.2.1 can be written succinctly using matrix multiplication as 0 A That is, the (row) vector of probabilities for the chain after one step 1 is equal to the (row) 0, multiplied by the matrix A of vector of probabilities for the chain after zero steps, then transition probabilities. In fact, if we write n for the row vector P Xn 0 An, proceeding by induction, we see that where An is the nth power of the matrix A. In this context, Theorem 11.2.4 has a par j entry of the ticularly nice interpretation. It says that Pi Xn matrix An, i.e., the nth power of the matrix A. n A for each n. Therefore, n is equal to the i n 1 1 i j i 11.2.3 Stationary Distributions Suppose we have Markov chain transition probabilities pi j on a state space S. Let i : i S be a probability distribution on S, so that i 0 for all i, and 1 We have the following definition. i S i Definition 11.2.1 The distribution with transition probabilities pi j on a state space S, if j i : i S. S is stationary for a Markov chain j for all i pi j i S The reason for the terminology “stationary” is that, if the chain begins with those probabilities, then it will always have those |
same probabilities, as the following theo rem and corollary show. S is a stationary distribution for a Markov Theorem 11.2.5 Suppose chain with transition probabilities pi j on a state space S. Suppose that for some integer n, we have P Xn i for all i i for all i i S. Then we also have P Xn 1 : i S. i i 630 Section 11.2: Markov Chains PROOF If i is stationary, then we compute that P Xn 1 j P Xn i Xn 1 j i S i S P Xn i P Xn 1 j Xn i i pi j j. i S By induction, we obtain the following corollary. S is a stationary distribution for a Markov Corollary 11.2.1 Suppose chain with transition probabilities pi j on a state space S. Suppose that for some integer n, we have P Xn S. Then we also have P Xm i for all i i : i i i i for all i S and all integers m n. The above theorem and corollary say that, once a Markov chain is in its stationary distribution, it will remain in its stationary distribution forevermore. EXAMPLE 11.2.13 Consider the Markov chain with S 1 2 3, and pi. No matter where this Markov chain is, it always jumps with the same probabilities, i.e., to state 1 with probability 1 2, to state 2 with probability 1 4, or to state 3 with probability 1 4. Indeed, if we set 1 S. Hence, for all i j 1 2, 2 1 4, and 3 1 4, then we see that pi j j i pi Thus, will stay in the distribution i forever. i is a stationary distribution. Hence, once in the distribution i, the chain EXAMPLE 11.2.14 Consider a Markov chain with S 0 1 and pi j 0 1 0 9 0 6 0 4. If this chain had a stationary distribution i, then we must have that, 1. The first equation gives 1 0 6 with the second equation. In addition, we require that 3 2 2 5 3 2 0 0 9, so 1 2 5. Then 1 1, so that 0 0 3 2 0 0. This is also consistent 1, i.e., that 0 1 3 5. Chapter 11: Advanced Topic — Stochastic Processes 631 We then check that the |
settings 0 2 5 and 1 3 5 satisfy the above equa tions. Hence, i is indeed a stationary distribution for this Markov chain. EXAMPLE 11.2.15 Consider next the Markov chain with S 1 2 3, and pi. We see that this Markov chain has the property that, in addition to having 1, for all i, it also has matrix pi j doubly stochastic.) 1, for all j. That is, not only do the rows of the (Such a matrix is sometimes called sum to 1, but so do the columns. j S pi j i S pi j Let compute that 1 2 3 1 3, so that i is the uniform distribution on S. Then we i pi j 1 3 pi j 1 3 pi Because this is true for all j, we see that chain. is a stationary distribution for this Markov i EXAMPLE 11.2.16 Consider the Markov chain with S 1 2 3, and pi. Does this Markov chain have a stationary distribution? Well, if it had a stationary distribution i, then the following equations would have to be satisfied: 1 2 3 1 1 The first equation gives 1 4 so that 3 3 2 1 4 2 2, 0 1 4 3 4 3, 3. 2 3 2. The second equation then gives, But we also require 3 11. Then 1 1 2 3 1, i.e., 2 3 2 2 2 2 1, so that 2 11, and 3 It is then easily checked that the distribution given by 1 3 11, and 6 11 satisfies the preceding equations, so it is indeed a stationary distribution for 6 11. 2 11, 2 2 3 this Markov chain. 632 Section 11.2: Markov Chains EXAMPLE 11.2.17 Consider again random walk on the circle, as in Example 11.2.6. We observe that for j, the state one any state j, there are precisely three states i (namely, the state i 1 3. Hence, clockwise from j, and the state one counterclockwise from j ) with pi j i S pi j It then follows, just as in Example 11.2.15, that the uniform distribution, given by 1 That is, the transition matrix pi j is again doubly stochastic. i 1 d for i 0 1 d 1, is a stationary distribution for this Markov chain. |
EXAMPLE 11.2.18 For Ehrenfest’s urn (see Example 11.2.7), it is not obvious what might be a stationary distribution. However, a possible solution emerges by thinking about each ball individ ually. Indeed, any given ball usually stays still but occasionally gets ipped from one urn to the other. So it seems reasonable that in stationarity, it should be equally likely to be in either urn, i.e., have probability 1/2 of being in urn #1. If this is so, then the total number of balls in urn #1 would have the distribution Binomial n 1 2, since there would be n balls, each having probability 1 2 of being in urn #1. 2d for i 0 1 d. We then compute that if To test this, we set j 1, then d i 1 d i i pi 2d 1 2d 1 1 j d d j 1 2d. d j 1 1 2d j 1 d Next, we use the identity known as Pascal’s triangle, which says that Hence, we conclude that d j 1 1 i pi j i S d 1 j d j 1 2d d j. j. With minor modifications (see Problem 11.2.19), the preceding argument works for S. 0 and j d as well. We therefore conclude that for all j i pi j j i S j Hence, is a stationary distribution. i One easy way to check for stationarity is the following. Definition 11.2.2 A Markov chain is said to be reversible with respect to a distrib i pi j ution S, we have if, for all i j p ji. j i Theorem 11.2.6 If a Markov chain is reversible with respect to stationary distribution for the chain. i, then is a i Chapter 11: Advanced Topic — Stochastic Processes 633 PROOF We compute, using reversibility, that for any j S, i pi j j p ji i S i S j i S p ji j 1 j. Hence, i is a stationarity distribution. EXAMPLE 11.2.19 Suppose S 1 2 3 4 5, and the transition probabilities are given by pi. It is not immediately clear what stationary distribution this chain may possess. Fur thermore, to compute directly as in Example 11 |
.2.16 would be quite messy. On the other hand, we observe that for 1 C2i for some C 2 pi 1 i. Hence, if we set i 4, we always have pi i 1 i 0, then we will have i pi i 1 C2i pi i 1 C2i 2 pi 1 i, i 1 pi 1 i C2i 1 pi 1 i. i 1 pi 1 i for each i. 0 if i and j differ by at least 2. It follows that while Hence, i pi i 1 Furthermore, pi j j i pi j and so j p ji is a i i for each i stationary distribution for the chain. S. Hence, the chain is reversible with respect to Finally, we solve for C. We need 5 i 1 2i i S 2i 1 63. Thus, 1 i S i 1 11.2.4 Markov Chain Limit Theorem 1 Hence, we must have C i 2i 63 for i S. Suppose now that Xn is a Markov chain, which has a stationary distribution have already seen that, if P Xn i for all i for some n, then also P Xm i i. We i i for all i for all m n. Suppose now that it is not the case that P Xn i expect that, if the chain is run for a long time (i.e., n being at a particular state i chosen. That is, one might expect that S might converge to i for all i. One might still ), then the probability of i, regardless of the initial state lim n P Xn i for each i S regardless of the initial distribution i, i. (11.2.1) This is not true in complete generality, as the following two examples show. How ever, we shall see in Theorem 11.2.8 that this is indeed true for most Markov chains. 634 Section 11.2: Markov Chains EXAMPLE 11.2.20 Suppose that S 1 2 and that the transition probabilities are given by pi j 1 0 0 1. That is, this Markov chain never moves at all! Suppose also that always have X0 1. 1 1, i.e., that we In this case, any distribution is stationary for this chain. In particular, we can take 1 2 as a stationary distribution. On the other hand, we clearly have 1 2, we do not have 1 2, and 1 2 1 1 P |
Xn 1 for all n. Because i i in this case. 1 P1 Xn limn We shall see later that this Markov chain is not “irreducible,” which is the obstacle to convergence. EXAMPLE 11.2.21 Suppose again that S by 1 2, but that this time the transition probabilities are given pi j 0 1 1 0. 1 1, i.e., that we always have X0 1 2 That is, this Markov chain always moves from 1 to 2, and from 2 to 1. Suppose again that 1. We may again take 1 2 as a stationary distribution (in fact, this time the stationary distribution is unique). On the other hand, this time we clearly have P1 Xn 0 for n odd. Hence, again we do not have limn 1 for n even, and P1 Xn 1 2 P1 Xn 1 1 1 1 We shall see that here the obstacle to convergence is that the Markov chain is “pe riodic,” with period 2. In light of these examples, we make some definitions. Definition 11.2.3 A Markov chain is irreducible if it is possible for the chain to move from any state to any other state. Equivalently, the Markov chain is irreducible if for any i S, there is a positive integer n with Pi Xn 0. j j Thus, the Markov chain of Example 11.2.20 is not irreducible because it is not possible to get from state 1 to state 2. Indeed, in that case, P1 Xn 2 0 for all n. EXAMPLE 11.2.22 Consider the Markov chain with S 1 2 3, and pi. For this chain, it is not possible to get from state 1 to state 3 in one step. On the other hand, it is possible to get from state 1 to state 2, and then from state 2 to state 3. Hence, this chain is still irreducible. Chapter 11: Advanced Topic — Stochastic Processes 635 EXAMPLE 11.2.23 Consider the Markov chain with S 1 2 3, and pi. For this chain, it is not possible to get from state 1 to state 3 in one step. Furthermore, it is not possible to get from state 2 to state 3, either. In fact, there is |
no way to ever get from state 1 to state 3, in any number of steps. Hence, this chain is not irreducible. Clearly, if a Markov chain is not irreducible, then the Markov chain convergence (11.2.1) will not always hold, because it will be impossible to ever get to certain states of the chain. We also need the following definition. Definition 11.2.4 Given Markov chain transitions pi j on a state space S, and a state i S, the period of i is the greatest common divisor (g.c.d.) of the set n i 0 where p n ii 1 : p n ii P Xn i X0 That is, the period of i is the g.c.d. of the times at which it is possible to travel from i to i. For example, the period of i is 2 if it is only possible to travel from i to i in an even number of steps. (Such was the case for Example 11.2.21.) On the other hand, if pii 0, then clearly the period of i is 1. Clearly, if the period of some state is greater than 1, then again (11.2.1) will not always hold, because the chain will be able to reach certain states at certain times only. This prompts the following definition. Definition 11.2.5 A Markov chain is aperiodic if the period of each state is equal to 1. EXAMPLE 11.2.24 Consider the Markov chain with S 1 2 3, and pi. For this chain, from state 1 it is possible only to get to state 2. And from state 2 it is possible only to get to state 3. Then from state 3 it is possible only to get to state 1. Hence, it is possible only to return to state 1 after an integer multiple of 3 steps. Hence, state 1 (and, indeed, all three states) has period equal to 3, and the chain is not aperiodic. EXAMPLE 11.2.25 Consider the Markov chain with S 1 2 3, and pi. 636 Section 11.2: Markov Chains For this chain, from state 1 it is possible only to get to state 2. And from state 2 it is possible only to get to state 3. However, from state 3 |
it is possible to get to either state 1 or state 3. Hence, it is possible to return to state 1 after either 3 or 4 steps. Because the g.c.d. of 3 and 4 is 1, we conclude that the period of state 1 (and, indeed, of all three states) is equal to 1, and the chain is indeed aperiodic. We note the following simple fact. Theorem 11.2.7 If a Markov chain has pi j irreducible and aperiodic. 0 for all i j S, then the chain is PROOF If pi j the Markov chain must be irreducible. 0 for all i j S, then Pi X1 j 0 for all i j S. Hence, 0 contains the value Also, if pi j 1 (and, indeed, all positive integers n). Hence, its greatest common divisor must n be 1. Therefore, each state i has period 1, so the chain is aperiodic. S, then the set n 0 for all i j 1 : p n ii In terms of the preceding definitions, we have the following very important theorem about Markov chain convergence. Theorem 11.2.8 Suppose a Markov chain is irreducible and aperiodic and has a stationary distribution i, we have P Xn limn i. Then regardless of the initial distribution i for all states i. i PROOF For a proof of this, see more advanced probability books, e.g., pages 92–93 of A First Look at Rigorous Probability Theory, 2nd ed., by J. S. Rosenthal (World Scientific Publishing, Singapore, 2006). Theorem 11.2.8 shows that stationary distributions are even more important. Not only does a Markov chain remain in a stationary distribution once it is there, but for most chains (irreducible and aperiodic ones), the probabilities converge to the station ary distribution in any case. Hence, the stationary distribution provides fundamental information about the longterm behavior of the Markov chain. EXAMPLE 11.2.26 Consider again the Markov chain with S 1 2 3, and pi. We have already seen that if we set is a stationary distribution. Furthermore, we see that pi j Theorem 11.2.7 the Markov chain must be irreducible and aperiodic. P Xn We conclude that limn |
1 4, and 3 0 for all i 1 2, 1 2 i i for all states i. For example, limn 1 4, then i S, so by j 1 2. (Also, this limit does not depend on the initial distribution, so, for 1 2 and limn In fact, for this example we will have P Xn P1 Xn 1 P2 Xn 1 1 2, as well.) i i for all i provided n 1. 1 P Xn example, limn Chapter 11: Advanced Topic — Stochastic Processes 637 EXAMPLE 11.2.27 Consider again the Markov chain of Example 11.2.14, with S 0 1 and pi j 0 1 0 9 0 6 0 4. We have already seen that this Markov chain has a stationary distribution, given by 0 2 5 and 1 3 5. Furthermore, because pi j 0 for all i j 100, then we will have P X100 and aperiodic. Therefore, we conclude that limn n this conclusion does not depend on the initial distribution, so, e.g., limn i as well. i P Xn 2 5, and P X100 P1 Xn limn 0 i S, this Markov chain is irreducible i. So, if (say) 3 5. Once again, i 1 P0 Xn EXAMPLE 11.2.28 Consider again the Markov chain of Example 11.2.16, with S 1 2 3, and pi. We have already seen that this chain has a stationary distribution 6 11. 2 11, 3 11, and 3 2 i given by 1 Now, in this case, we do not have pi j 0 and p21 0 for all i 0, so by Theorem 11.2.3, we have other hand, p32 j S because p31 0. On the P3 X2 1 p3k pk1 p32 p21 0. k S Hence, the chain is still irreducible. Similarly, we have P3 X2 3 0. Therefore, because the g.c.d. of 2 and 3 is 1, we see that the g.c.d. of the set of n with P3 Xn 0 is also 1. Hence, the chain is still aperiodic. 0, and P3 X3 p32 p21 p13 p32 p23 3 3 Because the chain is irreducible and |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.