predict.ramps: Prediction Method for georamps Model Fits

View source: R/predict.R

predict.rampsR Documentation

Prediction Method for georamps Model Fits

Description

Obtains prediction of main effects plus spatial variability from a georamps model fit.

Usage

   ## S3 method for class 'ramps'
predict(object, newdata, type = c("response", "spatial", "error", "random"), ...)

Arguments

object

object returned by georamps.

newdata

data frame containing covariate values for the main effect, unmeasured spatial coordinates, and (if applicable) spatial variance indices with which to predict.

type

character string specifying the type of spatial prediction to perform. The default value "response" provides spatial prediction which includes measurement error and non-spatial random effects; "spatial" excludes measurement error and non-spatial random effects from the prediction; "error" excludes non-spatial random effects; and "random" excludes measurement error.

...

some methods for this generic require additional arguments. None are used in this method.

Details

Prediction will be performed only at the coordinates in newdata that differ from those used in the initial georamps model fitting. In particular, overlapping coordinates will be excluded automatically in the prediction.

Value

'predict.ramps' object, inheriting from class 'matrix', of samples from the posterior predictive distribution. Labels for the samples at each new coordinate are supplied in the returned column names and MCMC iteration numbers in the row names. A matrix containing the new coordinates is supplied in the coords attribute of the object.

Author(s)

Brian Smith brian-j-smith@uiowa.edu

See Also

georamps plot.predict.ramps, window.predict.ramps,

Examples

## Prediction for georamps example results

## Not run: 
ct <- map("state", "connecticut", plot = FALSE)
lon <- seq(min(ct$x, na.rm = TRUE), max(ct$x, na.rm = TRUE), length = 20)
lat <- seq(min(ct$y, na.rm = TRUE), max(ct$y, na.rm = TRUE), length = 15)
grid <- expand.grid(lon, lat)

newsites <- data.frame(lon = grid[,1], lat = grid[,2],
                       measurement = 1)
NURE.pred <- predict(NURE.fit, newsites)

par(mfrow=c(2,1))
plot(NURE.pred, func = function(x) exp(mean(x)),
     database = "state", regions = "connecticut",
     resolution = c(200, 150), bw = 5,
     main = "Posterior Mean",
     legend.args = list(text = "ppm", side = 3, line = 1))
plot(NURE.pred, func = function(x) exp(sd(x)),
     database = "state", regions = "connecticut",
     resolution = c(200, 150), bw = 5,
     main = "Posterior Standard Deviation",
     legend.args = list(text = "ppm", side = 3, line = 1))

## End(Not run)

brian-j-smith/ramps documentation built on Feb. 2, 2023, 5:54 a.m.