Table of R Programs

SectionPageTypeTitle
Preface xviGraphHistorical Timeline
1.814Full ProgramSimple R program
15FragmentEnding an R session
15Full ProgramDefining a sequence of numbers
15Full ProgramDefining a sequence of squares
15FragmentObtaining documentation for a function
16Full ProgramApplying a function to a vector
16Full ProgramThe base 10 logarithm function
16Full ProgramDefining a vector
16Full ProgramDefining a vector with other vectors
16Full ProgramExtracting one element of a vector
16Full ProgramTossing a fair coin 10 times
17Full ProgramComparing a vector to a number
17Full ProgramFinding the heads in a vector of fair coin tosses
17FragmentAssigning a name to an vector
17FragmentAnother way to assign a name to a vector
18FragmentFinding the heads in a vector of biased coin tosses
18Full ProgramInvoking a function
18Full ProgramAdding a vector to a number
18Full ProgramAdding a vector to a vector
1.1027Full ProgramRolling a die to get a 6
28Full ProgramAdding the integers from 1 to 100
28Full ProgramAdding the first 100 squares
28Full ProgramThe numbers from -6 to 6 in increments of 0.001
28Full ProgramAnother way to compute the numbers from -6 to 6 in increments of 0.001
2.332Full ProgramLogarithm of the factorial
33Full ProgramFactorial logarithm base 10
2.536FragmentProbability for a birthday coincidence
36Full ProgramProbabilities for a birthday coincidence using logarithms
37GraphThe probabilities for birthday coincidences
38Full ProgramProbability for selecting a random committee
38Full ProgramAnother model for random committee selection
2.742Full ProgramSmuggler probability problem
42Full ProgramProbability for winning in the game of Craps
43Full ProgramPoker probabilities
44Full ProgramChinese dice game probabilities
45GraphThe probabilities for catching tagged fish
45Full ProgramComputing the maximum likelihood estimation
46FragmentProbability for horoscope coincidence
46Full ProgramProbability for horoscope coincidence using logarithms.
3.150Full ProgramThe waiting time for a head in the Bernoulli process
50Full ProgramA function for computing the Bernoulli process waiting time
50Full ProgramComputing a sequence of Bernoulli process waiting times
50GraphTabulation of Bernoulli waiting times
51GraphAnother way to tabulate and graph Bernoulli waiting times
52FragmentThe geometric distribution for various biases
52GraphGrouping R commands
53Full ProgramWaiting times in the Bernoulli process
53Full ProgramThe waiting time for the third head in the Bernoulli process
53Full ProgramUnknown values
54GraphTabulation of waiting times in the Bernoulli process
54GraphThe negative binomial distribution for various biases
55GraphVarious negative binomial distributions for a fair coin
57GraphA binomial distribution
58AnimationAnimation of the binomial distribution for biases from 0 to 1
58AnimationAnimation of the binomial distribution for biases from 0 to 1 with specified vertical scale
59AnimationAnimation of the binomial distribution for 1 to 100 trials
59AnimationAnimation of the binomial distribution for 1 to 200 trials with specified vertical scale
59AnimationAnimation of the binomial distribution for bias 0.25
60FragmentVectors used for computing the gaps in the Bernoulli process
3.2GraphRandom walk for a specific Bernoulli sample point
61AnimationAnimation of a random walk
3.776GraphPlaying card scores
77-78GraphThe distribution of a biased random walk
78FragmentComputing the most likely location for a biased random walk
78GraphA function for computing the most likely location for a biased random walk
79AnimationAnimation of a biased random walk
AnimationObserving the movement of the most likely location for a biased random walk
79AnimationAnimation of a biased random walk with fixed limits
AnimationAnimation of a biased random walk with fixed limits, showing the most likely location
80Full ProgramExpected score of a randomly chosen card
80Full ProgramExpected score of a randomly chosen card
82GraphThe birthday coincidence waiting time distribution
83Full ProgramSpecific example of the waiting time for a birthday coincidence
83Full ProgramSpecific example of the waiting time for a birthday coincidence
83Full ProgramExpected waiting time for a birthday coincidence
85GraphThe Banach matchbox probabilities
85Full ProgramTwo ways to compute the expectation for the Banach matchbox problem
4.088GraphDistribution of a uniform random variable
GraphDensity function of a uniform random variable
90GraphGraph symbols available in R
4.191FragmentComputing the first order statistic
91FragmentComputing the third order statistic
91GraphThe distribution of the first order statistic (i.e., the minimum)
92GraphThe density of the first order statistic
4.293GraphDistribution of a typical integer random variable
4.9111-112GraphComparison of X(1) and log(X(1)), graph is on page 112
113GraphTrapezoidal region for computing the distribution function of the spread
116-117GraphThe distribution of the smallest piece of broken DNA molecule
117Full ProgramConfidence interval for the smallest piece of a broken DNA molecule
117Full ProgramConfidence interval for the smallest piece of a broken DNA molecule
118Full ProgramExpected number of cards one must observe until one sees a spade
5.1123GraphVariance of a Bernoulli trial as a function of the bias
GraphStandard deviation of a Bernoulli trial
5.2GraphStandard normal density function
GraphStandard normal distribution function
GraphInverse of the standard normal distribution function
5.3129GraphComparison of a Binomial density with the corresponding normal density
GraphComparison of S(16) with N(8,4)
130GraphVarious normal distributions with mean 0
5.4132Full ProgramSignificance of a test for the unfairness of a coin
133Full ProgramSignificance of a test for whether a die is loaded
134Full ProgramTest of significance for whether a die is loaded
5.5134Full ProgramConfidence interval for accommodating airplane passengers
135Full ProgramAnother confidence interval for accommodating airplane passengers
135Full ProgramNormal approximation to confidence intervals
5.7140-141GraphRandomly generated tennis ball hits
141-142GraphRandom generation using the Cauchy distribution function
142AnimationAnimation of the Cauchy distribution and its mean value
5.9158Full ProgramA one-sided significance test of a hypothesis
158Full ProgramA two-sided significance test of whether a sample is random
158Full ProgramA one-sided significance test of whether a sample is random
159GraphNormal model of significance for a manufacturing process
160Full ProgramTest of significant effect for an advertising campaign
160Full ProgramTest of significant effect for a public relations campaign
161Full ProgramTest whether a questionnaire was badly worded
161Full ProgramRetest of significance for a public relations campaign
162Full ProgramHow often a professor has coffee before class
162Full ProgramResource provisioning for a telephone company
163Full ProgramResource provisioning alternative for a telephone company
163Full ProgramSalary comparisons for men and women
163Full ProgramTest whether an experiment was properly performed
6.7188Full ProgramExample of rejection sampling
6.9200Full ProgramThe effect of information on probabilities
7.1210GraphVarious exponential distributions
211GraphVarious exponential densities
7.2215Full ProgramExtracting the times when heads occur in a Bernoulli sample point
7.6237Full ProgramProbability of exactly 4 misprints on a page in a textbook: Bernoulli model
237Full ProgramProbability of at least 4 misprints on a page in a textbook: Bernoulli model
237Full ProgramProbability of 4 misprints on a page in a textbook: Poisson model
238Full ProgramProbability of 8 misprints on a page in a textbook
239Full ProgramProbability of 4 misprints on any page in a textbook
239Full ProgramProbability of 8 misprints on any page in a textbook
239Full ProgramStatistical significance of an all-white class
240Full ProgramConfidence interval for an inventory problem
240Full ProgramProbabilities in a criminal case
8.4GraphConditional density of a renewal time
8.7255AnimationAnimation of the evolution of a randomized Bernoulli process
AnimationEvolution of a randomized Bernoulli process with varying scale
255AnimationAnimation comparing Bayesian reasoning with a normal approximation
8.8257GraphProbability distribution of the time until failure
258GraphProbability density of the time until failure
GraphAn example of a reliability comparison using densities of the time until failure
8.9259Randomization ProgramRandomization program for defining a randomized Poisson process
259Randomization ProgramRandomization program for defining a compound process
260Randomization ProgramRandomization program for defining a Poisson process randomized by a normal process
8.11270Full ProgramConfidence interval for the time until a crystal is fully covered
272GraphSome reliability distributions
273GraphSome reliability densities
9.1278GraphEntropy of a Bernoulli trial
279GraphComparison of linear and logarithmic functions
10.1305Randomization ProgramRandomization program for defining a Markov chain as a stochastic process
306Randomization ProgramRandomization program for defining a Markov chain as a stochastic process
10.4314AnimationAnimation for the gambler's ruin
AnimationAnimation for the gambler's ruin, with varying vertical scale
AnimationAnimation for a random walk with reflecting barriers
AnimationAnimation for a random walk with reflecting barriers and varying vertical scale
10.9333FragmentInvariant distribution for taking exams
334Full ProgramTournament strategies
A.1343GraphThe reflection principle for the arcsine law: Diagram #1
344GraphThe reflection principle for the arcsine law: Diagram #2
345GraphThe reflection principle for the arcsine law: Diagram #3
GraphTypical random walk for the event C[n,a,x]-C[n,a+1,x] of the reflection principle
A.2347GraphThe reflection principle for the arcsine law: Diagram #4
GraphWiener process


© 2008 Kenneth Baclawski.