This is an old version, view current version.

5.12 Covariance Functions

5.12.1 Exponentiated quadratic covariance function

The exponentiated quadratic kernel defines the covariance between f(xi) and f(xj) where f:RDR as a function of the squared Euclidian distance between xiRD and xjRD: cov(f(xi),f(xj))=k(xi,xj)=α2exp(12ρ2Dd=1(xi,dxj,d)2) with α and ρ constrained to be positive.

There are two variants of the exponentiated quadratic covariance function in Stan. One builds a covariance matrix, KRN×N for x1,,xN, where Ki,j=k(xi,xj), which is necessarily symmetric and positive semidefinite by construction. There is a second variant of the exponentiated quadratic covariance function that builds a KRN×M covariance matrix for x1,,xN and x1,,xM, where xiRD and xiRD and Ki,j=k(xi,xj).

matrix cov_exp_quad(row_vectors x, real alpha, real rho)
The covariance matrix with an exponentiated quadratic kernel of x.

matrix cov_exp_quad(vectors x, real alpha, real rho)
The covariance matrix with an exponentiated quadratic kernel of x.

matrix cov_exp_quad(real[] x, real alpha, real rho)
The covariance matrix with an exponentiated quadratic kernel of x.

matrix cov_exp_quad(row_vectors x1, row_vectors x2, real alpha, real rho)
The covariance matrix with an exponentiated quadratic kernel of x1 and x2.

matrix cov_exp_quad(vectors x1, vectors x2, real alpha, real rho)
The covariance matrix with an exponentiated quadratic kernel of x1 and x2.

matrix cov_exp_quad(real[] x1, real[] x2, real alpha, real rho)
The covariance matrix with an exponentiated quadratic kernel of x1 and x2.