FIT5197 2021 S1 Formula Sheet
FIT5197 2021 S1 Formula Sheet
FIT5197 2021 S1 Formula Sheet
1 Sample Statistics
• quartiles, percentiles, etc.: given n data points, rank them in increasing
value to get x1 , ..., xn
– median, if n is odd, given by x(n+1)/2 , if n is even given by 12 (xn/2 +
xn/2+1 )
– quartiles, Q1 or Q3 is given by Qk = xp + 4q (xp+1 − xp ) where
p = f loor((k(n + 1))/4) and q = (k(n + 1)) mod 4
q
– percentiles, Pk = xp + 100 (xp+1 − xp ) where p = f loor((k(n +
1))/100) and q = (k(n + 1)) mod 100
• measures of spread for n data points, x = (x1 , ..., xn )
1
Pn
– Sample variance, var(x) = s2x = n−1 i=1 (xi − x̄)
2
1
Cheatsheet
• boxplots
– represents numerical data through quar-
tiles
2 Probability
• probability axioms of Kolmogorov:
Page 2 of 20
Cheatsheet
3 Expected Values
• if X has domain X , expectation and variance of f (X):
X
E [f (X)] = p(x)f (x)
x∈X
Page 3 of 20
Cheatsheet
4 Distributions
• for the Gaussian or normal distribution, denoted N (µ, σ 2 )
21
(x − µ)2
2 1
p(x | µ, σ ) = exp −
2πσ 2 2σ 2
and has the properties
– E [x] = µ and V [x] = σ 2
– the mode and the median are the same as the mean
– if the curve for p(x | 0, 1) is shifted to the right by µ and scaled by
σ, one gets the curve for p(x | µ, σ 2 )
• the discrete uniform distribution models discrete RVs denoted U (a, b)
and follows
1
P(X = k | a, b) =
b−a+1
where X ∈ {a, . . . , b} with b ≥ a, and has properties
Page 4 of 20
Cheatsheet
a+b (b−a+1)2 −1
– E[X] = 2
and V[X] = 12
p(X = 1 | θ) = θ, θ ∈ [0, 1]
p(x | θ) = θx (1 − θ)(1−x)
Page 5 of 20
Cheatsheet
5 Estimation
• have a sample x; let θ̂(x) beh a point
i estimate for model parameter θ;
then θ̂(x) is unbiased if Ex θ̂(x) = θ, where the expectation is taken
over samples x
• the bias of the estimator is
h i
bθ (θ̂) = Ex θ̂(x) − θ
Page 6 of 20
Cheatsheet
• the method of maximum likelihood says we should use the model that
assigns the greatest probability to the data we have observed; formally,
the maximum likelihood estimator (MLE) is found by solving
• the MLE estimates for λ of the Poisson and θ of the Bernoulli is also
the mean
• the MLE estimates for θ of the binomial, bin(θ, m), using sample x of
size n is n
1 X
θ̂M L = xi
nm i=1
Page 7 of 20
Cheatsheet
Page 8 of 20
Cheatsheet
• let X have the CDF P (X), and Q(p) = P −1 (p) is the correspond-
ing quantile function; then the (1 − α) one-sided lower confidence
interval for X is given by
Page 9 of 20
Cheatsheet
• for Poisson, assume dataset of count n with mean X̂; for Bernoulli,
assume dataset of count n with mean p̂; also a 2nd dataset of count m
with mean q̂;
assumptions parameter interval
q
Poisson, λ un- λ X̂ ± Zα/2 X̂/n
known, using
CLT p
Bernoulli, θ θ p̂ ± Zα/2 p̂(1 − p̂)/n
unknown, using
CLT
Bernoulli, θ1 , θ2 θ1 − θ2 p̂ −p q̂ ±
unknown, using Zα/2 p̂(1 − p̂)/n + q̂(1 − q̂)/m
CLT
7 Hypothesis Tests
• given an arbitrary test statistic x with CDF P (X) (i.e. x could be z
or t), then the p-value is given by
2P (−|x|) if null hypothesis is equality
p= 1 − P (x) if null hypothesis involves ≤
P (x) if null hypothesis involves ≥
Page 10 of 20
Cheatsheet
equal n+m−2
Gaussian, σ12 6= ∆µ0 use 1st case for σ12 = S 2 , σ22 = T 2,
σ22 unknown, us- assuming n, m are large
ing CLT
• for Poisson, assume dataset of count n with mean X̂; for Bernoulli,
assume dataset of count n with mean p̂; also a 2nd dataset of count m
with mean q̂; all using the CLT so require large samples (n, m)
assumptions null-hypo. test statistic
X̂−λ0
Poisson, λ un- λ0 Z=√
λ0 /n
known, using
CLT
p̂−θ0
Bernoulli, θ θ0 Z=√
θ0 (1−θ0 )/n
unknown, using
CLT
p̂−q̂−∆θ0
Bernoulli, θ1 , θ2 ∆θ0 Z=√
p̂(1−p̂)/n+q̂(1−q̂)/m
unknown, using If ∆θ0 = 0 this reduces to
p̂−q̂
CLT Z=√
r̂(1−r̂)(1/n+1/m)
where r̂ = np̂+mq̂
n+m
Page 11 of 20
Cheatsheet
8 Linear Regression
• simple least squares model has E [yi | xi ] = β0 + β1 xi and has a residual
sum of squares
n
X
RSS(β0 , β1 ) = (yi − β0 − β1 xi )2
i=1
• with this the RSS can be minimised using the solution for β1 of
SSXY XY − X Y
β̂1 = = 2
SSXX X2 − X
and the solution for β0 of
Y X 2 − XY X
β̂0 = Y − β̂1 X = 2
X2 − X
Page 12 of 20
Cheatsheet
Page 13 of 20
Cheatsheet
Page 14 of 20
Cheatsheet
where p
X
ηi = β0 + βj xi,j
j=1
• the parameters (β0 , β1 , ...βp ) are fit using optimising routines on the log
likelihood
10 More Classification
• log2 (x) = logc (x)/logc (2) where c is any constant
Page 15 of 20
Cheatsheet
Page 16 of 20
Cheatsheet
Page 17 of 20
Cheatsheet
Page 18 of 20
Cheatsheet
Page 19 of 20
Cheatsheet
13 Calculus
Page 20 of 20