1. Motivation
The key question in medical practice and clinical research is how diseases progress in individual patients. Accurate continuous monitoring of a patient’s condition could considerably improve prevention and treatment. Many medical tests, such as X-ray, magnetic resonance imaging (MRI), motion capture gait analysis, biopsy, or blood tests, cannot be taken routinely, since they are costly, harmful, or inconvenient. Therefore, practitioners and researchers need to reach out for statistical tools to analyze the progression of a patient’s condition with only sparse and noisy observations at hand.
For illustration, consider longitudinal measurements of the gait deviation index (GDI), which is a holistic measure of motor impairment in children. GDI is measured using advanced motion capture hardware and software (Figure 1). Due to high costs, such measurements are taken only a few times in a patient’s life. By looking at individual processes and accounting for between-subject similarities, we can model individual progressions despite observing only few measurements. Such modeling can yield personalized predictions, clustering of patients based on progression patterns, or latent representation of progression patterns, which then could be used as covariates in other predictive models.
Figure 1:

Left plot: We observe the gait deviation index (GDI), a holistic metric of motor impairment, at every visit to a clinic, and we derive the population progression (the thick solid curve) using a locally weighted scatterplot smoothing method. Right plot: The analysis of individual patients (connected dots in the right plot in different colors) reveals patterns in individual trends. We highlight 3 randomly selected subjects in red, green, and blue.
These kinds of data have been commonly analyzed using linear mixed models, where we treat time as a random effect, and the nonlinearity of this effect is imposed by choice of the functional basis (Zeger et al., 1988; Verbeke, 1997; McCulloch and Neuhaus, 2001). When data is very sparse, additional constraints on the covariance structure of trajectories are inferred using cross-validation or information criteria (Rice and Wu, 2001; Bigelow and Dunson, 2009). To further constrain the dimensionality of the problem, practitioners model the covariance as a low-rank matrix (James et al., 2000; Berkey and Kent, 1983; Yan et al., 2017; Hall et al., 2006; Besse and Ramsay, 1986; Yao and Lee, 2006; Greven et al., 2011). Many models have been developed for incorporating additional covariates (Song et al., 2002; Liu and Huang, 2009; Rizopoulos et al., 2014). While these methods are used in practice, they tend to be slow and require careful implementation.
In this work, we pose the problem of trajectory prediction as a matrix completion problem, and we solve it using sparse matrix factorization techniques (Rennie and Srebro, 2005; Candès and Recht, 2009; Fithian et al., 2018). The objective of the classical matrix completion problem is to predict elements of a sparsely observed matrix using its known elements while minimizing a specific criterion, commonly Mean Squared Error (MSE). The motivating example is the “Netflix Prize” competition (Bennett and Lanning, 2007), where teams were tasked to predict unknown movie ratings using a sparse set of observed ratings. We can represent these data as a matrix of users and movies, with a subset of known elements measured on a fixed scale, e.g., 1–5.
One popular approach to approximate the observed matrix is to estimate its low-rank decomposition (Srebro et al., 2005). In the low-rank representation , columns of spanning the space of movies can be loosely associated with some implicit (latent) characteristics such as taste, style, or genre, and each rater is represented as a weighted sum of their preferred characteristics, i.e., a row in the matrix of latent variables (see Figure 2).
Figure 2:

