Download presentation

Presentation is loading. Please wait.

Published byEllis Broadwater Modified about 1 year ago

1
Statistics: Unlocking the Power of Data Lock 5 STAT 101 Dr. Kari Lock Morgan Describing Data: Two Variables SECTIONS 2.1, 2.4, 2.5 Two categorical (2.1) Quantitative and categorical (2.4) Two quantitative (2.5)

2
Statistics: Unlocking the Power of Data Lock 5 The Big Picture Population Sample Sampling Statistical Inference Descriptive Statistics

3
Statistics: Unlocking the Power of Data Lock 5 Two Categorical Variables Look at the relationship between two categorical variables 1. Relationship status 2. Gender

4
Statistics: Unlocking the Power of Data Lock 5 Two-Way Table FemaleMaleTotal In a Relationship321042 It’s Complicated12719 Single6345108 Total10762169 It doesn’t matter which variable is displayed in the rows and which in the columns R: table(relationship, gender) Data from Duke students

5
Statistics: Unlocking the Power of Data Lock 5 Two-Way Table What proportion of students in this sample are in a relationship? a)42/169 25% b)32/107 30% c)10/62 16% d)32/42 76% FemaleMaleTotal In a Relationship321042 It’s Complicated12719 Single6345108 Total10762169

6
Statistics: Unlocking the Power of Data Lock 5 Two-Way Table What proportion of females in this sample are in a relationship? a)42/169 25% b)32/107 30% c)10/62 16% d)32/42 76% FemaleMaleTotal In a Relationship321042 It’s Complicated12719 Single6345108 Total10762169

7
Statistics: Unlocking the Power of Data Lock 5 Male and Female Proportions 30% of females in the sample say they are in a relationship 16% of males in the sample say they are in a relationship Why the difference???

8
Statistics: Unlocking the Power of Data Lock 5 Difference in Proportions

9
Statistics: Unlocking the Power of Data Lock 5 Two-Way Table What proportion of people in a relationship in this sample are female? a)42/169 25% b)32/107 30% c)10/62 16% d)32/42 76% FemaleMaleTotal In a Relationship321042 It’s Complicated12719 Single6345108 Total10762169

10
Statistics: Unlocking the Power of Data Lock 5 Two-Way Table CAUTION: The proportion of females in a relationship is NOT THE SAME AS the proportion of people in a relationship who are female! 30% ≠ 76%!

11
Statistics: Unlocking the Power of Data Lock 5 Side-by-Side Bar Chart R: barplot(relationship~gender, beside=TRUE) The height of each bar is the number of the corresponding cell in the two-way table

12
Statistics: Unlocking the Power of Data Lock 5 Segmented Bar Chart A segmented bar chart is like a side-by-side bar chart, but the bars are stacked instead of side-by-side R: barplot(relationship~gender)

13
Statistics: Unlocking the Power of Data Lock 5 Vitamin D Injections Many kidney dialysis patients get vitamin D injections to correct for a lack of calcium. Two forms of vitamin D injections are used: calcitriol and paricalcitol. The records of 67,000 dialysis patients were examined, and half received one drug; the other half the other drug. After three years, 58.7% of those getting paricalcitol had survived, while only 51.5% of those getting calcitriol had survived. Construct an approximate two-way table of the data ( due to rounding of the percentages we can’t recover the exact counts – round to whole numbers). Source: Teng, M., et. al., “Survival of patients undergoing hemodialysis with paricalcitol or calcitriol Therapy,” New England Journal of Medicine, July 31, 2003; 349(5): 446-456.Survival of patients undergoing hemodialysis with paricalcitol or calcitriol Therapy

14
Statistics: Unlocking the Power of Data Lock 5 Vitamin D Injections SurvivedDiedTotal Calcitriol Paricalcitol Total 67,000 33,500 19,66513,835 17,25216,248 36,91730,083

