Skip to main content

Section 15.1 Student Learning Objectives

Chapter 13 and Chapter 14 introduced statistical inference that involves a response and an explanatory variable that may affect the distribution of the response. In both chapters the response was numeric. The two chapters differed in the data type of the explanatory variable. In Chapter 13 the explanatory variable was a factor with two levels that splits the sample into two sub-samples. In Chapter 14 the explanatory variable was numeric and produced, together with the response, a linear trend. The aim in this chapter is to consider the case where the response is a Bernoulli variable. Such a variable may emerge as the indicator of the occurrence of an event associated with the response or as a factor with two levels. The explanatory variable is a factor with two levels in one case or a numerical variable in the other case.
Specifically, when the explanatory variable is a factor with two levels then we may use the function prop.test. This function was used in Chapter 12 for the analysis of the probability of an event in a single sample. Here we use it in order to compare between two sub-samples. This is similar to the way the function t.test was used for a numeric response for both a single sample and for the comparison between sub-samples. For the case where the explanatory variable is numeric we may use the function glm, acronym for Generalized Linear Model, in order to fit an appropriate regression model to the data.
By the end of this chapter, the student should be able to:
  • Produce mosaic plots of the response and the explanatory variable.
  • Apply the function prop.test in order to compare the probability of an event between two sub-populations.
  • Define the logistic regression model that relates the probability of an event in the response to a numeric explanatory variable.
  • Fit the logistic regression model to data using the function glm and produce statistical inference on the fitted model.