Docsity

Introduction to Probability and Statistics for Engineers: VIP Cheatsheet, Cheat Sheet of Statistics

Toggle sidebar
bg1
CME 106 – Introduction to Probability and Statistics for Engineers https://stanford.edu/~shervine
VIP Cheatsheet: Statistics
Afshine Amidi and Shervine Amidi
September 8, 2020
Paramater estimation
rRandom sample – A random sample is a collection of nrandom variables X1, ..., Xnthat
are independent and identically distributed with X.
rEstimator – An estimator ˆ
θis a function of the data that is used to infer the value of an
unknown parameter θin a statistical model.
rBias – The bias of an estimator ˆ
θis defined as being the difference between the expected
value of the distribution of ˆ
θand the true value, i.e.:
Bias(ˆ
θ) = E[ˆ
θ]−θ
Remark: an estimator is said to be unbiased when we have E[ˆ
θ] = θ.
rSample mean and variance – The sample mean and the sample variance of a random
sample are used to estimate the true mean µand the true variance σ2of a distribution, are
noted Xand s2respectively, and are such that:
X=1
n
n
X
i=1
Xiand s2= ˆσ2=1
n−1
n
X
i=1
(Xi−X)2
rCentral Limit Theorem – Let us have a random sample X1, ..., Xnfollowing a given
distribution with mean µand variance σ2, then we have:
X∼
n→+∞Nµ, σ
√n
Confidence intervals
rConfidence level – A confidence interval CI1−αwith confidence level 1−αof a true pa-
rameter θis such that 1−αof the time, the true value is contained in the confidence interval:
P(θ∈CI1−α)=1−α
rConfidence interval for the mean – When determining a confidence interval for the mean
µ, different test statistics have to be computed depending on which case we are in. The following
table sums it up:
Distribution Sample size σ2Statistic 1−αconfidence interval
any known X−µ
σ
√n∼ N(0,1) hX−zα
2
σ
√n,X +zα
2
σ
√ni
Xi∼ N(µ,σ )
small unknown X−µ
s
√n∼tn−1hX−tα
2
s
√n,X +tα
2
s
√ni
known X−µ
σ
√n∼ N(0,1) hX−zα
2
σ
√n,X +zα
2
σ
√ni
Xi∼any large
unknown X−µ
s
√n∼ N(0,1) hX−zα
2
s
√n,X +zα
2
s
√ni
Xi∼any small any Go home! Go home!
rConfidence interval for the variance – The single-line table below sums up the test
statistic to compute when determining the confidence interval for the variance.
Distribution Sample size µStatistic 1−αconfidence interval
Xi∼ N(µ,σ)any any s2(n−1)
σ2∼χ2
n−1hs2(n−1)
χ2
2
,s2(n−1)
χ2
1i
Hypothesis testing
rErrors – In a hypothesis test, we note αand βthe type I and type II errors respectively. By
noting Tthe test statistic and Rthe rejection region, we have:
α=P(T∈R|H0true)and β=P(T /∈R|H1true)
rp-value – In a hypothesis test, the p-value is the probability under the null hypothesis of
having a test statistic Tat least as extreme as the one that we observed T0. We have:
Case Left-sided Right-sided Two-sided
p-value P(T6T0|H0true)P(T>T0|H0true)P(|T|>|T0||H0true)
rSign test – The sign test is a non-parametric test used to determine whether the median of
a sample is equal to the hypothesized median. By noting Vthe number of samples falling to
the right of the hypothesized median, we have:
Statistic when np < 5Statistic when np >5
V∼
H0Bn, p =1
2Z=V−n
2
√n
2∼
H0N(0,1)
rTesting for the difference in two means – The table below sums up the test statistic to
compute when performing a hypothesis test where the null hypothesis is:
H0:µX−µY=δ
Stanford University 1Winter 2018
pf2

Partial preview of the text

Download Introduction to Probability and Statistics for Engineers: VIP Cheatsheet and more Cheat Sheet Statistics in PDF only on Docsity!

CME 106 – Introduction to Probability and Statistics for Engineers https://stanford.edu/~shervine

VIP Cheatsheet: Statistics

Afshine Amidi and Shervine Amidi

