Loading [MathJax]/jax/output/HTML-CSS/jax.js
  • Introduction
  • Notation
  • Objective
  • Prior parameter updates
  • Posterior parameter updates
  • Algorithm

Last updated: 2018-07-20

workflowr checks: (Click a bullet for more information)
  • R Markdown file: up-to-date

    Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

  • Repository version: 032edd6

    Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility. The version displayed above was the version of the Git repository at the time these results were generated.

    Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:
    
    Ignored files:
        Ignored:    .DS_Store
        Ignored:    .Rhistory
        Ignored:    .Rproj.user/
        Ignored:    docs/.DS_Store
        Ignored:    docs/figure/.DS_Store
    
    
    Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
Expand here to see past versions:
    File Version Author Date Message
    Rmd 032edd6 Jason Willwerscheid 2018-07-20 wflow_publish(c(“analysis/index.Rmd”, “analysis/flash_em.Rmd”,
    html f995dbb Jason Willwerscheid 2018-07-20 manual commits to remove licence
    html c9f10b0 Jason Willwerscheid 2018-07-20 Build site.
    Rmd 4fc94bd Jason Willwerscheid 2018-07-20 wflow_publish(c(“analysis/index.Rmd”, “analysis/flash_em.Rmd”))
    html 5487b70 Jason Willwerscheid 2018-07-20 Build site.
    Rmd 8911eb8 Jason Willwerscheid 2018-07-20 wflow_publish(c(“analysis/obj_notes.Rmd”,
    html da82b48 Jason Willwerscheid 2018-07-19 Build site.
    Rmd fb3eab9 Jason Willwerscheid 2018-07-19 wflow_publish(“analysis/flash_em.Rmd”)
    html 1a7bb47 Jason Willwerscheid 2018-07-19 Build site.
    Rmd 962e216 Jason Willwerscheid 2018-07-19 wflow_publish(“analysis/flash_em.Rmd”)


Introduction

If the expression for the KL divergence derived in the previous note is correct, then it seems likely that the FLASH objective could be optimized in a more direct fashion.

Notation

I parametrize the posteriors for, respectively, the ith element of the kth loading and the jth element of the kth factor as qli(1w(l)i)δ0+w(l)iN(μ(l)i,σ2(l)i) and qfj(1w(f)j)δ0+w(f)jN(μ(f)j,σ2(f)j) I parametrize the priors as gliπ(l)0δ0+(1π(l)0)N(0,1/al) and gfjπ(f)0δ0+(1π(f)0)N(0,1/af)

Objective

Using the expression for KL divergence derived in the previous note, the objective can be written: i,j[12logτij2πτij2((Rkij)22Rkijw(l)iμ(l)iw(f)jμ(f)j+w(l)i(μ(l)2i+σ2(l)i)w(f)j(μ(f)2j+σ2(f)j))]+i[(1w(l)i)logπ(l)01w(l)i+w(l)ilog1π(l)0w(l)i+w(l)i2(log(alσ2(l)i)al(μ(l)2i+σ2(l)i)+1)]+j[(1w(f)j)logπ(f)01w(f)j+w(f)jlog1π(f)0w(f)j+w(f)j2(log(afσ2(f)j)af(μ(f)2j+σ2(f)j)+1)],

where Rkij denotes the matrix of residuals obtained by using all factor/loading pairs but the kth.

Prior parameter updates

I derive an algorithm for loadings updates by differentiating with respect to each variable al, π(l)0, μ(l)1,,μ(l)n, σ2(l)1,,σ2(l)n, and w(l)1,,w(l)n, and setting each result equal to zero.

The updates for the prior parameters al and π(l)0 turn out to be very simple. First, differentiating with respect to al gives i[w(l)i2(1al(μ(l)2i+σ2(l)i))] Setting this equal to zero gives al=iw(l)iiw(l)i(μ(l)2i+σ2(l)i)=iw(l)iiEql2i

Next, differentiating with respect to π(l)0 gives i[1w(l)iπ(l)0w(l)i1π(l)0] Setting this equal to zero gives π(l)0iw(l)i=(1π(l)0)i(1w(l)i)π(l)0=1ni(1w(l)i)

Posterior parameter updates

The updates for the posterior parameters μ(l)i and σ2(l)i also turn out to be quite manageable. Differentiating with respect to μ(l)i gives jτij[Rkijw(l)iw(f)jμ(f)jw(l)iμ(l)iw(f)j(μ(f)2j+σ2(f)j)]w(l)ialμ(l)i Setting this equal to zero gives μ(l)i=jτijRkijw(f)jμ(f)jal+jτijw(f)j(μ(f)2j+σ2(f)j)=jτijRkijEfjal+jτijEf2j

Next, differentiating with respect to σ2(l)i gives 12jτijw(l)iw(f)j(μ(f)2j+σ2(f)j)+w(l)i2σ2(l)iw(l)ial2 Setting this equal to zero gives σ2(l)i=1al+jτijw(f)j(μ(f)2j+σ2(f)j)=1al+jτijEf2j

It remains to derive the update for w(l)i. Differentiating gives jτij[Rkijμ(l)iw(f)jμ(f)j12(μ(l)2i+σ2(l)i)w(f)j(μ(f)2j+σ2(f)j)]logπ(l)01w(l)i+log1π(l)0w(l)i+12(log(alσ2(l)i)al(μ(l)2i+σ2(l)i)+1) Setting this equal to zero gives logw(l)i1w(l)i=log1π(l)0π(l)0+12(log(alσ2(l)i)al(μ(l)2i+σ2(l)i)+1)+jτij[Rkijμ(l)iw(f)jμ(f)j12(μ(l)2i+σ2(l)i)w(f)j(μ(f)2j+σ2(f)j)], where the last sum can also be written jτij[Rkijμ(l)iEfj12(μ(l)2i+σ2(l)i)Ef2j]

Algorithm

I suggest that the loadings could be updated by

  1. Choosing starting values for al, π(l)0, and w(l)1,,w(l)n,

and then repeating the following two steps until convergence:

  1. Update μ(l)1,,μ(l)n and σ2(l)1,,σ2(l)n, and then update w(l)1,,w(l)n.

  2. Update al and π(l)0.


This reproducible R Markdown analysis was created with workflowr 1.0.1