Package SpatPCA. R topics documented: February 20, Type Package

Similar documents
Package EMVS. April 24, 2018

Package leiv. R topics documented: February 20, Version Type Package

Package bayeslm. R topics documented: June 18, Type Package

Package varband. November 7, 2016

Package FDRSeg. September 20, 2017

Package spcov. R topics documented: February 20, 2015

Package basad. November 20, 2017

Package esaddle. R topics documented: January 9, 2017

Package scio. February 20, 2015

Package bigtime. November 9, 2017

Package NonpModelCheck

Package diffeq. February 19, 2015

Package BayesNI. February 19, 2015

Package clogitboost. R topics documented: December 21, 2015

Package noncompliance

Package jmcm. November 25, 2017

Package rnmf. February 20, 2015

Package NlinTS. September 10, 2018

Package face. January 19, 2018

Package dhsic. R topics documented: July 27, 2017

Package invgamma. May 7, 2017

Package GPfit. R topics documented: April 2, Title Gaussian Processes Modeling Version Date

Package fwsim. October 5, 2018

Package netcoh. May 2, 2016

Package msir. R topics documented: April 7, Type Package Version Date Title Model-Based Sliced Inverse Regression

Package thief. R topics documented: January 24, Version 0.3 Title Temporal Hierarchical Forecasting

Package Grace. R topics documented: April 9, Type Package

Package RI2by2. October 21, 2016

Package mpmcorrelogram

Package reinforcedpred

Package scpdsi. November 18, 2018

Package denseflmm. R topics documented: March 17, 2017

Package abundant. January 1, 2017

Package clustergeneration

Package RTransferEntropy

Package MultisiteMediation

Package bivariate. December 10, 2018

Package depth.plot. December 20, 2015

Package BNN. February 2, 2018

Package ShrinkCovMat

Package ForwardSearch

Package tspi. August 7, 2017

Package TSPred. April 5, 2017

Package penmsm. R topics documented: February 20, Type Package

Package gma. September 19, 2017

Package FDRreg. August 29, 2016

Package ProDenICA. February 19, 2015

Package polypoly. R topics documented: May 27, 2017

Package monmlp. R topics documented: December 5, Type Package

Package covtest. R topics documented:

Package elhmc. R topics documented: July 4, Type Package

Package ensemblepp. R topics documented: September 20, Title Ensemble Postprocessing Data Sets. Version

Package rarhsmm. March 20, 2018

Package idmtpreg. February 27, 2018

Package gtheory. October 30, 2016

Package HDtest. R topics documented: September 13, Type Package

Package RZigZag. April 30, 2018

Package gumbel. February 15, 2013

The evdbayes Package

Package EBMAforecast

Package horseshoe. November 8, 2016

Package bpp. December 13, 2016

Package RootsExtremaInflections

Package RcppSMC. March 18, 2018

Package sindyr. September 10, 2018

Package mcmcse. July 4, 2017

Package cartogram. June 21, 2018

Package FinCovRegularization

Package IUPS. February 19, 2015

Package blme. August 29, 2016

Package pearson7. June 22, 2016

Package MAVE. May 20, 2018

Package sgpca. R topics documented: July 6, Type Package. Title Sparse Generalized Principal Component Analysis. Version 1.0.

Package HIMA. November 8, 2017

Package rgabriel. February 20, 2015

Package IndepTest. August 23, 2018

Package chemcal. July 17, 2018

Package zic. August 22, 2017

Package EL. February 19, 2015

Package jaccard. R topics documented: June 14, Type Package

Package CorrMixed. R topics documented: August 4, Type Package

