# Capture the Dominant Spatial Patten with One-Dimensional Locations In SpatPCA: Regularized Principal Component Analysis for Spatial Data



#### Compare SpatPCA with PCA

There are two comparison remarks 1. Two estimates are similar to the true eigenfunctions 2. SpatPCA can perform better at the both ends.

data.frame(position = position,
true = true_eigen_fn,
spatpca = eigen_est[, 1],
pca = svd(realizations)$v[, 1]) %>% gather(estimate, eigenfunction, -position) %>% ggplot(aes(x = position, y = eigenfunction, color = estimate)) + geom_line() + base_theme  ## Case II: Lower signal of the true eigenfunction ### Generate realizations with$\sigma=3$realizations <- rnorm(n = 100, sd = 3) %*% t(true_eigen_fn) + matrix(rnorm(n = 100 * 100), 100, 100)  ### Animate realizations It is hard to see a crystal clear spatial pattern via the simluated sample shown below. for (i in 1:100) { plot(x = position, y = realizations[i, ], ylim = c(-10, 10), ylab = "realization") }  ### Compare resultant patterns The following panel indicates that SpatPCA outperforms to PCA visually when the signal-to-noise ratio is quite lower. cv <- spatpca(x = position, Y = realizations) eigen_est <- cv$eigenfn

data.frame(position = position,
true = true_eigen_fn,
spatpca = eigen_est[, 1],
pca = svd(realizations)\$v[, 1]) %>%
gather(estimate, eigenfunction, -position) %>%
ggplot(aes(x = position, y = eigenfunction, color = estimate)) +
geom_line() +
base_theme


## Try the SpatPCA package in your browser

Any scripts or data that you put into this service are public.

SpatPCA documentation built on Jan. 31, 2021, 5:05 p.m.