Package: lgpr 1.2.4

lgpr: Longitudinal Gaussian Process Regression

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'. The modeling approach and methods are described in detail in Timonen et al. (2021) <doi:10.1093/bioinformatics/btab021>.

Authors:Juho Timonen [aut, cre], Andrew Johnson [ctb]

lgpr_1.2.4.tar.gz
lgpr_1.2.4.zip(r-4.5)lgpr_1.2.4.zip(r-4.4)lgpr_1.2.4.zip(r-4.3)
lgpr_1.2.4.tgz(r-4.4-x86_64)lgpr_1.2.4.tgz(r-4.4-arm64)lgpr_1.2.4.tgz(r-4.3-x86_64)lgpr_1.2.4.tgz(r-4.3-arm64)
lgpr_1.2.4.tar.gz(r-4.5-noble)lgpr_1.2.4.tar.gz(r-4.4-noble)
lgpr.pdf |lgpr.html
lgpr/json (API)

# Install 'lgpr' in R:
install.packages('lgpr', repos = c('https://jtimonen.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/jtimonen/lgpr/issues

Uses libs:
  • c++– GNU Standard C++ Library v3
Datasets:
  • testdata_001 - A very small artificial test data, used mostly for unit tests
  • testdata_002 - Medium-size artificial test data, used mostly for tutorials

On CRAN:

bayesian-inferencegaussian-processeslongitudinal-datastan

6.24 score 25 stars 69 scripts 184 downloads 62 exports 63 dependencies

Last updated 2 months agofrom:bb45f955b4. Checks:OK: 1 NOTE: 8. Indexed: yes.

TargetResultDate
Doc / VignettesOKOct 12 2024
R-4.5-win-x86_64NOTEOct 12 2024
R-4.5-linux-x86_64NOTEOct 12 2024
R-4.4-win-x86_64NOTEOct 12 2024
R-4.4-mac-x86_64NOTEOct 12 2024
R-4.4-mac-aarch64NOTEOct 12 2024
R-4.3-win-x86_64NOTEOct 12 2024
R-4.3-mac-x86_64NOTEOct 12 2024
R-4.3-mac-aarch64NOTEOct 12 2024

Exports:add_dis_ageadd_factoradd_factor_crossingadjusted_c_hatbetclear_postproccomponent_infocomponent_namescontains_postproccovariate_infocreate_modeldraw_predfit_summarygamget_drawsget_modelget_predget_stanfitigamis_f_sampledlgplog_normalmodel_summarynew_xnormalnum_componentsnum_evalpointsnum_paramsetsoptimize_modelparam_summaryparameter_infoplotplot_betaplot_componentsplot_dataplot_drawsplot_effect_timesplot_fplot_predplot_simplot_warppostprocppcpredprior_predread_proteomics_datarelevancessample_modelsample_param_priorselectselect_freqselect_freq.integrateselect.integrateshowsimulate_datasplit_by_factorsplit_datasplit_randomsplit_within_factorsplit_within_factor_randomstudent_tuniform

Dependencies:abindbackportsbayesplotBHbitopscallrcheckmateclicolorspacedescdistributionaldplyrfansifarvergenericsggplot2ggridgesgluegridExtragtableinlineisobandlabelinglatticelifecycleloomagrittrMASSMatrixmatrixStatsmgcvmunsellnlmenumDerivpillarpkgbuildpkgconfigplyrposteriorprocessxpsQuickJSRR6RColorBrewerRcppRcppEigenRcppParallelRCurlreshape2rlangrstanrstantoolsscalesStanHeadersstringistringrtensorAtibbletidyselectutf8vctrsviridisLitewithr

Mathematical description of lgpr models

Rendered frommath.Rmdusingknitr::rmarkdownon Oct 12 2024.

Last update: 2021-08-11
Started: 2021-08-07

Readme and manuals

Help Manual

Help pageTopics
The 'lgpr' package.lgpr-package lgpr
Easily add the disease-related age variable to a data frameadd_dis_age
Easily add a categorical covariate to a data frameadd_factor
Add a crossing of two factors to a data frameadd_factor_crossing
Set the GP mean vector, taking TMM or other normalization into accountadjusted_c_hat
Apply variable scalingapply_scaling
Character representations of different formula objectsas.character,lgpexpr-method as.character,lgpformula-method as.character,lgpterm-method as_character
Create a modelcreate_model
Parse the covariates and model components from given data and formulacreate_model.covs_and_comps
Create a model formulacreate_model.formula
Parse the response variable and its likelihood modelcreate_model.likelihood
Parse the given modeling optionscreate_model.options
Parse given priorcreate_model.prior
Helper function for plotscreate_plot_df
Create a standardizing transformcreate_scaling
Density and quantile functions of the inverse gamma distributiondinvgamma_stanlike qinvgamma_stanlike
Draw pseudo-observations from posterior or prior predictive distributiondraw_pred
Quick way to create an example lgpfit, useful for debuggingexample_fit
Print a fit summary.fit_summary
An S4 class to represent analytically computed predictive distributions (conditional on hyperparameters) of an additive GP modelcomponent_names,GaussianPrediction-method GaussianPrediction GaussianPrediction-class num_components,GaussianPrediction-method num_evalpoints,GaussianPrediction-method num_paramsets,GaussianPrediction-method show,GaussianPrediction-method
Extract parameter draws from lgpfit or stanfitget_draws
Extract model predictions and function posteriorsget_pred
Compute a kernel matrix (covariance matrix)kernel kernel_beta kernel_bin kernel_cat kernel_eq kernel_ns kernel_varmask kernel_zerosum
An S4 class to represent input for kernel matrix computationscomponent_names,KernelComputer-method KernelComputer KernelComputer-class num_components,KernelComputer-method num_evalpoints,KernelComputer-method num_paramsets,KernelComputer-method show,KernelComputer-method
Main function of the 'lgpr' packagelgp
An S4 class to represent an lgp expressionlgpexpr lgpexpr-class
An S4 class to represent the output of the 'lgp' functionclear_postproc,lgpfit-method component_names,lgpfit-method contains_postproc,lgpfit-method get_model,lgpfit-method get_stanfit,lgpfit-method is_f_sampled,lgpfit-method lgpfit lgpfit-class num_components,lgpfit-method plot,lgpfit,missing-method postproc,lgpfit-method show,lgpfit-method
An S4 class to represent an lgp formulalgpformula lgpformula-class
An S4 class to represent an additive GP modelcomponent_info,lgpmodel-method component_names,lgpmodel-method covariate_info,lgpmodel-method is_f_sampled,lgpmodel-method lgpmodel lgpmodel-class num_components,lgpmodel-method parameter_info,lgpmodel-method show,lgpmodel-method
An S4 class to represent the right-hand side of an lgp formulalgprhs lgprhs-class
An S4 class to represent variable scalinglgpscaling lgpscaling-class
An S4 class to represent a data set simulated using the additive GP formalismlgpsim lgpsim-class plot,lgpsim,missing-method show,lgpsim-method
An S4 class to represent one formula termlgpterm lgpterm-class
Print a model summary.model_summary param_summary
Create test input points for predictionnew_x
Operations on formula terms and expressions*,lgpterm,lgpterm-method +,lgprhs,lgprhs-method +,lgprhs,lgpterm-method +,lgpterm,lgpterm-method operations
Plot a generated/fit model componentplot_api_c
Plot longitudinal data and/or model fit so that each subject/group has their own panelplot_api_g
Visualize all model componentsplot_components
Vizualizing longitudinal dataplot_data
Visualize the distribution of parameter drawsplot_beta plot_draws plot_effect_times plot_warp
Visualize input warping function with several steepness parameter valuesplot_inputwarp
Plot the inverse gamma-distribution pdfplot_invgamma
Visualizing model predictions or inferred covariate effectsplot_f plot_pred
Visualize an lgpsim object (simulated data)plot_sim
Graphical posterior predictive checksppc
Posterior predictions and function posteriorspred
An S4 class to represent prior or posterior draws from an additive function distribution.component_names,Prediction-method num_components,Prediction-method num_evalpoints,Prediction-method num_paramsets,Prediction-method Prediction Prediction-class show,Prediction-method
Prior (predictive) samplingprior_pred sample_param_prior
Convert given prior to numeric formatprior_to_num
Prior definitionsbet gam gam, igam igam, log_normal log_normal, normal normal, priors student_t student_t, uniform uniform,
Function for reading the built-in proteomics dataread_proteomics_data
Assess component relevancesrelevances
S4 generics for lgpfit, lgpmodel, and other objectsclear_postproc component_info component_names contains_postproc covariate_info get_model get_stanfit is_f_sampled num_components num_evalpoints num_paramsets parameter_info postproc s4_generics
Fitting a modeloptimize_model sample_model
Select relevant componentsselect select.integrate select_freq select_freq.integrate
Printing formula object info using the show genericshow show,lgpformula-method show,lgprhs-method show,lgpterm-method
Simulate latent function components for longitudinal data analysissim.create_f
Create an input data frame X for simulated datasim.create_x
Simulate noisy observationssim.create_y
Compute all kernel matrices when simulating datasim.kernels
Generate an artificial longitudinal data setsimulate_data
Split data into training and test setssplit split_by_factor split_data split_random split_within_factor split_within_factor_random
A very small artificial test data, used mostly for unit teststestdata_001
Medium-size artificial test data, used mostly for tutorialstestdata_002
Validate S4 class objectsvalidate validate_GaussianPrediction validate_lgpexpr validate_lgpfit validate_lgpformula validate_lgpscaling validate_Prediction
Variance masking functionvar_mask
Input warping functionwarp_input