Skip to contents

Given a single subject's data X, and the cluster parameters (mu, W, sigma2), this function computes the posterior factor scores (T x r) under a PPCA assumption with isotropic noise sigma^2 * I.

Usage

compute_factor_scores_mpca_single(X, mu, W, sigma2)

Arguments

X

A (T x M) data matrix for one subject/time-series.

mu

A length-M mean vector.

W

An (M x r) loading (projection) matrix for the cluster.

sigma2

A scalar representing isotropic noise variance (sigma^2).

Value

A (T x r) matrix of factor (PC) scores for this subject.

Details

We use the posterior mean formula for PPCA with isotropic noise: z(t) = inv(W^T W + sigma2 * I_r) * W^T * (x(t) - mu). This is applied row by row in X, but we can do it in a vectorized manner.

If your noise model is not purely sigma2 * I, you will need a more general approach. Also note that if T=1, the result might be a (1 x r) matrix or (r)-vector, so be sure to keep it as a matrix if desired.