Description Usage Arguments Value Examples

`nsCorr`

calculates a nonstationary correlation matrix for a
fixed set of locations, based on vectors of the unique anisotropy
parameters for each station. Since the correlation function uses a
spatially-varying Mahalanobis distance, this function requires coordinate-
specific distance matrices (see below). The function is coded as a
`nimbleFunction`

(see the `nimble`

package) but can also be
used as a regular R function.

1 | ```
nsCorr(dist1_sq, dist2_sq, dist12, Sigma11, Sigma22, Sigma12, nu, d)
``` |

`dist1_sq` |
N x N matrix; contains values of pairwise squared distances in the x-coordinate. |

`dist2_sq` |
N x N matrix; contains values of pairwise squared distances in the y-coordinate. |

`dist12` |
N x N matrix; contains values of pairwise signed cross-
distances between the x- and y-coordinates. The sign of each element is
important; see |

`Sigma11` |
Vector of length N; contains the 1-1 element of the anisotropy process for each station. |

`Sigma22` |
Vector of length N; contains the 2-2 element of the anisotropy process for each station. |

`Sigma12` |
Vector of length N; contains the 1-2 element of the anisotropy process for each station. |

`nu` |
Scalar; Matern smoothness parameter. |

`d` |
Scalar; dimension of the spatial coordinates. |

A correlation matrix for a fixed set of stations and fixed parameter values.

1 2 3 4 5 6 7 8 9 10 11 | ```
# Generate some coordinates and parameters
coords <- cbind(runif(100),runif(100))
Sigma11 <- rep(1, 100) # Identity anisotropy process
Sigma22 <- rep(1, 100)
Sigma12 <- rep(0, 100)
nu <- 2
# Calculate distances
dist_list <- nsDist(coords)
# Calculate the correlation matrix
corMat <- nsCorr(dist_list$dist1_sq, dist_list$dist2_sq, dist_list$dist12,
Sigma11, Sigma22, Sigma12, nu, ncol(coords))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.