pflm.fpca.utils.get_fpca_ce_score#

get_fpca_ce_score(flatten_func_data: FlattenFunctionalData, mu: ndarray, num_pcs: int, fpca_lambda: ndarray, fpca_phi: ndarray, fitted_cov: ndarray, sigma2: float) tuple[ndarray, list[ndarray], list[ndarray]][source][source]#

Compute conditional expectation (CE) FPCA scores and fitted curves.

Parameters:
flatten_func_dataFlattenFunctionalData

Flattened data containing fields y, t, tid, unique_sid, sid_cnt.

munp.ndarray of shape (nt,)

Mean on the observation grid.

num_pcsint

Number of principal components to use (<= len(fpca_lambda)).

fpca_lambdanp.ndarray of shape (k,)

Eigenvalues for FPCA components.

fpca_phinp.ndarray of shape (nt, k)

Basis functions on the observation grid (columns are components).

fitted_covnp.ndarray of shape (nt, nt)

Fitted covariance on the observation grid.

sigma2float

Measurement noise variance.

Returns:
xinp.ndarray of shape (n_samples, num_pcs)

CE scores by subject.

xi_varList[np.ndarray]

Per-subject score covariance matrices or variance summaries.

fitted_y_matnp.ndarray of shape (nt, n_samples)

Fitted values on the observation grid.

fitted_yList[np.ndarray]

Fitted values at the observed time points per subject.

Raises:
ValueError

If fitted_cov has wrong shape, num_pcs exceeds available eigenvalues, or fpca_phi has incompatible shape.

See also

get_fpca_in_score

Numerical integration score computation.