The key observation motivating this work is the fact that the problem of estimating trajectories can be mapped to a matrix completion problem where we estimate values of unobserved entries of a matrix. Matrix completion can be approached with matrix factorization, where we look for of low rank, approximating observed values in (circled green rectangles in the matrix ). In the sparse longitudinal setting, we enforce smoothness by fixing the basis (e.g., splines, here with three elements), and again we find a low-rank matrix , such that approximates observed values in .
We can use the same idea to predict sparsely sampled curves as long as we introduce an additional smoothing step. The low-dimensional latent structure now corresponds to progression patterns, and the trajectory of each individual can be represented as a weighted sum of these “principal” patterns. In Figure 2, the patterns are given by , while the individual weights are encoded in .
The key advantage of this approach is that the implementation only relies on the iterative application of matrix multiplication and singular value decomposition. We can leverage existing literature and packages for these operations, making the implementation straightforward and very efficient.
To the best of our knowledge, this is the first application of matrix completion for filling in entire curves to sparsely observed data. Nevertheless, matrix completion techniques have been previously used in this context for estimating the covariance operator Descary and Panaretos (2016), which can subsequently be used for fitting curves.
The manuscript is organized as follows. In Section 2, we introduce the notation of the functional representation of the problem and we discuss optimization techniques. Next, in Section 3, we introduce the matrix representation of the problem and show how it maps to the functional representation. We develop our main results and conclude with links to other results. In Section 4, we extend our framework to the multivariate case. We show example uses of our methods in a simulation study (Section 5) and in a data study (Section 6). We conclude with a discussion section (Section 7).
2. Background and related work
To focus our attention and aid further discussion, we start by introducing notation and methodology for the univariate case. Let denote the number of subjects. For each individual , we take measurements at irregularly sampled time-points . We assume that for each and some . In this work, we ignore the stochastic nature of sampling timepoints and we assume that points are fixed for each individual. Vectors denote observations corresponding to for each individual .
To model individual trajectories given pairs practitioners map observations into a low-dimensional space that represents progression patterns. Conceptually, a small distance between individuals in the latent space reflects similar progression patterns.
In this section, we discuss state-of-the-art approaches to estimating this low-dimensional latent embedding. We classify them into three broad categories: the direct approach, mixed-effect models, and low-rank approximations.
2.1. Direct approach
If the set of observed values for each individual is dense, elementary interpolation using a continuous basis can be sufficient for approximating the entire trajectory. Let be a basis of , i.e. the space of functions such that the integral of on is finite, such as splines or polynomials. In practice, we truncate the basis to a finite set of the first basis elements. Let be a vector of basis elements evaluated at a timepoint . Throughout this article we use the word basis to refer to some truncated basis of elements. The choice of the basis is relevant and should be done carefully. We refer the reader to the vast literature on functional data analysis for recommendations on this topic (Ramsay, 2006). Throughout this manuscript, we assume the basis is fixed upfront.
To find an individual trajectory, for each subject , we might use least squares and estimate a set of coefficients , minimizing squared Euclidean distance to observed points
| (1) |
This direct approach has two main drawbacks. First, it ignores correlations within the curves, which could potentially improve the fit. Second, if the number of observations for an individual is smaller or equal to the size of the basis , we can fit a curve with no error leading to overfitting and an unreliable estimator of the variance.
To remedy the first issue, it is common to estimate the covariance operator, compute principal functional components across all individuals and represent curves in the space spanned by the first few of them. Such representation, is referred to as a Karhunen-Loève expansion (Watanabe, 1965; Kosambi, 2016), has became a foundation of many functional data analysis workflows (Ramsay and Dalzell, 1991; Yao et al., 2005; Cnaan et al., 1997; Laird, 1988; Horváth and Kokoszka, 2012; Besse et al., 1997).
A basic idea to remedy the second issue is to estimate both the basis coefficients and the covariance structure simultaneously. Linear mixed-effect models provide a convenient solution to this problem.
2.2. Linear mixed-effect models
A common approach to modeling longitudinal observation is to assume that data come from a linear mixed-effect model (LMM) (Verbeke, 1997; Zeger et al., 1988). We operate in a functionals pace with a basis of elements and we assume there exists a fixed effect , where for for . We model the individual random effect as a vector of basis coefficients. In the simplest form, we assume
where is a covariance matrix. We model individual observations as
| (3) |
where is the standard deviation of observation error and is the basis evaluated at timepoints defined in . Estimation of the model parameters is typically accomplished by the expectation-maximization (EM) algorithm (Laird and Ware, 1982). For predicting coefficients one can use the best unbiased linear predictor (BLUP) (Henderson, 1950; Robinson, 1991).
Since the LMM estimates the covariance structure and the individual fit simultaneously, it reduces the problem of overfitting of , present in the direct approach. However, this model is only applicable if we observe a relatively large number of observations per subject since we attempt to estimate coefficients for every subject.
To model trajectories from a small number of observations, practitioners further constrain the covariance structure. If we knew the functions which contribute the most to the random effect, we could fit an LMM in a smaller space spanned by these functions. We explore possibilities to learn the basics from the data using low-rank approximations of the covariance matrix.
2.3. Low-rank approximations
There are multiple ways to constrain the covariance structure. We can use cross-validation or information criteria to choose the best basis, the number of elements, or the positions of spline knots (Rice and Wu, 2001; Bigelow and Dunson, 2009). Alternatively, we can place a prior on the covariance matrix (MacLehose and Dunson, 2009).
Another solution is to restrict the latent space to dimensions and learn from the data a mapping between the latent space and the basis. In the simplest scenario with Gaussian noise, observations can be modeled as
| (4) |
following the notation from (3).
James et al. (2000) propose an EM algorithm for finding model parameters and predicting latent variables in (4). In the expectation stage, they compute the conditional mean of given and the model parameters, while in the maximization stage, with assumed observed, they maximize the likelihood with respect to . The likelihood, given , takes the form
Another approach to estimating parameters of (4) is to optimize over and marginalize (Lawrence, 2004). This approach allows modifying the distance measure in the latent space, using the kernel trick (Schulam and Arora, 2016).
Estimation of the covariance structure of processes is central to the estimation of individual trajectories. Descary and Panaretos (2016) propose a method where the estimate of the covariance matrix is obtained through matrix completion.
Methods based on low-rank approximations are widely adopted and applied in practice (Berkey and Kent, 1983; Yan et al., 2017; Hall et al., 2006; Besse and Ramsay, 1986; Yao and Lee, 2006; Greven et al., 2011). However, due to their probabilistic formulation and reliance on the distribution assumptions, these models usually need to be carefully fine-tuned for specific situations and existing implementations tend to be slow. This shortcoming motivates us to develop an elementary optimization framework, using existing, extensively studied, and well–optimized tools for matrix algebra.
3. Modeling sparse longitudinal processes using matrix completion
We first introduce the methodology for univariate sparsely-sampled processes. The direct method, mixed-effect models, and low-rank approximations described in Section 2 have their counterparts in the matrix completion setting. We discuss these analogies in Sections 3.2 and 3.3. Next, in Section 4, we show that the simple representation of the problem allows for extension to multivariate sparsely-sampled processes and a regression setting.
3.1. Notation
For each individual we observe measurements at time-points . Unlike in the prior work introduced in Section 2 operating on entire curves, here we discretize time to time-points , where and is arbitrarily large. Each individual is expressed as a partially observed vector . For each time-point for we find a corresponding grid-point . We assign . Let be a set of grid indices corresponding to observed grid points for an individual . All elements outside , i.e. are considered missing.
For sufficiently large, our observations can be uniquely represented as a matrix with missing values. We denote the set of all observed elements by pairs of indices as . Let be the projection onto observed indices, i.e. , such that for and otherwise. We define as the projection on the complement of , i.e. . We use to denote the Frobenius norm, i.e. the square root of the sum of squares of matrix elements, and to denote the nuclear norm, i.e. the sum of singular values.
As in Section 2 we imposed smoothness by using a continuous basis . When we evaluate the basis on a grid we get a matrix .
In our algorithms, we use diagonal thresholding operators defined as follows. Let be a diagonal matrix. We define soft-thresholding as
where , and hard-thresholding as
where .
3.2. Direct approach
The optimization problem (1) of the direct approach described in Section 2.1 can be approximated in the matrix completion setting. Note that the bias introduced by the grid is negligible if the grid is sufficiently large, i.e. if each observed timepoint is relatively close to some grid point. We defined the basis as a set of continuous functions, so the finer the grid the closer we are to the actual value of the basis at a given timepoint. Eventually, the difference becomes negligible. Similarly, for the observed points, the coordinate corresponding to time is more accurate when the grid is finer, but again, due to continuity assumption this difference becomes negligible. The analysis of the properties of the grid is beyond the scope of the paper. As a rule of thumb, we recommend choosing the grid based on a practical indication. For example, if we expect patients to visit a clinic 1–2 times per year, then a grid corresponding to 12 points per year might be sufficient.
We approximate each observation with a point on the selected grid . Next, we rewrite the optimization problem (1) as a matrix completion problem
| (5) |
where by optimization over we mean optimization over all and is an matrix composed of vectors stacked vertically.
The matrix formulation in equation (5) and the classic approach in Section 2.1 share multiple characteristics. In both cases, if data is dense, we may find an accurate representation of the underlying process simply by fitting least-squares estimates of or . Conversely, if the data is too sparse, the problem becomes ill-posed, and the least-squares estimates can overfit.
However, the represenational difference between functional representation (1) and matrix representation (5) leads to different computational approaches. The matrix representation enables us to use the matrix completion framework and, in particular, in Section 3.4 we introduce convex optimization algorithms for solving (5).
Some low-rank constraints on the random effect from the mixed-effect model introduced in Section 2.2 can be expressed in terms of constraints on . In particular, in Section 3.3 we show that the linear mixed-effect model can be expressed by constraining the .
3.3. Low-rank matrix approximation
In the low-rank approach described in Section 2.3 we assume that individual trajectories can be represented in a low-dimensional space, by constraining the rank of .
We use a similar approach in solving (5). One difficulty comes from the fact that optimization with a rank constraint on turns the original least-squares problem into a nonconvex problem. Motivated by the matrix completion literature, we relax the rank constraint in (5) to a nuclear norm constraint and we attempt to solve
| (6) |
for some parameter .
From the practical standpoint, low-rank representation corresponds to describing curves on a basis comprised of only a few functions which are the best functions for obtaining low reconstruction errors. In Figure 3 we illustrate two functions for describing processes introduced in Section 1 and Figure 1. Such low-dimensional representation of processes can also be used for clustering based on the type of their progression as we discuss in the data study (Section 6).
Figure 3:

