Learn R Programming

fields (version 5.02)

predict.Krig: Evaluation of Krig spatial process estimate.

Description

Provides predictions from the Krig spatial process estimate at arbitrary points, new data (Y) or other values of the smoothing parameter (lambda) including a GCV estimate.

Usage

## S3 method for class 'Krig':
predict(
object, x = NULL, Z = NULL, drop.Z = FALSE, just.fixed
                 = FALSE, lambda = NA, df = NA, model = NA,
                 eval.correlation.model = TRUE, y = NULL, yM = NULL,
                 verbose = FALSE, ...)

Arguments

Value

Vector of predicted responses

Details

The main goal in this function is to reuse the Krig object to rapidly evaluate different estimates. Thus there is flexibility in changing the value of lambda and also the independent data without having to recompute the matrices associated with the Krig object. The reason this is possible is that most on the calculations depend on the observed locations not on lambda or the observed data.

See Also

Krig, predict.surface gcv.Krig

Examples

Run this code
Krig(ozone$x,ozone$y, theta=50) ->fit
predict( fit) # gives predicted values at data points

# only the fixed part of the model

predict( fit, just.fixed=TRUE) 

# in this case the default is a linear spatial drift  (m=2) and there 
# are no additional covariates

grid<- make.surface.grid( list( seq( -40,40,,15), seq( -40,40,,15)))

look<- predict(fit,grid) # evaluate on a grid of points

# some useful graphing functions
out.p<- as.surface( grid, look) # reformat into $x $y $z image-type object
contour( out.p)  


# refit with 10 degrees of freedom in surface

look<- predict(fit,grid, df=15)

# refit with random data 

look<- predict( fit, grid, y= rnorm( 20))

Run the code above in your browser using DataLab