krige_pred: Kriging prediction function

View source: R/krige_pred.R

krige_predR Documentation

Kriging prediction function

Description

This function provides an example for pred_fun in scp, plausibility, and plausibility_contour, which provides a point prediction for location s0 (and corresponding standard error), given obserations s and Y.

Usage

krige_pred(s0, s, Y, return_sd = FALSE)

Arguments

s0

prediction location, a numeric vector with length = 2.

s

an n x 2 matrix or data.frame with two coordinates of n locations.

Y

a vector with n values corresponding to Y(s).

return_sd

logical. if TRUE, Krige_pred function returns the standard error of Y(s0) along with the point prediction; if FALSE, Krige_pred function only returns the point prediction. Defaults to FALSE.

Value

If return_sd is FALSE (default), the output is a value of point prediction for Y(s0); If return_sd is TRUE, the output is a list with the following elements:

yhat

point prediction for Y(s0)

sd

standard error for Y(s0)

Examples

#?sample_data
s0 = c(0.5,0.5)
s  = sample_data$s
Y  = sample_data$Y

krige_pred(s0,s,Y)
krige_pred(s0,s,Y,return_sd=TRUE)

mhuiying/scp documentation built on May 4, 2022, 11:35 p.m.