Table of R Programs
Section
Page
Type
Title
Preface
xvi
Graph
Historical Timeline
1.8
14
Full Program
Simple R program
15
Fragment
Ending an R session
15
Full Program
Defining a sequence of numbers
15
Full Program
Defining a sequence of squares
15
Fragment
Obtaining documentation for a function
16
Full Program
Applying a function to a vector
16
Full Program
The base 10 logarithm function
16
Full Program
Defining a vector
16
Full Program
Defining a vector with other vectors
16
Full Program
Extracting one element of a vector
16
Full Program
Tossing a fair coin 10 times
17
Full Program
Comparing a vector to a number
17
Full Program
Finding the heads in a vector of fair coin tosses
17
Fragment
Assigning a name to an vector
17
Fragment
Another way to assign a name to a vector
18
Fragment
Finding the heads in a vector of biased coin tosses
18
Full Program
Invoking a function
18
Full Program
Adding a vector to a number
18
Full Program
Adding a vector to a vector
1.10
27
Full Program
Rolling a die to get a 6
28
Full Program
Adding the integers from 1 to 100
28
Full Program
Adding the first 100 squares
28
Full Program
The numbers from -6 to 6 in increments of 0.001
28
Full Program
Another way to compute the numbers from -6 to 6 in increments of 0.001
2.3
32
Full Program
Logarithm of the factorial
33
Full Program
Factorial logarithm base 10
2.5
36
Fragment
Probability for a birthday coincidence
36
Full Program
Probabilities for a birthday coincidence using logarithms
37
Graph
The probabilities for birthday coincidences
38
Full Program
Probability for selecting a random committee
38
Full Program
Another model for random committee selection
2.7
42
Full Program
Smuggler probability problem
42
Full Program
Probability for winning in the game of Craps
43
Full Program
Poker probabilities
44
Full Program
Chinese dice game probabilities
45
Graph
The probabilities for catching tagged fish
45
Full Program
Computing the maximum likelihood estimation
46
Fragment
Probability for horoscope coincidence
46
Full Program
Probability for horoscope coincidence using logarithms.
3.1
50
Full Program
The waiting time for a head in the Bernoulli process
50
Full Program
A function for computing the Bernoulli process waiting time
50
Full Program
Computing a sequence of Bernoulli process waiting times
50
Graph
Tabulation of Bernoulli waiting times
51
Graph
Another way to tabulate and graph Bernoulli waiting times
52
Fragment
The geometric distribution for various biases
52
Graph
Grouping R commands
53
Full Program
Waiting times in the Bernoulli process
53
Full Program
The waiting time for the third head in the Bernoulli process
53
Full Program
Unknown values
54
Graph
Tabulation of waiting times in the Bernoulli process
54
Graph
The negative binomial distribution for various biases
55
Graph
Various negative binomial distributions for a fair coin
57
Graph
A binomial distribution
58
Animation
Animation of the binomial distribution for biases from 0 to 1
58
Animation
Animation of the binomial distribution for biases from 0 to 1 with specified vertical scale
59
Animation
Animation of the binomial distribution for 1 to 100 trials
59
Animation
Animation of the binomial distribution for 1 to 200 trials with specified vertical scale
59
Animation
Animation of the binomial distribution for bias 0.25
60
Fragment
Vectors used for computing the gaps in the Bernoulli process
3.2
Graph
Random walk for a specific Bernoulli sample point
61
Animation
Animation of a random walk
3.7
76
Graph
Playing card scores
77-78
Graph
The distribution of a biased random walk
78
Fragment
Computing the most likely location for a biased random walk
78
Graph
A function for computing the most likely location for a biased random walk
79
Animation
Animation of a biased random walk
Animation
Observing the movement of the most likely location for a biased random walk
79
Animation
Animation of a biased random walk with fixed limits
Animation
Animation of a biased random walk with fixed limits, showing the most likely location
80
Full Program
Expected score of a randomly chosen card
80
Full Program
Expected score of a randomly chosen card
82
Graph
The birthday coincidence waiting time distribution
83
Full Program
Specific example of the waiting time for a birthday coincidence
83
Full Program
Specific example of the waiting time for a birthday coincidence
83
Full Program
Expected waiting time for a birthday coincidence
85
Graph
The Banach matchbox probabilities
85
Full Program
Two ways to compute the expectation for the Banach matchbox problem
4.0
88
Graph
Distribution of a uniform random variable
Graph
Density function of a uniform random variable
90
Graph
Graph symbols available in R
4.1
91
Fragment
Computing the first order statistic
91
Fragment
Computing the third order statistic
91
Graph
The distribution of the first order statistic (i.e., the minimum)
92
Graph
The density of the first order statistic
4.2
93
Graph
Distribution of a typical integer random variable
4.9
111-112
Graph
Comparison of X(1) and log(X(1)), graph is on page 112
113
Graph
Trapezoidal region for computing the distribution function of the spread
116-117
Graph
The distribution of the smallest piece of broken DNA molecule
117
Full Program
Confidence interval for the smallest piece of a broken DNA molecule
117
Full Program
Confidence interval for the smallest piece of a broken DNA molecule
118
Full Program
Expected number of cards one must observe until one sees a spade
5.1
123
Graph
Variance of a Bernoulli trial as a function of the bias
Graph
Standard deviation of a Bernoulli trial
5.2
Graph
Standard normal density function
Graph
Standard normal distribution function
Graph
Inverse of the standard normal distribution function
5.3
129
Graph
Comparison of a Binomial density with the corresponding normal density
Graph
Comparison of S(16) with N(8,4)
130
Graph
Various normal distributions with mean 0
5.4
132
Full Program
Significance of a test for the unfairness of a coin
133
Full Program
Significance of a test for whether a die is loaded
134
Full Program
Test of significance for whether a die is loaded
5.5
134
Full Program
Confidence interval for accommodating airplane passengers
135
Full Program
Another confidence interval for accommodating airplane passengers
135
Full Program
Normal approximation to confidence intervals
5.7
140-141
Graph
Randomly generated tennis ball hits
141-142
Graph
Random generation using the Cauchy distribution function
142
Animation
Animation of the Cauchy distribution and its mean value
5.9
158
Full Program
A one-sided significance test of a hypothesis
158
Full Program
A two-sided significance test of whether a sample is random
158
Full Program
A one-sided significance test of whether a sample is random
159
Graph
Normal model of significance for a manufacturing process
160
Full Program
Test of significant effect for an advertising campaign
160
Full Program
Test of significant effect for a public relations campaign
161
Full Program
Test whether a questionnaire was badly worded
161
Full Program
Retest of significance for a public relations campaign
162
Full Program
How often a professor has coffee before class
162
Full Program
Resource provisioning for a telephone company
163
Full Program
Resource provisioning alternative for a telephone company
163
Full Program
Salary comparisons for men and women
163
Full Program
Test whether an experiment was properly performed
6.7
188
Full Program
Example of rejection sampling
6.9
200
Full Program
The effect of information on probabilities
7.1
210
Graph
Various exponential distributions
211
Graph
Various exponential densities
7.2
215
Full Program
Extracting the times when heads occur in a Bernoulli sample point
7.6
237
Full Program
Probability of exactly 4 misprints on a page in a textbook: Bernoulli model
237
Full Program
Probability of at least 4 misprints on a page in a textbook: Bernoulli model
237
Full Program
Probability of 4 misprints on a page in a textbook: Poisson model
238
Full Program
Probability of 8 misprints on a page in a textbook
239
Full Program
Probability of 4 misprints on any page in a textbook
239
Full Program
Probability of 8 misprints on any page in a textbook
239
Full Program
Statistical significance of an all-white class
240
Full Program
Confidence interval for an inventory problem
240
Full Program
Probabilities in a criminal case
8.4
Graph
Conditional density of a renewal time
8.7
255
Animation
Animation of the evolution of a randomized Bernoulli process
Animation
Evolution of a randomized Bernoulli process with varying scale
255
Animation
Animation comparing Bayesian reasoning with a normal approximation
8.8
257
Graph
Probability distribution of the time until failure
258
Graph
Probability density of the time until failure
Graph
An example of a reliability comparison using densities of the time until failure
8.9
259
Randomization Program
Randomization program for defining a randomized Poisson process
259
Randomization Program
Randomization program for defining a compound process
260
Randomization Program
Randomization program for defining a Poisson process randomized by a normal process
8.11
270
Full Program
Confidence interval for the time until a crystal is fully covered
272
Graph
Some reliability distributions
273
Graph
Some reliability densities
9.1
278
Graph
Entropy of a Bernoulli trial
279
Graph
Comparison of linear and logarithmic functions
10.1
305
Randomization Program
Randomization program for defining a Markov chain as a stochastic process
306
Randomization Program
Randomization program for defining a Markov chain as a stochastic process
10.4
314
Animation
Animation for the gambler's ruin
Animation
Animation for the gambler's ruin, with varying vertical scale
Animation
Animation for a random walk with reflecting barriers
Animation
Animation for a random walk with reflecting barriers and varying vertical scale
10.9
333
Fragment
Invariant distribution for taking exams
334
Full Program
Tournament strategies
A.1
343
Graph
The reflection principle for the arcsine law: Diagram #1
344
Graph
The reflection principle for the arcsine law: Diagram #2
345
Graph
The reflection principle for the arcsine law: Diagram #3
Graph
Typical random walk for the event C[n,a,x]-C[n,a+1,x] of the reflection principle
A.2
347
Graph
The reflection principle for the arcsine law: Diagram #4
Graph
Wiener process
© 2008 Kenneth Baclawski.