260 likes | 420 Views
Testing hypotheses. Continuous variables. Hypothesis Lower income Higher murder rate. L. L. H. H. L. L. H. L. H. L. Median income. H. L. Murder rate. L. H. L. H. L. H. H. H. H.
E N D
Testing hypotheses Continuous variables
Hypothesis Lower income Higher murder rate L L H H L L H L H L Median income H L Murder rate L H L H L H H H H L H H
Correlation and Regression • Correlation: measure of the strength of an association (relationship) between continuous variables • Regression: predicting the value of a continuous dependent variable (y) based on the value of a continuous independent variable (x)
Hypothesis Lower income Higher murder rate Distribution of cities by median income Distribution of cities by murder rate Median income Murder rate Murder rate Plot IV and DV for each case (city) on a “scattergram” (two cities detailed) Analysis later… Median income
Correlation statistic - r • Values of r Range from –1 to +1 • -1 is a perfect negative association (correlation), meaning that as the scores of one variable increase, the scores of the other variable decrease at exactly the same rate • +1 is a perfect positive association, meaning that both variables go up or down together, in perfect harmony • Intermediate values of r (close to zero) indicate weak or no relationship • Zero r (never in real life) means no relationship – that the variables do not change or “vary” together, except as what might happen through chance alone Perfect positive relationship + 1 0 No relationship Perfect negative relationship - 1
Two “scattergrams” – each with a “cloud” of dots Y Y NOTE: Dependent variable (Y) is always placed on the vertical axis r = +1 1 2 3 4 5 6 1 2 3 4 5 6 r = - 1 NOTE: Independent variable (X) is always placed on the horizontal axis X X 1 2 3 4 5 1 2 3 4 5 Can changes in one variable be predicted by changes in the other?
Can changes in one variable be predicted by changes in the other? Y As X changes in value, does Y move correspondingly, either in the same or opposite direction? Here there seems to be no connection between X and Y. One cannot predict values of Y from values of X. r = 0 1 2 3 4 5 X 1 2 3 4 5
Can changes in one variable be predicted by changes in the other? Y Here as X changes in value by one unit Y also changes in value by one unit. Knowing the value of X one can predict the value of Y. X and Y go up and down together, meaning a positive relationship. r = +1 1 2 3 4 5 X 1 2 3 4 5
Can changes in one variable be predicted by changes in the other? Y Here as X changes in value by one unit Y also changes in value by one unit. Knowing the value of X one can predict the value of Y. X and Y go up and down in an opposite direction, meaning a negative relationship. r = -1 1 2 3 4 5 X 1 2 3 4 5
Computing r using the “Line of best fit” • To arrive at a value of “r” a straight line is placed through the cloud of dots (the actual, “observed” data) • This line is placed so that the cumulative distance between itself and the dots is minimized • The smaller this distance, the higher the r • r’s are normally calculated with computers. Paired scores (each X/Y combination) and the means of X and Y are used to compute: • a, where the line crosses the Y axis • b, the slope of the line • When relationships are very strong or very weak, one can estimate the r value by simply examining the graph Y 1 2 3 4 5 6 b a X 1 2 3 4 5 2
“Line of best fit” Y • The line of best fit predicts a value for one variable given the value of the other variable • There will be a difference between these estimated values and the actual, known (“observed”) values. This difference is called a “residual” or an “error of the estimate.” • As the error between the known and predicted values decreases – as the dots cluster more tightly around the line – the absolute value of r (whether + or –) increases if y =5, x=3.4 1 2 3 4 5 6 if x =.5, y=2.3 X 1 2 3 4 5
A perfect fit: Line of best fit goes “through” each dot Y Y 1 2 3 4 5 6 1 2 3 4 5 6 r = +1.0a perfect fit r = -1.0a perfect fit X X 1 2 3 4 5 1 2 3 4 5 4
Moderate cumulative distancebetween line of best fit and “cloud” of dots Y 1 2 3 4 5 6 r = +.65An intermediate fit yields an intermediate value of r X 1 2 3 4 5 2
Large cumulative distancebetween line of best fit and “cloud” of dots Y 1 2 3 4 5 6 r = - .19 A poor fit yields a low value of r X 1 2 3 4 5
R-squared (R2), the coefficient of determination • Proportion of the change in the dependent variable (also known as the “effect” variable) that is accounted for by change in the independent variable (also known as the “predictor” variable) • Taken by squaring the correlation coefficient (r) • “Little” r squared (r2) depicts the explanatory power of a single independent/predictor variable • “Big” R squared (R2) combines the effects of multiple independent/predictor variables. It’s the more commonly used.
Hypothesis: Lower income higher murder rate • How to “read” a scattergram • Move along the IV. Do the values of the DV change in a consistent direction? • Look across the IV. Does knowing the value of the IV help you predict the value of the DV? • Place a straight line through the cloud of dots, trying to minimize the overall distance between the line and the dots. Is the line at a pronounced angle? • To the extent that you can answer “yes” to each of these, there is a relationship Change in the IV accounts for thirty-six percent of the change in the DV. A moderate-to-strong relationship, in the hypothesized direction – hypothesis confirmed! R = -.6 R2 = .36
Class exercise Hypothesis: Height Weight • Use this data to build a scattergram • Be sure that the independent variable is on the X axis, smallest value on the left, largest on the right, just like when graphing any distribution • Be sure that the dependent variable is on the Y axis, smallest value on the bottom, largest on top • Place a dot representing a case at the intersection of its values on X and Y • Place a STRAIGHT line where it minimizes the overall distance between itself and the cloud of dots • Use this overall distance to estimate a possible value of r, from -1 (perfect negative relationship,) to 0 (no relationship), to +1 (perfect positive relationship)
Height Weight r = .72 r2 = .52 A strong relationship
Age Weight r = .35 r2 = .12 A weak-to-moderate relationship
Age Weight (less extreme cases) r = -.17 r2 = .03 No relationship
Age Height r = .04 r2 =.00 No relationship
Changing the level of measurement from continuous to categorical SHORT TALL 240 220 HEAVY 3 7 200 180 Weight 160 12 4 140 LIGHT 120 100 58 60 62 64 66 68 70 72 74 76 Height
Exploring data with r But unless we go in with a hypothesis, backed by a literature review, it’s basically a fishing expedition. Remember that there are lots of variables changing all the time, so finding substantial correlations isn’t unusual. Theorizing after the fact is always hazardous. Remember the story about lunar cycles and homicide? Why are we so polarized? Could part of the reason be a poor economy? The r statistic can be used to explore such questions, not just for a small group but for the whole country!
Other correlation techniques • “Spearman’s r” • Assess correlation between two ordinal categorical variables • Partial correlation • Using a control variable to assess its potential influence on a bivariate (two-variable) relationship when all variables are continuous • Analogous to using first-order partial tables for categorical variables • Instead of height weight, is it possible that a variable related to height – age – is the real cause of changes in weight? HEIGHT WEIGHT AGE HEIGHT 1.00 .72 .04 WEIGHT .72 1.00 .34 AGE .04 .34 1.00 Zero-ordercorrelations Controlling for AGE HEIGHT WEIGHT HEIGHT 1.00 .75 WEIGHT .75 1.00 First-orderpartialcorrelations
Some parting thoughts • If we did not use probability sampling • Our results apply only to the cases we coded • Accounting for the influence of other variables can be tricky • R and related statistics are often unimpressive; describing what they mean can be tricky • If we used probability sampling • Our results can be extended to the population • But, since samples are just that – samples – we cannot assume that the statistics a sample yields (e.g., r, R2) hold true for the population • Techniques we’ll discuss later allow us to estimate the magnitude of the difference between sample statistics and the corresponding population parameters • This process will also let us interpret our results with far greater clarity and precision than is possible without probability sampling
Exam preview • You will be given a hypothesis and data from a sample. There will be two variables – the dependent variable, and the independent variable. Both will be categorical, and each will have two levels (e.g., low/high, etc.) • You will build a table containing the frequencies (number of cases), just like we did in class and in this slide show. For consistency, place the categories of the independent variable in rows, just like in the slide shows. • You will build another table with the percentages. Remember to go to one category of the independent variable and percentage it across the dependent variable. Then go to the other category of the independent variable and do the same. • You will analyze the results. Are they consistent with the hypothesis? • You will be given the same data as above, broken down by a control variable. It will also be categorical, with two levels. • You will build first order partial tables, one with frequencies (number of cases), the other with percentages, for each level of the control variable. Remember that these tables will look exactly like the zero-order table. The hypothesis, the independent and dependent variables and their categories stay the same. • You will be asked whether introducing the control variable affects your assessment of the hypothesized zero-order relationship. This requires that you separately compare the results for each level of the control variable to the zero-order table. Does introducing the control variable tell us anything new? • You will be given another hypothesis and data. There will be two variables – the dependent variable and the independent variable. Both are continuous variables. • You will build a scattergram and draw in a line of best fit. Remember that the independent variable must go on the X (horizontal) axis, and the dependent variable must go on the Y (vertical) axis. Also remember that the line of best fit must be a straight line, placed so as minimize its overall distance from the dots, which represent the cases. • You will estimate the r (correlation coefficient) and state whether the scattergram supports the hypothesis. Be careful! First, is there a relationship between variables? Second, is it in the same direction (positive or negative) as the hypothesized relationship?