spGaussLogLik: Density evaluation for a spatial Gaussian Copula

Description Usage Arguments Details Value Author(s) Examples

View source: R/spatialGaussianCopula.R

Description

Evaluates the density for a spatial Gaussian Copula.

Usage

1
spGaussLogLik(corFun, neigh, dataLocs, log = T)

Arguments

corFun

A valid correlogram (i.e. producing a valid correlation matrix; e.g. based on a variogram).

neigh

A neighbourhood object to be evaluated.

dataLocs

The same Spatial object used to generate neigh.

log

Should the log-likelihood be returned?

Details

Evaluates the density for all neighbourhoods in neigh and returns the (log)-likelihood.

Value

The (log)-likelihood value.

Author(s)

Benedikt Graeler

Examples

 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)

BenGraeler/spcopula documentation built on Nov. 20, 2020, 4:07 p.m.