These have STAN_kernel_* counterparts. These R versions are provided for reference and are not optimized for speed. These are used when generating simulated data, and not during model inference.

kernel_eq(x1, x2, alpha = 1, ell)

kernel_ns(x1, x2, alpha = 1, ell, a)

kernel_zerosum(x1, x2, M)

kernel_bin(x1, x2, pos_class = 0)

kernel_cat(x1, x2)

kernel_varmask(x1, x2, a, vm_params)

kernel_beta(beta, idx1_expand, idx2_expand)

Arguments

x1

vector of length \(n\)

x2

vector of length \(m\)

alpha

marginal std (default = 1)

ell

lengthscale

a

steepness of the warping function rise

M

number of categories

pos_class

binary (mask) kernel function has value one if both inputs have this value, other wise it is zero

vm_params

vector of two mask function parameters.

beta

a parameter vector (row vector) of length N_cases

idx1_expand

integer vector of length \(n\)

idx2_expand

integer vector of length \(m\)

Value

A matrix of size \(n\) x \(m\).

Functions

  • kernel_eq(): Uses the exponentiated quadratic kernel.

  • kernel_ns(): Uses the non-stationary kernel (input warping + squared exponential).

  • kernel_zerosum(): Uses the zero-sum kernel. Here, x1 and x2 must be integer vectors (integers denoting different categories). Returns a binary matrix.

  • kernel_bin(): Uses the binary (mask) kernel. Here, x1 and x2 must be integer vectors (integers denoting different categories). Returns a binary matrix.

  • kernel_cat(): Uses the categorical kernel. Here, x1 and x2 must be integer vectors (integers denoting different categories). Returns a binary matrix.

  • kernel_varmask(): Computes variance mask multiplier matrix. NaN's in x1 and x2 will be replaced by 0.

  • kernel_beta(): Computes the heterogeneity multiplier matrix. NOTE: idx_expand needs to be given so that idx_expand[j]-1 tells the index of the beta parameter that should be used for the \(j\)th observation. If observation \(j\) doesn't correspond to any beta parameter, then idx_expand[j] should be 1.