Chapter 2 - Looking at Data-Relationships

2.1 Relationships

  • Association between variables: Statistics often involves examining relationships between pairs of variables.

  • Two variables are associated if knowing the value of one provides information about the other.

  • Explanatory and response variables:

    • A response variable measures the outcome of a study.

    • An explanatory variable explains or causes changes in the response variable.

Key Characteristics of a Data Set

  • When exploring relationships between two variables, consider these key characteristics:

    • Cases: Identify the cases and their number in the dataset.

    • Categorical or Quantitative: Classify each variable.

    • Values: Identify the possible values for each variable.

    • Explanatory or Response: Classify variables as explanatory or response, if applicable.

    • Label: Identify the label variable, if present.

2.2 Scatterplots

  • Scatterplots:

    • They are used to display the relationship between two quantitative variables measured on the same cases.

    • Values of one variable appear on the horizontal axis (x-axis), and values of the other on the vertical axis (y-axis).

    • Each case corresponds to a point on the graph.

  • How to make a scatterplot:

    1. Decide which variable goes on each axis (explanatory on x, response on y if a distinction exists).

    2. Label and scale the axes appropriately.

    3. Plot the individual data values.

  • Interpreting scatterplots:

    • Look for the overall pattern and deviations from that pattern.

    • Describe the overall pattern by its form, direction, and strength.

    • Form: Linear, curved, etc.

    • Direction: Positive or negative association.

    • Strength: How closely the points follow a clear form.

    • An outlier is a value that falls outside the overall pattern.

  • Positive association: Above-average values of one variable tend to accompany above-average values of the other (and below-average with below-average).

  • Negative association: Above-average values of one variable tend to accompany below-average values of the other (and vice versa).

  • Log transformation:

    • Useful when the pattern that best describes the data is a curve.

    • The log transformation can render the relationship approximately linear.

    • It can only be used for positive values.

  • Adding categorical variables to a scatterplot:

    • Use different colors or symbols for different categories.

  • Nonlinear relationships:

    • Relationships can also be nonlinear, exhibiting curvature.

2.3 Correlation

  • Measuring Linear Association: A scatterplot shows the strength, direction, and form of a relationship; however, our eyes aren't always good judges, so we use a numerical measure.

  • Correlation (r): Measures the strength of the linear relationship between two quantitative variables.

  • Properties of Correlation:

    • 1r1-1 \le r \le 1

    • r>0r > 0 indicates a positive association.

    • r<0r < 0 indicates a negative association.

    • r0r \approx 0 indicates a very weak linear relationship.

    • The closer r is to -1 or 1, the stronger the linear relationship.

    • r=1r = -1 and r=1r = 1 only occur in perfect linear relationships.

  • Cautions About Correlation:

    • Requires both variables to be quantitative.

    • Does not describe curved relationships.

    • Not resistant; affected by outliers.

    • Not a complete summary of two-variable data.

2.4 Least-Squares Regression

  • Regression Line: Is a straight line that describes how a response variable y changes as an explanatory variable x changes. It is used to predict the value of y for a given value of x.

  • Regression equation: y^\hat{y} =b0b_0 + b1b_1x

    • y^\hat{y} is the predicted value of the response variable (yy) for a given value of the explanatory variable (xx).

    • b1b_1 is the slope, representing the amount by which yy changes for each one-unit increase in xx.

    • b0b_0 is the intercept, the value of yy when x=0x = 0.

  • Least-Squares Regression Line (LSRL):

    • The line that minimizes the sum of the squares of the vertical distances of the data points from the line.

  • Predictions via Regression Line:

    • Substitute a value of xx into the regression equation to predict the corresponding value of y^\hat{y}.

  • Extrapolation:

    • Using the regression line to predict outside the range of observed x values. It's risky and often inaccurate.

  • Facts about Least-Squares Regression:

    • A change of one standard deviation in xx corresponds to a change of rr standard deviations in yy.

    • The LSRL always passes through the point (xˉ,yˉ)(\bar{x}, \bar{y}) (the mean of x and the mean of y).

    • The distinction between explanatory and response variables is essential.

  • Coefficient of determination: The square of the correlation, r², represents the fraction of the variation in the values of yy that is explained by the least-squares regression of yy on xx.

2.5 Cautions about Correlation and Regression

  • Residuals:

    • The vertical distances between the points and the least-squares regression line.

    • Residual=Observed valuePredicted valueResidual = Observed \ value - Predicted \ value

  • Residual Plots:

    • A scatterplot of the regression residuals against the explanatory variable.

    • Used to assess the fit of a regression line.

    • Ideally, it should show a random scatter around zero.

    • Patterns in the residual plot suggest deviations from a linear relationship.

  • Outliers and Influential Points:

    • An outlier is an observation that lies outside the overall pattern.

    • Outliers in the yy direction have large residuals.

    • Outliers in the xx direction are often influential, meaning their removal would significantly change the regression line.

  • Lurking Variables:

    • A variable not among the explanatory or response variables but may influence the interpretation of relationships.

  • Cautions about Correlation and Regression:

    • Both describe linear relationships.

    • Both are affected by outliers.

    • Always plot the data before interpreting.

    • Beware of extrapolation.

    • Beware of lurking variables.

    • Correlation does not imply causation!

2.6 Data Analysis for Two-Way Tables

  • Categorical Variables:

    • Place individuals into groups or categories.

    • Values are labels for the categories.

    • The distribution lists the count or percent in each category.

  • Two-Way Table: Describes two categorical variables, organizing counts by a row variable and a column variable.

  • Marginal Distribution:

    • The distribution of values of one variable among all individuals in the table.

    • Percentages are generally more useful than counts for comparison.

  • Conditional Distribution:

    • Describes the values of a variable among individuals with a specific value of another variable.