plausibility_contour: generate plausibility contour

View source: R/plausibility_contour.R

plausibility_contourR Documentation

generate plausibility contour

Description

This function provides the plausibility contour for Y(s0), given observations s and Y, using spatial conformal prediction algorithms.

Usage

plausibility_contour(
  s0,
  s,
  Y,
  global = TRUE,
  eta = Inf,
  m = NULL,
  pred_fun = krige_pred,
  thetaHat = NULL,
  dfun = c("residual2", "std_residual2"),
  precision = NULL
)

Arguments

s0

prediction location, a numeric vector with length = 2 or a matrix with 1 row and 2 cols, or a data.frame with 1 row and 2 cordinates.

s

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

Y

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

global

logical; if TRUE , scp function returns the result of global spatial conformal prediction (GSCP); if FALSE, scp function returns the result of local spatial conformal prediction (LSCP) and users need to specify eta < Inf or m n. Defaults to TRUE.

eta

kernel bandwidth for weight schema, a positve scalar with smaller value meaning more localized procedure. Defauls to Inf, which puts equal weight on surrounding m points.

m

an postive integer representing the number of nearest locations to use for prediction. Default to NULL. If global = TRUE, m = n; if global = FALSE and m is not specified, m would be determined by eta.

pred_fun

spatial prediction function with inputs being s0, s, Y and ouputs being predicted Y(s0) (and its standard error). Defaults to krige_pred.

thetaHat

a vector of Matern parameters, representing nugget, partial sill, range, and smoothness as in Mao. et al. (2020). Defaults to NULL. It will be ignored if pred_fun is not krige_pred.

dfun

non-conformity measure with four options. In which, "residual2" (default) represents squared residual and "std_residual2" represents standardized squared residual.

precision

a positive scalar represents how dense Y(s) candidates (Y_cand) are. Defaults to NULL.

Value

The output is a “plausibility_contour” object.

Author(s)

Huiying Mao, hmao@samsi.info, Brian Reich bjreich@ncsu.edu

References

to be entered

See Also

plausibility

Examples

## generate plausibility contour for Y(s0), where s0 = c(0.5,0.5), using sample data

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

pc = plausibility_contour(s0=s0,s=s,Y=Y)
plot(pc)

idx = which(s[, 1] == s0[1] & s[, 2] == s0[2])
abline(v = Y[idx], col = "red", lty = 2)
legend("topright", col=1:2, lty=1:2, c("plausibility", "true value"))


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