Parameter Estimation

Data Visualization

Histogram is used to visualize continuous observations by grouping data into several bins

The bin size (num. of bins) is important

Boxplot

min,Q1⏟14,Q2⏟median,Q3⏟34⏞Interquartile range,max

boxplot.png

Interpretation


Parameter Estimation / Point Estimation

Given a sample with size n from population
Assumption:

Parameter Space

Suppose sample X1,⋯,Xn are random and i.i.d. with unknown parameter θ and PMF / PDF f(x;θ).
The parameter θ takes value in the parameter space Ω (i.e. domain of θ)

Note

在之后求解 MLE 时起到硬约束的作用(不可以取超过 Ω 的值)

Example
For the PDF of normal distribution,

f(x)=1σ2πexp⁡[−(x−μ)22σ2],−∞<x<∞

Hence, the corresponding parameter space is

Ω={(μ,σ2):−∞<μ<∞,0<σ2<∞}

μ 可以取任意 real number
σ2 必然是 positive number,必然大于 0

Estimator

写法 名称 性质 例子
大写 Xi 随机变量(random variable) 在抽样之前,结果是未知的,是随机的 "下一位被测者的身高"
小写 xi 观测值(observed value) 抽样之后,已经拿到手的确定数值 我实际测到 172.5 cm
u(X1,…,Xn)⏟Point estimator:Random variables → 代入具体样本  u(x1,…,xn)⏟point estimate:Single value → 用来猜  θ⏟真参数:永远不知道

Evaluate estimate

Maximum Likelihood Estimation

Estimator

L(θ):=f(x1,x2,⋯,xn;θ)=∏i=1nf(xi;θ)ℓ(θ):=ln⁡L(θ)

L(θ)→ℓ(θ) 使得乘积变成求和,方便求导计算

Maximum likelihood estimator (MLE) θ^: Value of θ that maximizes L(θ)

θ^=arg⁡maxθ∈ΩL(θ)

Calculation of MLE

  1. Formulate ℓ(θ)
  2. ∂ℓ(θ)∂θ⏟score function=0⇒θ^
    1. 这一步的 θ^ 只是 stationary point,不一定是 maximum point
  3. −∂2ℓ(θ)∂θ2|θ=θ^>0⇒θ^ is MLE

Example

Bernoulli Distribution
  1. Formulate ℓ(θ)
f(x;p)=px(1−p)1−x,x∈{0,1},0≤p≤1L(p)=∏i=1npxi(1−p)1−xi=p∑i=1nxi(1−p)∑i=1n1−xi=p∑i=1nxi(1−p)n−∑i=1nxiℓ(p)=(∑i=1nxi)ln⁡p+(n−∑i=1nxi)ln⁡(1−p)
  1. Use score function to find MLE
ℓ′(p)=0(∑i=1nxi)1p−(n−∑i=1nxi)11−p=0(∑i=1nxi)1p=(n−∑i=1nxi)11−p(1−p)(∑i=1nxi)=p(n−∑i=1nxi)∑i=1nxi−p∑i=1nxi=pn−p∑i=1nxi∑i=1nxi=pnp=1n∑i=1nxip^=x¯
  1. Verify θ^ is MLE
ℓ″(p)=−∑i=1nxip2−(n−∑i=1nxi)1(1−p)2∵∑i=1nxi≥0,n−∑i=1nxi≥0ℓ″(p)<0

Since ℓ″(p)<0, ℓ(p) is strictly concave function, p^=x¯ is the MLE.
The MLE is the sample mean in Bernoulli Distribution.

Exponential Distribution
f(x;θ)=1θe−x/θ,0<x<∞,θ∈(0,∞)L(θ)=1θnexp⁡(−∑i=1nxiθ)ℓ(θ)=−∑i=1nxiθ+ln⁡1θn=−∑i=1nxiθ−nln⁡θℓ′(θ)=0∑i=1nxiθ2−nθ=0∑i=1nxiθ2=nθθ=1n∑i=1nxiθ^=x¯ℓ″(θ)=−2∑i=1nxiθ3+nθ2=−2nx¯θ3⏟x¯=1n∑i=1nxi+nθ2ℓ″(θ)|θ=x¯=−2nx¯x¯3+nx¯2=−2nx¯2+nx¯2=−nx¯2<0

Hence, θ^=x¯ is the MLE for Exponential Distribution.

