A comprehensive guide to statistical hypothesis testing with examples in SAS and R When analyzing datasets the following questions often arise: Is there a short hand procedure for a statistical test available in SAS or R? If so, how do I use it? If not, how do I program the test myself? This book answers these questions and provides an overview of the most common statistical test problems in a comprehensive way, making it easy to find and perform an appropriate statistical test. A general summary of statistical test theory is presented, along with a basic description for each test, including the necessary prerequisites, assumptions, the formal test problem and the test statistic. Examples in both SAS and R are provided, along with program code to perform the test, resulting output and remarks explaining the necessary program parameters. Key features: * Provides examples in both SAS and R for each test presented. * Looks at the most common statistical tests, displayed in a clear and easy to follow way. * Supported by a supplementary website http://www.d-taeger.de featuring example program code.Academics, practitioners and SAS and R programmers will find this book a valuable resource. Students using SAS and R will also find it an excellent choice for reference and data analysis.
Preface xiii
Part I INTRODUCTION 1 (16)
1 Statistical hypothesis testing 3 (14)
1.1 Theory of statistical hypothesis 3 (1)
testing
1.2 Testing statistical hypothesis with 4 (9)
SAS and R
1.2.1 Programming philosophy of SAS and 5 (1)
R
1.2.2 Testing in SAS and R--An example 6 (5)
1.2.3 Calculating p-values 11 (2)
1.3 Presentation of the statistical tests 13 (4)
References 15 (2)
Part II NORMAL DISTRIBUTION 17 (32)
2 Tests on the mean 19 (17)
2.1 One-sample tests 19 (4)
2.1.1 z-test 19 (3)
2.1.2 t-test 22 (1)
2.2 Two-sample tests 23 (13)
2.2.1 Two-sample z-test 23 (3)
2.2.2 Two-sample pooled t-test 26 (2)
2.2.3 Welch test 28 (3)
2.2.4 Paired z-test 31 (2)
2.2.5 Paired t-test 33 (2)
References 35 (1)
3 Tests on the variance 36 (13)
3.1 One-sample tests 36 (5)
3.1.1 Χ-test on the variance (mean 36 (3)
known)
3.1.2 Χ2-test on the variance (mean 39 (2)
unknown)
3.2 Two-sample tests 41 (8)
3.2.1 Two-sample F-test on variances of 41 (3)
two populations
3.2.2 t-test on variances of two 44 (3)
dependent populations
References 47 (2)
Part III BINOMIAL DISTRIBUTION 49 (16)
4 Tests on proportions 51 (14)
4.1 One-sample tests 51 (4)
4.1.1 Binomial test 51 (4)
4.2 Two-sample tests 55 (7)
4.2.1 z-test for the difference of two 55 (4)
proportions (unpooled variances)
4.2.2 z-test for the equality between 59 (3)
two proportions (pooled variances)
4.3 K-sample tests 62 (3)
4.3.1 K-sample binomial test 62 (2)
References 64 (1)
Part IV OTHER DISTRIBUTIONS 65 (14)
5 Poisson distribution 67 (9)
5.1 Tests on the Poisson parameter 67 (9)
5.1.1 z-test on the Poisson parameter 67 (3)
5.1.2 Exact test on the Poisson 70 (2)
parameter
5.1.3 z-test on the difference between 72 (3)
two Poisson parameters
References 75 (1)
6 Exponential distribution 76 (3)
6.1 Test on the parameter of an 76 (3)
exponential distribution
6.1.1 z-test on the parameter of an 76 (2)
exponential distribution
Reference 78 (1)
Part V CORRELATION 79 (20)
7 Tests on association 81 (18)
7.1 One-sample tests 81 (13)
7.1.1 Pearson's product moment 81 (5)
correlation coefficient
7.1.2 Spearman's rank correlation 86 (5)
coefficient
7.1.3 Partial correlation 91 (3)
7.2 Two-sample tests 94 (5)
7.2.1 z-test for two correlation 94 (4)
coefficients (independent populations)
References 98 (1)
Part VI NONPARAMETRIC TESTS 99 (38)
8 Tests on location 101 (19)
8.1 One-sample tests 101 (9)
8.1.1 Sign test 101 (4)
8.1.2 Wilcoxon signed-rank test 105 (5)
8.2 Two-sample tests 110 (6)
8.2.1 Wilcoxon rank-sum test 110 (4)
(Mann--Whitney U test)
8.2.2 Wilcoxon matched-pairs 114 (2)
signed-rank test
8.3 K-sample tests 116 (4)
8.3.1 Kruskal--Wallis test 116 (2)
References 118 (2)
9 Tests on scale difference 120 (12)
9.1 Two-sample tests 120 (12)
9.1.1 Siegel--Tukey test 120 (5)
9.1.2 Ansari--Bradley test 125 (3)
9.1.3 Mood test 128 (3)
References 131 (1)
10 Other tests 132 (5)
10.1 Two-sample tests 132 (5)
10.1.1 Kolmogorov--Smirnov two-sample 132 (3)
test (Smirnov test)
References 135 (2)
Part VII GOODNESS-OF-FIT TESTS 137 (30)
11 Tests on normality 139 (15)
11.1 Tests based on the EDF 139 (9)
11.1.1 Kolmogorov--Smirnov test 139 (3)
(Lilliefors test for normality)
11.1.2 Anderson--Darling test 142 (3)
11.1.3 Cramer--von Mises test 145 (3)
11.2 Tests not based on the EDF 148 (6)
11.2.1 Shapiro--Wilk test 148 (2)
11.2.2 Jarque--Bera test 150 (2)
References 152 (2)
12 Tests on other distributions 154 (13)
12.1 Tests based on the EDF 154 (10)
12.1.1 Kolmogorov--Smirnov test 154 (3)
12.1.2 Anderson--Darling test 157 (3)
12.1.3 Cramer--von Mises test 160 (4)
12.2 Tests not based on the EDF 164 (3)
12.2.1 Χ2 Goodness-of-fit test 164 (2)
References 166 (1)
Part VIII TESTS ON RANDOMNESS 167 (20)
13 Tests on randomness 169 (18)
13.1 Run tests 169 (9)
13.1.1 Wald--Wolfowitz runs test 169 (5)
13.1.2 Runs up and down test 174 (4)
13.2 Successive difference tests 178 (9)
13.2.1 von Neumann test 178 (3)
13.2.2 von Neumann rank test (Bartels' 181 (4)
test)
References 185 (2)
Part IX TESTS ON CONTINGENCY TABLES 187 (30)
14 Tests on contingency tables 189 (28)
14.1 Tests on independence and homogeneity 189 (8)
14.1.1 Fisher's exact test 189 (3)
14.1.2 Pearson's Χ2-test 192 (3)
14.1.3 Likelihood-ratio Χ2-test 195 (2)
14.2 Tests on agreement and symmetry 197 (8)
14.2.1 Test on Cohen's kappa 197 (3)
14.2.2 McNemar's test 200 (3)
14.2.3 Bowker's test for symmetry 203 (2)
14.3 Test on risk measures 205 (12)
14.3.1 Large sample test on the odds 205 (5)
ratio
14.3.2 Large sample test on the 210 (4)
relative risk
References 214 (3)
Part X TESTS ON OUTLIERS 217 (20)
15 Tests on outliers 219 (18)
15.1 Outliers tests for Gaussian null 219 (10)
distribution
15.1.1 Grubbs' test 219 (4)
15.1.2 David--Hartley--Pearson test 223 (2)
15.1.3 Dixon's tests 225 (4)
15.2 Outlier tests for other null 229 (8)
distributions
15.2.1 Test on outliers for exponential 229 (3)
null distributions
15.2.2 Test on outliers for uniform 232 (3)
null distributions
References 235 (2)
Part XI TESTS IN REGRESSION ANALYSIS 237 (27)
16 Tests in regression analysis 239 (14)
16.1 Simple linear regression 239 (7)
16.1.1 Test on the slope 239 (4)
16.1.2 Test on the intercept 243 (3)
16.2 Multiple linear regression 246 (7)
16.2.1 Test on an individual regression 247 (3)
coefficient
16.2.2 Test for significance of 250 (2)
regression
References 252 (1)
17 Tests in variance analysis 253 (11)
17.1 Analysis of variance 253 (5)
17.1.1 One-way ANOVA 253 (2)
17.1.2 Two-way ANOVA 255 (3)
17.2 Tests for homogeneity of variances 258 (6)
17.2.1 Bartlett test 258 (2)
17.2.2 Levene test 260 (3)
References 263 (1)
Appendix A Datasets 264 (7)
Appendix B Tables 271 (13)
Glossary 284 (3)
Index 287