Interpretable nonparametric modeling of longitudinal data using additive Gaussian process regression. Contains functionality for inferring covariate effects and assessing covariate relevances. Models are specified using a convenient formula syntax, and can include shared, group-specific, non-stationary, heterogeneous and temporally uncertain effects. Bayesian inference for model parameters is performed using 'Stan' (rstan). The modeling approach and methods are described in detail in Timonen et al. (2021).

Core functions

Main functionality of the package consists of creating and fitting an additive GP model:

  • lgp: Specify and fit an additive GP model with one command.

  • create_model: Define an lgpmodel object.

  • sample_model: Fit a model by sampling the posterior distribution of its parameters and create an lgpfit object.

  • pred: Computing model predictions and inferred covariate effects after fitting a model.

  • relevances: Assessing covariate relevances after fitting a model.

  • prior_pred: Prior predictive sampling to check if your prior makes sense.



The data that you wish to analyze with 'lgpr' should be in an R data.frame where columns correspond to measured variables and rows correspond to observations. Some functions that can help working with such data frames are:

Vignettes and tutorials

See The tutorials focus on code and use cases, whereas the Mathematical description of lgpr models vignette describes the statistical models and how they can be customized in 'lgpr'.


Run citation("lgpr") to get citation information.


Bug reports, PRs, enhancement ideas or user experiences in general are welcome and appreciated. Create an issue in Github or email the author.


  1. Timonen, J. et al. (2021). lgpr: an interpretable non-parametric method for inferring covariate effects from longitudinal data. Bioinformatics, url.

  2. Carpenter, B. et al. (2017). Stan: A probabilistic programming language. Journal of Statistical Software 76(1).


Juho Timonen (first.last at