Description Usage Arguments Details Value Author(s) Examples
View source: R/spatialGaussianCopula.R
Evaluates the density for a spatial Gaussian Copula.
1 | spGaussLogLik(corFun, neigh, dataLocs, log = T)
|
corFun |
A valid correlogram (i.e. producing a valid correlation matrix; e.g. based on a variogram). |
neigh |
A |
dataLocs |
The same |
log |
Should the log-likelihood be returned? |
Evaluates the density for all neighbourhoods in neigh
and returns the (log)-likelihood.
The (log)-likelihood value.
Benedikt Graeler
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | library("spcopula")
# load data from the Meuse demo
data("spCopDemo")
# calculate the correlation function based on Kendall's tau
calcKTauPol <- fitCorFun(bins, degree=1)
# translate Kendall's tau correlation function into Gaussian Copula parameters
# using a linear variogram
meuseGaussCorFun <- function(h) {
res <- pmax(iTau(normalCopula(0), calcKTauPol(0))/658*(658-h),0)
res[h ==0] <- 1
return(res)
}
# get the neighbours
library("sp")
data("meuse")
coordinates(meuse) <- ~x+y
meuse$rtZinc <- rank(meuse$zinc)/(length(meuse)+1)
meuseNeigh <- getNeighbours(meuse, size=5L, var="rtZinc",
prediction=FALSE)
# calculate the log-likelihood
spGaussLogLik(meuseGaussCorFun, meuseNeigh, meuse)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.