#### Overview of this book

Data Science with R aims to teach you how to begin performing data science tasks by taking advantage of Rs powerful ecosystem of packages. R being the most widely used programming language when used with data science can be a powerful combination to solve complexities involved with varied data sets in the real world. The book will provide a computational and methodological framework for statistical simulation to the users. Through this book, you will get in grips with the software environment R. After getting to know the background of popular methods in the area of computational statistics, you will see some applications in R to better understand the methods as well as gaining experience of working with real-world data and real-world problems. This book helps uncover the large-scale patterns in complex systems where interdependencies and variation are critical. An effective simulation is driven by data generating processes that accurately reflect real physical populations. You will learn how to plan and structure a simulation project to aid in the decision-making process as well as the presentation of results. By the end of this book, you reader will get in touch with the software environment R. After getting background on popular methods in the area, you will see applications in R to better understand the methods as well as to gain experience when working on real-world data and real-world problems.
Simulation for Data Science with R
Credits
www.PacktPub.com
Preface
Free Chapter
Introduction
R and High-Performance Computing
The Discrepancy between Pencil-Driven Theory and Data-Driven Computational Solutions
Simulation of Random Numbers
Monte Carlo Methods for Optimization Problems
Probability Theory Shown by Simulation
Resampling Methods
Applications of Resampling Methods and Monte Carlo Tests
The EM Algorithm
Simulation with Complex Data
System Dynamics and Agent-Based Models
Index

## Tests for random numbers

In the previous sections of this chapter, random numbers have been simulated with different approaches. Most of the tests for random number generations tests if the basic random number generator, the random number generator that simulates uniformly distributed random numbers, is doing a good job.

We saw already in the beginning of the chapter plots, where we show a sequence of simulated random values against the sequence with lag 1 (and lag 2 for three-dimensional plots).

The random number generators are typically tested on whole test batteries defined by different tests. An original collection of tests can be found at http://stat.fsu.edu/pub/diehard/. These are the so-called DieHard tests from Marsaglia.

Since the code of Marsaglia is no longer maintained, and there are already more tests available, we refer additionally to the dieharder tests at http://www.phy.duke.edu/~rgb/General/dieharder.php. A Linux version of the R package `RDieHarder` is available at CRAN.

They...