  Modeling non-linear temporal trajectories is of fundamental interest in many
application areas, such as in longitudinal microbiome analysis. Many existing
methods focus on estimating mean trajectories, but it is also often of value to
assess temporal patterns of individual subjects. Sparse principal components
analysis (SFPCA) serves as a useful tool for assessing individual variation in
non-linear trajectories; however its application to real data often requires
careful model selection criteria and diagnostic tools. Here, we propose a
Bayesian approach to SFPCA, which allows users to use the efficient
leave-one-out cross-validation (LOO) with Pareto-smoothed importance sampling
(PSIS) for model selection, and to utilize the estimated shape parameter from
PSIS-LOO and also the posterior predictive checks for graphical model
diagnostics. This Bayesian implementation thus enables careful application of
SFPCA to a wide range of longitudinal data applications.