September 8, 2020

Paramater estimation

r Random sample – A random sample is a collection of n random variables X 1 , ..., X n that are independent and identically distributed with X.

r Estimator – An estimator θˆ is a function of the data that is used to infer the value of an unknown parameter θ in a statistical model.

r Bias – The bias of an estimator θˆ is defined as being the difference between the expected

value of the distribution of ˆθ and the true value, i.e.:

Bias(θˆ) = E[θˆ] − θ

Remark: an estimator is said to be unbiased when we have E[θˆ] = θ.

r Sample mean and variance – The sample mean and the sample variance of a random sample are used to estimate the true mean μ and the true variance σ^2 of a distribution, are

noted X and s^2 respectively, and are such that:

X =

n

∑^ n

i =

X i and s^2 = ˆσ^2 =

n − 1

∑^ n

i =

(X i − X)^2

r Central Limit Theorem – Let us have a random sample X 1 , ..., X n following a given

distribution with mean μ and variance σ^2 , then we have:

X ∼

n →+∞

N

μ,

σ √ n

Confidence intervals

r Confidence level – A confidence interval CI 1 − α with confidence level 1 − α of a true pa- rameter θ is such that 1 − α of the time, the true value is contained in the confidence interval:

P (θ ∈ CI 1 − α ) = 1 − α

r Confidence interval for the mean – When determining a confidence interval for the mean μ, different test statistics have to be computed depending on which case we are in. The following table sums it up:

Distribution Sample size σ^2 Statistic 1 − α confidence interval

any known

X − μ √^ σ n

∼ N (0,1)

[

X − z α 2

√^ σ n ,X + z α 2

√^ σ n

]

X i ∼ N (μ, σ)

small unknown

X − μ √^ s n

∼ t n − 1

[

X − t α 2

√^ s n ,X^ +^ t^ α 2

√^ s n

]

known

X − μ √^ σ n

∼ N (0,1)

[

X − z α 2

√^ σ n ,X^ +^ z^ α 2

√^ σ n

]

X i ∼ any large

unknown

X − μ √^ s n

∼ N (0,1)

[

X − z α 2

√^ s n ,X + z α 2

√^ s n

]

X i ∼ any small any Go home! Go home!

r Confidence interval for the variance – The single-line table below sums up the test statistic to compute when determining the confidence interval for the variance.

Distribution Sample size μ Statistic 1 − α confidence interval

X i ∼ N (μ,σ) any any

s^2 (n − 1) σ^2

∼ χ 2 n − 1

[

s^2 ( n −1) χ^22 ,^

s^2 ( n −1) χ^21

]

Hypothesis testing

r Errors – In a hypothesis test, we note α and β the type I and type II errors respectively. By noting T the test statistic and R the rejection region, we have:

α = P (T ∈ R|H 0 true) and β = P (T /∈ R|H 1 true)

r p -value – In a hypothesis test, the p-value is the probability under the null hypothesis of having a test statistic T at least as extreme as the one that we observed T 0. We have:

Case Left-sided Right-sided Two-sided

p-value P (T 6 T 0 |H 0 true) P (T > T 0 |H 0 true) P (|T | > |T 0 ||H 0 true)

r Sign test – The sign test is a non-parametric test used to determine whether the median of a sample is equal to the hypothesized median. By noting V the number of samples falling to the right of the hypothesized median, we have:

Statistic when np < 5 Statistic when np > 5

V ∼

H 0

B

n, p = (^12)

Z =

V − n 2 √ n 2

H 0

N (0,1)

r Testing for the difference in two means – The table below sums up the test statistic to compute when performing a hypothesis test where the null hypothesis is: H 0 : μ X − μ Y = δ

Stanford University 1 Winter 2018

CME 106 – Introduction to Probability and Statistics for Engineers https://stanford.edu/~shervine

Distribution of X i , Y i n X , n Y σ X^2 , σ^2 Y Statistic

any known

(X − Y ) − δ

σ^2 X nX +^

σ^2 Y nY

H 0

N (0,1)

Normal large unknown

(X − Y ) − δ

s^2 X nX +^

s^2 Y nY

H 0

N (0,1)

small unknown σ X = σ Y

(X − Y ) − δ

