Weighted PCA with MultivariateStats.jl


I want to perfrom PCA on my dataset and assign possible different weights to my variables. According to Jolliffe (2002), this can be easily done when the weighting matrix can be factorized, i.e., W_{ij} = \omega_i \phi_j. Where \boldsymbol{\phi} weigths the experiments and \boldsymbol{\omega} weigths the pixels inside each experiment.

In this case, I guess that computing the weighted PCA of X (each column is an experiment) using the package is reduced to

X_weighted = sqrt.(ϕ)' .* X .* sqrt.(ω)
M = fit(PCA, X_weighted; kwargs...)

Is it correct to proceed like this? And when I want to project existing (or new) experiments onto the new lower-dimensional subspace, should I project X_new or X_new .* sqrt.(ω) (same question for the reconstruction)?
What about the eigenvectors (projection matrix), should I divide them by the square roots of the weigths to grasp their true meaning (i.e., 1./sqrt.(ϕ)' .* M.proj .* 1./sqrt.(ω))?

Thanks in advance,