{'fraction_non_alphanumeric': 0.029096375480207114, 'fraction_numerical': 0.00965425087689995, 'mean_word_length': 4.716249761313729, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Trajectory modeling of gestational weight: A functional principal component analysis approach

Suboptimal gestational weight gain (GWG), which is linked to increased risk of adverse outcomes for a pregnant woman and her infant, is prevalent. In the study of a large cohort of Canadian pregnant women, our goals are to estimate the individual weight growth trajectory using sparsely collected bodyweight data, and to identify the factors affecting the weight change during pregnancy, such as prepregnancy body mass index (BMI), dietary intakes and physical activity. The first goal was achieved through functional principal component analysis (FPCA) by conditional expectation. For the second goal, we used linear regression with the total weight gain as the response variable. The trajectory modeling through FPCA had a significantly smaller root mean square error (RMSE) and improved adaptability than the classic nonlinear mixed-effect models, demonstrating a novel tool that can be used to facilitate real time monitoring and interventions of GWG. Our regression analysis showed that prepregnancy BMI had a high predictive value for the weight changes during pregnancy, which agrees with the published weight gain guideline.


Introduction
Normal physiological adaptations to pregnancy favor weight gain to support fetal growth, followed by weight loss postpartum to meet increased maternal energy demands during lactation [1,2]. It is well known that the risk of poor maternal and fetal health outcomes increases when women gain either too little or too much weight during pregnancy. Gaining too little weight is associated with low birth weight and preterm birth [3]. Excessive weight gain in pregnancy, which is a growing problem in developed countries, contributes to increased rates of maternal and perinatal complications, including gestational diabetes, emergency caesarian delivery, large infant (>90% percentile) for gestational age at birth and sometimes even fetal death [4]. It has been reported that across all prepregnancy BMI categories, 45-80% of Canadian women gain in excess of their respective BMI category-specific Gestational Weight Gain (GWG) recommendations from Institute of Medicine [5][6][7]. Excessive GWG adds to the growing PLOS  prevalence of overweight and obesity among women entering pregnancy (in the case of a subsequent pregnancy) and increases women's long-term risk of obesity and obesity-related chronic diseases, such as diabetes, hypertension, and certain cancers [8].
Customized counseling and education combined with individual weight monitoring have been shown to improve GWG adherence [9,10]. Women are currently referred to general weight gain trajectory based on their prepregnancy BMI category, but that adherence rates might be improved if weight trajectory could be individualized. Thus, monitoring and modelling individual weight growth trajectories during pregnancy could be clinically relevant and useful for women and health care providers. For example, the weight growth trajectory may be used to predict the gestational weight changes so that women at high risk of suboptimal GWG can be identified and appropriate intervention can be offered.
Instead of an individual's unique trajectory, previous modeling studies on gestation weight growth aim to obtain a reference weight trajectory for the population of pregnant women [11][12][13]. Most statistical methods of modeling individual trajectory were developed for modeling the daily or monthly cycling patterns of certain biomarkers [14][15][16]. These mixed effects models require a large number of measurements per individual. This data requirement needs intensive data collection, which is challenging for large cohort studies over a 9-month pregnancy in the research setting. To reduce the data collection burden for both study participants and the research team, a model that can estimate individual trajectory using irregularly spaced sparse longitudinal data is needed. The search of suitable statistical method leads us to examine the functional principal component analysis (FPCA) approach [17]. The development of FPCA is motivated by irregularly spaced sparse functional or longitudinal data, where the functional principal component (FPC) scores are framed as conditional expectations. With a cohort of sparse longitudinal samples, FPCA is capable of efficiently estimating the individual continuous trajectory by borrowing information from the whole cohort.
We have three objectives in this study. First, to investigate whether the FPCA approach provides a good fit to individual gestational weight growth trajectory. Second, to compare the performance of FPCA to the classic method for trajectory analysis, i.e., the mixed effects model. Lastly, to examine the contribution of prepregnancy BMI to the variation in gestational weight changes.

Materials
Data collection. In the Alberta Pregnancy Outcome and Nutrition (APrON) study, pregnant women who were less than 27 weeks of gestation were recruited. The study protocol has been published elsewhere [18]. The ethical approval is granted through University of Alberta Ethic Board (Human ethics PRO00002954). Briefly, upon a woman's recruitment, informed written consent was obtained and her prepregnancy weight (W 0 ) and due date were selfreported. Women recruited before 13 weeks gestation were assessed in each trimester, labeled as gestation stage A, B, C. Those recruited in 14-27 weeks gestation were assessed in gestation B and C. Each assessment included a weight measurement; a 24-hour food recall, either webbased to be completed online or interviewer-administered to be completed at a study site; a self-administered Baecke's physical activity (PA) questionnaire, among other questionnaires. The web-based 24-hour food recall was developed by Hanning et al. [19] and the database was modified to include food items typically only consumed by adults, including alcohol [20]; and the interviewer-administered instrument was described by Conway et al. [21]. The Baecke's PA questionnaire, first proposed by Baecke et al. [22], was modified for pregnancy [23]. In addition, height was measured at her first study visit, which was used to calculate her prepregnancy BMI. Gestational age (GA) was calculated based on due dates. Each women was asked to attend a postpartum visit at three months after delivery, during which her highest weight during pregnancy (W H ) and delivery date were reported.
The weights measured in gestation stage A, B, C are denoted as W A , W B , and W C respectively. In the 24-hour food recall, macro-and micro-nutrient intakes were calculated. A calibration study showed that direct pooling of the results from the web-based and intervieweradministered instrument may not be feasible [24] and therefore we model them separately. Levels of PA measured in the Baecke's questionnaire were represented by the PA indices. Each subject had a maximum of 5 body weight data points, the self-reported W 0 and W H and the measured W A , W B , W C for a trajectory, where corresponding GAs vary from 0 to 42 weeks. One or more of these data points could be missing due to missed study visit(s). We associate W 0 to t = 0, and W H to the GA at birth.
Inclusion criteria. Subjects who had a full-term (GA at birth !37 weeks), singleton live birth were included. For statistical modeling, we required the subject to have at least one record of physical activities or food intake, height measurement, W 0 and at least one measured weight (W A , W B and W C ) with corresponding GA. Consistency is also required, for example, the GA at birth should be greater than the GA of W C .

Method
FPCA set up and trajectory estimation. The Functional Principle Component Analysis (FPCA) approach proposed by Yao et al. [17] is developed for sparse, irregularly measured longitudinal data. We assume that each subject's measurements come from a smooth underlying trajectory subject to measurement errors. The FPCA procedure first estimates the smooth covariance surface of the observed data as a function of time, then captures the principal components (PC) as functions of time that explain variance among all observed data. An estimated trajectory for each subject is reconstructed through a linear combination of the first few PC functions that captures most of the variation in the data. Since the PC functions are estimated from all available data, the reconstruction of trajectories borrows information from the entire sample. The validity of the FPCA approach is guaranteed even when there are only a few measurements for each subject. A mathematical overview of FPCA is provided below; readers who are less sophisticated in statistics may skip this section.
We consider a smooth random function X(t), with unknown mean μ(t) and smooth covariance function cov(X(s), X(t)) = G(s, t). Suppose that X i (t), i = 1, . . ., n, are its n realizations, each with N i observations, X i (T ij ) + ij , which were made at different time points T ij , j = 1, . . ., N i and subject to uncorrelated measurement errors ij with mean 0 and constant variance σ 2 . In our case, X(t) can be one of the trajectory of weight, nutrient intake, or PA index. The time t is in a closed time interval T between 0 and 42 weeks. In FPCA, the j-th observation of the ith realization is expressed as where ϕ k 's are the k-th principal component (PC) functions, assumed to be smooth, and ξ ik 's are the FPC scores that are uncorrelated with zero mean and unit standard deviation. The estimation of the trajectory is implemented in the following four steps.
Step 1 Estimation of the mean function.
The mean function μ is estimated based on all the data points from all individuals, where local linear kernel smoothers proposed by Fan et al [25] are employed.
Step 2 Estimation of the covariance structure.
Let G i ðT ij ; T il Þ ¼ ðY ij ÀmðT ij ÞÞðY il ÀmðT il ÞÞ be the "raw" covariances of the observed data. Then we have where δ jl = 0 for j 6 ¼ l and δ jl = 1 for j = l. Therefore, we use only those G i (T ij , T il ) with j 6 ¼ l to first obtain the smoothed covariance surface of X(t) by the local linear kernel smoother, denoted byĜðs; tÞ. As noted by Yao et al [17], when the assembled pairs (T ij , T il ) are sufficiently dense in the domain, the estimation of the covariance function is feasible. Next a local linear component along the diagonal and a quadratic component along the direction perpendicular to the diagonal are fitted. We denote the diagonal of the estimated surface bỹ GðtÞ. A local linear kernel smootherV ðtÞ focusing on diagonal entries of {G(t, t) + σ 2 } is obtained by using G(T ij , T ij ) as input.
The estimation of eigendecomposition, including the eigenfunctions (PCs) and eigenvalues, is essentially to solve the eigenequations Z TĜ ðs; tÞ0 k ðsÞds ¼l k0k ðtÞ ð2Þ with respect to0 k 's andl k 's. These eigenfunctions are estimated by discretizing the smoothed covariance as in [26].

Step 4 Prediction of FPC scores.
To predict the FPC scores, the integration of a smooth function is needed, and general Riemann sums may not work well due to the sparse data. DenoteỸ i ¼ ðY i1 ; :::; Y iN i Þ, then in FPCA through conditional expectation [17], the best prediction of the FPC scores is the conditional expectation Eðx ik jỸ i Þ. If we further assume that ξ ik and ij are jointly normal, the conditional expectation is given by [27] x Plugging in the unknown quantities in Eq (3) by their estimates, we obtain the "plugging in" estimator of the FPC scorê For our data analysis, we use the MATLAB package, Principal Analysis by Conditional Expectation (PACE) [17], for the implementation of FPCA.
Typically, the first few PCs explain the largest fraction of total variation in all the trajectories, thus represent the dominant modes of variation. For each individual, the trajectory can be well approximated by a linear combination of these first K smooth functions. Popular approaches to choose K include the Akaike information criterion (AIC) and fraction of variance explained (FVE). We employ the FVE method with a threshold of 0.99 of the variance explained. That is, we choose the smallest K eigenfunctions that explain at least 99% of the total variance. Once K is chosen we approximate the trajectory of the i-th subject aŝ wherex ik 's are the individual-specific FPC scores defined in (4). In (5), the termsmðtÞ and 0 k ðtÞ borrows information from the entire data set, whilex ik is driven byỸ i , the observations of the specific subject. As described previously, we have up to 5 weight records for each subject in our study measured from t = 0 (W 0 ) to t ! 37 (W H at GA at birth). Individual weight trajectories can be estimated following steps 1 to 4 outlined above. Simultaneous confidence interval bands for individual trajectories are also obtained; details on the construction of confidence interval bands are given in Appendix A. Performance comparison: FPCA vs. non-linear mixed effect model for trajectory modeling. The performance of the FPCA-based individual trajectory is compared with the classic model for trajectory modelling. Since the weight growth curve is nonlinear (Fig 1), we choose a parametric nonlinear mixed effect model. It is also observed that the mean weight curve is convex during early and mid-pregnancy and there is an inflection point at 30 weeks (Fig 1). Thus we use a logistic curve to model this shape of weight trajectory, which is in the form of As a logistic curve always starts from zero, we add an intercept c to this model. The model then has the following form: In (6), L is the maximum of of the curve, which is related to the total weight gain. Since we use only part of the curve, it acts as a magnifying factor. k is the steepness of the curve, which is affected by the weight growth rate. t 0 is an inflection point. From the shape of the estimated mean function, we set it at 30 weeks. c is a baseline weight and can be interpreted as the prepregnancy weight. L and c are treated as random effects and k is treated as a fixed effect of the model to be estimated from the data. After estimating the weight trajectory of each subject with models 5 and 6, we compare the model-based weight estimates at each study visit to the observed weights for each subject to quantify the model fit. The mean squared error (MSE) and root mean squared error (RMSE) is thus calculated as Gestational weight change. The gestational weight change can be defined either absolutely or relatively. The conventional gestational weight change is defined by total GWG, which is the weight at delivery minus the prepregnancy weight. As weight at delivery is unavailable in our data set, it is substituted with W C or W H whichever is larger. Thus the absolute change in weight is: This GWG has three potential drawbacks: (i) For subjects whose self-reported W H is less than measured W C , the latter is used as the highest weight. However, we know from our data that subjects are unlikely to schedule a visit after 37 weeks of GA. W C measured before 37 weeks of GA is likely differ from weight at delivery; (ii) It is possible that the weight of a pregnant woman drops during the last few weeks of gestation. The highest weight may differ from her weight at delivery; (iii) Both W H and W 0 are self-reported and subject to bias in recall and reporting [28,29]. Thus, absolute weight change as defined in (7) may overestimate the total GWG. Alternatively, estimated total GWG can be obtained from the weight trajectory given by FPCA, denoted by G': G 0 ¼ ðweight estimated at GA at deliveryÞ À ðweight estimated at GA ¼ 0Þ: The relative weight change is expressed as a ratio of weight at delivery and pre-pregnancy weight. A log-transformed weight ratio is denoted by LG and LG', respectively: LG 0 ¼ log weight estimated at GA at delivery weight estimated at GA ¼ 0 : LG and LG 0 are the four possible response variables for the regression model. The covariates include prepregnancy BMI, nutrient intakes, and PA. In the APrON study, nutrient intakes and PA indices were collected longitudinally during the same study visit when the weight was measured.
To fit a multiple linear regression model, we use the average of all relevant measurements from one subject as her covariate value for the nutrient intake and PA.
We have also directly modelled the estimated weight trajectory as the response variable and the estimated trajectories of nutrient intakes and PA as the explanatory variables, extending the approach by Müller et al. [30]. The results from this approach are not reported because the complex model with trajectory as covariates has identical R 2 and MSE as the much simpler and more straightforward multiple linear regression model.

Results
The APrON study recruited 2191 pregnant women, among which 1629 subjects have fullterm, singleton, live births, and at least one weight record. 101 were excluded because they completed neither food recall nor Baecke's PA questionnaire. We further excluded 6 subjects who completed both the interviewer-administered and web-based versions of food recall. In our final cohort, 725 completed only the interviewer-administered version of the 24-hour food recall, 797 completed only the web-based version of the 24-hour food recall.

Modeling the trajectories of weight with FPCA
The distribution of the time points when the observations were made is revealed by the assembled pairs of time (T ij , T ik ), where i indexes subject and j, k index time points. The assembled pairs of all the weight records of the 1540 subjects are shown in Fig 1(a). Note that by assigning W H to GA at delivery, a larger cluster occurs at T ij ! 37. The self-reported prepregnancy weight is assigned to GA = 0, resulting in the horizontal and vertical lines T i1 = 0. Both lines approximately start at 5 and ends at 42 weeks, indicating that there exists a weight record from a certain subject at almost any time point after 5 weeks. A smoothed mean weight trajectory is estimated for all subjects using the FPCA method (Fig 1(b)).
The smooth estimate of the variance function for weight data is shown in Fig 2(a). It decreases prior to 25 weeks of gestation, suggesting that variation in the weights are largest at the beginning of pregnancy. As the measurement times were schedule by trimesters, there are few measurement at the boundary between two trimesters. Specifically, there are only a few data points around GA = 29 (Fig 1), the estimate of variance around t = 29 is not as reliable as estimates elsewhere where more data points were available. Thus, the fluctuation observed around 27-35 weeks of gestation (Fig 2(a)) is more likely due to a lack of data than due to a true underlying pattern. After 35 weeks of gestation, the variance decreases rapidly, which indicates a smaller variance among W H than W 0 of all subjects.
The smooth estimate of the correlation surface of weight data is shown in Fig 2(b). The entire surface is above 0.7, indicating that weight records of the same subject are highly correlated at all times. However, the correlation between the weight during the first 20 weeks of gestation and weight measured at later times decreases drastically. Correlation between W 0 and the gestational weight is weaker in later pregnancy (>20 weeks) than that in early pregnancy. It suggests that a subject's weight begins to develop new patterns after 20 weeks. A strong correlation of weight within second/third trimester indicates that the weight at any two time points after a woman enters second trimester are highly correlated.
The scree plot is shown in Fig 3(a). The first 3 PCs account for more than 99% of the variation, thus they are used to estimate an individual's weight trajectory. Accounting for 95.7% of the total variation, the first PC is an average over the pregnancy, which is flat during the first trimester, and decreases rapidly in the second and third trimester (Fig 3(b)). It corroborates the fact that the majority of weight is gained during the last two trimesters. The second PC increases most rapidly in the first trimester, corresponding to a contrast between weights in pre-or very early pregnancy and the second/third trimester (Fig 3(c)). The third PC (Fig 3(d)) corresponds to a contrast between the second and the third trimester.
The weight gain estimated from trajectory could account for the weight gain in the last few weeks even if the subject does not have any weight record. Moreover, FPCA method has a smoothing effect. For subjects with large/small weight gain, the estimated trajectory tends to have a lowered/increased weight gain, and thus the estimated weight gain is closer to the mean weight gain. This effect can be seen from Fig 4(b). The weight gain estimated from the trajectory, G 0 , is highly correlated with the weight gain directly calculated, G, but tends to be smaller than G when G is large, or larger than G when G is small. This approach of estimating GWG may reduce the bias of under-reporting the prepregnancy BMI or over-reporting the W H , as noted in [28,29].
Comparison of FPCA and non-linear mixed effect model for weight trajectory Fig 5 displays observed weights during pregnancy from four study subjects, one from each prepregnancy BMI category as defined by the Institute of Medicine [5]. The estimated trajectories using the FPCA model (5) and NLME model estimated in the form of (6) are superimposed in the same panel. For subject A, her weight steadily increases during pregnancy, which is of similar pattern to the mean function of all samples; see Fig 1. Estimated trajectories from both FPCA and NLME are in good agreement with the observed weights. Subject B lost weight at the beginning of her pregnancy and did not regain to her prepregnancy weight even in the 3rd trimester. So her weight gain pattern deviates from the mean function of all samples. The NLME approach uses a curve shape similar to subject A (and in fact, similar to the mean function of all samples), so the fitted trajectory gives poor estimates for her observed weights that yields large residuals jŴ ðT ij Þ À WðT ij Þj. The trajectory estimated by FPCA gives much better estimates for subject B's observed weight.
As illustrated in Fig 5, FPCA provides a flexible fit to the weight data and a significantly better fit to the weight trajectory than the classic NLME model. The superior model fit is also confirmed by a 35% reduction in residual variance when FPCA is compared to NMLE (4.4kg 2 FPCA vs. 6.8kg 2 NLME).
We also applied FPCA model to the sparse longitudinal nutrient intake data and PA indices to estimate their trajectories. However, these attempts did not yield satisfactory fit (results not shown).

Explaining variation in gestational weight change
We successfully estimated the trajectories of weight from sparse measurements, which may be used to predict the total GWG and inform interventions such as counseling and education. Our next goal is to identify the factors associated with the weight change during pregnancy, such as prepregnancy BMI, caloric intakes and physical activity.  Since we observed a nonnegligible discrepancy in caloric intakes calculated from the two 24-hour food recall instruments [24], we built separate models, stratifying participants by food recall instrument. The results from the two separate models are similar. Thus, we presented the results from modeling participants who completed the interview-administrated 24h food recall as an example to illustrate our findings. Our explanatory variables are prepregnancy BMI, the average total caloric intake and the average of the PA indices. Table 1 reports the RMSE and R 2 of these regression models.
We observe the following: 1) The weight change as estimated from the weight trajectory can be explained better than the weight change calculated from the weight records; 2) The relative weight change (log-transformed) can be explained better than the absolute weight change; 3) Adding nutrient intake and PA data did not improve model fit as measured by the RMSE or R 2 , when compared to the corresponding simple linear regression model with prepregnancy BMI (BMI p ) as the only predictor. Among these models, the most parsimonious model is given by where the response variable is the log transformed relative weight change calculated from the estimated weight trajectory and the explanatory variable is the prepregnancy BMI, which explains 51% of the variation in weight changes during pregnancy. Fig 4(a) shows a scatter plot of the relative weight change and prepregnancy BMI (both on log-scale), illustrating a strong negative linear association between prepregnancy BMI and weight change during pregnancy.

