Learn R Programming

geoRglm (version 0.9-16)

glsm.krige: Prediction for a Generalised Linear Spatial Model

Description

This function makes prediction for a generalised linear spatial model, using an output object from glsm.mcmc

Usage

glsm.krige(mcmc.output, locations, borders, trend.l,
micro.scale=NULL, dist.epsilon= 1e-10, output)

Arguments

mcmc.output

an output file from the function glsm.mcmc.

locations

an \(N \times 2\) matrix or data frame, or a list with the 2-D coordinates of the \(N\) prediction locations.

borders

optional. If a two column matrix defining a polygon is provided the prediction is performed only at locations inside this polygon.

trend.l

specifies the trend (covariate) values at prediction locations. It must be of the same type as for trend.

micro.scale

micro-scale variance. If specified, the nugget is divided into 2 terms: micro-scale variance and measurement error. This has effect on prediction, since the the target for prediction is inverse link function of the ``signal'' part of \(S\) (without the measurement error part of the nugget). The default is micro.scale = nugget.

dist.epsilon

a numeric value. Locations which are separated by a distance less than this value are considered co-located.

output

parameters for controlling the output. It can take an output from output.glm.control or a list with elements as for the arguments in output.glm.control. See documentation for output.glm.control.

Value

A list with the following components:

predict

a vector with predicted values.

krige.var

a vector with predicted variances.

mcmc.error

estimated Monte Carlo errors on the predicted values.

simulations

an \(ni \times n.sim\) matrix where \(ni\) is the number of prediction locations and \(n.sim\) is the number of MCMC simulations. Each column corresponds to a conditional simulation of the predictive distribution \(g^{-1}(S^{*})\). Only returned if sim.predict = TRUE.

message

messages about the type of prediction performed.

call

the function call.

Details

This function makes prediction for fixed parameters using an output object from glsm.mcmc containing the model specification and simulations from the posterior values of \(S\).

The prediction consist of performing trans-Gaussian kriging on each of the simulated \(g^{-1}(S)\)-``datasets'' from the conditional distribution. Afterwards the predictor is obtained by taking the mean of prediction means, and the prediction variance is obtained by taking the mean of the prediction variances plus the variance of the prediction means. The trans-Gaussian kriging is done by calling an internal function which is an extension of krige.conv allowing for more than one ``data set'', and using a second order Taylor approximation of the inverse link function \(g^{-1}\).

See Also

glsm.mcmc for MCMC simulation in a generalised linear spatial model.

Examples

Run this code
# NOT RUN {
if(!exists(".Random.seed", envir=.GlobalEnv, inherits = FALSE)) set.seed(1234)
data(b50)
mcmc.5 <- mcmc.control(S.scale = 0.6, thin=1)
model.5 <- list(cov.pars=c(0.6, 0.1), beta=1, family="binomial")
outmcmc.5 <- glsm.mcmc(b50, model= model.5, mcmc.input = mcmc.5)
test2 <- glsm.krige(outmcmc.5, locations=matrix(c(0.15,0.15,0.005,0.05),2,2))
image(test2)
test3 <- glsm.krige(outmcmc.5, locations=matrix(c(0.15,0.15,0.005,0.05),2,2),
                     output=output.glm.control(sim.predict=TRUE, quantile=FALSE))
# }

Run the code above in your browser using DataLab