Skip to main content

Probability with R: An Introduction with Computer Science Applications

Probability with R: An Introduction with Computer Science Applications

Jane Horgan

ISBN: 978-1-118-16595-9 September 2011 416 Pages




A Complete Introduction to probability AND its computer Science Applications USING R

Probability with R serves as a comprehensive and introductory book on probability with an emphasis on computing-related applications. Real examples show how probability can be used in practical situations, and the freely available and downloadable statistical programming language R illustrates and clarifies the book's main principles.

Promoting a simulation- and experimentation-driven methodology, this book highlights the relationship between probability and computing in five distinctive parts:

  • The R Language presents the essentials of the R language, including key procedures for summarizing and building graphical displays of statistical data.

  • Fundamentals of Probability provides the foundations of the basic concepts of probability and moves into applications in computing. Topical coverage includes conditional probability, Bayes' theorem, system reliability, and the development of the main laws and properties of probability.

  • Discrete Distributions addresses discrete random variables and their density and distribution functions as well as the properties of expectation. The geometric, binomial, hypergeometric, and Poisson distributions are also discussed and used to develop sampling inspection schemes.

  • Continuous Distributions introduces continuous variables by examining the waiting time between Poisson occurrences. The exponential distribution and its applications to reliability are investigated, and the Markov property is illustrated via simulation in R. The normal distribution is examined and applied to statistical process control.

  • Tailing Off delves into the use of Markov and Chebyshev inequalities as tools for estimating tail probabilities with limited information on the random variable.

Numerous exercises and projects are provided in each chapter, many of which require the use of R to perform routine calculations and conduct experiments with simulated data. The author directs readers to the appropriate Web-based resources for installing the R software package and also supplies the essential commands for working in the R workspace. A related Web site features an active appendix as well as a forum for readers to share findings, thoughts, and ideas.

With its accessible and hands-on approach, Probability with R is an ideal book for a first course in probability at the upper-undergraduate and graduate levels for readers with a background in computer science, engineering, and the general sciences. It also serves as a valuable reference for computing professionals who would like to further understand the relevance of probability in their areas of practice.

Related Resources



1. Basics of R.

1.1 What is R?

1.2 Installing R.

1.3 R Documentation.

1.4 Basics.

1.5 Getting Help.

1.6 Data Entry.

1.7 Tidying Up.

1.8 Saving and Retrieving the Workspace.

2. Summarising Statistical Data.

2.1 Measures of Central Tendency.

2.2 Measures of Dispersion.

2.3 Overall Summary Statistics.

2.4 Programming in R.

3. Graphical Displays.

3.1 Boxplots.

3.2 Histograms.

3.3 Stem and Leaf.

3.4 Scatter Plots.

3.5 Graphical Display vs Summary Statistics.


4. Basics.

4.1 Experiments, Sample Spaces and Events.

4.2 Classical Approach to Probability.

4.3 Permutations and Combinations.

4.4 The Birthday Problem.

4.5 Balls and Bins.

4.6 Relative Frequency Approach to Probability.

4.7 Simulating Probabilities.

5. Rules of Probability.

5.1 Probability and Sets.

5.2 Mutually Exclusive Events.

5.3 Complementary Events.

5.4 Axioms of Probability.

5.5 Properties of Probability.

6. Conditional Probability.

6.1 Multiplication Law of Probability.

6.2 Independent Events.

6.3 The Intel Fiasco.

6.4 Law of Total Probability.

6.5 Trees.

7. Posterior Probability and Bayes.

7.1 Bayes’ Rule.

7.2 Hardware Fault Diagnosis.

7.3 Machine Learning.

7.4 The Fundamental Equation of Machine Translation.

8. Reliability.

8.1 Series Systems.

8.2 Parallel Systems.

8.3 Reliability of a System.

8.4 Series-Parallel Systems.

8.5 The Design of Systems.

8.6 The General System.


9. Discrete Distributions.

9.1 Discrete Random Variables.

9.2 Cumulative Distribution Function.

9.3 Some Simple Discrete Distributions.

9.4 Benford’s Law.

9.5 Summarising Random Variables: Expectation.

9.6 Properties of Expectations.

9.7 Simulating Expectation for Discrete Random Variables.

10. The Geometric Distribution.

10.1 Geometric Random Variables.

10.2 Cumulative Distribution Function.

10.3 The Quantile Function.

10.4 Geometric Expectations.

10.5 Simulating Geometric Probabilities and Expectations.

10.6 Amnesia.

10.7 Project.

11. The Binomial Distribution.

11.1 Binomial Probabilities.

11.2 Binomial Random Variables.

11.3 Cumulative Distribution Function.

