gp_fit {nimblewomble} | R Documentation |
Fit a Gaussian process
Description
Fits a Gaussian process with the choice of three kernels. Uses 'nimble' to generate posterior samples.
Usage
gp_fit(
coords = NULL,
y = NULL,
X = NULL,
kernel = c("matern1", "matern2", "gaussian"),
niter = NULL,
nburn = NULL
)
Arguments
coords |
spatial coordinats (supply as a matrix) |
y |
response |
X |
covariates (supply as a matrix without the intercept) |
kernel |
choice of kernel; must be one of "matern1", "matern2", "gaussian" |
niter |
number of iterations |
nburn |
burn-in |
Value
A list of MCMC samples containing the covariance parameters and the parameter estimates with associated 95
Author(s)
Aritra Halder <aritra.halder@drexel.edu>,
Sudipto Banerjee <sudipto@ucla.edu>
Examples
require(nimble)
require(nimblewomble)
set.seed(1)
# Generated Simulated Data
N = 1e2
tau = 1
coords = matrix(runif(2 * N, -10, 10), ncol = 2)
colnames(coords) = c("x", "y")
y = rnorm(N, mean = 20 * sin(sqrt(coords[, 1]^2 + coords[, 2]^2)), sd = tau)
# Posterior samples for theta
mc_sp = gp_fit(coords = coords, y = y, kernel = "matern2")
mc_sp$estimates
[Package nimblewomble version 0.1.0 Index]