Left: The first two trends of variability for processes of the Gait Deviation Index, derived from the first two dimensions of the low-rank decomposition of the observed matrix. We can appreciate variability around the age of 10 in the first component, and correction before and after the age of 10 in the second component. Right: We illustrate how the individual score on the first component (positive and negative value) affects the population means.
Cai et al. (2010) propose a first-order singular value thresholding algorithm (SVT), for solving a general class of problems involving a nuclear norm penalty and a linear form of , which includes (6). Their algorithm can handle large datasets and has strong guarantees of convergence, but it requires tuning the step size parameter, which can decrease computational efficiency as different steps have to be tried in practice. This limitation was addressed by Ma et al. (2011); Mazumder et al. (2010); Hastie et al. (2015a) who introduced iterative procedures which do not depend on such tuning.
In the last decade, machine learning and statistical learning communities have introduced multiple algorithms for matrix completion. Many of them are suitable for solving (6). However, in this article, we focus on analyzing the benefits of framing the trajectory prediction problem (1) in the matrix completion framework, rather than on benchmarking possible solutions.
3.4. Low-rank approximation with singular value thresholding
The low-rank probabilistic approach, introduced in Section 2.3, is based on the observation that the underlying processes for each subject can be approximated in a low-dimensional space. Here, we exploit the same characteristic using matrix-factorization techniques for solving the optimization problem (6).
For the sake of clarity and simplicity, we choose to solve the problem (6) with an extended version of the SOFT-IMPUTE algorithm designed by Hastie et al. (2015a); Mazumder et al. (2010). We find it easy to implement because it only uses matrix multiplication and Singular Value Decomposition (SVD). Using standard matrix operations also reduces the computational cost of our method, since implementations of these operations leverage well-optimized algorithms. However, as discussed in Section 3.3, many other convex optimization algorithms can be applied.
The key component to the solution is the following property linking problem (6) with the SVD. Consider the fully observed case of (6). Using Theorem 2.1 in Cai et al. (2010), one can show that the optimization problem
| (7) |
with , has a unique solution , where and is the SVD of , i.e., is an unitary matrix, is an rectangular diagonal matrix, with non-negative real numbers on the diagonal in decreasing order, while is a matrix. We refer to as the singular value thresholding (SVT) of . Note that, the decomposition of is identifiable since the solution of SVD with constrained is identifiable.
In order to solve (7) with a sparsely observed , we modify the SOFT-IMPUTE algorithm to account for the basis . Our Algorithm 1 iteratively constructs better approximations of the global solution for each in some predefined set for . For a given approximation of the solution , we use to impute unknown elements of obtaining . Then, we construct the next approximation by computing SVT of .
As a stopping criterion, we compute the change between subsequent solutions, relative to the magnitude of the solution, following the methodology in Cai et al. (2010). We set a fixed threshold of for this criterion, depending on the desired accuracy.
Algorithm 1.
| 1. Initialize with zeros |
| 2. For each : |
| (a) Repeat: |
| i. Compute |
| ii. If exit |
| iii. Assign |
| (b) Assign |
| 3. Output |
A common bottleneck of the algorithms introduced by Cai et al. (2010); Mazumder et al. (2010); Ma et al. (2011) as well as other SVT-based approaches is the computation of the SVD of large matrices. This problem is particularly severe in standard matrix completion settings, such as the Netflix problem, where the matrix size is over 400, 000 × 20, 000. However, in our problem,
| (8) |
and in our motivating data example. While algorithms for large matrices are applicable here, the property (8) makes the computation of SVD feasible in practice with generic packages such as PROPACK (Larsen, 2004).
For estimating curves on new data, we need to find minimizing the prediction error.
To this end, we regress observed values on with a penalty on the coeffcients, i.e. we optimize
where are basis functions evaluated at the corresponding timepoints.
While our algorithms for finding do not depend on the density of the grid, it is important to highlight that with the growing the norm of the solution grows to infinity and , for some fixed (See Appendix A). In order to obtain comparable results for different , parameters need to be adjusted to this scale (for example, by modifying the penalty to ).
The algorithm converges at a rate , where is the number of iterations (this can be established by an elementary extension of the proofs in Mazumder et al. (2010)) as we demonstrate in Appendix A. Each step of our algorithm requires matrix multiplications and an SVD. Thus the complexity of each step is . For EM-based algorithms, the minimization step requires multiple matrix multiplications and therefore we expect a larger constant in each step. For practical use, we report computing times on synthetic data in Section 5.
3.5. regularization
While the nuclear norm relaxation (6) is motivated by making the problem convex, Mazumder et al. (2010) argue that in many cases it can also give better results than the rank constraint. They draw an analogy to the relation between best-subset regression regularization) and LASSO (, regularization as in Tibshirani (1996); Friedman et al. (2001)). In LASSO, by shrinking model parameters, we allow more parameters to be included, which can potentially improve predictions if the true subset is larger than the one derived through regularization. In the case of (6), shrinking the nuclear norm allows us to include more dimensions of again potentially improving the prediction if the true dimension is high.
In theory, estimating too many components can lead to problems if the true dimension is small. In such cases, shrinking may cause the inclusion of unnecessary dimensions emerging from the noise. To remedy this issue, following the analogy with penalized linear regression, we may consider another class of penalties. In particular, we may consider coming back to the rank constraint by modifying the nuclear norm penalty (6) to . We define . The problem
| (9) |
has a solution , where and is the SVD of . We refer to as the hard singular value thresholding (hard SVT) of . We use Algorithm 2 to find the hard SVT of .
Algorithm 2.
| 1. Initialize with solutions from Soft-Longitudinal-Impute |
| 2. For each : |
| (a) Repeat: |
| i. Compute |
| ii. If exit |
| iii. Assign |
| (b) Assign |
| 3. Output |
The problem (9) is non-convex, however, by starting from the solutions of Algorithm 1 we explore the space around the global minimum of the , version of the problem. Ge et al. (2016) show that this strategy is successful empirically.
In practice, the continuous parameterization via leads to similar results as rank-truncation methods for different ranks. There are two advantages of the former. First, it allows for a continuum of warm starts and, as such, it is a natural post-processor for Soft-Impute solutions. Second, it can be a basis for further generalizations with penalties between and (Mazumder et al., 2010). However, if the true rank can be estimated with high confidence and the signal is strong, then a rank-truncated method can lead to better predictive performance.
3.6. Dense grid and proximal gradient descent
Growing grid size parameter improves the accuracy of approximation of the data on the grid, but benefits in approximation are negligible when becomes sufficiently large. However, we show that also leads to a continuous version of the algorithm, equivalent to the proximal gradient descent method applied to the initial formulation of the problem (1) with nuclear norm penalty.
We start by observing that in Algorithm 1 the Step 2(a)(i) depends on the grid and requires multiplication with all evaluations of the basis on that grid. We can rewrite the expression in such that only a sparse number of evaluations of the basis is required. Indeed, we write
| (10) |
and to compute on in (10) we only need and an evaluation of the basis on gridpoints corresponding to . Therefore, for computing we also only need evaluated on gridpoints with a nonzero number of observations. Now, if we increase the number of grid points to infinity we derive a solution where the basis needs to be evaluated only at observed timepoints.
Since is orthogonal, when the product converges to 0 and the update in Step 2(a)(i) in Algorithm 1 also converges to 0 at the rate . Therefore, in order to obtain comparable results for different we need to scale the update direction with , for some . We refer to as the step size.
We show that at the limit our approach is equivalent to proximal gradient descent. Let us define the loss function as in (1), i.e.
where are timepoints, are observations. We optimize the loss function with a nuclear norm penalty for some
where . To solve problem (11) we define
and the gradient of takes form
Note that is corresponding to in (10) with infinitely dense grid. For the update step in the proximal gradient descent method, we use step size and singular value thresholding with a threshold as recommended in Hastie et al. (2015b). We describe the full procedure in Algorithm 3.
Algorithm 3.
Grid-free soft-Longitudinal-Impute
| 1. Initialize with zeros |
| 2. For each : |
| (a) Repeat: |
| i. Compute |
| ii. If exit |
| iii. Assign |
| (b) Assign |
| 3. Output |
Nesterov (2013) showed sufficient conditions for convergence of Algorithm 3. If where is the Lipschitz constant of , then the algorithm converges at the rate , where is the number of steps.
3.7. A link between the reduced-rank model and Soft-Longitudinal-Impute
Intuitively, we might expect similarity between the principal directions derived using the probabilistic approach (3) and their counterparts derived from the SVT-based approach. We investigate this relation by analyzing the behavior of SVT for matrices sampled from the probabilistic model given by (3).
For simplicity, let us assume that and the data is fully observed on a grid of timepoints. Assume that observations come from the mixed-effect model
| (12) |
where is an unknown covariance matrix of rank and variables are independent. By the spectral decomposition theorem, we decompose , where is a orthogonal and is a diagonal matrix with positive coefficients in decreasing order. Since and are independent, the distribution (12) can be rewritten as
The model (13) is a factor model with uncorrelated errors and factors — the first columns of .
The following theorem constitutes a link between the mixed-effect model and SVT (Theorem 9.4.1 in Mardia et al. (1980)),
Theorem 1.
Let be the observed matrix and let . Then, is the maximum likelihood estimator of .
Theorem 1 implies that in the fully observed case the estimator of converges to the true parameter at the rate , as the MLE.
Factor analysis methods give not only estimates of and but also predictors of the individual latent variables . In the multivariate analysis literature, there are multiple ways to estimate factor scores, i.e., a matrix such that . Most notably researchers introduce Spearman’s scores, Bartlett’s scores, and Thompson’s scores (Kim and Mueller, 1978). Simply taking as the estimate of the scores corresponds to the solution of (7) as long as .
In Theorem 1 we assume that is known, which is rarely the case in practice. However, the likelihood of can be parametrized by , and we can find the optimal solution analytically. This corresponds to minimizing (7) for different .
A similar analogy is drawn between the classical principal component analysis and probabilistic principal component analysis by Tipping and Bishop (1999) and James et al. (2000).
4. Multivariate longitudinal data
In practice, we are often interested in the prediction of a univariate process in the context of other longitudinal measurements and covariates constant over time. Examples include the prediction of disease progression given patient’s demographics, data from clinical visits at which multiple blood tests or physical exams are taken, or measurements that are intrinsically multivariate such as gene expression or x-rays collected over time. The growing interest in this setting stimulated research in latent models (Sammel and Ryan, 1996) and multivariate longitudinal regression (Gray and Brookmeyer, 1998, 2000). Diggle et al. (2002) present an example case study in which longitudinal multivariate modeling enables estimation of joint confidence region of multiple parameters changing over time, shrinking the individual confidence intervals.
In this section, we present an extension of our univariate framework to multivariate measurements sparse in time. We explore two cases: (1) dimensionality reduction, where we project sparsely sampled multivariate processes to a small latent space, and (2) linear regression, where we use a multivariate process and covariates constant over time for the prediction of a univariate process of interest. To motivate the methodology, we start with a regression involving two variables observed over time.
4.1. Illustrative example: Univariate regression
Suppose that the true processes are in a low-dimensional space of some continuous functions (e.g., splines) and that we observe them with noise. More precisely, let
| (14) |
for , where are vectors, are vectors and is a matrix of splines evaluated on a grid of points. We assume zero-mean independent errors with fixed covariance matrices respectively, and that the true processes underlying the observed and follow a linear relation in the spline space, i.e.
where is an unknown matrix.
Let be matrices formed from stacked vertically. From (15) we have , while (14) implies
| (16) |
where are matrices of observation noise. Without loss of generality, we assume that is orthonormal. We have full freedom to choose the basis , since any basis can be orthogonalized using, for example, the singular value decomposition.
Due to the orthogonality of and after multiplying both expressions in (16) by we can map the problem to the classical multivariate errors-in-variables models. Let
| (17) |
where and . In errors-in-variables models it is assumed that the parameters and are unknown, and are to be estimated. Both regressors and responses are measured with noise (here and ). The parameter can be interpreted as a latent representation of both and .
The problem of estimating parameters in (17) has been extensively studied in literature dating back to Adcock (1878). Two main methods for estimating parameters in (17) are maximum likelihood estimates (MLE) and generalized least squares estimators (GLSE). The estimators in MLE are derived under the assumption of certain distributions of errors. In GLSE, the only assumption about errors is that they are independent, zero-mean, and they have a common covariance matrix. Then, and are zero-mean and estimates for and can be found by optimizing some norm of these expressions. Gleser and Watson (1973) show that in the no-intercept model for and of the same size (as in our case) and under the assumption of Gaussian errors, MLE and GLSE give the same estimates of , if GLSE is derived for the Frobenius norm.
In this work, we focus on the GLSE approach as it can be directly solved in our matrix factorization framework and we find it easier to deploy and extend in practice. To account for different magnitudes of the noise in and , we consider the optimization problem with weights
| (18) |
where . Let . Then (18) can be transformed to
| (19) |
where operator stacks horizontally matrices with the same number of rows. To solve (19), we show that the SVD of truncated to the first dimensions, can be decomposed to . Let be the SVD of , with
where each and is a matrix for and each is a matrix for . By Lemma 2.1 and Lemma 2.2 in (Gleser, 1981) matrix is almost surely nonsingular. Therefore, almost surely exists and we can transform the decomposition such that and , solving (19).
For partially observed data, if they are very sparse, it might be essential to constrain the rank of the solution. The partially-observed and rank-constrained version of the problem (19) takes the form
, where is the desired rank of the solution and is a projection on
As previously, for an unknown we can introduce a rank penalty using the nuclear norm
| (20) |
The algorithm in the general case of multiple processes is derived in Section 4.2.
Although we motivate the problem as a regression of on and are symmetric in (19). The low-rank matrix is, therefore, a joint low-rank representation of matrices and and thus our method can be seen as a dimensionality reduction technique or as a latent space model. In Section 4.2 we extended this idea to a larger number of variables. In Section 4.3 we discuss how this approach can be used for regression.
The linear structure of (16) allows us to draw analogy not only to the errors-in-variables models but also to the vast literature on canonical correlation analysis (CCA), partial least squares (PLS), factor analysis (FA), and linear functional equation (LFE) models. Borga et al. (1997) show that solutions of CCA and PLS can also be derived from the SVD of stacked matrices, as we did with in (19). Gleser (1981) thoroughly discusses the relation between errors-in-variables, FA, and LFE.
Finally, the method of using SVD for stacked matrices has also been directly applied in the recommender systems context. Condli et al. (1999) showed that for improving the prediction of unknown entries in some partially observed matrix one might consider a low-rank decomposition of (), where are additional covariates for each row, e.g., demographic features of individuals.
4.2. Dimensionality reduction
Suppose that for every individual we observe multiple variables varying in time (e.g. results of multiple medical tests at different times in a clinic) and we want to find a projection on maximizing the variance explained for some . This projection would correspond to characterizing patients by their progression trends of multiple metrics simultaneously.
We extend the equation (19) to account for a larger number of covariates, and we do not impose decomposition of the solution yet. We formulate the following optimization problem
| (21) |
where are some matrices corresponding to the processes measured on a grid of points, is a basis evaluated on the same grid and orthogonalized (a matrix), and is a matrix.
Let be the Kronecker product of identity matrix and , i.e. a matrix with stacked times on the diagonal, and let . Matrix is orthogonal and therefore results developed in Section 2.3 apply here. In particular, singular value thresholding solves
and we can use Algorithm 1 for solving
| (22) |
where is the projection on observed indices .
The optimization problem (21) can be further extended. For example, we can choose a different basis for each process or scale individual contributions of processes using scaling factors. By modifying Equation (22) correspondingly, we can extend our solution to these cases.
4.3. Regression
In practice, we are often interested in the relationship between the progression of an individual parameter (e.g., cancer growth) and some individual features constant over time (e.g., demographics) or progressions of other covariates (e.g., blood tests, vitals, biopsy results). We show how our framework can be used to exploit relations between curves in order to improve the estimation of the progression of the main parameter of interest.
We start with a regression problem with fixed covariates and sparsely observed response trajectories. Assume that for each subject we observe covariates and samples from trajectories following the distribution
where is the matrix of evaluations of the basis on the same evaluation points as (See Section 2.2). We map the problem to the matrix completion framework as in Section 3. Let be a matrix of observed covariates, be a sparsely observed matrix of trajectories, and be a matrix representing a basis of splines evaluated on a grid of points. We consider the optimization problem
where is a matrix and is a projection on the observed indices . To solve (23) we propose an iterative Algorithm 4.
Algorithm 4.
| 1. Initialize zeros |
| 2. Repeat till convergence: |
| (a) Impute regressed values |
| (b) Compute |
| (c) If exit |
| (d) Assign |
| 3. Return |
Suppose we want to incorporate other variables varying in time for the prediction of the response process. We can directly apply the method proposed in Section 4.2 and model the response and regressors together. However, it might be suboptimal for prediction, as it optimizes the least-squares distance in all variables rather than only the response. This difference is analogous to the difference between the regression line of some univariate on independent variables and the first principal component analysis of , used for the prediction of . While the first one minimizes the distance to , the latter minimizes the distance to , which is usually less efficient for predicting .
Alternatively, we can use methodology from Section 4.2 only for covariates. The solution of (22) can be decomposed into , and we regress on as in (23). Let be an orthogonal matrix derived from , where is the numbers of latent components. We search for a matrix solving
| (24) |
where is a projection on a set of observed coefficients. We propose a two-step iterative procedure (Algorithm 5).
Algorithm 5.
Sparse-Longitudinal-Regression
| 1. For each |
| ● Get by solving the regression problem (24) with (Algorithm 4) |
| 2. Return |
5. Simulations
We illustrate the properties of the multivariate longitudinal fitting in a simulation study. First, we generate curves with quickly decaying eigenvalues of covariance matrices. Then, we compare the performance of the methods in terms of the variance explained by the predictions.
5.1. Data generation
We seek to simulate data similar to observations in Section 6. We want to parametrize the processes to draw insights depending on sample size and relation between variables. Let be a grid of equidistributed points and let be a basis of spline functions evaluated on the grid . We simulate three matrices using the same procedure , where :
-
Define the procedure generating symmetric matrices for a given vector
Simulate matrix
Use SVD to decompose to
Return , where is a diagonal matrix with on the diagonal
Let and .
Draw
vectors
from the distribution
Return a matrix with rows .
We chose values of close to values on the diagonal of the spectral decomposition of covariance structure estimated in Section 6. We define
Let be generated following the procedure and let . We consider , and as coefficients in a spline space . We derive corresponding functions by multiplying these matrices by , i.e. and . We set and .
In order to reflect a realistic sampling of curves, we use timepoints at which subjects in the data study were observed (see Section 6). As we are particularly interested in predictive performance, we select subjects with at least 4 observed timepoints to enable leave-one-out estimation. For each simulated curve we randomly select a subject and use grid-aligned timepoints at which this subject visited the clinic. We acknowledge that specifics of sampling might affect relative performance of methods, however a thorough analysis of sampling is beyond the scope of our work. Here we only focus on the case directly derived from our data study.
Each observed element of each matrix and is drawn with Gaussian noise with mean 0 and standard deviation 0.25. Our goal is to recover from such sparsely sampled noisy data.
5.2. Methods
We compare Soft-Longitudinal-Impute (SLI) defined in Algorithm 1, Proximal-Gradient (PG) method defined in Algorithm 3, the fPCA procedure (James et al., 2000), implemented by Peng and Paul (2009), fdapace (Zhou et al., 2022), and face (Xiao et al., 2018). The first three algorithms require a set of basis functions as one of the inputs. In all cases, we use a polynomial . In SLI and PG we also need to specify the tuning parameter , while in fPCA we need to choose the rank . We use cross-validation to choose and by optimizing for the prediction error on held-out (validation) observations.
We divide the observed coefficients into training (81%), validation (9%), and test (10%) sets. We choose the best parameters of the three models on the validation set and then retrain on the entire training and validation sets combined. We compute the error by taking the mean squared Frobenius distance between and estimated , i.e.
| (25) |
on the test set .
We train the algorithms with all combinations of parameters: regularization parameter for SLI and PG procedures and the rank for fPCA procedure . We compare the five methods fPCA, fdapace, face, PG, and SLI, to the baseline null model which we define as the population means across all visits.
For testing our multivariate approach, we model together and we compare our Sparse-Longitudinal-Regression (SLR) with MFACE package (Li et al., 2020). We compare compute time and predictive performance in terms of recovering of .
5.3. Results and discussion
The SLI and PG methods achieve superior performance at a good running time as presented in Figure 4. Fdapace (Zhou et al., 2022) outperforms all methods in terms of speed, but it performs worse in terms of the mean squared error.
Figure 4:

