lgpr-package {lgpr} | R Documentation |
The 'lgpr' package.
Description
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.
Visualization
-
plot_pred
: Plot model predictions. -
plot_components
: Visualize inferred model components. -
plot_draws
: Visualize parameter draws. -
plot_data
: Visualize longitudinal data.
Data
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:
-
new_x
: Creating new test points where the posterior distribution of any function component or sum of all components, or the posterior predictive distribution can be computed after model fitting. Other functions:
add_factor
,add_factor_crossing
,add_dis_age
,adjusted_c_hat
.
Vignettes and tutorials
See https://jtimonen.github.io/lgpr-usage/index.html. 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'.
Citation
Run citation("lgpr")
to get citation information.
Feedback
Bug reports, PRs, enhancement ideas or user experiences in general are welcome and appreciated. Create an issue in Github or email the author.
Author(s)
Juho Timonen (first.last at iki.fi)
References
Timonen, J. et al. (2021). lgpr: an interpretable non-parametric method for inferring covariate effects from longitudinal data. Bioinformatics, url.
Carpenter, B. et al. (2017). Stan: A probabilistic programming language. Journal of Statistical Software 76(1).