# Handling negative variances on the derivative of Gaussian processes

The variance of the derivative of a Gaussian process, $$f$$, is given by (9.1):

$$Var(\frac{\partial f}{\partial x}) =\frac {\partial ^2 k(x,x)}{\partial x^2},$$

where $$k(·, ·)$$ is both a positive-definite quantity and the covariance function of $$f$$. But when evaluating the error corresponding to $$\frac{\partial f}{\partial x}$$, we observe that it is not necessarily positive everywhere. Therefore, is the above definition for $$Var(\frac{\partial f}{\partial x})$$ actually correct? Is it valid to simply take the absolute value of this quantity when computing the error or should this variance be handled differently?

As a simple case, if we consider a modified squared exponential kernel centered at $$x_a$$ and $$x_b$$, then $$k(x_i,x_j) = \exp(-(x_i-x_a)^2 - (x_j-x_b)^2)$$. This is positive definite. But $$\frac {\partial k(x_i,x_j)}{\partial x_i} = -2(x_i - x_a) k(x_i, x_j)$$ and $$\frac {\partial k(x_i,x_j)}{\partial x_i \partial x_j} = 4(x_i - x_a)(x_j - x_b) k(x_i, x_j)$$, which can both possibly be negative. Therefore, is (9.1) by itself a valid covariance function? To obtain the variance, is taking the absolute value of values along the diagonal of the covariance matrix appropriate?

• If you're going to ask the same question simultaneously on two different forums, you should give the associated link: stats.stackexchange.com/questions/402317/…. Otherwise you can be wasting folks' time if hints or answers appear on the other site. – JimB Apr 11 at 21:41