Package AID. R topics documented: November 10, Type Package Title Box-Cox Power Transformation Version 2.3 Date Depends R (>= 2.15.

Package epr. November 16, 2017

Package CEC. R topics documented: August 29, Title Cross-Entropy Clustering Version Date

Package ProbForecastGOP

Package factorqr. R topics documented: February 19, 2015

Package rarpack. August 29, 2016

Package OGI. December 20, 2017

Package lomb. February 20, 2015

Package gk. R topics documented: February 4, Type Package Title g-and-k and g-and-h Distribution Functions Version 0.5.

Package esreg. August 22, 2017

Package EnergyOnlineCPM

Package darts. February 19, 2015

Package Blendstat. February 21, 2018

Package penalized. February 21, 2018

Package CPE. R topics documented: February 19, 2015

Package xdcclarge. R topics documented: July 12, Type Package

Package LIStest. February 19, 2015

Package severity. February 20, 2015

Package threeboost. February 20, 2015

Transcription:

Type Package Package SpatPCA February 20, 2018 Title Regularized Principal Component Analysis for Spatial Data Version 1.2.0.0 Date 2018-02-20 URL https://github.com/egpivo/spatpca BugReports https://github.com/egpivo/spatpca/issues Description Provide regularized principal component analysis incorporating smoothness, sparseness and orthogonality of eigenfunctions by using the alternating direction method of multipliers algorithm (Wang and Huang, 2017, <DOI:10.1080/10618600.2016.1157483>). The method can be applied to either regularly or irregularly spaced data, including 1D, 2D, and 3D. License GPL-2 Imports Rcpp, RcppParallel LinkingTo Rcpp, RcppArmadillo, RcppParallel SystemRequirements GNU make Author Wen-Ting Wang, Hsin-Cheng Huang Maintainer Wen-Ting Wang <egpivo@gmail.com> NeedsCompilation yes Repository CRAN Date/Publication 2018-02-20 22:44:51 UTC R topics documented: SpatPCA-package...................................... 2 spatpca........................................... 2 Index 6 1

2 spatpca SpatPCA-package Regularized Principal Component Analysis for Spatial Data Description Details A new regularization approach to estimate the leading spatial patterns via smoothness and sparseness penalties, and spatial predctions for spatial data that may be irregularly located in space (including 1D, 2D and 3D), and obtain the spatial prediction at the designated locations. Package: SpatPCA Type: Package Version: 1.2.0.0 Date: 2018-02-20 License: GPL version 2 or newer Author(s) Wen-Ting Wang <egpivo@gmail.com> and Hsin-Cheng Huang <hchuang@stat.sinica.edu.tw> spatpca Regularized PCA for spatial data Description Usage Produce spatial dominant patterns and spatial predictions at the designated locations according to the specified tuning parameters or the selected tuning parameters by the M-fold cross-validation. spatpca(x, Y, M = 5, K = NULL, K.select = ifelse(is.null(k),true,false), tau1 = NULL, tau2 = NULL, gamma = NULL, x_new = NULL, center = FALSE, plot.cv = FALSE, maxit = 100, thr = 1e-04) Arguments x Location matrix (p d). Each row is a location. d is the dimension of locations Y Data matrix (n p) stores the values at p locations with sample size n. K Optional user-supplied number of eigenfunctions; default is NULL. If K is NULL or K.select is TRUE, K is selected automatically.

spatpca 3 K.select tau1 tau2 Details Value gamma If TRUE, K is selected automatically; otherwise, K.select is set to be usersupplied K. Default depends on user-supplied K. Optional user-supplied numeric vector of a nonnegative smoothness parameter sequence. If NULL, 10 tau1 values in a range are used. Optional user-supplied numeric vector of a nonnegative sparseness parameter sequence. If NULL, none of tau2 is used. Optional user-supplied numeric vector of a nonnegative tuning parameter sequence. If NULL, 10 values in a range are used. x_new New location matrix. If NULL, it is x. M Optional number of folds; default is 5. center plot.cv If TRUE, center the columns of Y. Default is FALSE. If TRUE, plot the cv values. Default is FALSE. maxit Maximum number of iterations. Default value is 100. thr Threshold for convergence. Default value is 10 4. An ADMM form of the proposed objective function is written as min Φ Y Y ΦΦ 2 F + τ 1 tr(φ T ΩΦ) + τ 2 K k=1 j=1 p φ jk, subject to Φ T Φ = I K, where Y is a data matrix, Ω is a smoothness matrix, and Φ = {φ jk }. eigenfn Yhat stau1 stau2 sgamma cv1 cv2 cv3 tau1 tau2 gamma Estimated eigenfunctions at the new locations, x_new. Prediction of Y at the new locations, x_new. Selected tau1. Selected tau2. Selected gamma. cv socres for tau1. cv socres for tau2. cv socres for gamma. Sequence of tau1-values used in the process. Sequence of tau2-values used in the process. Sequence of gamma-values used in the process. Yc If center is TRUE, Yc is the centered Y; else, Yc is equal to Y. Author(s) Wen-Ting Wang and Hsin-Cheng Huang

4 spatpca References Wang, W.-T. and Huang, H.-C. (2017). Regularized principal component analysis for spatial data. Journal of Computational and Graphical Statistics 26 14-25. Examples ###### 1D: regular locations x_1d <- as.matrix(seq(-5, 5, length = 50)) 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*50), 100, 50) cv_1d <- spatpca(x = x_1d, Y = Y_1D) 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) ## Not run: ### 1D: artificial irregular locations rm_loc <- sample(1:50, 20) x_1drm <- x_1d[-rm_loc] Y_1Drm <- Y_1D[,-rm_loc] x_1dnew <- as.matrix(seq(-5, 5, length = 100)) cv_1d <- spatpca(x = x_1drm, Y = Y_1Drm, tau2 = 1:100, x_new = x_1dnew) plot(x_1dnew, cv_1d$eigenfn, type = 'l', main="eigenfunction") plot(cv_1d$yhat[,50], xlab = "n", ylab = "Yhat", type='l', main= paste("prediction at x = ", x_1dnew[50])) ###### 2D: Daily 8-hour ozone averages for sites in the Midwest (USA) library(fields) library(pracma) data(ozone2) x <- ozone2$lon.lat Y <- ozone2$y date <- as.date(ozone2$date, format = '%y%m%d') rmna <-!colsums(is.na(y)) YY <- matrix(y[, rmna], nrow=nrow(y)) YY <- detrend(yy, "linear") xx <- x[rmna,] cv <- spatpca(x = xx, Y = YY) quilt.plot(xx, cv$eigenfn[,1]) map("state", xlim = range(xx[,1]), ylim = range(xx[,2]), add = T) map.text("state", xlim = range(xx[,1]), ylim = range(xx[,2]), cex = 2, add = T) plot(date, YY%*%cv$eigenfn[,1], type = "l", ylab = "1st Principal Component") ### new loactions new_p = 200 x_lon <- seq(min(xx[,1]), max(xx[,1]), length = new_p) x_lat <- seq(min(xx[,2]), max(xx[,2]), length = new_p) xx_new <- as.matrix(expand.grid(x = x_lon, y = x_lat)) eof <- spatpca(x = xx, Y = YY, K = cv$khat, tau1 = cv$stau1, tau2 = cv$stau2, x_new = xx_new) quilt.plot(xx_new, eof$eigenfn[,1], nx = new_p, ny = new_p, xlab = "lon.", ylab = "lat.") map("state", xlim = range(x_lon), ylim = range(x_lat), add = T)

spatpca 5 map.text("state", xlim = range(x_lon), ylim = range(x_lat), cex = 2, add = T) ###### 3D: regular locations x = y = z = as.matrix(seq(-5, 5, length = 10)) d = expand.grid(x, y, z) Phi_3D <- exp(-d[,1]^2 - d[,2]^2 -d[,3]^2)/norm(exp(-d[,1]^2 - d[,2]^2 -d[,3]^2), "F") Y_3D <- rnorm(n = 1000, sd = 3)%*%t(Phi) + matrix(rnorm(n = 100*10^3), 100, 10^3) cv_3d <- spatpca(x = d, Y = Y_3D, tau2 = seq(0, 1000, length=10)) library(plot3d) library(rcolorbrewer) cols <- colorramppalette(brewer.pal(9,'blues'))(10) isosurf3d(x, y, z, colvar = array(cv_3d$eigenfn[,1], c(p, p, p)), level= seq(min(cv_3d$eigenfn[,1]), max(cv_3d$eigenfn[,1]), length=10), ticktype = "detailed", colkey = list(side = 1), col = cols) ## End(Not run)

Index spatpca, 2 SpatPCA-package, 2 6