s

1 nX +^

1 nY

H 0

t nX + nY − 2

Normal, paired any unknown

D − δ s √ D n

H 0

t n − 1

D i = X i − Y i n X = n Y

r χ^2 goodness of fit test – By noting k the number of bins, n the total number of samples, p i the probability of success in each bin and Y i the associated number of samples, we can use the test statistic T defined below to test whether or not there is a good fit. If np i > 5 , we have:

T =

∑^ k

i =

(Y i − np i )^2 np i

H 0

χ^2 df with df = (k − 1) − #(estimated parameters)

r Test for arbitrary trends – Given a sequence, the test for arbitrary trends is a non- parametric test, whose aim is to determine whether the data suggest the presence of an increasing trend:

H 0 : no trend versus H 1 : there is an increasing trend

If we note x the number of transpositions in the sequence, the p-value is computed as:

p-value = P (T 6 x)

Regression analysis

In the following section, we will note (x 1 , Y 1 ), ..., (x n , Y n ) a collection of n data points. r Simple linear model – Let X be a deterministic variable and Y a dependent random variable. In the context of a simple linear model, we assume that Y is linked to X via the regression coefficients α, β and a random variable e ∼ N (0,σ), where e is referred as the error.

We estimate Y, α, β by Y , A, Bˆ and have:

Y = α + βX + e and Yˆ i = A + Bx i

r Notations – Given n data points (x i , Y i ), we define S XY ,S XX and S Y Y as follows:

S XY =

∑^ n

i =

(x i − x)(Y i − Y ) and S XX =

∑^ n

i =

(x i − x) 2 and S Y Y =

∑^ n

i =

(Y i − Y ) 2

r Sum of squared errors – By keeping the same notations, we define the sum of squared errors, also known as SSE, as follows:

SSE =

∑^ n

i =

(Y i − Yˆ i )^2 =

∑^ n

i =

(Y i − (A + Bx i ))^2 = S Y Y − BS XY

r Least-squares estimates – When estimating the coefficients α, β with the least-squares method which is done by minimizing the SSE, we obtain the estimates A, B defined as follows:

A = Y −

S XY

S XX

x and B =

S XY

S XX

r Key results – When σ is unknown, this parameter is estimated by the unbiased estimator s^2 defined as follows:

s 2 =

S Y Y − BS XY

n − 2

and we have

s^2 (n − 2) σ^2

∼ χ 2 n − 2

The table below sums up the properties surrounding the least-squares estimates A, B when σ is known or not:

Coeff σ Statistic 1 − α confidence interval

known

A − α

σ

1 n +^

X 2 SXX

∼ N (0,1)

[

A − z α 2 σ

1 n +^

X 2 SXX ,A^ +^ z^ α 2 σ

1 n +^

X 2 SXX

]

α

unknown A − α s

1 n +^

X^2 SXX

∼ t n − 2

[

A − t α 2

s

1 n

+ X

2 SXX ,A + t α 2

s

1 n

+ X

2 SXX

]

known B − β √^ σ SXX

∼ N (0,1)

[

B − z α 2

√^ σ SXX ,B + z α 2

√^ σ SXX

]

β

unknown B − β √^ s SXX

∼ t n − 2

[

B − t α 2

√^ s SXX

,B + t α 2

√^ s SXX

]

Correlation analysis

r Sample correlation coefficient – The correlation coefficient is in practice estimated by the sample correlation coefficient, often noted r or ρˆ, which is defined as:

r = ˆρ =

S XY

S XX S Y Y

with

r

n − 2 √ 1 − r^2

H 0

t n − 2 for H 0 : ρ = 0

r Correlation properties – By noting V 1 = V −

z α √^2 n − 3

, V 2 = V +

z α √^2 n − 3 with V = 12 ln

1+ r 1 − r

the table below sums up the key results surrounding the correlation coefficient estimate:

Sample size Standardized statistic 1 − α confidence interval for ρ

large

V − 12 ln

1 − ρ

√^1 n − 3

n  1

N (0,1)

[

e^2 V^1 − 1 e^2 V^1 + 1

e^2 V^2 − 1 e^2 V^2 + 1

]

Stanford University 2 Winter 2018