SpatPCA is an R package designed for efficient regularized principal component analysis, providing the following features:
- Identify dominant spatial patterns (eigenfunctions) with both smooth and localized characteristics.
- Conduct spatial prediction (Kriging) at new locations.
- Adapt to regularly or irregularly spaced data, spanning 1D, 2D, and 3D datasets.
- Implement using the alternating direction method of multipliers (ADMM) algorithm.
You can install SpatPCA using either of the following methods:
install.packages("SpatPCA")remotes::install_github("SpaceTimeViz/SpatPCA")To compile C++ code with the required RcppArmadillo and RcppParallel packages, follow these instructions based on your operating system:
Install Rtools
- Install Xcode Command Line Tools
- install the
gfortranlibrary. You can achieve this by running the following commands in the terminal:
brew update
brew install gccFor a detailed solution, refer to this link, or download and install the library gfortran to resolve the error ld: library not found for -lgfortran.
To use SpatPCA, first load the package:
library(SpatPCA)Then, apply the spatpca function with the following syntax:
spatpca(position, realizations)- Input: Realizations with the corresponding positions.
- Output: Return the most dominant eigenfunctions automatically.
For more details, refer to the Demo.
Wang, W.-T. and Huang, H.-C. (2017). Regularized principal component analysis for spatial data, "Regularized principal component analysis for spatial data"). Journal of Computational and Graphical Statistics, 26, 14-25.
GPL (>= 2)
- To cite package ‘SpatPCA’ in publications use:
Wang W, Huang H (2023). SpatPCA: Regularized Principal Component Analysis for
Spatial Data_. R package version 1.3.5,
<https://CRAN.R-project.org/package=SpatPCA>.
- A BibTeX entry for LaTeX users is
@Manual{,
title = {SpatPCA: Regularized Principal Component Analysis for Spatial Data},
author = {Wen-Ting Wang and Hsin-Cheng Huang},
year = {2023},
note = {R package version 1.3.5},
url = {https://CRAN.R-project.org/package=SpatPCA},
}