predict | R Documentation |
Predict the response on new locations with the estimated spatial structures.
predict(spatpca_object, x_new, eigen_patterns_on_new_site = NULL)
spatpca_object |
An |
x_new |
New location matrix. |
eigen_patterns_on_new_site |
Eigen-patterns on x_new |
A prediction matrix of Y at the new locations, x_new.
spatpca
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.