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)
vector of length \(n\)
vector of length \(m\)
marginal std (default = 1)
lengthscale
steepness of the warping function rise
number of categories
binary (mask) kernel function has value one if both inputs have this value, other wise it is zero
vector of two mask function parameters.
a parameter vector (row vector) of length N_cases
integer vector of length \(n\)
integer vector of length \(m\)
A matrix of size \(n\) x \(m\).
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.