kernel {lgpr} | R Documentation |
Compute a kernel matrix (covariance matrix)
Description
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.
Usage
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 |
x2 |
vector of length |
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 |
idx1_expand |
integer vector of length |
idx2_expand |
integer vector of length |
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
andx2
must be integer vectors (integers denoting different categories). Returns a binary matrix. -
kernel_bin()
: Uses the binary (mask) kernel. Here,x1
andx2
must be integer vectors (integers denoting different categories). Returns a binary matrix. -
kernel_cat()
: Uses the categorical kernel. Here,x1
andx2
must be integer vectors (integers denoting different categories). Returns a binary matrix. -
kernel_varmask()
: Computes variance mask multiplier matrix.NaN
's inx1
andx2
will be replaced by 0. -
kernel_beta()
: Computes the heterogeneity multiplier matrix. NOTE:idx_expand
needs to be given so thatidx_expand[j]-1
tells the index of the beta parameter that should be used for thej
th observation. If observationj
doesn't correspond to any beta parameter, thenidx_expand[j]
should be 1.