Choosing Appropriate Descriptive Statistics, Graphs and Statistical Tests
Brian Yuen15 January 2013
Slide - 2
2
Using appropriate statistics and graphs• Report statistics and graphs depends on the types of variables of
interest:
– For continuous (Normally distributed) variables
• N, mean, standard deviation, minimum, maximum • histograms, dot plots, box plots, scatter plots
– For continuous (skewed) variables
• N, median, lower quartile, upper quartile, minimum, maximum, geometric mean
• histograms, dot plots, box plots, scatter plots
– For categorical variables
• frequency counts, percentages• one-way tables, two-way tables• bar charts
Slide - 3
3
Using appropriate statistics and graphs…
Z=Cat. Z=Cat.
Y=Cat. Y=Cont. Y=Cat. Y=Cont.
X=Cat.Use
3-Way Table
X=Cont.
X=Time N/A N/A N/A
All these graphs are available in Chart Builder, from the Choose from: list.
Bar chart
Clustered bar charts (two categorical variables)
Bar charts with error bars
Histogram (can be plotted against a categorical variable)
Box & Whisker plot (can be plotted against a categorical variable)
Dot plot (can be plotted against a categorical variable)
Scatter plot (two continuous variables)
Mean
Median
Standard deviation
Range (Min, Max)
Inter-quartile range (LQ, UQ)
Flow chart of commonly used descriptive statistics and graphical illustrations
Frequency
Percentage (Row, Column or Total)
Exploring data
Descriptive statistics
Graphical illustrations
Categorical data
Continuous data: Measure of location
Continuous data: Measure of variation
Categorical data
Continuous data
Slide - 5
Choosing appropriate statistical test
• Having a well-defined hypothesis helps to distinguish the outcome variable and the exposure variable
• Answer the following questions to decide which statistical test is appropriate to analysis your data
– What is the variable type for the outcome variable?
• Continuous (Normal, Skew) / Binary / Time dependent• If more than one outcomes, are they paired or related?
– What is the variable type for the main exposure variable?
• Categorical (1 group, 2 groups, >2 groups) / Continuous• For 2 or >2 groups: Independent (Unrelated) / Paired
(Related)
– Any other covariates, confounding factors?5
6
Continuous
CategoricalOutcome variable
Normal Skew
Survival
1 group
2 groups
>2 groups
Paired
Sign test / Signed rank test
Mann-Whitney U test
Wilcoxon signed rank test
Kruskal Wallis test
1 group
2 groups
>2 groups
Paired
Chi-square test / Exact test
Chi-square test / Fisher’s exact test / Logistic regression
McNemar’s test / Kappa statistic
Chi-square test / Fisher’s exact test / Logistic regression
2 groups
>2 groups
KM plot with Log-rank test
KM plot with Log-rank test
Continuous
Continuous
Continuous
Spearman Corr / Linear Reg
Logistic regression / Sensitivity & specificity / ROC
Cox regression
Two-sample t test
Paired t test
One-way ANOVA test
Pearson Corr / Linear Reg
One-sample t test
Exposure variable
Flow chart of commonly used statistical tests
http://www.som.soton.ac.uk/learn/resmethods/statisticalnotes/which_test.htm
Case Studies
Slide - 9
9
• A simple study investigating:
– the fitness level of our locally selected group of healthy volunteers– with the published average value on fitness level which was done
previously on the national level– fitness level was measured by the length of time walking on a treadmill
before stopping through tiredness
• Objective: any difference between the group average and the published value
• Outcome & type:
• Exposure & type:
• If the continuous outcome is
– Normally distributed – Not Normally distributed
vs.
CONTINUOUS & ORDINAL DATACase Study 1
Slide - 10
10
• A clinical trial investigating:
– the effect of two physiotherapy treatments (standard and enhanced exercise) for patients with a broken leg
– on their fitness level (length of time walking on a treadmill before stopping through tiredness)
• Objective: any difference between the 2 group averages
• Outcome & type:
• Exposure & type:
• If the continuous outcome is
– Normally distributed – Not Normally distributed
CONTINUOUS & ORDINAL DATACase Study 2
Slide - 11
11
• Now each patient performs the walking test before and after enhanced physiotherapy treatment
– data might be presented as two variables, one as before data and the other as after data, but the values for individual patients are paired
• Objective: any difference between the before and the after averages
• Number of outcomes:
• Outcomes & type:
• If the difference in outcomes (e.g. after - before) is
– Normally distributed – Not Normally distributed
CONTINUOUS & ORDINAL DATACase Study 3
Slide - 12
12
• Based on Case Study 2 (standard vs. enhanced exercises), but now with a control group
– i.e. patients without a broken leg
• Objective: any difference among the 3 group averages
• Outcome & type:
• Exposure & type:
• If the continuous outcome is
– Normally distributed – Not Normally distributed
CONTINUOUS & ORDINAL DATACase Study 4
Slide - 13
13
• Now a group of patients each perform the walking test 3 times
– firstly when the cast is removed– after six weeks of physiotherapy– at six months after the physiotherapy treatment
• Objective: any improvement over time
• Number of outcomes:
• Outcomes & type:
• If the continuous outcome is
– Normally distributed – Not Normally distributed
• Note –
Note –
CONTINUOUS & ORDINAL DATACase Study 5
Slide - 14
14
• Before the participants started their fitness test, their blood pressure (BP) was recorded by two different machines
– machine 1 was the ‘gold standard’– machine 2 was newly made and claimed to be more accurate– aim to validate the measurements recorded from machine 2 by assessing the level
of agreement with that obtained from machine 1
• Objective: any agreement between measuring tools
• Number of outcomes:
• Outcomes & type:
• Choice of test:
– –
• Note –
Note –
CONTINUOUS & ORDINAL DATA Case Study 6
Slide - 15
15
When the continuous outcome is not normally distributed?• If outcome normally distributed use t-tests / ANOVA
– easy to obtain confidence interval for differences• So far we’ve recommended using non-parametric tests when data not normal
– often less powerful– non-parametric confidence intervals problematic
• Recall another possibility – take logs (natural log) of the outcome
– check to see if outcome looks normal after logging– can then use t-tests / ANOVA– estimate of the difference and its confidence interval on log scale easily
available– back transform to get estimate of percent change between groups– back transform confidence interval– better to analyse on log scale if data become normally distributed than to
use non-parametric test
Slide - 16
16
• Fitness is now assessed only as Unfit / Fit
– could be as a result of dichotomising the previous continuous outcome (0-5 minutes = Unfit; >5 minutes = Fit)
– investigate whether the proportions of Unfit and Fit are equal (i.e. 50% each) after the standard treatment
– or compare the proportions to specific values (e.g. 10% Fit, 90% Unfit)
• Objective: any difference in proportion within the group(or any difference from the specific proportions)
• Outcome & type:
• Exposure & type:
• Choice of test:
– –
Unfit
Fit
Standard
BINARY DATACase Study 7
Slide - 17
17
Unfit
Fit
Standard
Enhanced
BINARY DATACase Study 8• Similar setting as Case Study 2, but with the binary outcome defined
from Case Study 7 (Unfit / Fit)
– to find out if the enhanced treatment is better than the standard treatment, i.e. more patients into the Fit category
• Objective: any difference in proportion between the groups
• Outcome & type:
• Exposure & type:
• Choice of test:
– –
• Note –
Slide - 18
18
• Fitness still assessed as Unfit / Fit, but we now have only one group of patients assessed before and after enhanced physiotherapy
– each patient was measured before and after treatment
– their status in fitness may change
– similar to Case Study 3
• Objective: any change in status
• Number of outcomes:
• Outcomes & type:
• Choice of test:
–
BINARY DATACase Study 9
Before
After
Unfit Fit
Unfit
Fit
Slide - 19
19
• Recall resting blood pressure (BP) was recorded by two different machines (machine 1 and 2) on our participants from Case Study 6
– the measurements were now categorised as Low BP and High BP– could be as a result of dichotomising the previous continuous outcome by
the default settings from the two machines– aim to validate the status recorded from machine 2 by assessing the level
of agreement with that obtained from machine 1
• Objective: any agreement between measuring tools
• Number of outcomes:
• Outcomes & type:
• Choice of test:
–
BINARY DATACase Study 10
Mac. 1
Mac. 2
Low High
Low
High
Slide - 20
20
• A clinical trial investigating the survival time of patients with a particular cancer
– patients are being randomised into a number of treatment groups– they are then monitored until the end of the study– the length of time between first diagnosis and death is recorded– some people will still be alive at the end of study and we don’t want to exclude
them
• Objective: any difference in the average survival time between groups
• Outcome & type:
• Exposure & type:
• Choice of test:
–
• Note –
SURVIVAL DATACase Study 11
Slide - 21
21
• Table shows results from our trial (number of patients)
• Difference in proportion of Fit between groups (absolute difference):
d/(c+d) - b/(a+b)
• An alternative parameter is the relative risk (multiplicative difference):
d/(c+d)
b/(a+b)
• Another alternative is the odds ratio:
d/c ad
b/a bc
Unfit Fit Total
Standard80
(a)
140
(b)
220
(a+b)
Enhanced20
(c)
220
(d)
240
(c+d)
Chi-square test and Fisher’s exact test show if there is any association between the two independent variables, but it doesn’t provide the effect size between the groups regarding the outcome of interest, e.g. Fit
=
Comparing a binary outcome between two groups – data presented as a 2x2 table
Slide - 22
22
Parameter (95% CI)
Absolute difference in proportions d/(c+d) - b/(a+b)
28.1% (21%, 35%)*
Relative risk d/(c+d)Relative risk c/(a+b)
1.44 (1.29, 1.60)
Odds ratio adOdds ratio bc
6.29 (3.69, 10.72)
* Asymptotic 95% confidence intervals (calculated in CIA) 95% confidence intervals calculated in SPSS
Percentage of Fit in standard group: 140/220 (63.6%) Percentage of Fit in enhanced group: 220/240 (91.7%)
• Reminder: Report confidence intervals for ALL key parameter estimates
– If 95% confidence interval for a difference excludes 0 statistically significant e.g. Absolute difference
– If 95% confidence interval for a ratio excludes 1 statistically significant e.g. Relative risk and Odds ratio
Slide - 23
23
Absolute difference
• simplest to calculate and to interpret• when applied to number of subjects in a group gives number of subjects
expected to benefit• 1/(absolute difference) gives NNT – ‘number needed to treat’ to see one
additional positive response
Relative risk
• intuitively appealing• a multiplicative effect – proportion (risk) of failure in the treatment group
examined relative to (or compare to) that in the reference group• different result depending on whether risks of ‘Fit’ or ‘Unfit’ are examined and
whether ‘Standard exercise’ group is selected as the reference level• natural parameter for cohort studies
Odds ratio • difficult to understand – unless you’re a betting person!• ratio of ‘number of successes expected per number of failures’ between the
treatment group of interest and the reference group• invariant to whether rate of ‘Fit’, ‘Unfit’, or rate of taking ‘Enhanced exercise’
are examined• logistic regression in terms of odds ratios• natural parameter for case-control studies
Advantages and disadvantages of absolute and relative changes, and odds ratios
Slide - 24
24
CONTINUOUS & ORDINAL DATACase Study 12• Now, in the physiotherapy trial, we wanted to investigate
– if there was any relationship between the participants’ fitness level and their age at assessment
– we suspected that age at assessment affected their fitness level regardless of the treatment group they were in
– quantify the relationship by the direction, strength, and magnitude
• Objective: assess and quantify the relationship between two variables
• Outcome & type:
• Exposure & type:
• Choice of test:
– If any of the variables is Normally distributed
– If both variables are not Normally distributed
Slide - 25
25
CONTINUOUS & ORDINAL DATACase Study 13• We now found, in Case Study 12, that age at assignment had some
linear relationship with participants’ fitness level
– needed to quantify this relationship, i.e. what is the average fitness level at different age at assignment
– also wanted to predict fitness level for future patients, given their age at assignment
• Objective: set up a statistical model to quantify the effect of exposure variable on the outcome variable
• Outcome & type:
• Exposure & type:
• Choice of test:
– • Note –
Slide - 26
26
BINARY DATACase Study 14• Similar analysis was performed as in Case Study 13, but
– substituted the binary fitness level (Unfit / Fit) instead of the continuous fitness level
– and wanted to predict the status of fitness level (Unfit / Fit) for future patients, given their age at assignment
• Objective: set up a statistical model to quantify the effect of exposure variable on the outcome variable
• Outcome & type:
• Exposure & type:
• Choice of test:
– • Note –
Slide - 27
27
BINARY DATACase Study 15• Using the logistic regression model from Case Study 14, we can
– aim to evaluate the predictive performance of the regression model developed given we know the true outcome status of fitness level for each participant
– investigate the optimal predictive performance of the model– relate the results to an individual participant indicating the likelihood of them
having a specific status of fitness
• Objective: (1) assess the predictive performance of the model; (2) determine the probability that an individual test result is accurate
• Outcome & type:
• Exposure & type:
• Choice of test:
– (1) – (2)
• Note –
Slide - 28
28
SURVIVAL DATA Case Study 16• Recall the clinical trial investigating the survival time of patients with a
particular cancer (Case Study 11)
– age at randomisation is now considered as an important factor in this relationship regardless of the treatment group
– still interested in the length of time between first diagnosis and death– note that censored data still present due to some people having dropped out during
follow-up, or are still alive at the end of study and we want to make use of this information
• Objective: set up a statistical model to quantify the relationship between the exposure variable and the survival status / time
• Outcome & type:
• Exposure & type:
• Choice of test:
– • Note –
Slide - 29
29
References
• Altman, D.G. Practical Statistics for Medical Research. Chapman and Hall 1991.
• Kirkwood B.R. & Sterne J.A.C. Essential Medical Statistics. 2nd Edition. Oxford: Blackwell Science Ltd 2003.
• Bland M. An Introduction to Medical Statistics. 3rd Edition. Oxford: Oxford Medical Publications 2000.
• Altman D.G., Machin D., Bryant, T.N. & Gardner M.J. Statistics with Confidence. 2nd Edition. BMJ Books 2000.
• Campbell M.J. & Machin D. Medical Statistics: A Commonsense Approach. 3rd Edition, 1999.
• Field A. Discovering Statistics Using SPSS for Windows. 2nd edition. London: Sage Publications 2005.
• Bland JM, Altman DG. (1986). Statistical methods for assessing agreement between two methods of clinical measurement. Lancet, i, 307-310.
• Mathews JNS, Altman DG, Campbell MJ, Royston P (1990) Analysis of serial measurements in medical research. British Medical Journal, 300, 230-235.
Slide - 30
30
Other web and software resources
• UCLA – What statistical analysis should I use?
– http://www.ats.ucla.edu/stat/mult_pkg/whatstat/default.htm• DISCUS
– Discovering Important Statistical Concepts Using Spreadsheets– Interactive spreadsheets, designed for teaching statistics– Web-sites for download and information -
http://www.coventry.ac.uk/ec/research/discus/discus_home.html• Choosing the correct statistical test
– http://bama.ua.edu/~jleeper/627/choosestat.html• SPSS for Windows
– Help– Statistics Coach
• Statistics for the Terrified
Solutions to Case Studies
Slide - 32
32
• A simple study investigating:
– the fitness level of our locally selected group of healthy volunteers– with the published average value on fitness level which was done
previously on the national level– fitness level was measured by the length of time walking on a treadmill
before stopping through tiredness
• Objective: any difference between the group average and the published value
• Outcome & type: fitness level (length of time) – continuous
• Exposure & type: one group only
• If the continuous outcome is
– Normally distributed One-sample t test– Not Normally distributed Sign test / Signed rank test
vs.
CONTINUOUS & ORDINAL DATACase Study 1
Slide - 33
33
• A clinical trial investigating:
– the effect of two physiotherapy treatments (standard and enhanced exercise) for patients with a broken leg
– on their fitness level (length of time walking on a treadmill before stopping through tiredness)
• Objective: any difference between the 2 group averages
• Outcome & type: fitness level – continuous
• Exposure & type: treatment group – binary, independent(or unrelated)
• If the continuous outcome is
– Normally distributed Two-sample t test– Not Normally distributed Mann-Whitney U test
CONTINUOUS & ORDINAL DATACase Study 2
Slide - 34
34
• Now each patient performs the walking test before and after enhanced physiotherapy treatment
– data might be presented as two variables, one as before data and the other as after data, but the values for individual patients are paired
• Objective: any difference between the before and the after averages
• Number of outcomes: 2 (before and after)
• Outcomes & type: fitness level – continuous, paired (or related)
• If the difference in outcomes (e.g. after - before) is
– Normally distributed Paired t test– Not Normally distributed Wilcoxon signed rank test
CONTINUOUS & ORDINAL DATACase Study 3
Slide - 35
35
• Based on Case Study 2 (standard vs. enhanced exercises), but now with a control group
– i.e. patients without a broken leg
• Objective: any difference among the 3 group averages
• Outcome & type: fitness level – continuous
• Exposure & type: treatment group – categorical (more than two levels), independent (or unrelated)
• If the continuous outcome is
– Normally distributed One-way ANOVA test
– Not Normally distributed Kruskal-Wallis test
CONTINUOUS & ORDINAL DATACase Study 4
Slide - 36
36
• Now a group of patients each perform the walking test 3 times
– firstly when the cast is removed– after six weeks of physiotherapy– at six months after the physiotherapy treatment
• Objective: any improvement over time
• Number of outcomes: 3 (time points)
• Outcomes & type: fitness level – continuous, related (more than two repeated measures per patient)
• If the continuous outcome is
– Normally distributed Repeated measures ANOVA test– Not Normally distributed Friedman’s test
• Note – might have a problem with patients dropping out
Note – both approaches only use patients with measures at all three time points
CONTINUOUS & ORDINAL DATACase Study 5
Slide - 37
37
• Before the participants started their fitness test, their blood pressure (BP) was recorded by two different machines
– machine 1 was the ‘gold standard’– machine 2 was newly made and claimed to be more accurate– aim to validate the measurements recorded from machine 2 by assessing the level
of agreement with that obtained from machine 1
• Objective: any agreement between measuring tools
• Number of outcomes: 2 (machines)
• Outcomes & type: blood pressure – continuous, paired (or related)
• Choice of test:
– Bland-Altman method (& Paired t-test)
• Note – the Bland-Altman method is not a statistical test
Note – see the Bland and Altman paper for details
CONTINUOUS & ORDINAL DATA Case Study 6
Slide - 38
38
• Fitness is now assessed only as Unfit / Fit
– could be as a result of dichotomising the previous continuous outcome (0-5 minutes = Unfit; >5 minutes = Fit)
– investigate whether the proportions of Unfit and Fit are equal (i.e. 50% each) after the standard treatment
– or compare the proportions to specific values (e.g. 10% Fit, 90% Unfit)
• Objective: any difference in proportion within the group(or any difference from the specific proportions)
• Outcome & type: fitness level category – binary
• Exposure & type: one group only
• Choice of test:
– Chi-square test (large sample size)– Exact test (small sample size)
Unfit
Fit
Standard
BINARY DATACase Study 7
Slide - 39
39
Unfit Fit
Standard
Enhanced
BINARY DATACase Study 8• Similar setting as Case Study 2, but with the binary outcome defined
from Case Study 7 (Unfit / Fit)
– to find out if the enhanced treatment is better than the standard treatment, i.e. more patients into the Fit category
• Objective: any difference in proportion between the groups
• Outcome & type: fitness level category – binary
• Exposure & type: treatment groups – binary, independent (or unrelated)
• Choice of test:
– Chi-square test (large sample size)– Fisher’s exact test (small sample size)
• Note – same tests for more than 2 groups
Slide - 40
40
• Fitness still assessed as Unfit / Fit, but we now have only one group of patients assessed before and after enhanced physiotherapy
– each patient was measured before and after treatment
– their status in fitness may change
– similar to Case Study 3
• Objective: any change in status
• Number of outcomes: 2 (before and after)
• Outcomes & type: fitness level category – binary, paired (or related)
• Choice of test:
– McNemar’s test
BINARY DATACase Study 9
Before
After
Unfit Fit
Unfit
Fit
Slide - 41
41
• Recall resting blood pressure (BP) was recorded by two different machines (machine 1 and 2) on our participants from Case Study 6
– the measurements were now categorised as Low BP and High BP– could be as a result of dichotomising the previous continuous outcome by
the default settings from the two machines– aim to validate the status recorded from machine 2 by assessing the level
of agreement with that obtained from machine 1
• Objective: any agreement between measuring tools
• Number of outcomes: 2 (machines)
• Outcomes & type: blood pressure status (from each machine) – binary, paired (or related)
• Choice of test:
– Kappa statistic
BINARY DATACase Study 10
Mac. 1
Mac. 2
Low High
Low
High
Slide - 42
42
• A clinical trial investigating the survival time of patients with a particular cancer
– patients are being randomised into a number of treatment groups– they are then monitored until the end of the study– the length of time between first diagnosis and death is recorded– some people will still be alive at the end of study and we don’t want to exclude them
• Objective: any difference in the average survival time between groups
• Outcome & type: time monitored & death status– survival
• Exposure & type: treatment group – binary, independent (or unrelated)
• Choice of test:
– KM plot with Log-rank test
• Note – we can also apply this to our physiotherapy example, to look at the “survival time”, that is the time to stop walking on the treadmill through tiredness for both groups of patients in the presence of censored data
SURVIVAL DATACase Study 11
Slide - 43
43
CONTINUOUS & ORDINAL DATACase Study 12• Now, in the physiotherapy trial, we wanted to investigate
– if there was any relationship between the participants’ fitness level and their age at assessment
– we suspected that age at assessment affected their fitness level regardless of the treatment group they were in
– quantify the relationship by the direction, strength, and magnitude
• Objective: assess and quantify the relationship between two variables
• Outcome & type: fitness level – continuous
• Exposure & type: age at assessment – continuous
• Choice of test:
– If any of the variables is Normally distributed Pearson correlation
– If both variables are not Normally distributed Spearman’s rank correlation
Slide - 44
44
CONTINUOUS & ORDINAL DATACase Study 13• We now found, in Case Study 12, that age at assignment had some
linear relationship with participants’ fitness level
– needed to quantify this relationship, i.e. what is the average fitness level at different age at assignment
– also wanted to predict fitness level for future patients, given their age at assignment
• Objective: set up a statistical model to quantify the effect of exposure variable on the outcome variable
• Outcome & type: fitness level – continuous
• Exposure & type: age at assessment – continuous
• Choice of test:
– (Simple) Linear regression• Note – Linear regression is also appropriate when the exposure variable is
categorical, e.g. exercise treatment group (standard & enhanced), as well as controlling for other covariates
Slide - 45
45
BINARY DATACase Study 14• Similar analysis was performed as in Case Study 13, but
– substituted the binary fitness level (Unfit / Fit) instead of the continuous fitness level
– and wanted to predict the status of fitness level (Unfit / Fit) for future patients, given their age at assignment
• Objective: set up a statistical model to quantify the effect of exposure variable on the outcome variable
• Outcome & type: fitness level category – binary
• Exposure & type: age at assessment – continuous
• Choice of test:
– (Simple) Logistic regression• Note – Logistic regression is also appropriate when the exposure variable is
categorical, e.g. exercise treatment group (standard & enhanced), as well as controlling for other covariates
Slide - 46
46
BINARY DATACase Study 15• Using the logistic regression model from Case Study 14, we can
– aim to evaluate the predictive performance of the regression model developed given we know the true outcome status of fitness level for each participant
– investigate the optimal predictive performance of the model– relate the results to an individual participant indicating the likelihood of them
having a specific status of fitness
• Objective: (1) assess the predictive performance of the model; (2) determine the probability that an individual test result is accurate
• Outcome & type: fitness level category – binary
• Exposure & type: age at assessment – continuous
• Choice of test:
– (1) Sensitivity and specificity, ROC curve– (2) PPV and NPV
• Note – none of the above methods are statistical tests
Slide - 47
47
SURVIVAL DATA Case Study 16• Recall the clinical trial investigating the survival time of patients with a
particular cancer (Case Study 11)
– age at randomisation is now considered as an important factor in this relationship regardless of the treatment group
– still interested in the length of time between first diagnosis and death– note that censored data still present due to some people having dropped out during
follow-up, or are still alive at the end of study and we want to make use of this information
• Objective: set up a statistical model to quantify the relationship between the exposure variable and the survival status / time
• Outcome & type: time monitored & death status – survival
• Exposure & type: age at randomisation – continuous
• Choice of test:
– Cox regression• Note – Cox regression is also appropriate when the exposure variable is categorical, e.g.
treatment groups (active & placebo), as well as controlling for other covariates