predict: Spatial predictions on new locations

View source: R/SpatPCA.R

predictR Documentation

Spatial predictions on new locations

Description

Predict the response on new locations with the estimated spatial structures.

Usage

predict(spatpca_object, x_new, eigen_patterns_on_new_site = NULL)

Arguments

spatpca_object

An spatpca class object

x_new

New location matrix.

eigen_patterns_on_new_site

Eigen-patterns on x_new

Value

A prediction matrix of Y at the new locations, x_new.

See Also

spatpca

Examples

# 1D: artificial irregular locations
x_1D <- as.matrix(seq(-5, 5, length = 10))
Phi_1D <- exp(-x_1D^2) / norm(exp(-x_1D^2), "F")
set.seed(1234)
Y_1D <- rnorm(n = 100, sd = 3) %*% t(Phi_1D) + matrix(rnorm(n = 100 * 10), 100, 10)
removed_location <- sample(1:10, 3)
removed_x_1D <- x_1D[-removed_location]
removed_Y_1D <- Y_1D[, -removed_location]
new_x_1D <- as.matrix(seq(-5, 5, length = 20))
cv_1D <- spatpca(x = removed_x_1D, Y = removed_Y_1D, tau2 = 1:100, num_cores = 2)
predictions <- predict(cv_1D, x_new = new_x_1D)


SpatPCA documentation built on Nov. 13, 2023, 5:06 p.m.