Quant Toolbox - 41. Useful algorithms - Factor analysis algorithms

3
Quant Toolbox > 41. Useful algorithms > Factor analysis algorithms Generalized principal analysis factorization Generalized principal analysis factorization The following algorithm solves the principal axis factorization problem (17b.18) with additional constraint db = 0 for some vector d. c 2 , β)= FactorAnalysis (c 2 , d, ¯ k) 0. Initialize c 2 c 2 , b (e1|···|e¯ k )Diag (λ1, ..., λ¯ k ) PC ¯ k (c 2 ) (41.1) 1. CPCA a. Perform CPCA {λ λ|d, e|d}← CPC ¯ n(bb 0 , d) (Table 41.1) b. Select first ¯ k {(λ 1: ¯ k λ 1: ¯ k )|d, e 1: ¯ k |d}⇐{λ λ|d, e|d} 2. Update matrix b a. Loadings b (e 1: ¯ k |d)Diag (λ 1: ¯ k |d) b. Rows length ln ← ||bn,· ||, n =1,..., ¯ n c. Rows scaling if ln > 1 bn,· bn,· /ln, n =1,..., ¯ n 3. Reconstruct c 2 bb 0 + Diag (diag (I ¯ n - bb 0 )) 4. If convergence, ¯ c 2 c 2 , β b; else go to 1a Table 41.2 Principle factor analysis algorithm ARPM - Advanced Risk and Portfolio Management - arpm.co This update: Mar-08-2017 - Last update

Transcript of Quant Toolbox - 41. Useful algorithms - Factor analysis algorithms

Page 1: Quant Toolbox - 41. Useful algorithms - Factor analysis algorithms

Quant Toolbox > 41. Useful algorithms > Factor analysis algorithmsGeneralized principal analysis factorization

Generalized principal analysis factorizationThe following algorithm solves the principal axis factorization problem(17b.18) with additional constraint db = 0 for some vector d.

(c̄2,β) = FactorAnalysis(c2,d, k̄)

0. Initialize c2 ← c2, b ≡ (e1| · · · |ek̄)Diag(λ1, ..., λk̄)← PC k̄(c2) (41.1)1. CPCAa. Perform CPCA {λ ◦ λ|d, e|d} ← CPC n̄(bb′,d) (Table 41.1)b. Select first k̄ {(λ1:k̄ ◦ λ1:k̄)|d, e1:k̄|d} ⇐ {λ ◦ λ|d, e|d}

2. Update matrix ba. Loadings b← (e1:k̄|d)Diag(λ1:k̄|d)

b. Rows length ln ← ||bn,·||, n = 1, . . . , n̄

c. Rows scaling if ln > 1 bn,· ← bn,·/ln, n = 1, . . . , n̄

3. Reconstruct c2 ← bb′ + Diag(diag(In̄ − bb′))4. If convergence, c̄2 ← c2, β ← b; else go to 1a

Table 41.2 Principle factor analysis algorithm

ARPM - Advanced Risk and Portfolio Management - arpm.co This update: Mar-08-2017 - Last update

Page 2: Quant Toolbox - 41. Useful algorithms - Factor analysis algorithms

Quant Toolbox > 41. Useful algorithms > Factor analysis algorithmsMaximum likelihood factorization

Maximum likelihood factorizationConsider the pseudo-distance defined as the relative entropy (25.66)

D(σ2,σ2) ≡ E(0,σ2‖0,σ2) =1

2(tr(σ2(σ2)−1)− ln |σ2(σ2)−1|− n̄) (41.15)

where σ2 and σ2 are arbitrary covariance matrices. The factor analysismodel (17b.9)

Cv{X} = σ2(β, δ) ≡ ββ′ + Diag(δ ◦ δ) (41.16)

where we do not require δ ◦ δ = diag(In̄ − ββ′).

Minimizing the pseudo-distance

BML(σ2) ≡ argmin(b,d)

D(σ2(b,d),σ2) (41.17)

is equivalent to the maximum likelihood optimization (3a.59) of a setof normally distributed invariants with sample covariance σ̂ = σ2

[E.41.10].

ARPM - Advanced Risk and Portfolio Management - arpm.co This update: Mar-08-2017 - Last update

Page 3: Quant Toolbox - 41. Useful algorithms - Factor analysis algorithms

Quant Toolbox > 41. Useful algorithms > Factor analysis algorithmsMaximum likelihood factorization

Maximum likelihood factorization

The following algorithm solves the ML factorization problem (41.1)

β, δ = FactorAnalysisEM (σ2)

0. Initialize b, d1. Compute vector η η ← b′(bb′ + Diag(d ◦ d))−1

2. Update matrix b b← σ2η × (Ik̄ − b′η + η′σ2η)−1

3. Update vector d d← diag(σ2 − σ2ηb′)12

4. If convergence, β ← b, δ ← d; else go to 1

Table 41.3 Factor analysis EM algorithm

ARPM - Advanced Risk and Portfolio Management - arpm.co This update: Mar-08-2017 - Last update