## Over 100 Statistical Tests at Your Fingertips!

If you have been involved in data analysis, or you’re planning to to use data, you want a quick and easy access to relevant statistical tests.

The R statistical package is a great tool used by millions. You can do your analysis, draw charts, carry out statistical tests, it is easy to use and best of all it is free!

In the following paragraphs, I’ll show you how easy and quick it is to use R for statistical tests. Let's begin with the Ljung -Box Test.

Is the sequence of observations in a sample randomly distributed?

To test the hypothesis that the elements of the sequence of data in a sample are random. The Ljung-Box test is based on the autocorrelation plot. If the autocorrelations are very small, we conclude that series is random. Instead of testing randomness at each distinct lag, it tests the "overall" randomness based on a pre-specified number of lags. There are a number of rules of thumb for choosing the lag length. The first is to set it to ln(n), where n is the number of observations in the sample and ln() is the natural logarithm. An alternative rule sets it to 20, if the sample size is reasonable large.

The R statistical package is a great tool used by millions. You can do your analysis, draw charts, carry out statistical tests, it is easy to use and best of all it is free!

In the following paragraphs, I’ll show you how easy and quick it is to use R for statistical tests. Let's begin with the Ljung -Box Test.

**Ljung-Box Test****Question the test addresses**Is the sequence of observations in a sample randomly distributed?

**When to use the test?**To test the hypothesis that the elements of the sequence of data in a sample are random. The Ljung-Box test is based on the autocorrelation plot. If the autocorrelations are very small, we conclude that series is random. Instead of testing randomness at each distinct lag, it tests the "overall" randomness based on a pre-specified number of lags. There are a number of rules of thumb for choosing the lag length. The first is to set it to ln(n), where n is the number of observations in the sample and ln() is the natural logarithm. An alternative rule sets it to 20, if the sample size is reasonable large.

**Some Practical Applications of the**

**Ljung-Box Test**

**Lara-Ramírez et al (2013) study data on onchocerciasis cases in Chiapas and Oaxaca, Mexico. Monthly data of onchocerciasis cases between 1988 and 2010 were modeled using time-series models. The researchers developed two models, one for Chiapas and the other for Oaxaca. The best-fit model for Oaxaca was a mixed Auto-regressive integrated moving average (ARIMA ) seasonal non-stationary model. The Ljung–Box test was used to assess the independence of the residuals (p- value = 0.93); It did not reject the null hypothesis of independence in the residuals of the Oaxaca time series model. The best-fit model for Chiapas was a mixed ARIMA seasonal non-stationary model. The Ljung–Box test was used to assess the independence of the residuals (p- value = 0.34); It did not reject the null hypothesis of independence in the residuals of the Oaxaca time series model.**

*Onchocerciasis cases in Mexico:***Maurer et al (2013) investigate seed dispersal by the tropical tree, Luehea seemannii in the Parque Natural Metropolitano, Panama. A nine-month data set of wind speed in three dimensions and turbulence (February through October, 2007) was used in the analysis. In addition long-term measurements of above-canopy wind (hourly mean horizontal wind speed and temperature from 2000 to 2010 ). A multivariate regression model between seed abscission and the observed environmental factors is constructed. The goodness-of-fit of the final model was evaluated by testing the residuals for independence using the Box–Ljung test. The researchers report the best-fit model and the second-best-fit model, the residuals can be considered independent (Ljung-Box test p-value >0.05).**

*Seed dispersal:***Allen et al (2013) evaluate the effectiveness of a behavioral treatment package to reduce chronic sleep problems in children with Angelman Syndrome. Five children (Annie,Bobby ,Eddie, Cindy and Darcy) between the ages of 2 to 11 years old were recruited onto the study. Sleep and disruptive nighttime behaviors were logged by parents in sleep diaries. Actigraphy was added to provide independent evaluations of sleep–wake activity. The researchers report that Annie,Bobby and Eddie had no statistically significant autocorrelations (Ljung–Boxtest p-value >0.05). Cindy showed significant auto correlation at lag 1 (Ljung–Boxtest p-value <0.05). Darcy showed autocorrelation at lag 1 (Ljung–Boxtest p-value <0.01), lag 2 (Ljung–Boxtest p-value <0.01), lag 3 (Ljung–Boxtest p-value <0.01), lag 4 (Ljung–Boxtest p-value <0.05), lag 5 (Ljung–Boxtest p-value <0.05) and lag 6 (Ljung–Boxtest p-value <0.05).**

