Description Usage Arguments Details Value Examples
Fitting, summarizing and predicting from Gaussian process models using a range of inference methods.
1 2 3 4 5 6 7 |
formula |
an object of class |
data |
a data frame containing the covariates against which to model
the response variable. This must have the same number of rows as
|
family |
a |
weights |
an optional vector of 'prior weights' to be used in the fitting process. Should be NULL or a numeric vector. |
mean_function |
an optional function specifying the prior over the mean
of the gp, in other words a 'first guess' at what the true function is.
This must act on a dataframe with named variables matching some of those in
|
inducing_data |
an optional dataframe containing the locations of
inducing points to be used when carrying out sparse inference (e.g. FITC).
This must contain variables with names matching those referenced by
|
inference |
a string specifying the inference method to be used to
estimate the values of the latent parameters. If |
hyperinference |
the method to be used for inference on the
hyperparameters (parameters of the kernel). |
verbose |
whether to return non-critical information to the user during model fitting. |
x |
an object of class |
... |
additional arguments for compatibility with generic functions |
The default inference method for a model with the family
gaussian(link = 'identity')
is full direct inference ('full'
),
for binomial(link = 'logit')
and binomial(link = 'probit')
the default is full Laplace inference ('Laplace'
; though note that
only Bernoulli data is handled at the moment). Sparse inference can be
carried out by specifying inference = 'FITC'
, this is currently only
available for a model with a Gaussian likelihood.
A fitted gp object for which there aren't yet any associated functions. But there will be.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # make some fake data
n <- 100 # observations
m <- 10 # inducing points
# dataframes
df <- data.frame(x = sort(runif(n, -5, 5)))
inducing_df <- data.frame(x = sort(runif(m, -5, 5)))
prediction_df <- data.frame(x = seq(min(df$x), max(df$x), len = 500))
# fake Gaussian response data
f <- sin(df$x)
y <- rnorm(n, f, 1)
# fit a full (non-sparse) GP model (without updating the hyperparameters)
# as this is the default. Notice we add the observation error to the kernel.
m1 <- gp(y ~ rbf('x') + iid(), df, gaussian)
# fit another with FITC sparsity
m2 <- gp(y ~ rbf('x') + iid(), df, gaussian, inference = 'FITC',
inducing_data = df)
# summary stats, other associated functions still to come
# construct a poisson response variable
y2 <- rpois(n, exp(f))
# fit a GP model by Laplace approximation
# (note no observation error in this model)
m3 <- gp(y2 ~ rbf('x'), df, poisson)
print(m3)
m3
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.