Learn R Programming

SpatPCA Package

Description

SpatPCA is an R package designed for efficient regularized principal component analysis, providing the following features:

  • Identification of dominant spatial patterns (eigenfunctions) with both smooth and localized characteristics.
  • Spatial prediction (Kriging) at new locations.
  • Adaptability for regularly or irregularly spaced data, spanning 1D, 2D, and 3D datasets.
  • Implementation using the alternating direction method of multipliers (ADMM) algorithm.

Installation

To install the current development version from GitHub, use the following R code:

remotes::install_github("egpivo/SpatPCA")

For compiling C++ code with the required RcppArmadillo and RcppParallel packages, follow these instructions:

  • Windows users: Install Rtools
  • Mac users: Install Xcode Command Line Tools, and install the gfortran library. You can achieve this by running the following commands in the terminal:
brew update
brew install gcc

For a detailed solution, refer to this link, or download and install the library gfortran to resolve the error ld: library not found for -lgfortran.

Usage

library(SpatPCA)
spatpca(position, realizations)
  • Input: Realizations with the corresponding positions.
  • Output: Return the most dominant eigenfunctions automatically.
  • For more details, refer to the Demo.

Author

Maintainer

Wen-Ting Wang

Reference

Wang, W.-T. and Huang, H.-C. (2017). Regularized principal component analysis for spatial data. Journal of Computational and Graphical Statistics, 26, 14-25.

License

GPL-3

Copy Link

Version

Install

install.packages('SpatPCA')

Monthly Downloads

233

Version

1.3.5

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Last Published

November 13th, 2023

Functions in SpatPCA (1.3.5)

predict

Spatial predictions on new locations
spatpca

Regularized PCA for spatial data
thinPlateSplineMatrix

Thin-plane spline matrix
scaleLocation

Internal function: Scale one-dimension locations
predictEigenfunction

Spatial dominant patterns on new locations
plot.spatpca

Display the cross-validation results
SpatPCA-package

Regularized Principal Component Analysis for Spatial Data
checkInputData

Internal function: Validate input data for a spatpca object
eigenFunction

Interpolated Eigen-function
fetchUpperBoundNumberEigenfunctions

Internal function: Fetch the upper bound of the number of eigenfunctions
detrend

Internal function: Detrend Y by column-wise centering
setGamma

Internal function: Set tuning parameter - gamma
checkNewLocationsForSpatpcaObject

Internal function: Validate new locations for a spatpca object
spatpcaCV

Internal function: M-fold Cross-validation
setCores

Internal function: Set the number of cores for parallel computing
spatialPrediction

Internal function: Spatial prediction
setNumberEigenfunctions

Internal function: Set the number of eigenfunctions for a spatpca object
setTau1

Internal function: Set tuning parameter - tau1
spatpcaCVWithSelectedK

Internal function: M-fold CV of SpatPCA with selected K
setL2

Internal function: Set tuning parameter - l2
setTau2

Internal function: Set tuning parameter - tau2