Discussion
Meeting GWG recommended by guideline was achieved only in a minority of the pregnancies [7]. A useful intervention is to combine customized counseling and education with individual weight monitoring [9,10], which could benefit from a personalized weight growth trajectory as a reference for targeted intervention. Our study demonstrated that the FPCA approach successfully captures the shape of the individual gestational weight growth trajectory with sparse (3 to 5 observations per subject) irregularly-spaced gestation weight (Fig 1). FPCA has the potential to be developed into a tool for predicting gestational weight growth. In addition, we found that the variation in gestational weight change estimated from these individualized trajectories can be largely explained by woman's prepregnancy BMI. Contrary to our expectation, adding the dietary intake and physical activity covariates, either as trajectories or numeric averages, does not improve the explained variation of weight changes. The most likely explanation is that dietary intake and physical activity data are subject to large variation (e.g. day-to- day variation in diet and physical activities), as well as large measurement errors due to the nature of survey data. Moreover, the dietary intake and physical activity data are more sparse than the weight data, making accurate trajectory modeling more challenging. When modeling the individual weight trajectory with our sparse, irregularly collected longitudinal data, FPCA offers a significant advantage when compared to the NLME, a classic approach in modeling individual curves [14][15][16]. As seen in Fig 5, the curves estimated using NLME all follow a fixed shape of the mean weight trajectory of the population. This is because once the function is specified, the estimated trajectories can only differ by a dilation and shift but maintain the shape of the curve. Thus, NLME can not capture large deviation in individual patterns from the mean weight trajectory. It is also known that when there are only three or four data points per subject, the parameters of NLME estimated using either restricted maximum likelihood or maximum likelihood are prone to be biased. In contrast, the curve estimated using FPCA is flexible and adaptive to the observed sparse data points, which is especially useful for individuals who have different weight trajectories from the mean weight trajectory of the population. For each subject we have only up to five weight records. In the four steps of our estimation, estimation of both the PFC scores and eigenfunctions relies on the estimate of the covariance surface. As long as the total covariance structure is consistently estimated, which relies on sufficient density of the assembled pairs (T ij , T ik ), the estimate of trajectory works reasonably well.
The principle components identified by the FPCA offers insight into the weight trajectories among subjects. The first principle component is flat in the first trimester then rapid declines, which corresponds to the overall pattern of bodyweight variances during pregnancy. That is, as gestational age increases, the variation in body weight decreases. This trend agrees with our second study finding that the estimated total GWG is negatively correlated with prepregnancy BMI and more than half of the variation in total GWG are explained by prepregnancy BMI alone. This strong negative correlation between GWG and prepregnancy BMI is consistent with the GWG guidelines from IOM [31], which recommends women in a lower prepregnancy BMI category to gain more weight during pregnancy than those in a higher prepregnancy BMI category.
Within subject correlation provides insight into individual patterns of GWG. The correlation between the weights at the beginning and towards the end of the pregnancy was low. It suggests that in general, women's weight develops a new pattern after 20 weeks into gestation. This within subject weight correlation pattern suggests that an efficient time to start predicting weight growth is likely to be in the second trimester for the majority of pregnant women.
The FPCA method borrows information from the entire data set, and does not incorporate women's prepregnancy BMI information. However, women with lower prepregnancy BMIs tend to have higher GWG and their weight growth trajectories are likely steeper than the mean weight growth trajectory. Women with higher prepregnancy BMIs have an opposite trend; their weight trajectories are more gradually rising than the mean weight growth trajectory. For our future research, we will address this limitation and improve fit by incorporating additional BMI category-specific FPCAs. as The estimation error ofξ K;i can be assessed by varðξ K;i À ξ K;i Þ. The conditional expectation Eðx K;i jỸ i Þ is the projection of ξ K,i on the space spanfỸ i g, thus Eðξ K;i ξ T K;i Þ ¼ Eðξ K;iξ T K;i Þ, and varðξ K;i À ξ K;i Þ ¼ varðξ K;i Þ À varðξ K;i Þ ¼ O K ; where O K ¼ L À HS À 1 Y i H T ¼ diagðl 1 ; :::; l K Þ À HS À 1 Y i H T . Under Gaussian assumptions, we have ðξ K;i À ξ K;i Þ $ N ð0; O K Þ. From (5), the individual trajectory is estimated aŝ