15
Statistics: Unlocking the Power of Data Lock 5 Kidney Stones R. Charig, D. R. Webb, S. R. Payne, O. E. Wickham (1986). "Comparison of treatment of renal calculi by open surgery, percutaneous nephrolithotomy, and extracorporeal shockwave lithotripsy". Br Med J (Clin Res Ed) 292 (6524): 879–882"Comparison of treatment of renal calculi by open surgery, percutaneous nephrolithotomy, and extracorporeal shockwave lithotripsy" SuccessFailure Treatment A27377 Treatment B28961 Which treatment is better at removing kidney stones? a) Treatment A b) Treatment B

16
Statistics: Unlocking the Power of Data Lock 5 Kidney Stones SMALL STONESSuccessFailure Treatment A816 Treatment B23436 Which treatment is better at removing small kidney stones? a) Treatment A b) Treatment B

17
Statistics: Unlocking the Power of Data Lock 5 Kidney Stones LARGE STONESSuccessFailure Treatment A19271 Treatment B5525 Which treatment is better at removing large kidney stones? a) Treatment A b) Treatment B

18
Statistics: Unlocking the Power of Data Lock 5 Kidney Stones Treatment A is more effective for all kidney stones, but the data shows Treatment B to be effective overall! How is this possible!?!?

19
Statistics: Unlocking the Power of Data Lock 5 Kidney Stones – Simpson’s Paradox Large StonesSuccessFailureSuccess Rate Treatment A1927173% Treatment B552569% Small StonesSuccessFailureSuccess Rate Treatment A81693% Treatment B2343687% ALL STONESSuccessFailureSuccess Rate Treatment A2737778% Treatment B2896183%

20
Statistics: Unlocking the Power of Data Lock 5 Kidney Stones Treatment A is used more often on large stones, which are harder to treat. This is an example of Simpson’s Paradox: an observed relationship between two variables can change (or even reverse!) when a third variable is considered

21
Statistics: Unlocking the Power of Data Lock 5 Kidney Stones

22
Statistics: Unlocking the Power of Data Lock 5

23
Small Stones Treatment A Treatment B Successful81 (93%)234 (87%) Unsuccessful636 Slope = # successful / # unsuccessful = odds

24
Statistics: Unlocking the Power of Data Lock 5 Large Stones Treatment A Treatment B Successful192 (73%)55 (69%) Unsuccessful7125 Slope = # successful / # unsuccessful = odds

25
Statistics: Unlocking the Power of Data Lock 5 Combined Treatment A Treatment B Successful 81+192=27 3 289 Unsuccessful6+71=7761

26
Statistics: Unlocking the Power of Data Lock 5 Combined Treatment A Treatment B Successful273 (78%)289 (83%) Unsuccessful7761

27
Statistics: Unlocking the Power of Data Lock 5 Combined Treatment A Treatment B Successful273 (78%)289 (83%) Unsuccessful7761

28
Statistics: Unlocking the Power of Data Lock 5

29
Summary: Two Categorical Variables Summary Statistics Two-way table Difference in proportions Visualization Side-by-side bar chart Segmented bar chart

30
Statistics: Unlocking the Power of Data Lock 5 Quantitative and Categorical Relationships Interested in a quantitative variable broken down by categorical groups

31
Statistics: Unlocking the Power of Data Lock 5 Tea and the Immune System Mednick, Cai, Kanady, and Drummond (2008). “Comparing the benefits of caffeine, naps and placebo on verbal, motor and perceptual memory,” Behavioral Brain Research, 193, 79-86. Participants were randomized to drink five or six cups of either tea or coffee every day for two weeks (both drinks have caffeine but only tea has L-theanine) After two weeks, blood samples were exposed to an antigen, and production of interferon gamma (immune system response) was measured Explanatory variable: tea or coffee Response variable: measure of interferon gamma

32
Statistics: Unlocking the Power of Data Lock 5 Tea and the Immune System If the tea drinkers have significantly higher levels of interferon gamma, can we conclude that drinking tea rather than coffee caused an increase in this aspect of the immune response? a) Yes b) No Randomized experiment – possible to make conclusions about causality

33
Statistics: Unlocking the Power of Data Lock 5 Side-by-Side Boxplots R: boxplot(InterferonGamma~Drink)

34
Statistics: Unlocking the Power of Data Lock 5 Quantitative Statistics by a Categorical Variable