11.4 The Quantile Function.

11.5 Machine Learning and the Binomial Distribution.

11.6 Binomial Expectations.

11.7 Simulating Binomial Probabilities and Expectations.

11.8 Project.

12. The Hypergeometric Distribution.

12.1 Hypergeometric Random Variables.

12.2 Cumulative Distribution Function.

12.3 The Lottery.

12.4 Hypergeometric or Binomial?.

12.5 Project.

13. The Poisson Distribution.

13.1 Death by Horse Kick.

13.2 Limiting Binomial Distribution.

13.3 Random Events in Time and Space.

13.4 Probability Density Function.

13.5 Cumulative Distribution Function.

13.6 The Quantile Function.

13.7 Estimating Software Reliability.

13.8 Modelling Defects in Integrated Circuits.

13.9 Simulating Poisson Probabilities.


14. Sampling Inspection Schemes.

14.1 Introduction.

14.2 Single Sampling Inspection Schemes.

14.3 Acceptance Probabilities.

14.4 Simulating Sampling Inspections Schemes.

14.5 Operating Characteristic Curve.

14.6 Producer’s and Consumer’s Risks.

14.7 Design of Sampling Schemes.

14.8 Rectifying Sampling Inspection Schemes.

14.9 Average Outgoing Quality.

14.10 Double Sampling Inspection Schemes.

14.11 Average Sample Size.

14.12 Single vs Double Schemes.

14.13 Project.


15. Continuous Distributions.

15.1 Continuous Random Variables.

15.2 Probability Density Function.

15.3 Cumulative Distribution Function.

15.4 The Uniform Distribution.

15.5 Expectation of a Continuous Random Variable.

15.6 Simulating Continuous Variables.

16. The Exponential Distribution.

16.1 Probability Density Function Of Waiting Times.

16.2 Cumulative Distribution Function.

16.3 Quantiles.

16.4 Exponential Expectations.

16.5 Simulating the Exponential Distribution.

16.6 Amnesia.

16.7 Simulating Markov.

17. Applications of the Exponential Distribution.

17.1 Failure Rate and Reliability.

17.2 Modelling Response Times.

17.3 Queue Lengths.

17.4 Average Response Time.

17.5 Extensions of the M/M/1 queue.

18. The Normal Distribution.

18.1 The Normal Probability Density Function.

18.2 The Cumulative Distribution Function.

18.3 Quantiles.

18.4 The Standard Normal Distribution.

18.5 Achieving Normality; Limiting Distributions.

18.6 Project in R.

19. Process Control.

19.1 Control Charts.

19.2 Cusum Charts.

19.3 Charts for Defective Rates.

19.4 Project.


20. Markov and Chebyshev Bound.

20.1 Markov’s Inequality.

20.2 Algorithm Run-Time.

20.3 Chebyshev’s Inequality.

Appendix 1: Variance derivations.

Appendix 2: Binomial approximation to the hypergeometric.

Appendix 3: Standard Normal Tables.

"For anyone comfortable with basic mathematics, an independent reading of this book would provide an excellent primer on probability." (Zentralblatt Math, 2010)

"This is a wonderful text for beginners to learn probability. Reading it is a joy. Although the book is oriented towards CS majors, I believe that students in other fields can also benefit from it." (Computing Reviews, January 26, 2009)

"For the audience this book is intended, the book is the best lecture notes a teacher can give to students and to anybody wishing to self-teach themselves, with that caveat." (Journal of Statistical Software, January 2009)

"For the audience this book is intended, the book is the best lecture notes a teacher can give to students and to anybody wishing to self-teach themselves, with that caveat." (Journal of Statistical Software, Jan 2009)

"This is a wonderful text for beginners to learn probability.  Reading it is a joy. Although the book is oriented towards CS majors, I believe that students in other fields can also benefit from it." (Computing Reviews, Jan 2009)

"..a great quality of this book is that it could be used by anybody with a reasonable level of education to self-teach themselves probability and its applications... It is more user-friendly than the R manuals and, because the code is used within the examples, it teaches R for probability much more effectively." (Journal of Statistical Software, 2008)

  • Recognizing students learn better by understanding definitions, generalizations, and abstractions after seeing the applications, ideas are introduced and illustrated with real examples 
  • Examples cover a wide range of computer science applications, including testing program performance, measuring response time and cpu time, estimating the reliability of components and systems, evaluating algorithms and queueing systems 
  • Thoroughly classroom tested and mathematical derivations are kept to a minimum 
  • Readers are encouraged to perform the simulations in R in order to gain a firm understanding of the text’s concepts 
  • Readers are prompted to collect their own data throughout the book