Skip to content
Regularized Principal Component Analysis for Spatial Data
Branch: master
Clone or download
Latest commit be9cb4f Apr 1, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R Update Nov 27, 2017
man Adjust description Apr 1, 2018
src Update Nov 27, 2017
.DS_Store Update the package Feb 20, 2018
.Rbuildignore Update travis.yml Jan 26, 2017
.gitignore no message Jan 24, 2017
.travis.yml Update travis.yml Jan 26, 2017
DESCRIPTION Update the package Feb 20, 2018
NAMESPACE Update Mar 17, 2017
README.md Merge remote-tracking branch 'origin/master' Feb 20, 2018
SpatPCA.Rproj Update a new version of the pkg Nov 3, 2017

README.md

SpatPCA Package

CRAN_Status_Badge Downloads Travis-CI Build Status License Research software impact

Description

SpatPCA is an R package that facilitates regularized principal component analysis,

  • seeking the dominant patterns (eigenfunctions), which can be smooth and localized
  • computing spatial prediction (Kriging) at new locations
  • suitable for either regularly or irregularly spaced data, including 1D, 2D, and 3D
  • by the alternating direction method of multipliers (ADMM) algorithm

Installation

To get the current released version from CRAN:

install.packages("SpatPCA")

To get the current development version from GitHub:

devtools::install_github("egpivo/SpatPCA")

To compile C++ code with the package RcppArmadillo,

  • Windows users require Rtools
  • Mac users require Xcode Command Line Tools, and install the library gfortran by typing the following lines into terminal
curl -O http://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2
sudo tar fvxz gfortran-4.8.2-darwin13.tar.bz2 -C /

More details can be found here.

Usage

library(SpatPCA)

### location
x_1D <- as.matrix(seq(-5, 5, length = 50))

###underlying eigenfunction
Phi_1D <- exp(-x_1D^2)/norm(exp(-x_1D^2), "F")

### Realizations on x_1D
set.seed(1234)
Y_1D <- rnorm(n = 100, sd = 3)%*%t(Phi_1D) + matrix(rnorm(n = 100*50), 100, 50)

### main function: spatpca()
cv_1D <- spatpca(x = x_1D, Y = Y_1D)

### Plot the estimate
plot(x_1D, cv_1D$eigenfn[,1], type = 'l', main = "1st eigenfunction")
lines(x_1D, svd(Y_1D)$v[,1], col='red')
legend('topleft', c('SpatPCA', 'PCA'), lty=1:1, col=1:2)

Author

Wen-Ting Wang and Hsin-Cheng Huang

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-2

You can’t perform that action at this time.