  Functional data analysis (FDA) finds widespread application across various
fields, due to data being recorded continuously over a time interval or at
several discrete points. Since the data is not observed at every point but
rather across a dense grid, smoothing techniques are often employed to convert
the observed data into functions. In this work, we propose a novel Bayesian
approach for selecting basis functions for smoothing one or multiple curves
simultaneously. Our method differentiates from other Bayesian approaches in two
key ways: (i) by accounting for correlated errors and (ii) by developing a
variational EM algorithm instead of a Gibbs sampler. Simulation studies
demonstrate that our method effectively identifies the true underlying
structure of the data across various scenarios and it is applicable to
different types of functional data. Our variational EM algorithm not only
recovers the basis coefficients and the correct set of basis functions but also
estimates the existing within-curve correlation. When applied to the motorcycle
dataset, our method demonstrates comparable, and in some cases superior,
performance in terms of adjusted $R^2$ compared to other techniques such as
regression splines, Bayesian LASSO and LASSO. Additionally, when assuming
independence among observations within a curve, our method, utilizing only a
variational Bayes algorithm, is in the order of thousands faster than a Gibbs
sampler on average. Our proposed method is implemented in R and codes are
available at https://github.com/acarolcruz/VB-Bases-Selection.
