SST 301 • UNIT 7 • Statistics
Pseudo-Random Number Generators & Simulation
Topics covered: Distribution Function Families, Continuous Distributions, Discrete Distributions
Syllabus Study Notes (Core Overview)
Free Overview Preview1. Concept and Use Case
Pseudo-random number generators (PRNGs) are algorithms that produce sequences of numbers which appear random but are generated deterministically from an initial seed. In R, these generators are the foundation for simulation studies, statistical modelling, and probabilistic computation. The course context introduces the standard R prefixes that unify the interface to probability distributions:
r— random generation (e.g.,runif,rnorm)d— density or probability mass function (e.g.,dunif,dnorm)p— cumulative distribution function (e.g.,punif,pnorm)q— quantile function (e.g.,qunif,qnorm)
These four prefixes apply consistently across distribution families, allowing a single mental model to be reused for every distribution encountered. The use case spans simulating, plotting densities, and evaluating the Uniform, Normal, Exponential, Student’s $t$, and Chi-square continuous distributions, as well as simulating binary and event counts using the Binomial and Poisson discrete distributions.
2. Data, Syntax, and Core Concepts
2.1 Distribution Function Families
Every probability distribution in R is accessed through the four-prefix family. For a distribution with parameters $\theta$, the functions are:
-
r-function: generates $n$ independent pseudo-random values from the distribution. -
d-function: evaluates the density (continuous) or probability mass (discrete) at a point $x$. -
p-function: evaluates the cumulative distribution function $F(x)=P(X\le x)$. -
q-function: evaluates the quantile function, the inverse of $F$.
The general call syntax follows the pattern:
r<dist>(n, ...)
d<dist>(x, ...)
p<dist>(q, ...)
q<dist>(p, ...)
where ... represents distribution-specific parameters.
2.2 Continuous Distributions
Continuous distributions are characterised by a density function $f(x)$ such that probabilities are obtained by integration over an interval. The approved distributions are:
-
Uniform (
runif,dunif,punif,qunif): parametersminandmax. The density is constant on $[\text{min},\text{max}]$. -
Normal (
rnorm,dnorm,pnorm,qnorm): parametersmeanandsd. The density is the familiar bell-shaped curve. -
Exponential (
rexp,dexp,pexp,qexp): parameterrate. The density decays exponentially. -
Student’s $t$ (
rt,dt,pt,qt): parameterdf(degrees of freedom). The density is symmetric and heavier-tailed than the Normal. -
Chi-square (
rchisq,dchisq,pchisq,qchisq): parameterdf. The density is positive and right-skewed.
2.3 Discrete Distributions
Discrete distributions assign probability mass to countable outcomes. The approved distributions are:
-
Binomial (
rbinom,dbinom,pbinom,qbinom): parameterssize(number of trials) andprob(probability of success). Models the number of successes insizeindependent Bernoulli trials. -
Poisson (
rpois,dpois,ppois,qpois): parameterlambda(mean rate). Models event counts in a fixed interval.
For discrete distributions, the d-function returns $P(X=x)$, and the p-function returns $P(X\le x)$.
Unlock Complete Study Notes & Exam Traps
The full guide includes formal proofs, worked exemplar calculations, high-yield exam traps, and examiner marking schemes. Continue studying this topic in Mentify Prep Studio.