Learn R Programming

gpboost (version 0.6.1)

GPModel: Create a GPModel object

Description

Create a GPModel which contains a Gaussian process and / or mixed effects model with grouped random effects

Usage

GPModel(group_data = NULL, group_rand_coef_data = NULL,
  ind_effect_group_rand_coef = NULL, gp_coords = NULL,
  gp_rand_coef_data = NULL, cov_function = "exponential",
  cov_fct_shape = 0, cov_fct_taper_range = 1, vecchia_approx = FALSE,
  num_neighbors = 30L, vecchia_ordering = "none",
  vecchia_pred_type = "order_obs_first_cond_obs_only",
  num_neighbors_pred = num_neighbors, cluster_ids = NULL,
  free_raw_data = FALSE, likelihood = "gaussian")

Arguments

group_data

A vector or matrix with labels of group levels for grouped random effects

group_rand_coef_data

A vector or matrix with covariate data for grouped random coefficients

ind_effect_group_rand_coef

A vector with indices that relate every random coefficients to a "base" intercept grouped random effect. Counting starts at 1.

gp_coords

A matrix with coordinates (features) for Gaussian process

gp_rand_coef_data

A vector or matrix with covariate data for Gaussian process random coefficients

cov_function

A string specifying the covariance function for the Gaussian process. The following covariance functions are available: "exponential", "gaussian", "matern", "powered_exponential", "wendland", and "exponential_tapered". For "exponential", "gaussian", and "powered_exponential", we follow the notation and parametrization of Diggle and Ribeiro (2007). For "matern", we follow the notation of Rassmusen and Williams (2006). For "wendland", we follow the notation of Bevilacqua et al. (2019). A covariance function with the suffix "_tapered" refers to a covariance function that is multiplied by a compactly supported Wendland covariance function (= tapering)

cov_fct_shape

A numeric specifying the shape parameter of the covariance function (=smoothness parameter for Matern and Wendland covariance). For the Wendland covariance function, we follow the notation of Bevilacqua et al. (2019)). This parameter is irrelevant for some covariance functions such as the exponential or Gaussian.

cov_fct_taper_range

A numeric specifying the range parameter of the Wendland covariance function / taper. We follow the notation of Bevilacqua et al. (2019)

vecchia_approx

A boolean. If true, the Vecchia approximation is used

num_neighbors

An integer specifying the number of neighbors for the Vecchia approximation

vecchia_ordering

A string specifying the ordering used in the Vecchia approximation. "none" means the default ordering is used, "random" uses a random ordering

vecchia_pred_type

A string specifying the type of Vecchia approximation used for making predictions. "order_obs_first_cond_obs_only" = observed data is ordered first and the neighbors are only observed points, "order_obs_first_cond_all" = observed data is ordered first and the neighbors are selected among all points (observed + predicted), "order_pred_first" = predicted data is ordered first for making predictions, "latent_order_obs_first_cond_obs_only" = Vecchia approximation for the latent process and observed data is ordered first and neighbors are only observed points, "latent_order_obs_first_cond_all" = Vecchia approximation for the latent process and observed data is ordered first and neighbors are selected among all points

num_neighbors_pred

an integer specifying the number of neighbors for the Vecchia approximation for making predictions

cluster_ids

A vector with IDs / labels indicating independent realizations of random effects / Gaussian processes (same values = same process realization)

free_raw_data

If TRUE, the data (groups, coordinates, covariate data for random coefficients) is freed in R after initialization

likelihood

A string specifying the likelihood function (distribution) of the response variable Default = "gaussian"

Value

A GPModel containing ontains a Gaussian process and / or mixed effects model with grouped random effects

Examples

Run this code
# NOT RUN {
# See https://github.com/fabsig/GPBoost/tree/master/R-package for more examples

library(gpboost)
data(GPBoost_data, package = "gpboost")

#--------------------Grouped random effects model: single-level random effect----------------
gp_model <- GPModel(group_data = group_data[,1], likelihood="gaussian")

#--------------------Gaussian process model----------------
gp_model <- GPModel(gp_coords = coords, cov_function = "exponential",
                    likelihood="gaussian")

#--------------------Combine Gaussian process with grouped random effects----------------
gp_model <- GPModel(group_data = group_data,
                    gp_coords = coords, cov_function = "exponential",
                    likelihood="gaussian")
# }

Run the code above in your browser using DataLab