ll_xycholv: Compute the log-likelihood of a model

Description Usage Arguments Value References Examples

View source: R/ll_xycholv.R

Description

ll_xycholv computes the log-likelihood of multivariate normal data using components typically found in a geolm. For ploglik_xycholv, cholv is the cholesky decomposition of the covariance matrix for the observed data after dividing the matrix by the (estimated) psill. See the examples below. Depending on parameter choices, the function can return the log-likelihood, the restricted log-likelihood, -2 times the log-likelihood or restricted log-likelihood, or the estimated partial sill for both a maximum likelihood and restricted maximum likelihood setting. This is intended to be an internal function, so minimal error checking is done.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
ploglik_xycholv(
  x,
  y,
  cholv,
  mu = NULL,
  reml = FALSE,
  minus2 = TRUE,
  return_ll = TRUE
)

ll_xycholv(
  x,
  y,
  cholv,
  mu = NULL,
  reml = FALSE,
  minus2 = TRUE,
  return_ll = TRUE
)

Arguments

x

The matrix of covariates.

y

The vector of observed responses.

cholv

The cholesky decomposition of the covariance matrix of y (or of that matrix divided by psill for loglik_xycholv.

mu

A single numeric value indicating the assumed mean of the underlying process.

reml

A logical value. Should the Restricted Maximum Likelihood be returned. The default is FALSE.

minus2

A logical value. Should -2 times the log-likelihood be returned. The default is TRUE.

return_ll

A logical value. Should the log-liklihood be returned? Default is TRUE. If FALSE, the estimated partial sill is returned.

Value

A likelihood value, -2 times the likelihood value, or the estimated partial sill, depending on the user's argument choices.

References

Statistical Methods for Spatial Data Analysis. Oliver Schabenberger and Carol A. Gotway (Chapman & Hall/CRC Press) 2005. pp. 259-263

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
y = rnorm(10)
x = matrix(rep(1, length(y)))
coords = matrix(runif(length(y) * 2), ncol = 2)
d = as.matrix(dist(coords))
pv = exp(-d/3) + 0.1 * diag(length(y))
est_psill = ploglik_xycholv(x, y, chol(pv), return_ll = FALSE)
v = pv * est_psill
# same result
ploglik_xycholv(x, y, chol(pv), minus2 = FALSE)
ll_xycholv(x, y, chol(v), minus2 = FALSE)

gear documentation built on April 14, 2020, 5:12 p.m.

Related to ll_xycholv in gear...