*Angelman Syndrome:***How to calculate the Ljung-Box Test in R**

The function Box.test{stats} is used to perform this test. It takes the form:

Box.test (series, lag = 1, type = "Ljung-Box").

Note 'series' refers to the time-series you wish to test, 'lag' refers to the number of autocorrelation coefficients you want to test.

Let's take a look at how to use this test in R.

**Enter the following data into the R consol:**

y<-c(-82.29,-31.14,136.58,85.42,42.96,-122.72,0.59,55.77,117.62,-10.95,-211.38,-304.02,30.72,238.19,140.98,18.88,-48.21,-63.7)

Now type:

Box.test (y, lag = 3,type = "Ljung-Box")

And you will see the following output:

Box-Ljung test

data: y

X-squared = 18.9507, df = 3, p-value = 0.0002799

Since the p-value is less than 0.05 (5% significance level), we can reject the null hypothesis of randomness.

**Gain Access to Over Three Hundred Applications!**

100 Statistical Tests in R is designed to give you rapid access to one hundred of the most popular statistical tests. It shows you, step by step, how to carry out these tests in the free and popular R statistical package. The book was created for the applied researcher whose primary focus is on their subject matter rather than mathematical lemmas or statistical theory. Step by step examples of each test are clearly described, and can be typed directly into R as printed on the page. To accelerate your research ideas, over three hundred applications of statistical tests across engineering, science, and the social sciences are discussed.

What Other Who Have Brought The Book Are Saying" An amazingly wide range of examples is shown, from communicating with whales to stock trading, game theory to medical applications."" Exactly what it says. If you know what test you want the book tells you how to do it in R. Very clear expanation with examples. Output explained, including stored output."" Provides information on a large number of statistical tests and a review of the literature on when they were used. The book also explains the general purpose of the test and identifies the R packages and commands that best implement them"" Perfect reference book. great to have around when advising students. good self-study tool." |

**What About You?**

Wish you had fresh ways to present data, explore relationships, visualize high volume data-sets and break free from mundane charts and diagrams? Analysis complex relationships with ease using R begins here. In this book you will find innovative ideas to unlock the relationships in your own data. This book is for you if you:

• Need fresh ideas on how to use statistical tests.

• Want to boost your hypothesis testing toolkit.

• Wish to capture and connect relationships in your data.

• Uncover and exploit new insights.

• Master new alternative techniques to assess a hypothesis about data.

• Seek real life applications of statistical tests.

• Need inspiration on how others use statistical tests to ignite your own creativity.

**TABLE OF CONTENTS**

Forward 11

How to get the most from this book 13

Test 1 Pearson’s product moment correlation coefficient t-test 17

Test 2 Spearman rank correlation test 22

Test 3 Kendall’s tau correlation coefficient test 27

Test 4 Z test of the difference between independent correlations 31

Test 5 Difference between two overlapping correlation coefficients 36

Test 6 Difference between two non-overlapping dependent correlation coefficients 41

Test 7 Bartlett’s test of sphericity 46

Test 8 Jennrich test of the equality of two matrices 50

Test 9 Granger causality test 55

Test 10 Durbin-Watson autocorrelation test 60

Test 11 Breusch–Godfrey autocorrelation test 64

Test 12 One sample t-test for a hypothesized mean 68

Test 13 One sample Wilcoxon signed rank test 73

Test 14 Sign Test for a hypothesized median 77

Test 15 Two sample t-test for the difference in sample means 81

Test 16 Pairwise t-test for the difference in sample means 86

Test 17 Pairwise t-test for the difference in sample means with common variance 91

Test 18 Welch t-test for the difference in sample means 96

Test 19 Paired t-test for the difference in sample means 101

Test 20 Matched pairs Wilcoxon test 106

Test 21 Pairwise paired t-test for the difference in sample means 111

Test 22 Pairwise Wilcox test for the difference in sample means 116

Test 23 Two sample dependent sign rank test for difference in medians 121

Test 24 Wilcoxon rank sum test for the difference in medians 126

Test 25 Wald-Wolfowitz runs test for dichotomous data 130

Test 26 Wald-Wolfowitz runs test for continuous data 134

Test 27 Bartels test of randomness in a sample 138

Test 28 Ljung-Box Test 142

Test 29 Box-Pierce test 146

Test 30 BDS test 150

Test 31 Wald-Wolfowitz two sample run test 156

