Nonparametrics and goodness-of-fit

Slides:



Advertisements
Similar presentations
Hypothesis Testing Steps in Hypothesis Testing:
Advertisements

McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies, Inc. All rights reserved. Nonparametric Methods Chapter 15.
statistics NONPARAMETRIC TEST
Chapter 14 Analysis of Categorical Data
Lesson #25 Nonparametric Tests for a Single Population.
The Simple Regression Model
Topic 2: Statistical Concepts and Market Returns
Test statistic: Group Comparison Jobayer Hossain Larry Holmes, Jr Research Statistics, Lecture 5 October 30,2008.
Final Review Session.
Intro to Statistics for the Behavioral Sciences PSYC 1900 Lecture 17: Nonparametric Tests & Course Summary.
Lecture 9 Today: –Log transformation: interpretation for population inference (3.5) –Rank sum test (4.2) –Wilcoxon signed-rank test (4.4.2) Thursday: –Welch’s.
Chapter 2 Simple Comparative Experiments
Inferences About Process Quality
Student’s t statistic Use Test for equality of two means
15-1 Introduction Most of the hypothesis-testing and confidence interval procedures discussed in previous chapters are based on the assumption that.
Summary of Quantitative Analysis Neuman and Robson Ch. 11
Review for Exam 2 Some important themes from Chapters 6-9 Chap. 6. Significance Tests Chap. 7: Comparing Two Groups Chap. 8: Contingency Tables (Categorical.
7.1 Lecture 10/29.
Nonparametrics and goodness of fit Petter Mostad
Chapter 15 Nonparametric Statistics
1 Chapter 20 Two Categorical Variables: The Chi-Square Test.
Statistical Methods II
Hypothesis Testing and T-Tests. Hypothesis Tests Related to Differences Copyright © 2009 Pearson Education, Inc. Chapter Tests of Differences One.
Chapter 9 Title and Outline 1 9 Tests of Hypotheses for a Single Sample 9-1 Hypothesis Testing Statistical Hypotheses Tests of Statistical.
Chapter 12: Analysis of Variance
AM Recitation 2/10/11.
Non-parametric Dr Azmi Mohd Tamil.
Chapter 14: Nonparametric Statistics
Regression Analysis (2)
The paired sample experiment The paired t test. Frequently one is interested in comparing the effects of two treatments (drugs, etc…) on a response variable.
More About Significance Tests
NONPARAMETRIC STATISTICS
© Buddy Freeman, 2015 H 0 : H 1 : α = Decision Rule: If then do not reject H 0, otherwise reject H 0. Test Statistic: Decision: Conclusion: We have found.
Probability theory 2 Tron Anders Moger September 13th 2006.
Statistics & Biology Shelly’s Super Happy Fun Times February 7, 2012 Will Herrick.
Non-parametric Tests. With histograms like these, there really isn’t a need to perform the Shapiro-Wilk tests!
+ Chapter 12: Inference for Regression Inference for Linear Regression.
Biostat 200 Lecture 7 1. Hypothesis tests so far T-test of one mean: Null hypothesis µ=µ 0 Test of one proportion: Null hypothesis p=p 0 Paired t-test:
Copyright © 2012 Pearson Education. Chapter 23 Nonparametric Methods.
Previous Lecture: Categorical Data Methods. Nonparametric Methods This Lecture Judy Zhong Ph.D.
Analysis of variance Petter Mostad Comparing more than two groups Up to now we have studied situations with –One observation per object One.
Maximum Likelihood Estimator of Proportion Let {s 1,s 2,…,s n } be a set of independent outcomes from a Bernoulli experiment with unknown probability.
Nonparametric Statistics aka, distribution-free statistics makes no assumption about the underlying distribution, other than that it is continuous the.
Chapter 16 The Chi-Square Statistic
1/23 Ch10 Nonparametric Tests. 2/23 Outline Introduction The sign test Rank-sum tests Tests of randomness The Kolmogorov-Smirnov and Anderson- Darling.
+ Chapter 12: More About Regression Section 12.1 Inference for Linear Regression.
FPP 28 Chi-square test. More types of inference for nominal variables Nominal data is categorical with more than two categories Compare observed frequencies.
1 Nonparametric Statistical Techniques Chapter 17.
Nonparametric Statistics
BPS - 5th Ed. Chapter 221 Two Categorical Variables: The Chi-Square Test.
Nonparametric tests, rank-based tests, chi-square tests 1.
Simple linear regression Tron Anders Moger
Medical Statistics (full English class) Ji-Qian Fang School of Public Health Sun Yat-Sen University.
N318b Winter 2002 Nursing Statistics Specific statistical tests Chi-square (  2 ) Lecture 7.
Lecture 2 Frequency Distribution, Cross-Tabulation, and Hypothesis Testing.
Analisis Non-Parametrik Antonius NW Pratama MK Metodologi Penelitian Bagian Farmasi Klinik dan Komunitas Fakultas Farmasi Universitas Jember.
Tuesday PM  Presentation of AM results  What are nonparametric tests?  Nonparametric tests for central tendency Mann-Whitney U test (aka Wilcoxon rank-sum.
Copyright © 2013, 2009, and 2007, Pearson Education, Inc. Chapter 11 Analyzing the Association Between Categorical Variables Section 11.2 Testing Categorical.
Chapter 15 The Chi-Square Statistic: Tests for Goodness of Fit and Independence PowerPoint Lecture Slides Essentials of Statistics for the Behavioral.
Biostatistics Nonparametric Statistics Class 8 March 14, 2000.
Logistic regression. Recall the simple linear regression model: y =  0 +  1 x +  where we are trying to predict a continuous dependent variable y from.
Analysis of variance Tron Anders Moger
BPS - 5th Ed. Chapter 221 Two Categorical Variables: The Chi-Square Test.
Hypothesis Tests u Structure of hypothesis tests 1. choose the appropriate test »based on: data characteristics, study objectives »parametric or nonparametric.
Two-Sample-Means-1 Two Independent Populations (Chapter 6) Develop a confidence interval for the difference in means between two independent normal populations.
Chapter 11: Categorical Data n Chi-square goodness of fit test allows us to examine a single distribution of a categorical variable in a population. n.
CHI SQUARE DISTRIBUTION. The Chi-Square (  2 ) Distribution The chi-square distribution is the probability distribution of the sum of several independent,
Georgi Iskrov, MBA, MPH, PhD Department of Social Medicine
Chapter Fifteen Frequency Distribution, Cross-Tabulation, and
Georgi Iskrov, MBA, MPH, PhD Department of Social Medicine
Presentation transcript:

Nonparametrics and goodness-of-fit Tron Anders Moger 23.10.2006

Nonparametric statistics In tests we have done so far, the null hypothesis has always been a stochastic model with a few parameters. T tests Tests for regression coefficients Test for autocorrelation … In nonparametric tests, the null hypothesis is not a parametric distribution, rather a much larger class of possible distributions

Parametric methods we’ve seen: Estimation Confidence interval for µ Confidence interval for µ1 -µ2 Testing One sample T test Two sample T test The methods are based on the assumption of normally distributed data (or normally distributed mean)

Nonparametric statistics The null hypothesis is for example that the median of the distribution is zero A test statistic can be formulated, so that it has a known distribution under this hypothesis it has more extreme values under alternative hypotheses

Non-parametric methods: Estimation Confidence interval for the median Testing Paired data: Sign test and Wilcoxon signed rank test Two independent samples: Mann-Whitney test/Wilcoxon rank-sum test Make (almost) no assumptions regarding distribution

Confidence interval for the median, example Betaendorphine concentrations (pmol/l) in 11 individuals who collapsed during a half-marathon (in increasing order): 66.0 71.2 83.0 83.6 101.0 107.6 122.0 143.0 160.0 177.0 414.0 Find that median is 107.6 What is the 95% confidence interval?

Confidence interval for the median in SPSS: Use ratio statistics, which is meant for the ratio between two variables. Make a variable that has value 1 for all data (unit) Analyze->Descriptive statistics->Ratios Numerator: betae Denominator: unit Click Statistics and under Central tendency check Median and Confidence Intervals

SPSS-output: 95% confidence interval for the median is (71.2, 177.0):

The sign test Assume the null hypothesis is that the median of the distribution is zero. Given a sample from the distribution, there should be roughly the same number of positive and negative values. More precisely, number of positive values should follow a binomial distribution with probability 0.5. When the sample is large, the binomial distribution can be approximated with a normal distribution Sign test assumes independent observations, no assumptions about the distribution SPSS: Analyze->nonparametric tests->two related samples. Choose sign under test type

Example from lecture 5: Energy intake kJ SUBJECT PREMENST POSTMENS 1 5260.0 3910.0 2 5470.0 4220.0 3 5640.0 3885.0 4 6180.0 5160.0 5 6390.0 5645.0 6 6515.0 4680.0 7 6805.0 5265.0 8 7515.0 5975.0 9 7515.0 6790.0 10 8230.0 6900.0 11 8770.0 7335.0 Number of cases read: 11 Number of cases listed: 11 Want to test if energy intake is different before and after menstruation. H0: Median difference=0 H1: Median difference≠0 +

Using the sign test: The number of positive differences (+’s) should follow a binomial distribution with P=0.5 if H0: median difference between premenst and postmenst is 0 What is the probability of observing 11 +’s? Let P(x) count the number of + signs P(x) is Bin(n=11,P=0.5) The p-value of the test is the probability of observing 11 +’s or something more extreme if H0 is true, hence However, because of two-sided test, the p-value is 0.0005*2=0.001 Clear rejection of H0 on significance-level 0.05

In SPSS: Recall: Found p-value=0.000 using t-test, so p-value from sign-test is a bit larger This will always be the case P-value

Wilcoxon signed rank test Takes into account the strength of the differences, not just if they are positive or negative Here, the null hypothesis is a symmetric distribution with zero median. Do as follows: Rank all values by their absolute values, from smallest to largest Let T+ be the sum of ranks of the positive values, and T-corresponding for negative values Let T be the minimum of T+ and T- Under the null hypothesis, T has a known distribution (p.874). For large samples, the distribution can be approximated with a normal distribution Assumes independent observations and symmetrical distributions SPSS: Analyze->nonparametric tests->two related samples. Choose Wilcoxon under test type

The energy intake example: Difference Rank (+) Rank(-) premenst-postmenst 1350,00 6 No 1250,00 4 negative 1755,00 10 differences! 1020,00 3 745,00 2 1835,00 11 1540,00 8.5 725,00 1 1330,00 5 1435,00 7 Rank sum: T+:66 T-:0 Min(66,0)=0 Test H0: Median difference =0 vs H1: Median difference≠0 with α=0.05 From p.874, find T=11 for n=11 and α/2=0.025 Reject H0 Also, see that p-value is smaller than 0.01

In SPSS: Sum of ranks P-value based on normal approximation P-value based on Wilcoxon distribution

Sign test and Wilcoxon signed rank test Often used on paired data. E.g. we want to compare primary health care costs for the patient in two countries: A number of people having lived in both countries are asked about the difference in costs per year. Use this data in test. In the previous example, if we assume all patients attach the same meaning to the valuations, we could use Wilcoxon signed rank test on the differences in valuations

Wilcoxon rank sum test (or the Mann-Whitney U test) Here, we do NOT have paired data, but rather n1 values from group 1 and n2 values from group 2. Assumptions: Independence within and between groups, same distributions in both groups We want to test whether the values in the groups are samples from different distributions: Rank all values as if they were from the same group Let T be the sum of the ranks of the values from group 1. Under the assumption that the values come from the same distribution, the distribution of T is known. The expectation and variance under the null hypothesis are simple functions of n1 and n2.

Wilcoxon rank sum test (or the Mann-Whitney U test) For large samples, we can use a normal approximation for the distribution of T. The Mann-Whitney U test gives exactly the same results, but uses slightly different test statistic. In SPSS: Analyze->nonparametric tests-> two independent samples tests Test type: Mann-Whitney U

Example We have observed values are the groups different? If we assume that the values in the groups are normally distributed, we can solve this using the T-test. Otherwise we can try the normal approximation to the Wilcoxon rank sum test Test H0: Groups come from same distribution vs H1: Groups come from different distributions on 5% significance level

Example (cont.) Rank Group 1 Group 2 Wilcoxon T: 16 1 1.3 2 1.5 3 2.1 4 3.2 5 3.4 6 4.3 7 4.9 8 6.3 9 7.1 E(T)= n1(n1+n2+1)/2 =25 SE(T)= √n1n2(n1+n2+1)/12 =4.08 Z=(T-E(T))/SE(T) =(16-25)/4.08 =-2.20 p-value: 0.032 Reject H0 Rank sum: 16 29

Number of cases read: 22 Number of cases listed: 22 ID GROUP ENERGY 1 0 6.13 2 0 7.05 .... 12 0 10.15 13 0 10.88 14 1 8.79 15 1 9.19 .... 21 1 11.85 22 1 12.79 Number of cases read: 22 Number of cases listed: 22 Example from lecture 4: Energy expenditure in two groups, lean and obese. Want to test if they come from different distributions.

Wilcoxon Rank Sum Test in SPSS: Sum of ranks Z-value P-value based on normal approx. Exact P-value Exactly the same result as we got when using the T distribution!

Spearman rank correlation This can be applied when you have two observations per item, and you want to test whether the observations are related. Computing the sample correlation (Pearson’s r) gives an indication. We can test whether the Pearson correlation could be zero but test needs assumption of normality.

Spearman rank correlation The Spearman rank correlation tests for association without any assumption on the association: Rank the X-values, and rank the Y-values. Compute ordinary sample correlation of the ranks: This is called the Spearman rank correlation. Under the null hypothesis that X values and Y values are independent, it has a fixed, tabulated distribution (depending on number of observations)

Concluding remarks on nonparametric statistics Tests with much more general null hypotheses, and so fewer assumptions Often a good choice when normality of the data cannot be assumed If you reject the null hypothesis with a nonparametric test, it is a robust conclusion However, with small amounts of data, you can often not get significant conclusions In SPSS, you only get p-values from non-parametric tests, more interesting to know the mean difference and confidence intervals

Some useful comments: Always start by checking whether it is appropriate to use T tests (normally distributed data) If in doubt, a useful tip is to compare p-values from t-tests with p-values from non-parametric tests If very different results, stay with the p-values from the non-parametric tests

Contingency tables The following data type is frequent: Each object (person, case,…) can be in one of two or more categories. The data is the count of number of objects in each category. Often, you measure several categories for each object. The resulting counts can then be put in a contingency table.

Testing if probabilities are as specified Example: Have n objects been placed in K groups, each with probability 1/K? Expected count in group i: Observed count in group i: Test statistic: Test statistic has approx. distribution with K-1 degrees of freedom under null hypothesis.

The Chi-square distribution The Chi-square distribution with n degrees of freedom is denoted It is equal to the sum of the squares of n independent random variables with standard normal distributions.

Testing association in a contingency table Treatment A B C TOTAL 1 23 14 19 R1=56 2 7 10 R2=31 3 9 5 54 R3=68 C1=46 C2=26 C3=83 155 G R O U P n values in total

Testing association in a contingency table If the assignment of observations to the two categories is independent, the expected count in a cell can be computed from the marginal counts: Actual observed count: Test statistic: Under null hypothesis, it has distribution with (r-1)(c-1) degrees of freedom In SPSS: Analyze->Descriptives->Crosstabs

Example from Lecture 4: Spontanous abortions among nurses helping with operations and other nurses Want to test if there is any association between abortions and type of nurse Op.nurses Other nurses No. interviewed 67 92 No. births 36 34 No. abortions 10 3 Percent abortions 27.8 8.8

Example: Abortions No abortions Total Op.nurses 10 26 36 Other nurses 31 34 13 57 70 Expected cell values: Abortion/op.nurses: 13*36/70=6.7 Abortion/other nurses: 13*34/70=6.3 No abortion/op.nurses: 57*36/70=29.3 No abortion/other nurses: 57*34/70=27.7

We get: This has a chi-square distribution with (2-1)*(2-1)=1 d.f. Want to test H0: No association between abortions and type of nurse at 5%-level Find from table 7, p. 869, that the 95%-percentile is 3.84 This gives you a two-sided test! Reject H0: No association Same result as the test for different proportions in Lecture 4!

In SPSS: Check Expected under Cells, Chi-square under statistics, and Display clustered bar charts!

Goodness-of-fit tests Sometimes, the null hypothesis is that the data comes from some parametric distribution, values are then categorized into K groups, and we have the counts from the categories. To test this hypothesis: Estimate the m parameters in the distribution from data. Compute expected counts. Compute the test statistic used for contingency tables. This will now have a chi-squared distribution with K-m-1 d.f. under the null hypothesis.

Poisson example from lecture 3: No. of No. Expected no. observed cases observed (from Poisson dist.) 0 20 18.4 1 16 17.2 2 8 8.1 3 2 2.5 4 0 0.6 5 0 0.11 6 1 0.017 Calculation: P(X=2)=0.9362*e-0.936/2!=0.17 Multiply by the number of weeks: 0.17*47=8.1 Poisson distribution fits data fairly well!

Test if the data can come from a Poisson distribution: Test statistic: approx. with 6-1-1=4 d.f. Calculate: From table 7, p. 869, see that 95%-percentile of chi-square ditribution with 4 d.f. is 9.49 Reject H0: The data come from a Poisson distribution

Tests for normality Visual methods, like histograms and normality plots, are very useful. In addition, several statistical tests for normality exist: Kolmogorov-Smirnov test (which I have showed you before) Bowman-Shelton test (tests skewness and kurtosis) However, with enough data, visual methods are more useful

Next time: Seen tests for comparing means in two independent groups What if you have more than two groups? Analysis of variance