Poisson Distribution
f(x;λ)=λxx!e−λL(λ)=∏i=1nλxixi!e−λ=λ∑i=1nxi∏i=1nxi!e−nλℓ(λ)=∑i=1nxiln⁡λ−ln⁡(∏i=1nxi!)−nλℓ′(λ)=1λ∑i=1nxi−n0=nx¯λ−nnλ=nx¯λ^=x¯−ℓ″(λ)=1λ2∑i=1nxi−ℓ″(λ)|λ=x¯=1x¯2∑i=1nxi=1x¯2nx¯=nx¯>0
Geometric Distribution
f(x;p)=(1−p)x−1pL(p)=∏i=1n(1−p)xi−1p=(1−p)∑i=1nxi−npnℓ(p)=(∑i=1nxi−n)ln⁡(1−p)+nln⁡pℓ′(p)=00=−11−p(∑i=1nxi−n)+npnx¯−n1−p=npx¯−11−p=1pp(x¯−1)=1−ppx¯=1p^=1x¯−ℓ″(p)=1(1−p)2(∑i=1nxi−n)+np2=1(1−p)2(nx¯−n)+np2−ℓ″(p)|p=1x¯=1(1−1x¯)2(nx¯−n)+n1x¯2=x¯2(nx¯−n)(x¯−1)2+x¯2n=nx¯2(x¯−1)(x¯−1)2+x¯2n=nx¯2[x¯−1(x¯−1)2+1]>0
Uniform Distribution (Special Cases)
f(x)={1θ,0≤x≤θ,0,Otherwiseθ∈(0,∞)

For the likelihood function L(θ),

L(θ)=∏i=1nf(xi;θ)

If xi>θ or xi<0, then f(xi)=0 and L(θ)=0
Hence, L(θ)>0⟺

L(θ)={1θn,θ≥maxixi0,θ<maxixi

However, we cannot use ℓ′(θ)=0 to find θ^ because θ^ is on the boundary or at a discontinuous point.
sta2002_uniform_mle_Ltheta.png|479
Hence, we need to introduce indicator function to rewrite L(θ).
Indicator function is

1{A}={1,若条件 A 成立0,若条件 A 不成立

Rewrite L(θ),

f(x;θ)=1θ1{x∈[0,θ]}L(θ)=∏i=1n1θ1{x∈[0,θ]}=1θn1{0≤mini{xi},maxi{xi}≤θ}={θ−n,θ≥maxixi0,Otherwises

The domain of L(θ) now becomes θ∈[maxixi,∞).
Hence, θ^=maxi{xi}, which is the min. point within the domain.

Definition

Maximum Likelihood Estimator
θ^=θ^(X1,⋯,Xn) is MLE of θ if

θ^=arg⁡maxL(θ;X1,⋯,Xn)

It means L(θ;X1,⋯,Xn) achieves its max. value at θ^


Unbiased Estimator

Definition

An estimator u(X1,X2,⋯,Xn) of θ is unbiased estimator of θ if

E[u(X1,X2,⋯,Xn)]=θ

Otherwise, u(X1,X2,⋯,Xn) is biased estimator

Example

Calculate the MLE of normal distribution.

X1,⋯,Xn∼N(θ1⏟μ,θ2⏟σ2)f(x;θ)=12πθ2exp⁡[−(x−θ1)22θ2],−∞<x<∞θ∈Ω={(θ1,θ2):−∞<θ1<∞,0<θ2<∞}L(θ1,θ2)=∏i=1n12πθ2exp⁡[−(x−θ1)22θ2]=1(2πθ2)nexp⁡[−∑i=1n(xi−θ1)22θ2]ℓ(θ1,θ2)=−n2ln⁡(2πθ2)−∑i=1n(xi−θ1)22θ2=−n2ln⁡(2π)−n2ln⁡θ2−∑i=1n(xi−θ1)22θ2∂ℓ(θ1,θ2)∂θ1=∑i=1n(xi−θ1)θ20=∑i=1n(xi−θ1)θ2∑i=1n(xi−θ1)=0∑i=1nxi−nθ1=0θ1=1n∑i=1nxiθ^1=x¯∂ℓ(θ1,θ2)∂θ2=∑i=1n(xi−θ1)22θ22−n2θ20=∑i=1n(xi−θ1)22θ22−n2θ2nθ2=∑i=1n(xi−θ1)2θ^2=1n∑i=1n(xi−θ1)2{θ^1=x¯θ^2=1n∑i=1n(xi−θ1)2−∂2ℓ(θ1,θ2)∂θ1∂θ2=−[∂2ℓ(θ1,θ2)∂θ12∂2ℓ(θ1,θ2)∂θ2∂θ1∂2ℓ(θ1,θ2)∂θ1∂θ2∂2ℓ(θ1,θ2)∂θ22]{−∂2ℓ(θ1,θ2)∂θ12=nθ2−∂2ℓ(θ1,θ2)∂θ2∂θ1=∑i=1nxiθ22−nθ1θ22=n(x¯−θ1)θ22∂2ℓ(θ1,θ2)∂θ22=−n2θ22+∑i=1n(xi−θ1)22θ23−∂2ℓ(θ1,θ2)∂θ1∂θ2>0∴{θ^1=x¯θ^2=1n∑i=1n(xi−θ1)2

Given that sample variance S2=1n−1∑i=1n(Xi−X¯)2
Rewrite θ^2 as

θ^2=1n∑i=1n(xi−θ1)2=n−1n[1n−1∑i=1n(Xi−X¯)2]=n−1nS2

Recall that

X¯∼N(θ1,θ2n)(n−1)S2θ2∼χ2(n−1)

Hence,

E(θ^1)=E(X¯)=μ=θ1E(S2)=E{(θ2n−1)[(n−1)S2θ2]}=θ2n−1E[(n−1)S2θ2]=θ2n−1E[χ2(n−1)]=θ2n−1(n−1)=θ2E(θ2^)=n−1nE(S2)=n−1nθ2

Hence, θ^1 is unbiased estimator while θ^2 is biased estimator of θ2


Method of Moments (MoM)

As MLE may not able to find an explicit formula for the max. value, it requires numerical optimization.

For the unknown parameter θ=(θ1,⋯,θn) is k-dimensional.
For 1≤j≤k, denote the jth moment to be

αj(θ)=Eθ(Xj)

Denote the jth sample moment to be

α^j=1n∑i=1nXij
Definition

Method of Moments Estimator
The method of moments estimator θ^ is defined to be the value of θ s.t.

α1(θ)=α^1α2(θ)=α^2⋮αk(θ)=α^k

It gives a system of k equations with k unkwown

Note

为什么“矩”可以估计参数?
因为不同参数会让分布的理论平均值不同;观察到样本平均值后,就可以反推参数

  • 如果 λ=1,Poisson 数据通常集中在 0、1、2。
  • 如果 λ=10,Poisson 数据通常会在 10 附近。
  • 如果样本均值是 1.6,我们自然会觉得 λ 大概在 1.6 附近。
    MoM 就是把这个直觉数学化:
理论平均=样本平均

Example

Gamma Distribution

For X1,⋯,Xn∼Gamma(θ1,θ2). The unknown parameter is two-dimensional θ=(θ1,θ2).
The first two moments are

α1(θ1,θ2)=Eθ(X1)=θ1θ2α2(θ1,θ2)=Eθ(X12)=θ1θ2+θ12θ22

The first two sample moments are

α^1=1n∑i=1nXiα^2=1n∑i=1nXi2

The kth moment αk(θ) is equal to kth sample moment α^k

{θ1θ2=1n∑i=1nXi=X¯θ1θ22+θ12θ22=1n∑i=1nXi2Let V=1n∑i=1n(Xi−X¯)2=1n∑i=1n(Xi2−2X¯Xi+X¯2)=1n[∑i=1n(Xi2)−2∑i=1nX¯Xi+nX¯2]=1n∑i=1n(Xi2)−2X¯2+X¯2=1n∑i=1nXi2−X¯2

Sub. θ1θ2 into θ1θ22+θ12θ22,

X¯θ2+X¯2=1n∑i=1nXi2X¯θ2=Vθ2=VX¯θ1θ2=X¯θ1VX¯=X¯θ1=X¯2V

Hence, the method of moments estimators are

{θ~1=X¯2Vθ~2=VX¯
Poisson Distribution
X1,⋯,Xn∼P(λ)α1(λ)=E(X)=λα^1=1n∑i=1nXi=X¯α1(λ)=α^1λ=X¯λ~1=X¯

MoM estimator is not unique for Poisson distribution, i.e. second-moment estimator

E(X2)=E(X2)−[E(X)]2+[E(X)]2=Var(X)+[E(X)]2=λ+λ2λ=E(X2)−λ2=E(X2)−[E(X)]2=1n∑i=1nXi2−X¯2λ~2=1n∑i=1nXi2−X¯2
Note

Mean-based estimator λ~1=X¯ is preferred because of smaller variance.

Uniform Distribution
X1,⋯,Xn∼U(0,θ)α(θ)=E(X)=θ2α^=1n∑i=1nXi=X¯θ2=X¯θ~=2X¯
Note

θ~ may not be a good estimator if

2X¯<max{X1,⋯,Xn}

As in uniform distribution U(0,θ), all data are in (0,θ).
Hence, θ should be larger than maxi{Xi}.
If 2X¯⏟θ~<max{X1,⋯,Xn}, it is contradiction.