Test 32 Mood’s test 160

Test 33 F-test of equality of variances 164

Test 34 Pitman-Morgan test 168

Test 35 Ansari-Bradley test 172

Test 36 Bartlett test for homogeneity of variance 177

Test 37 Fligner-Killeen test 181

Test 38 Levene's test of equality of variance 186

Test 39 Cochran C test for inlying or outlying variance 190

Test 40 Brown-Forsythe Levene-type test 196

Test 41 Mauchly's sphericity test 200

Test 42 Binominal test 204

Test 43 One sample proportions test 209

Test 44 One sample Poisson test 213

Test 45 Pairwise comparison of proportions test 217

Test 46 Two sample Poisson test 223

Test 47 Multiple sample proportions test 227

Test 48 Chi-squared test for linear trend 231

Test 49 Pearson’s chi-squared test 235

Test 50 Fishers exact test 239

Test 51 Cochran-Mantel-Haenszel test 244

Test 52 McNemar's test 252

Test 53 Equal means in a one-way layout with equal variances 256

Test 54 Welch-test for more than two samples 260

Test 55 Kruskal Wallis rank sum test 264

Test 56 Friedman’s test 269

Test 57 Quade test 274

Test 58 D’ Agostino test of skewness 279

Test 59 Anscombe-Glynn test of kurtosis 283

Test 60 Bonett-Seier test of kurtosis 287

Test 61 Shapiro-Wilk test 291

Test 62 Kolmogorov-Smirnov test of normality 295

Test 63 Jarque-Bera test 299

Test 64 D’ Agostino test 303

Test 65 Anderson-Darling test of normality 307

Test 66 Cramer-von Mises test 310

Test 67 Lilliefors test 314

Test 68 Shapiro-Francia test 318

Test 69 Mardia's test of multivariate normality 322

Test 70 Kolomogorov – Smirnov test for goodness of fit 326

Test 71 Anderson-Darling goodness of fit test 331

Test 72 Two-sample Kolmogorov-Smirnov test 335

Test 73 Anderson-Darling multiple sample goodness of fit test 339

Test 74 Brunner-Munzel generalized Wilcoxon Test 344

Test 75 Dixon’s Q test 348

Test 76 Chi-squared test for outliers 352

Test 77 Bonferroni outlier test 356

Test 78 Grubbs test 360

Test 79 Goldfeld-Quandt test for heteroscedasticity 364

Test 80 Breusch-Pagan test for heteroscedasticity 367

Test 81 Harrison-McCabe test for heteroskedasticity 372

Test 82 Harvey-Collier test for linearity 376

Test 83 Ramsey Reset test 380

Test 84 White neural network test 384

Test 85 Augmented Dickey-Fuller test 388

Test 86 Phillips-Perron test 395

Test 87 Phillips-Ouliaris test 399

Test 88 Kwiatkowski-Phillips-Schmidt-Shin test 403

Test 89 Elliott, Rothenberg & Stock test 408

Test 90 Schmidt - Phillips test 413

Test 91 Zivot and Andrews test 418

Test 92 Grambsch-Therneau test of proportionality 423

Test 93 Mantel-Haenszel log-rank test 427

Test 94 Peto and Peto test 432

Test 95 Kuiper's test of uniformity 436

Test 96 Rao's spacing test of uniformity 440

Test 97 Rayleigh test of uniformity 445

Test 98 Watson's goodness of fit test 449

Test 99 Watson's two-sample test of homogeneity 453

Test 100 Rao's test for homogeneity 458

Test 101 Pearson Chi square test 463

References for Ljung-Box TestAllen, K. D., Kuhn, B. R., DeHaai, K. A., & Wallace, D. P. (2013). Evaluation of a behavioral treatment package to reduce sleep problems in children with Angelman Syndrome. Research in developmental disabilities, 34(1), 676-686. Lara-Ramírez, E. E., Rodríguez-Pérez, M. A., Pérez-Rodríguez, M. A., Adeleke, M. A., Orozco-Algarra, M. E., Arrendondo-Jiménez, J. I., & Guo, X. (2013). Time Series Analysis of Onchocerciasis Data from Mexico: A Trend towards Elimination. PLOS Neglected Tropical Diseases, 7(2), e2033. Maurer, K. D., Bohrer, G., Medvigy, D., & Wright, S. J. (2013). The timing of abscission affects dispersal distance in a wind‐dispersed tropical tree. Functional Ecology, 27(1), 208-218. |