We illustrate the performance (top panels) and computation time (bottom panels) of seven estimation methods on simulated data. In the univariate case, we compare face (Xiao et al., 2018), fdapace (pace; Zhou et al. (2022)), PCA (fPCA; James et al. (2000)) with our Soft-Longitudinal-Impute (SLI) and proximal gradient (PG). In the multivariate case, we compare multivariate face (mface; Li et al. (2020)) with our Soft-Longitudinal-Regression (SLR). We measure performance by normalized mean squared error (NMSE; the lower the better). Boxplots in the top panels and bottom left panel represent distributions over 100 repetitions with simulated subjects. In the bottom right panel, we illustrate computation time with different for methods that converged in all cases without errors. Computation time is measured in seconds and represented on the log scale. On the absolute scale, with , methods pace, fPCA, PG, SLI and SLR took, on average, 2, 779, 9, 214 and 3133 seconds.
Results indicate that both our methods, SLI and PG, should be considered on par with fdapace and face for practical applications since each method has its own advantages. A solution derived from fdapace might also be used as a warm start for other algorithms to speed them up. We also observed that the performance gap decreases with the growing number of curves.
One additional advantage of SLI and PG is that they return a smooth space of solutions, parametrized with . In Figure 5, we present the estimated rank and cross-validation error of one of the simulation runs. Compared to fixed-rank alternatives, our methods allow for tuning the predictive accuracy and the rank simultaneously in a smooth manner.
Figure 5:

Our regularized procedure requires a choice of the tuning parameter . This can be done using cross-validation where we optimize the mean-squared error of predictions on the held-out dataset. We plot the estimated error of the solution as a function of in one of the simulations (left) and the estimated rank of the solution depending on the parameter (right).
In the multivariate case, both mface and our SLR successfully recovered addional information from variables and as their NMSE in modeling was better compared to univariate counterpart methods (SLI and face respectively). SLR outperformed mface in terms of NMSE, but required more time to converge. We conclude that SLR should also be considered a viable candidate method for multivariate sparsely sampled functions on function regression.
6. Data study
We present an application of our methods for understanding how longitudinal changes in gait patterns relate to subtypes of neurological disorders. First, we discuss how practitioners collect the data and use them to guide the decision process. Next, we describe our dataset and present how our methodology can improve current workflows.
In clinical gait analysis, at each visit movement of a child is recorded using optical motion capture. Optical motion capture allows estimating 3D positions of body parts using a set of cameras tracking markers positions on the subject’s body. A set of at least three markers is placed at each analyzed body segment so that its 3D position and orientation can be identified uniquely. These data are then used to determine the relative positions of body segments by computing the angle between the corresponding planes. Typically it is done using a biomechanical model for enforcing biomechanical constraints and improving accuracy.
In gait analysis practitioners usually analyze the movement pattern of seven joints in the lower limbs: ankle, knee, hip in each leg, and pelvis (Figure 6). Each joint angle is measured in time. For making the curves comparable between the patients, usually, the time dimension is normalized to the percentage of the gait cycle, defined as the time between two foot strikes.
Figure 6:

Four joints were measured in clinical gait analysis: pelvis, hip, knee, and ankle. Each joint can be measured in three planes: sagittal plane (top row), frontal plate (middle row), and transverse plane (bottom row).
While trajectories of joint angles are a piece of data commonly used by practitioners for taking decisions regarding treatment, their high-dimensional nature hinders their use as a quantitative metric of gait pathology or treatment outcome. This motivates the development of univariate summary metrics of gait impairment, such as questionnaire-based metrics Gillette Functional Assessment Walking Scale (FAQ) (Gorton III et al., 2011), Gross Motor Function Classification System (GMFCS) (Palisano et al., 2008) and Functional Mobility Scale (FMS) (Graham et al., 2004), or observational video analysis scores such as Edinburgh Gait Score (Read et al., 2003).
One of the most widely adopted quantitative measurements of gait impairments in pediatrics is the gait deviation index (GDI) (Schwartz and Rozumalski, 2008). GDI is derived from joint angle trajectories and measures the deviation of the first ten singular values from the population average of the typically developing population. GDI is normalized in such a way that 100 corresponds to the mean value of typically developing children, with the standard deviation equal 10. It is observed to be highly correlated with questionnaire-based methods. Thanks to its deterministic derivation from the motion capture measurements this method is considered more objective than questionnaires.
In medical practice, GDI has been adapted as a metric for diagnosing the severity of impairment, and it constitutes an integral part of the clinical decision-making process and evaluation of treatment outcomes. However, in order to correctly identify the surgery outcome, it is crucial to understand the natural progression of GDI. In particular, a positive outcome of surgery might be negligible when compared to natural improvement during puberty. Similarly, a surgery maintaining the same level of GDI might be incorrectly classified as a failure, if the decline in the patient’s function over time is not accounted for.
Methods introduced in this article can be used to approximate individual progressions of GDI. First, we present how a prediction can be made solely based on the patient’s GDI history and the histories of other patients. Next, using our regression procedure, we predict GDI trajectories using other sparsely observed covariates, namely O2 expenditure and walking speed.
6.1. Materials and methods
We analyze a dataset of Gillette Children’s Hospital patients visiting the clinic between 1994 and 2014, ages ranging from 4 to 19 years, mostly diagnosed with Cerebral Palsy. The dataset contains 84 visits of 36 patients without gait disorders and 6066 visits of 2898 patients with gait pathologies.
Motion capture data was collected at 120Hz and joint angles in time were extracted. These joint angles were then normalized in time to the gait cycle. Points from these curves were then subsampled (51 equidistributed points) for the downstream analysis established in the clinic.
In the dataset which we received from the hospital, for each patient we know their birthday and disease subtype. From each visit, we observe the following variables: patient ID, time of the visit, GDI of the left leg, GDI of the right leg, walking speed, and O2 expenditure. Other clinical variables that we received were not included in this study. Walking speed is related to information we lose during the normalization of the gait cycle in time. O2 expenditure is a measure of a subject’s energy expenditure during walking. Pathological gait is often energy inefficient and reduction of O2 expenditure is one of the objectives of treatments. Finally, GDI is computed for two legs while in many cases the neurological disorder affects only one limb. To simplify the analysis, we focus on the more impaired limb by analyzing the minimum of the left and the right GDI.
Our objective is to model individual progression curves. We test two methods: functional principal components (fPCA) and Soft-Longitudinal-Impute (SLI). We compare the results to the null model – the population mean across all visits (mean). In SLR, we approximate GDI using latent variables of sparsely observed covariates O2 expenditure and walking speed, following the methodology from Section 4.3.
Let us denote the test set as . We validate each model on heldout indices by computing the mean squared error as defined in (25). We select the parameters of each of the three methods using cross-validation, using the same validation set.
In our evaluation procedure, for the test set, we randomly select 5% of observations of patients who visited the clinic at least 4 times. We chose the cutoff at 4 in order to have at least 3 observations to fit the curve, and keep 1 observation for testing. We verified with the collaborators at the hospital that three visits are reasonable for the practical use of our methods. We split the remaining 95% of observations into training and validation sets in 90: 10 proportion. We also ran the procedures using a smaller test set and did not observe any relevant difference in results, likely because the training set is already relatively large for the task. We train the algorithms with the following combinations of parameters: the regularization parameter for SLI and SLR procedures and the rank for fPCA procedure . We define the grid of points. We repeat the entire evaluation procedure 20 times.
6.2. Results
Compared to the null model, fPCA and SLI explain around ~30% of the variance. We present detailed results in Table 1. SLR using additional predictors, O2 expenditure and walking speed, yielded a mean MSE of 0.68 with a standard deviation of 0.8. We conclude that O2 expenditure and walking speed provide additional information for the prediction of GDI progression.
Table 1:
Distribution of cross-validated MSE of the two methods: functional principal components (fPCA) and Soft-Longitudinal-Impute (SLI).
| mean | sd | |
|---|---|---|
| fPCA | 76.4 | 11.9 |
| SLI | 74.7 | 7.5 |
Both fPCA and Sparse-Longitudinal-Impute provide latent representations of patients’ progression curves. We analyze the singular value vectors from our SVD solution which we refer to as principal components. In the left plot in Figure 3 we show the first two estimated principal components. We found that the first component estimates the change between GDI before and after age of 20. The second component model changes around the age of 10 and around the age of 18. In the right plot in Figure 3, by adding a principle component to the population mean curve, we illustrate how differences in the first component are reflected in the patient’s trajectory. By visual investigation of curves returned by our Sparse-Longitudinal-Impute and by fPCA we found similar trends in the first two components.
Since our SVD decomposition defines a low-rank representation of the progression trends, we can also use it to gain insights into progression in different groups of patients. In Cerebral Palsy, we divide paralysis into subtypes depending on which limbs are affected: monoplegia (one leg), diplegia (two legs), hemiplegia (one side of the body), triplegia (three limbs), quadriplegia (four limbs). Hemiplegia is the most prevalent in our population and it might be divided depending on severity, from type I (weak muscles, drop foot) to type IV (severe spasticity). We find differences between trends of progression for different subtypes of paralysis of patients . We illustrate these distributions in Figure 7.
Figure 7:

