lecture 6 - statistical tests 6 - statistical tests.pdf · lecture 6 – statistical tests...

21
Lecture 6 – Statistical Tests Confidence intervals Student test ANOVA test Fisher test for variances Nonparametric tests

Upload: others

Post on 19-Jan-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture 6 - Statistical tests 6 - Statistical tests.pdf · Lecture 6 – Statistical Tests Confidence intervals Student test ANOVA test Fisher test for variances Nonparametric tests

Lecture 6 – Statistical Tests Confidence intervals Student test ANOVA test Fisher test for variances Nonparametric tests

Page 2: Lecture 6 - Statistical tests 6 - Statistical tests.pdf · Lecture 6 – Statistical Tests Confidence intervals Student test ANOVA test Fisher test for variances Nonparametric tests

Gauss Curve

Average=100, Standard deviation=15

Page 3: Lecture 6 - Statistical tests 6 - Statistical tests.pdf · Lecture 6 – Statistical Tests Confidence intervals Student test ANOVA test Fisher test for variances Nonparametric tests

Sample from a normal population

In the following 9 images you will see: In the first one – the distribution of

values for a Gauss population In the second - the distribution of

averages computed for groups of twoindividuals

In the next images, the distribution ofaverages computed for groups of 3, 4, 9,16, 25, 36 and 100 individuals

Page 4: Lecture 6 - Statistical tests 6 - Statistical tests.pdf · Lecture 6 – Statistical Tests Confidence intervals Student test ANOVA test Fisher test for variances Nonparametric tests
Page 5: Lecture 6 - Statistical tests 6 - Statistical tests.pdf · Lecture 6 – Statistical Tests Confidence intervals Student test ANOVA test Fisher test for variances Nonparametric tests

Conclusion: Averages calculated on a sample of

size n drawn from a Gaussiandistributed population have: A Gaussian distribution An average equal to the average of the

population of origin Standard deviation equal to the deviation

of the population divided by square rootof n= STANDARD ERROR!

Err = σ / √n

Page 6: Lecture 6 - Statistical tests 6 - Statistical tests.pdf · Lecture 6 – Statistical Tests Confidence intervals Student test ANOVA test Fisher test for variances Nonparametric tests

Confidence interval- definition We call confidence interval for the

mean an interval of real numberswhere we are almost certain that thereal mean is located.

The level of confidence can bechosen; usually it is 95% or 99%

95,0

n

stmn

stmP cc

Page 7: Lecture 6 - Statistical tests 6 - Statistical tests.pdf · Lecture 6 – Statistical Tests Confidence intervals Student test ANOVA test Fisher test for variances Nonparametric tests

Example: CI95%

Values: Latencies measured over the optic nerve Average: 112,2 Standard deviation: 12,5 Number of cases: 156 Standard error: Coefficient used for 95% confidence: The limits of the interval are:

=> CI95%=[110.24; 114,16]

Page 8: Lecture 6 - Statistical tests 6 - Statistical tests.pdf · Lecture 6 – Statistical Tests Confidence intervals Student test ANOVA test Fisher test for variances Nonparametric tests

What is a statistical test ?

It is a decision method that helps us tovalidate or invalidate a statisticalhypothesis with a certain degree ofconfidence.

Page 9: Lecture 6 - Statistical tests 6 - Statistical tests.pdf · Lecture 6 – Statistical Tests Confidence intervals Student test ANOVA test Fisher test for variances Nonparametric tests

Statistical tests

Statistical tests verify the truthfulnessof statistical hypotheses => a processcalled statistical inference hypothesis H0 (or null hypothesis) data have

no connections between them/ comparedvalues do not differ

hypothesis H1 (or alternate hypothesis) datahave connections between them/ comparedvalues do differ

Page 10: Lecture 6 - Statistical tests 6 - Statistical tests.pdf · Lecture 6 – Statistical Tests Confidence intervals Student test ANOVA test Fisher test for variances Nonparametric tests

Statistical tests

The result of the test is denoted as “p”. “p” is a number between 0 and 1 (or 0% and 100%),

and it represents the probability to make an error if wereject H0, the null hypothesis.

Interpreting p (the same for all statistical tests): p > 0.05, the statistical relationship is not significant (NS). p < 0.05, the statistical relationship is significant (S, 95%

confidence). p < 0.01, the statistical relationship is significant (S, 99%

confidence). p < 0.001, the statistical relationship is highly significant

(HS, 99.9% confidence).

Page 11: Lecture 6 - Statistical tests 6 - Statistical tests.pdf · Lecture 6 – Statistical Tests Confidence intervals Student test ANOVA test Fisher test for variances Nonparametric tests

Student “t” test Test for comparing two means when the

standard deviations are equal It can be used if:

1. measurements from the two samples areindependent

2. the samples come from populations that arenormally distributed (which must be verified beforeapplying the test)

3. the populations from which the samples are drawnhave equal dispersions (or standard deviations)

Page 12: Lecture 6 - Statistical tests 6 - Statistical tests.pdf · Lecture 6 – Statistical Tests Confidence intervals Student test ANOVA test Fisher test for variances Nonparametric tests

Student “t” testWe call H0 the null hypothesis - the assumption

that the averages of the populations (from whichthe samples are drawn) are equal -----H0 : m1 = m2

We call H1 the alternate hypothesis - theassumption that the averages of the populations aredifferent ----- H1 : m1 m2

If the test doesn’t reject H0, we say that data donot support the hypothesis that the populations’means are different

If the test rejects H0, we say that data support thehypothesis that the populations’ means are different

Page 13: Lecture 6 - Statistical tests 6 - Statistical tests.pdf · Lecture 6 – Statistical Tests Confidence intervals Student test ANOVA test Fisher test for variances Nonparametric tests

