Package 'FastGP'

Title: Efficiently Using Gaussian Processes with Rcpp and RcppEigen
Description: Contains Rcpp and RcppEigen implementations of matrix operations useful for Gaussian process models, such as the inversion of a symmetric Toeplitz matrix, sampling from multivariate normal distributions, evaluation of the log-density of a multivariate normal vector, and Bayesian inference for latent variable Gaussian process models with elliptical slice sampling (Murray, Adams, and MacKay 2010).
Authors: Giri Gopalan, Luke Bornn
Maintainer: Giri Gopalan <[email protected]>
License: GPL-2
Version: 1.2
Built: 2024-11-26 03:51:07 UTC
Source: https://github.com/cran/FastGP

Help Index


Sampling from a Bayesian model with a multivariate normal prior distribution

Description

This function uses elliptical slice sampling to sample from a Bayesian model in which the prior is multivariate normal (JMLR Murray, Adams, and MacKay 2010)

Usage

ess(log.lik,Y, Sig, N_mcmc,burn_in,N,flag)

Arguments

log.lik

Log-lik function in model which is assumed to take two arguments: the first contains the parameters/latent variables and the second the observed data Y

Y

Observed data.

Sig

Covariance matrix associated with the prior distribution on the parameters/latent variable vector.

N_mcmc

Number of desired mcmc samples.

burn_in

Number of burn-in iterations.

N

Dimensionality of parameter/latent variable vector.

flag

Set to TRUE for MASS implementation of mvrnorm (which may be more stable but slow), FALSE for FastGP implementation of rcpp_rmvnorm (which is faster but less stable)

Author(s)

Giri Gopalan [email protected]

Examples

# See demo/FastGPdemo.r.

Matrix Operations Using Rcpp and RcppEigen

Description

Performs useful matrix operations using Rcpp and RcppEigen.

Usage

rcppeigen_invert_matrix(A)
rcppeigen_get_det(A)
rcppeigen_get_chol(A)
rcppeigen_get_chol_stable(A)
rcppeigen_get_chol_diag(A)
tinv(A)

Arguments

A

Matrix to perform operation on.

Details

Functions with "rcppeigen" directly call RcppEigen implementations of the associated functions; rcppeigen_get_chol_stable retrieves L and rcppeigen_get_chol_diag(A) retrieves D in A = LDL^T form, whereas rcppeigen_get_chol(A) retrieves L in A = LL^T form. Thanks to Jared Knowles who pointed out that the former variant is more stable (with a potential speed trade-off) and has found it useful for his package merTools. tinv inverts a symmetric Toeplitz matrix using methods from Trench and Durbin from "Matrix Computations" by Golub and Van Loan using Rcpp.

Author(s)

[email protected]

Examples

# See demo/FastGPdemo.R

Multivariate Normal Sampling and Log-Density Evaluation

Description

These functions allow for the sampling of and evaluation of the log-density of a multivariate normal vector.

Usage

rcpp_log_dmvnorm(S,mu,x, istoep)
rcpp_rmvnorm(n,S,mu)
rcpp_rmvnorm_stable(n,S,mu)

Arguments

S

Covariance matrix of associated multivariate normal.

n

Number of (independent) samples to generate.

mu

Mean vector.

x

Vector of observations to evaluate the log-density of.

istoep

set this to TRUE if S is Toeplitz.

Author(s)

Giri Gopalan [email protected]

Examples

#See demo/FastGPdemo.R