Progression trends in different subsets of diseases. Negative values of the score, such as most of the quadriplegic group, correspond to individual trends where the first component (the red curve Figure 3 left) is subtracted from the mean (the red curve in Figure 3 right). Positive values of the score, such as most of the hemiplegic group, correspond to individual trends where the first component is added (the green curve in Figure 3 right).
7. Discussion
Results presented in Section 6.2 imply that our Sparse-Longitudinal-Impute and Sparse-Longitudinal-Regression methods can be successfully applied to understand trends of the variability of disease progression. We show how to incorporate progressions of O2 expenditure and walking speed in the prediction of the progression of GDI. We present how low-rank representation can be leveraged to gain insights into subtypes of impairment.
While a large portion of variance remains unexplained, it is important to note that in practice the individual progression is not accounted for explicitly in the current decision-making process. Instead, practitioners only use the population-level characteristics of the dependence between age and impairment severity. Our model can greatly improve this practice.
Despite successful application, we identify limitations that could be potentially addressed in the extensions of our model. First, the method is meant to capture the natural continuous progression of GDI, while in practice there are many discrete events, such as surgeries that break continuity assumptions and render the mean trajectories less interpretable. Second, our methodology does not address the “cold start problem”, i.e. we do not provide tools for predictions with only one or zero observations. Third, we do not provide explicit equations for the confidence bounds of predicted parameters. Fourth, in our methods, we focus on finding a solution of (7) regardless of the distribution of the data (e.g., the nature of missingness of the data). While we see it as an advantage if distributions are unknown, in certain situations we could leverage the distribution and improve results.
While these and other limitations can constrain the applicability of the method in the current form, they can be addressed using existing techniques of matrix completion. The focus of this paper is to introduce a computational framework rather than build a full solution for all cases. Elementary formulation of the optimization problem as well as the fully-functional implementation can foster the development of new tools using matrix completion for longitudinal analysis and for mixed-effect models.
In our R package fcomplete available at https://github.com/kidzik/fcomplete, we provide implementations of all algorithms described in this article as well as helper functions for transforming the data, sampling training and test datasets, and plotting functions. For convenience, we also provided an interface for using the fpca package implementing Sparse Functional Principal Components algorithms (James et al., 2000; Peng and Paul, 2009). The analysis was performed on a desktop PC with 64 GB RAM memory and an Intel® Core™ Intel(R) Core(TM) i9–10900K CPU @ 3.70GHz, operating on a Ubuntu 18.04 system with R version 4.1.0.