35
Statistics: Unlocking the Power of Data Lock 5 Difference in Means R: compareMean(InterferonGamma~Drink)

36
Statistics: Unlocking the Power of Data Lock 5 Summary: One Quantitative and One Categorical Summary Statistics Any summary statistics for quantitative variables, broken down by groups Difference in means Visualization Side-by-side boxplots

37
Statistics: Unlocking the Power of Data Lock 5 Two Quantitative Variables Summary Statistics: correlation Visualization: scatterplot

38
Statistics: Unlocking the Power of Data Lock 5 Scatterplot A scatterplot is the graph of the relationship between two quantitative variables. R: plot(study_hours, gpa)

39
Statistics: Unlocking the Power of Data Lock 5 Direction of Association A positive association means that values of one variable tend to be higher when values of the other variable are higher A negative association means that values of one variable tend to be lower when values of the other variable are higher Two variables are not associated if knowing the value of one variable does not give you any information about the value of the other variable

40
Statistics: Unlocking the Power of Data Lock 5 Cars Data Handout Quantitative Variables: Weight (pounds) City MPG Fuel capacity (gallons) Page number (in Consumer Reports) Time to go ¼ mile (in seconds) Acceleration time from 0 to 60 mph Relationships Weight vs. CityMPG Weight vs. FuelCapacity PageNum vs. Fuel Capacity Weight vs. QtrMile Acc060 vs. QtrMile CityMPG vs. QtrMile

41
Statistics: Unlocking the Power of Data Lock 5 Car Associations

42
Statistics: Unlocking the Power of Data Lock 5 Correlation The correlation is a measure of the strength and direction of linear association between two quantitative variables Sample correlation: r Population correlation: (“rho”) R: cor(x,y)

43
Statistics: Unlocking the Power of Data Lock 5 Car Correlations What are the properties of correlation? (-.91) (.89) (-.08) (-.45) (.99) (.51)

44
Statistics: Unlocking the Power of Data Lock 5 Correlation 1. -1 ≤ r ≤ 1 2. The sign indicates the direction of association 1. positive association: r > 0 2. negative association: r < 0 3. no linear association: r 0 3. The closer r is to ±1, the stronger the linear association 4. r has no units and does not depend on the units of measurement 5. The correlation between X and Y is the same as the correlation between Y and X

45
Statistics: Unlocking the Power of Data Lock 5 Correlation Guessing Game http://istics.net/gett/gcstart.php?group_id=duke Highest scorer in the class by the first exam gets one extra credit point!

46
Statistics: Unlocking the Power of Data Lock 5 Correlation r = 0.43 NFL Teams

47
Statistics: Unlocking the Power of Data Lock 5 Correlation Same plot, but with Dolphins and Raiders (outliers) removed r = 0.08

48
Statistics: Unlocking the Power of Data Lock 5 Human Cannonball Y X Plot Y vs. X What is the correlation between X and Y? a) r > 0 b) r < 0 c) r = 0 Are X and Y associated? a) Yes b) No

49
Statistics: Unlocking the Power of Data Lock 5 Correlation Cautions 1. Correlation can be heavily affected by outliers. Always plot your data! 2. r = 0 means no linear association. The variables could still be otherwise associated. Always plot your data! 3. Correlation does not imply causation!

50
Statistics: Unlocking the Power of Data Lock 5 Summary: Two Quantitative Variables Summary Statistics: correlation Visualization: scatterplot

51
Statistics: Unlocking the Power of Data Lock 5 Variable(s)VisualizationSummary Statistics Categoricalbar chart, pie chart frequency table, relative frequency table, proportion Quantitativedotplot, histogram, boxplot mean, median, max, min, standard deviation, range, IQR, five number summary Categorical vs Categorical side-by-side bar chart, segmented bar chart two-way table, difference in proportions Quantitative vs Categorical side-by-side boxplotsstatistics by group, difference in means Quantitative vs Quantitative scatterplotcorrelation

52
Statistics: Unlocking the Power of Data Lock 5 To Do Read Sections 2.1, 2.4, 2.5 Do HW 2 (due Wednesday, 1/29)

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google