Example

Pacient No. Localised infection Sepsis1 25 552 20 883 110 534 45 305 50 726 50 527 72 918 53 709 30 11010 50 12311 27 5612 35 3113 85 10014 22 7015 78 4416 65 7017 85 9018 85 12319 55 8520 25 7221 50 7522 85 5023 75 8524 40 10725 50 110

Media 54.68 76.48Deviaţia standard 24.42 26.55

Dispersia 596.56 704.84C.V. (%) 44.67% 34.81%

We analyzed 25 patients with localised infectionand 25 with sepsis, among other measurementswe recorded ESR value.

p<0,05 – we reject H0with a confidence of 95%

54.68

76.48

0

20

40

60

80

100

120

Localised infection Sepsis

Mea

n ±

stan

dar

d d

evia

tio

n

p test Student = 0.004 - S

ESR

t‐Test: Two‐Sample Assuming Equal Variances

Localised infection Sepsis EXPLANATIONSMean 54.68 76.48 Samples’ averagesVariance 596.56 704.84 Samples’ varianceObservations 25 25 Number of patientsPooled Variance 650.70Hypothesized Mean Difference 0df 48 Degrees of freedom: 25+25‐2t Stat ‐3.02149 Computed t valueP(T<=t) one‐tail 0.00201t Critical one‐tail 1.67722P(T<=t) two‐tail 0.00403 p – test resultt Critical two‐tail 2.01063 Theoretical t value)

Page 14: Lecture 6 - Statistical tests 6 - Statistical tests.pdf · Lecture 6 – Statistical Tests Confidence intervals Student test ANOVA test Fisher test for variances Nonparametric tests

Confidence interval analysis

We notice that the upper limit of the 95% confidence interval forthe lower average is below the lower limit of the 95% for thehigher average.In conclusion, we can say that the two averages are different witha confidence level of 95% - which we did using Student’s t test.

Parameter Localised infection SepsisNo. of patients 25 25Mean value 54.68 76.48Standard deviation 24.42 26.55Standard error 4.88 5.31t95% for df=48 2.064 2.064Error level for 95% conf. 10.08 10.96Lower limit 44.60 65.52Upper limit 64.76 87.44

Page 15: Lecture 6 - Statistical tests 6 - Statistical tests.pdf · Lecture 6 – Statistical Tests Confidence intervals Student test ANOVA test Fisher test for variances Nonparametric tests

Student’s t test - variants

t test for samples with equalvariances

t test for samples with unequalvariances

t test for samples with pairedmeasurements

These variants differ in how the coefficient t is calculated, and thus the

p-value.

Page 16: Lecture 6 - Statistical tests 6 - Statistical tests.pdf · Lecture 6 – Statistical Tests Confidence intervals Student test ANOVA test Fisher test for variances Nonparametric tests

ANOVA test Compares the averages of several samples simultaneously. H0: m1 = m2 = m3 = m4 (for 4 samples) H1: at least two averages are significantly different The result is a number p that is interpreted as follows:

If p> 0.05 we do not reject H0, we say that the difference is not significant with 95% confidence

If p <0.05 H0 is rejected with a confidence level of 95% -At least two averrages are significantly different

If p <0.001 H0 is rejected with a confidence level of 99.9%. The difference is highly significant

Page 17: Lecture 6 - Statistical tests 6 - Statistical tests.pdf · Lecture 6 – Statistical Tests Confidence intervals Student test ANOVA test Fisher test for variances Nonparametric tests

Exemplu

In three cities from Dolj county data were taken on dietaryhabits and their relationship to obesity and diabetes. Amongother data we collected the weight of individuals as well asdata on smoking

Individuals, regardless of gender or age group, were dividedinto four categories: non-smokers, former smokers, lightsmokers (less than 10 cigarettes per day) and smokers (morethan 10 cigarettes per day)

An interesting question is whether there was a link betweensmoking habit and body weight in these individuals.

H0: Whether or not smoking, body weight is the same H1: At least two of the four categories had different body

weights

Page 18: Lecture 6 - Statistical tests 6 - Statistical tests.pdf · Lecture 6 – Statistical Tests Confidence intervals Student test ANOVA test Fisher test for variances Nonparametric tests

ANOVA test - results

Page 19: Lecture 6 - Statistical tests 6 - Statistical tests.pdf · Lecture 6 – Statistical Tests Confidence intervals Student test ANOVA test Fisher test for variances Nonparametric tests

Fischer’s test is used to verify the equalityof variances for two normally distributedindependent variables. Null hypothesis is H0: σ1

2=σ22

Bartlett's test is used to verify theequality of variances for several normallydistributed independent variables Null hypothesis is H0: σ1

2=σ22=...=σk

2

THEY ARE PARAMETRIC TESTS

Variance comparison tests

Page 20: Lecture 6 - Statistical tests 6 - Statistical tests.pdf · Lecture 6 – Statistical Tests Confidence intervals Student test ANOVA test Fisher test for variances Nonparametric tests

Nonparametric tests These are tests that do not make assumptions

about data distribution.

They can be applied in all circumstances, if themeasurements are independent

Usually they are used when we are not allowedto apply a parametric test

These tests have less accurate results thanparametric tests, so we apply them only when itis not possible to apply a parametric test

Page 21: Lecture 6 - Statistical tests 6 - Statistical tests.pdf · Lecture 6 – Statistical Tests Confidence intervals Student test ANOVA test Fisher test for variances Nonparametric tests

Nonparametric tests

Comparing means Random data Paired data

2 samples Mann-Whitney Wilcoxon

>2 samples Kruskal-Wallis Friedman

Comparingvariances Levene