The SPDE approach proposed by Lindgren, Rue, and Lindström (2011) provides a powerful link between continuous Gaussian Fields (GFs) and discrete Gaussian Markov Random Fields (GMRFs). The key to this approach is the parameter mapping that connects the SPDE parameters to the interpretable parameters of the Matèrn covariance function.
The SPDE is given by:
\[ (\kappa^2 - \Delta)^{\alpha/2}(\tau \xi(s)) = W(s), \tag{1} \]
And its stationary solution has the Matèrn covariance function:
\[ \text{Cov}(\xi(s_i), \xi(s_j)) = \frac{\sigma^2}{\Gamma(\lambda) 2^{\lambda-1}} (\kappa \|s_i - s_j\|)^\lambda K_\lambda(\kappa \|s_i - s_j\|), \tag{2} \]
The link between the SPDE in Eq. (1) and the Matèrn parameters is given by the following equations:
\[ \begin{cases} \lambda = \alpha - \frac{d}{2} \\[1.2em] \sigma^2 = \frac{\Gamma(\lambda)}{\Gamma(\alpha) (4\pi)^{d/2} \kappa^{2\lambda} \tau^2} \end{cases} \]
For the case of \(s \in \mathbb{R}^2\) (\(d = 2\)), this simplifies to:
\[ \begin{cases} \lambda = \alpha - 1 \\[1.2em] \sigma^2 = \frac{\Gamma(\lambda)}{\Gamma(\alpha) (4\pi) \kappa^{2\lambda} \tau^2} \end{cases} \]
In this document, we explain the meaning of each parameter, derive the mapping, and show how to use it in practice.
The SPDE in Eq. (1) uses three parameters:
| Parameter | Symbol | Role | Interpretation |
|---|---|---|---|
| Fractional power | \(\alpha\) | Controls smoothness | Higher \(\alpha\) = smoother field |
| Scale parameter | \(\kappa\) | Controls correlation range | Larger \(\kappa\) = faster decay |
| Precision scaling | \(\tau\) | Controls variance | Larger \(\tau\) = smaller variance |
These parameters are convenient for mathematical operations such as:
The Matèrn covariance in Eq. (2) uses three parameters:
| Parameter | Symbol | Role | Interpretation |
|---|---|---|---|
| Smoothness | \(\lambda\) (or \(\nu\)) | Controls differentiability | \(\lambda = 0.5\):
Exponential (rough) \(\lambda = 1\): Once differentiable \(\lambda \to \infty\): Infinitely smooth |
| Scale parameter | \(\kappa\) | Controls correlation range | Same as in SPDE |
| Marginal variance | \(\sigma^2\) | Controls amplitude | \(\text{Var}(\xi(s)) = \sigma^2\) |
These parameters are convenient for statistical interpretation:
This arises from the Fourier transform relationship. The Matèrn spectral density has the form:
\[ f(\omega) \propto \frac{1}{(\kappa^2 + \|\omega\|^2)^{\lambda + d/2}} \]
While the SPDE spectral density has:
\[ f(\omega) \propto \frac{1}{(\kappa^2 + \|\omega\|^2)^{\alpha}} \]
For these to match exactly, we must have:
\[ \alpha = \lambda + \frac{d}{2} \]
Rearranging gives:
\[ \lambda = \alpha - \frac{d}{2} \]
| \(\lambda\) | Differentiability | Shape of Covariance | Example Process |
|---|---|---|---|
| 0.5 | Not differentiable | Exponential decay | Rough, fractal-like surfaces |
| 1.0 | Once differentiable | Smooth at origin | Typical environmental data |
| 1.5 | Twice differentiable | Very smooth at origin | Smooth physical fields |
| \(\to \infty\) | Infinitely differentiable | Gaussian covariance | Extremely smooth processes |
The marginal variance \(\sigma^2\) is the integral of the spectral density over all frequencies:
\[ \sigma^2 = \int_{\mathbb{R}^d} f(\omega) d\omega \]
From the SPDE solution, the spectral density is:
\[ f(\omega) = \frac{1}{\tau^2} \frac{1}{(\kappa^2 + \|\omega\|^2)^\alpha} \]
Therefore:
\[ \sigma^2 = \frac{1}{\tau^2} \int_{\mathbb{R}^d} \frac{1}{(\kappa^2 + \|\omega\|^2)^\alpha} d\omega \]
The integral \(\int_{\mathbb{R}^d} \frac{1}{(\kappa^2 + \|\omega\|^2)^\alpha} d\omega\) can be evaluated analytically. In \(d\)-dimensions, it equals:
\[ \int_{\mathbb{R}^d} \frac{1}{(\kappa^2 + \|\omega\|^2)^\alpha} d\omega = \frac{\Gamma(\alpha - d/2)}{\Gamma(\alpha)} \frac{\pi^{d/2}}{\kappa^{2\alpha - d}} \]
Using \(\lambda = \alpha - d/2\), we get:
\[ \sigma^2 = \frac{1}{\tau^2} \cdot \frac{\Gamma(\lambda)}{\Gamma(\alpha)} \frac{\pi^{d/2}}{\kappa^{2\lambda}} \]
Rearranging:
\[ \sigma^2 = \frac{\Gamma(\lambda)}{\Gamma(\alpha) \pi^{d/2} \kappa^{2\lambda} \tau^2} \]
In the Lindgren et al. (2011) paper, they use a specific Fourier transform convention that introduces a factor of \(4\):
\[ \sigma^2 = \frac{\Gamma(\lambda)}{\Gamma(\alpha) (4\pi)^{d/2} \kappa^{2\lambda} \tau^2} \]
The factor \(4\) comes from different normalization conventions for the Fourier transform. Different authors use different constants (\(2\pi\), \(4\pi\), etc.), but the key relationships remain the same:
| Relationship | Interpretation |
|---|---|
| \(\sigma^2 \propto 1/\tau^2\) | Larger precision \(\tau\) = smaller variance |
| \(\sigma^2 \propto 1/\kappa^{2\lambda}\) | Larger scale \(\kappa\) = smaller variance (for fixed \(\tau\)) |
| \(\Gamma\) ratios | Ensure correct normalization as \(\lambda\) changes |
In most spatial statistics applications, we work in \(s \in \mathbb{R}^2\) (2D space). For this special case, the mapping simplifies:
\[ \begin{cases} \lambda = \alpha - 1 \\[1.2em] \sigma^2 = \frac{\Gamma(\lambda)}{\Gamma(\alpha) (4\pi) \kappa^{2\lambda} \tau^2} \end{cases} \]
For the field to be valid (positive variance and finite smoothness), we require:
\[ \lambda > 0 \Rightarrow \alpha > 1 \]
This means:
Goal: Create a field that is once differentiable (smooth enough for most environmental applications).
Parameters: - \(d = 2\), \(\lambda = 1\) - \(\alpha = \lambda + d/2 = 1 + 1 = 2\) - \(\kappa = 0.5\) (moderate correlation range) - \(\tau = 1\) (moderate precision)
Variance Calculation:
\[ \sigma^2 = \frac{\Gamma(1)}{\Gamma(2) (4\pi) (0.5)^{2(1)} (1)^2} \]
Since \(\Gamma(1) = 1\) and \(\Gamma(2) = 1\):
\[ \sigma^2 = \frac{1}{4\pi \cdot 0.25} = \frac{1}{\pi} \approx 0.318 \]
Goal: Create a rough field with Exponential covariance (not differentiable).
Parameters: - \(d = 2\), \(\lambda = 0.5\) - \(\alpha = \lambda + 1 = 1.5\) - \(\kappa = 0.5\) - \(\tau = 1\)
Variance Calculation:
\[ \sigma^2 = \frac{\Gamma(0.5)}{\Gamma(1.5) (4\pi) (0.5)^{2(0.5)} (1)^2} \]
Since \(\Gamma(0.5) = \sqrt{\pi}\) and \(\Gamma(1.5) = \sqrt{\pi}/2\):
\[ \sigma^2 = \frac{\sqrt{\pi}}{(\sqrt{\pi}/2) \cdot (4\pi) \cdot 0.5} = \frac{2}{4\pi \cdot 0.5} = \frac{2}{2\pi} = \frac{1}{\pi} \approx 0.318 \]
Goal: Create a very smooth field (twice differentiable).
Parameters: - \(d = 2\), \(\lambda = 2\) - \(\alpha = \lambda + 1 = 3\) - \(\kappa = 0.5\) - \(\tau = 1\)
Variance Calculation:
\[ \sigma^2 = \frac{\Gamma(2)}{\Gamma(3) (4\pi) (0.5)^{2(2)} (1)^2} \]
Since \(\Gamma(2) = 1\) and \(\Gamma(3) = 2\):
\[ \sigma^2 = \frac{1}{2 \cdot 4\pi \cdot (0.5)^4} = \frac{1}{8\pi \cdot 0.0625} = \frac{1}{0.5\pi} = \frac{2}{\pi} \approx 0.637 \]
Notice that increasing \(\lambda\) (smoothness) while keeping \(\kappa\) and \(\tau\) fixed increases the variance.
The Helmholtz operator (also called the Helmholtz equation operator) is a fundamental differential operator that appears in the SPDE approach. It is defined as:
\[ (\kappa^2 - \Delta) \]
where: - \(\kappa^2\) is a positive constant (the square of the scale parameter) - \(\Delta\) is the Laplacian operator
The Laplacian is the sum of all unmixed second partial derivatives:
In 2D space (\(s = (x, y)\)): \[ \Delta f(s) = \frac{\partial^2 f}{\partial x^2} + \frac{\partial^2 f}{\partial y^2} \]
In 3D space (\(s = (x, y, z)\)): \[ \Delta f(s) = \frac{\partial^2 f}{\partial x^2} + \frac{\partial^2 f}{\partial y^2} + \frac{\partial^2 f}{\partial z^2} \]
The Laplacian measures the local curvature or “bumpiness” of a function:
At a local peak (maximum): The function curves downward in all directions. The second derivatives are negative, so \(\Delta f < 0\).
At a local valley (minimum): The function curves upward in all directions. The second derivatives are positive, so \(\Delta f > 0\).
At a flat region: The function is constant, so \(\Delta f = 0\).
At a saddle point: The function curves up in one direction and down in another, so \(\Delta f\) can be positive, negative, or zero depending on the balance.
Imagine a rubber sheet: - High \(\Delta\): The sheet has sharp bumps or dips (high curvature) - Low \(\Delta\): The sheet is smooth and flat (low curvature) - Zero \(\Delta\): The sheet is perfectly flat or has no curvature (harmonic)
The term \(\kappa^2 f(s)\) multiplies the function by a positive constant. This term:
When applied to a function \(f(s)\):
\[ (\kappa^2 - \Delta)f(s) = \kappa^2 f(s) - \Delta f(s) \]
The Helmholtz operator combines two effects:
Together, they create a “stiffness” operator:
The true power of the Helmholtz operator becomes clear in the frequency domain. Using Fourier transforms:
\[ \mathcal{F}\{(\kappa^2 - \Delta)f(s)\} = (\kappa^2 + \|\omega\|^2)\hat{f}(\omega) \]
where: - \(\omega\) is the frequency vector - \(\|\omega\|\) is the magnitude of the frequency - \(\hat{f}(\omega)\) is the Fourier transform of \(f\)
The operator multiplies each frequency component by the scalar \((\kappa^2 + \|\omega\|^2)\):
Low frequencies (small \(\|\omega\|\)): The multiplication factor is approximately \(\kappa^2\). These smooth, long-range variations are preserved.
High frequencies (large \(\|\omega\|\)): The multiplication factor is approximately \(\|\omega\|^2\). These rapid, short-range variations are amplified.
The Helmholtz operator only involves local derivatives. This means: - It only depends on the function value at a point and its immediate neighbors - It can be discretized using sparse matrices - It enables efficient computation with the Finite Element Method (FEM)
In the SPDE approach, the Helmholtz operator is raised to a fractional power:
\[ (\kappa^2 - \Delta)^{\alpha/2} \]
The spectral representation becomes:
\[ (\kappa^2 + \|\omega\|^2)^{\alpha/2} \]
This directly leads to the Matèrn spectral density:
\[ f(\omega) \propto \frac{1}{(\kappa^2 + \|\omega\|^2)^{\nu + d/2}} \]
where \(\alpha = \nu + d/2\).
The Helmholtz operator acts as a spatial filter:
In 1D, the Helmholtz operator becomes:
\[ (\kappa^2 - \frac{d^2}{dx^2})f(x) \]
Applied to \(f(x) = \sin(kx)\):
\[ (\kappa^2 - \frac{d^2}{dx^2})\sin(kx) = (\kappa^2 + k^2)\sin(kx) \]
Consider \(f(x,y) = e^{-(x^2 + y^2)}\) at the origin \((0,0)\):
Consider \(f(x,y) = -e^{-(x^2 + y^2)}\) at the origin \((0,0)\):
The Helmholtz operator appears in many physical contexts:
The Helmholtz equation arises from the wave equation: \[ \nabla^2 u + k^2 u = 0 \] This is the same as \((\Delta + k^2)u = 0\) or \((\kappa^2 - \Delta)u = 0\) with \(\kappa = ik\).
The heat equation \(\frac{\partial u}{\partial t} = \alpha \Delta u\) has solutions that decay as \(e^{-\alpha \kappa^2 t}\), where \(\kappa\) determines the spatial scale.
In solid mechanics, the operator \(\kappa^2 - \Delta\) describes the stiffness of a material under deformation.
| Aspect | Description |
|---|---|
| Definition | \((\kappa^2 - \Delta)\) |
| Components | Zero-order term \(\kappa^2\) + second-order term \(-\Delta\) |
| What it measures | Local curvature plus damping |
| Frequency domain | Multiplication by \((\kappa^2 + \|\omega\|^2)\) |
| Effect on smooth fields | Minimal amplification |
| Effect on rough fields | Strong amplification |
| Role in SPDE | Determines correlation range and smoothness |
| Computational advantage | Local operator → sparse matrices |
# Create a simple 1D function
x <- seq(-5, 5, length.out = 100)
f <- exp(-x^2/2) # Gaussian bump
# Compute derivatives numerically
dx <- x[2] - x[1]
df2 <- c(0, diff(diff(f)/dx)/dx, 0) # Second derivative
# Apply Helmholtz operator for different kappa values
kappa_vals <- c(0.5, 1, 2)
colors <- c("blue", "red", "green")
# Plot
plot(x, f, type = "l", lwd = 2, col = "black",
ylim = c(-1, 2),
main = "Effect of Helmholtz Operator on a Gaussian Bump",
xlab = "x", ylab = "Value")
legend("topright", legend = c("Original", "kappa=0.5", "kappa=1", "kappa=2"),
col = c("black", colors), lwd = 2)
for (i in 1:length(kappa_vals)) {
kappa <- kappa_vals[i]
helmholtz <- kappa^2 * f - df2
lines(x, helmholtz, col = colors[i], lwd = 2, lty = 2)
}
grid()
This plot shows how the Helmholtz operator transforms a smooth Gaussian bump for different values of \(\kappa\). Notice that: - Larger \(\kappa\) values produce a larger overall magnitude - The operator amplifies the peak and creates negative regions around it - The shape reflects the balance between the damping term (\(\kappa^2 f\)) and the curvature term (\(-\Delta f\))
Purpose: Controls the overall precision (inverse variance) of the process. A larger \(\tau\) means smaller variance.
As explained in detail above, this is the Helmholtz operator. Applied to a function \(f(s)\):
\[ (\kappa^2 - \Delta)f(s) = \kappa^2 f(s) - \Delta f(s) \]
Physical Intuition: This operator measures the “stiffness” of a rubber sheet, penalizing sharp local wiggles while rewarding smooth slopes.
This is the most abstract part. The exponent \(\alpha/2\) applies a fractional power of the Helmholtz operator, which is defined using Fourier transforms:
In the frequency domain, the operator \((\kappa^2 - \Delta)\) becomes multiplication by the scalar \((\kappa^2 + \|\omega\|^2)\).
Raising to the power \(\alpha/2\) means:
\[ (\kappa^2 - \Delta)^{\alpha/2} f(s) = \text{InverseFT}\left\{(\kappa^2 + \|\omega\|^2)^{\alpha/2} \cdot \hat{f}(\omega)\right\} \]
What does the fractional power do?
The Crucial Trick: By choosing a fractional \(\alpha\), we can achieve any desired level of smoothness for the field, not just integer derivatives.
When the compound operator acts on \(\tau \xi(s)\), it outputs a new spatial function representing the residual forcing or local innovation:
The SPDE states that this output must equal spatial white noise \(W(s)\):
\[ (\kappa^2 - \Delta)^{\alpha/2}(\tau \xi(s)) = W(s) \]
Since white noise has no spatial correlation, the equation means: “Apply this differential filter to the field to strip away all spatial structure; the residuals must be completely independent in space.”
If you are familiar with time-series, this equation is the spatial equivalent of an Autoregressive (AR) model:
The operator \((\kappa^2 - \Delta)^{\alpha/2}\) acts like the polynomial \((1 - \phi B)^p\). It is a differential filter that transforms a correlated spatial field \(\xi(s)\) into uncorrelated white noise \(W(s)\). The parameters \(\kappa\), \(\tau\), and \(\alpha\) control the shape and strength of this filter, ultimately determining the correlation range, variance, and smoothness of the resulting field.
Equation (2) describes the covariance between two points in the spatial field:
\[ \text{Cov}(\xi(s_i), \xi(s_j)) = \frac{\sigma^2}{\Gamma(\lambda) 2^{\lambda-1}} (\kappa \|s_i - s_j\|)^\lambda K_\lambda(\kappa \|s_i - s_j\|) \]
Key Property: The covariance depends only on the distance between the points (stationarity and isotropy). The correlation starts at 1 at distance 0, decays to 0 as distance goes to infinity, and the rate of decay is governed by \(\kappa\) and \(\lambda\).
The Matèrn covariance has a famous spectral density (its Fourier transform):
\[ f(\omega) \propto \frac{1}{(\kappa^2 + \|\omega\|^2)^{\nu + d/2}} \]
This is famous because it has three extraordinary properties:
Power-Law Tails: For high frequencies, it decays as \(1/\|\omega\|^{2\nu+d}\), which matches the fractal behavior of many real-world spatial phenomena.
Rational Form: It is a rational function of \(\|\omega\|^2\), making it the spatial equivalent of Autoregressive (AR) processes in time-series analysis. This is the key that allows connection to the SPDE.
Continuity in Smoothness: It spans the gap between the Exponential covariance (\(\nu = 0.5\)) and the Gaussian covariance (\(\nu \to \infty\)), covering all levels of smoothness.
Apply the Fourier transform to both sides of Equation (1):
\[ \mathcal{F}\{(\kappa^2 - \Delta)^{\alpha/2}(\tau \xi(s))\} = \mathcal{F}\{W(s)\} \]
The Fourier transform of the Laplacian is: \(\mathcal{F}\{\Delta \xi(s)\} = -\|\omega\|^2 \hat{\xi}(\omega)\).
Therefore, the Fourier transform of the operator is: \((\kappa^2 + \|\omega\|^2)^{\alpha/2} \hat{\xi}(\omega)\).
The Fourier transform of white noise \(W(s)\) is a constant (usually 1).
Thus:
\[ (\kappa^2 + \|\omega\|^2)^{\alpha/2} \tau \hat{\xi}(\omega) = 1 \]
Solving for \(\hat{\xi}(\omega)\):
\[ \hat{\xi}(\omega) = \frac{1}{\tau} \frac{1}{(\kappa^2 + \|\omega\|^2)^{\alpha/2}} \]
The spectral density \(f(\omega)\) (the squared magnitude of the Fourier coefficients) is:
\[ f(\omega) = \frac{1}{\tau^2} \frac{1}{(\kappa^2 + \|\omega\|^2)^\alpha} \]
The classic Matèrn spectral density is:
\[ f(\omega) = \frac{\sigma^2 2^d \pi^{d/2} \Gamma(\nu + d/2) \kappa^{2\nu}}{\Gamma(\nu)} \cdot \frac{1}{(\kappa^2 + \|\omega\|^2)^{\nu + d/2}} \]
For the SPDE solution to match this, we must set:
\[ \alpha = \nu + \frac{d}{2} \]
Substituting this into the SPDE spectrum:
\[ \hat{\xi}(\omega) = \frac{1}{(\kappa^2 + \|\omega\|^2)^{\nu/2 + d/4}} \]
And the spectral density becomes:
\[ f(\omega) = \frac{1}{(\kappa^2 + \|\omega\|^2)^{\nu + d/2}} \]
This perfectly matches the denominator of the classic Matèrn spectrum.
By the Wiener-Khinchin theorem, the covariance is the inverse Fourier transform of the spectral density:
\[ C(h) = \frac{1}{(2\pi)^d} \int_{\mathbb{R}^d} \frac{1}{(\kappa^2 + \|\omega\|^2)^{\nu + d/2}} e^{i\omega \cdot h} d\omega \]
where \(h = \|s_i - s_j\|\) and \(\omega\) is the frequency vector.
Because the spectrum is radially symmetric, the \(d\)-dimensional Fourier transform reduces to a 1D Hankel transform. In hyperspherical coordinates:
\[ C(h) = \frac{1}{(2\pi)^{d/2}} \int_0^\infty \frac{r^{d-1}}{(\kappa^2 + r^2)^{\nu + d/2}} (rh)^{1-d/2} J_{d/2-1}(rh) dr \]
where \(r = \|\omega\|\) and \(J\) is the Bessel function of the first kind.
This integral is a known form of the Hankel transform of a Bessel potential. The solution is:
\[ \int_0^\infty \frac{r^{d-1}}{(\kappa^2 + r^2)^{\nu + d/2}} (rh)^{1-d/2} J_{d/2-1}(rh) dr = \frac{\pi^{d/2} 2^{1-\nu}}{\Gamma(\nu)} h^\nu \kappa^{d/2-\nu} K_\nu(\kappa h) \]
where \(K_\nu\) is the modified Bessel function of the second kind.
Plugging this back into the covariance integral:
\[ C(h) = \frac{1}{(2\pi)^{d/2}} \cdot \frac{\pi^{d/2} 2^{1-\nu}}{\Gamma(\nu)} h^\nu \kappa^{d/2-\nu} K_\nu(\kappa h) \]
Simplify the constants:
\[ C(h) = \frac{2^{1-\nu-d/2}}{\Gamma(\nu)} \kappa^{d/2-\nu} h^\nu K_\nu(\kappa h) \]
To get the form with \((\kappa h)^\nu\), multiply and divide by \(\kappa^\nu\):
\[ C(h) = \frac{2^{1-\nu-d/2}}{\Gamma(\nu)} \kappa^{d/2-2\nu} (\kappa h)^\nu K_\nu(\kappa h) \]
Define the marginal variance \(\sigma^2\) such that:
\[ \frac{2^{1-\nu-d/2}}{\Gamma(\nu)} \kappa^{d/2-2\nu} = \frac{\sigma^2}{\Gamma(\nu) 2^{\nu-1}} \]
Then:
\[ C(h) = \frac{\sigma^2}{\Gamma(\nu) 2^{\nu-1}} (\kappa h)^\nu K_\nu(\kappa h) \]
Replacing \(\nu\) with \(\lambda\) and writing \(h = \|s_i - s_j\|\), we obtain exactly Equation (2):
\[ \text{Cov}(\xi(s_i), \xi(s_j)) = \frac{\sigma^2}{\Gamma(\lambda) 2^{\lambda-1}} (\kappa \|s_i - s_j\|)^\lambda K_\lambda(\kappa \|s_i - s_j\|) \]
# Function to compute Matèrn covariance
matern_cov <- function(h, kappa, nu, sigma2 = 1) {
if (h == 0) {
return(sigma2)
} else {
Kv <- besselK(kappa * h, nu)
return(sigma2 / (gamma(nu) * 2^(nu - 1)) * (kappa * h)^nu * Kv)
}
}
# Create distance grid
h_vals <- seq(0, 10, length.out = 200)
# Define different alpha values for d=2
# alpha = nu + 1
alpha_vals <- c(1.5, 2, 2.5, 3)
nu_vals <- alpha_vals - 1 # lambda
# Parameters
kappa <- 1
tau <- 1
# Compute sigma^2 for each alpha
sigma2_vals <- sapply(nu_vals, function(nu) {
alpha <- nu + 1
gamma(nu) / (gamma(alpha) * (4*pi) * kappa^(2*nu) * tau^2)
})
# Compute covariance for each combination
results <- data.frame()
for (i in 1:length(alpha_vals)) {
temp <- data.frame(
h = h_vals,
covariance = sapply(h_vals, matern_cov,
kappa = kappa,
nu = nu_vals[i],
sigma2 = sigma2_vals[i]),
alpha = paste("alpha =", alpha_vals[i]),
nu = paste("nu =", round(nu_vals[i], 2))
)
results <- rbind(results, temp)
}
# Plot
ggplot(results, aes(x = h, y = covariance, color = alpha, group = alpha)) +
geom_line(size = 1.2) +
labs(
title = "Effect of Alpha (Smoothness) on the Covariance Function",
subtitle = "d = 2, kappa = 1, tau = 1",
x = "Distance (h)",
y = "Covariance C(h)",
color = "Alpha"
) +
theme_minimal() +
theme(
plot.title = element_text(hjust = 0.5, size = 14, face = "bold"),
plot.subtitle = element_text(hjust = 0.5, size = 12),
legend.position = "bottom"
) +
scale_color_viridis(discrete = TRUE)