Learn R Programming

geoR (version 1.2-5)

loglik.GRF: Log-Likelihood for a Gaussian Random Field

Description

This function computes the value of the log-likelihood for a realisation of a Gaussian random field.

Usage

loglik.GRF(geodata, coords = geodata$coords, data = geodata$data,
           cov.model = "exp", cov.pars, nugget = 0, kappa = 0.5,
           lambda = 1, psiR = 1, psiA = 0,
           trend = "cte", method.lik = "ML", compute.dists = TRUE,
           realisations = NULL)

Arguments

geodata
a list containing elements coords and data as described next. Typically an object of the class "geodata" - a geoR data-set. If not provided the arguments coords and data
coords
an $n \times 2$ matrix, each row containing Euclidean coordinates of the n data locations. By default it takes the element coords of the argument geodata.
data
a vector with data values. By default it takes the element data of the argument geodata.
cov.model
a string specifying the model for the correlation function. For further details see documentation for cov.spatial.
cov.pars
a vector with 2 elements with values of the covariance parameters $\sigma^2$ (partial sill) and $\phi$ (range parameter).
nugget
value of the nugget parameter. Defaults to $0$.
kappa
value of the smoothness parameter. Defaults to $0.5$.
lambda
value of the Box-Cox tranformation parameter. Defaults to $1$.
psiR
value of the anisotropy ratio parameter. Defaults to $1$, corresponding to isotropy.
psiA
value (in radians) of the anisotropy rotation parameter. Defaults to zero.
trend
specifies the mean part of the model. The options are: "cte" (constant mean), "1st" (a first degree polynomial on the coordinates), "2nd" (a second degree polynomial on the coordinates), or a form
method.lik
options are "ML" for likelihood and "REML" for restricted likelihood. Defaults to "ML".
compute.dists
for internal use with other function. Don't change the default unless you know what you are doing.
realisations
optional. A vector indicating replication number for each data. For more details see as.geodata.

Value

  • The numerical value of the log-likelihood.

Details

The expression log-likelihood is: $$l(\theta) = -\frac{n}{2} \log (2\pi) - \frac{1}{2} \log |\Sigma| - \frac{1}{2} (y - F\beta)' \Sigma^{-1} (y - F\beta),$$ where $n$ is the size of the data vector $y$, $\beta$ is the mean (vector) parameter with dimention $p$, $\Sigma$ is the covariance matrix and $F$ is the matrix with the values of the covariates (a vector of $1$'s if the mean is constant.

The expression restricted log-likelihood is: $$rl(\theta) = -\frac{n-p}{2} \log (2\pi) + \frac{1}{2} \log |F' F| - \frac{1}{2} \log |\Sigma| - \frac{1}{2} \log |F' \Sigma F| - \frac{1}{2} (y - F\beta)' \Sigma^{-1} (y - F\beta).$$

References

Further information about geoR can be found at: http://www.maths.lancs.ac.uk/~ribeiro/geoR.

See Also

likfit for likelihood-based parameter estimation.

Examples

Run this code
if(is.R()) data(s100)
loglik.GRF(s100, cov.pars=c(0.8, .25), nugget=0.2)
loglik.GRF(s100, cov.pars=c(0.8, .25), nugget=0.2, met="RML")

Run the code above in your browser using DataLab