Package rgcvpack. February 20, Index 6. Fitting Thin Plate Smoothing Spline. Fit thin plate splines of any order with user specified knots

Similar documents
Package sspline. R topics documented: February 20, 2015

Package lmesplines. R topics documented: February 20, Version

The sspline Package. October 11, 2007

Package flam. April 6, 2018

Package msgps. February 20, 2015

Package RAMP. May 25, 2017

Package robustgam. February 20, 2015

Package SAM. March 12, 2019

Package CGP. June 12, 2018

Semiparametric Tools: Generalized Additive Models

Package SSLASSO. August 28, 2018

Package freeknotsplines

Package hgam. February 20, 2015

Package robustgam. January 7, 2013

Package ridge. R topics documented: February 15, Title Ridge Regression with automatic selection of the penalty parameter. Version 2.

NONPARAMETRIC REGRESSION SPLINES FOR GENERALIZED LINEAR MODELS IN THE PRESENCE OF MEASUREMENT ERROR

Package gwrr. February 20, 2015

Package rpst. June 6, 2017

Package assortnet. January 18, 2016

Package desirability

Package gamm4. July 25, Index 10

Package glmnetutils. August 1, 2017

Package glinternet. June 15, 2018

Package cgh. R topics documented: February 19, 2015

Package TANDEM. R topics documented: June 15, Type Package

Package dkdna. June 1, Description Compute diffusion kernels on DNA polymorphisms, including SNP and bi-allelic genotypes.

Package DTRreg. August 30, 2017

Package svmpath. R topics documented: August 30, Title The SVM Path Algorithm Date Version Author Trevor Hastie

Package clustmixtype

Package ssa. July 24, 2016

Package msda. February 20, 2015

Package MeanShift. R topics documented: August 29, 2016

Package splines2. June 14, 2018

Package ibr. R topics documented: May 1, Version Date Title Iterative Bias Reduction

Package CepLDA. January 18, 2016

Package naivebayes. R topics documented: January 3, Type Package. Title High Performance Implementation of the Naive Bayes Algorithm

Package CompGLM. April 29, 2018

Package SAENET. June 4, 2015

Package truncreg. R topics documented: August 3, 2016

Package sparsereg. R topics documented: March 10, Type Package

Package penrvine. R topics documented: May 21, Type Package

Package arulesnbminer

Package flsa. February 19, 2015

Package nodeharvest. June 12, 2015

Package gsscopu. R topics documented: July 2, Version Date

Abstract R-splines are introduced as splines t with a polynomial null space plus the sum of radial basis functions. Thin plate splines are a special c

Package GWRM. R topics documented: July 31, Type Package

Package Density.T.HoldOut

Package logisticpca. R topics documented: August 29, 2016

Package mlegp. April 15, 2018

Package hiernet. March 18, 2018

Package obliquerf. February 20, Index 8. Extract variable importance measure

Package orthogonalsplinebasis

Package intccr. September 12, 2017

Package maxnet. R topics documented: February 11, Type Package

Package pendvine. R topics documented: July 9, Type Package

Package reval. May 26, 2015

Package OptimaRegion

Package milr. June 8, 2017

Package RSpectra. May 23, 2018

Package svd. R topics documented: March 24, Type Package. Title Interfaces to various state-of-art SVD and eigensolvers. Version 0.3.

Package cosinor. February 19, 2015

Package sfa. R topics documented: February 20, 2015

Package GAMBoost. February 19, 2015

Package GauPro. September 11, 2017

Package treethresh. R topics documented: June 30, Version Date

Package oasis. February 21, 2018

Package LVGP. November 14, 2018

Package slp. August 29, 2016

Package CvM2SL2Test. February 15, 2013

Package corclass. R topics documented: January 20, 2016

Last time... Bias-Variance decomposition. This week

Package PUlasso. April 7, 2018

Package Combine. R topics documented: September 4, Type Package Title Game-Theoretic Probability Combination Version 1.

Package gibbs.met. February 19, 2015

Package kernelfactory

Package snn. August 23, 2015

Package smoother. April 16, 2015

Package RYoudaoTranslate

Package StatMeasures

The grplasso Package

Package StVAR. February 11, 2017

Package bgeva. May 19, 2017

Package logspline. February 3, 2016

Package NormalGamma. February 19, 2015

Package PrivateLR. March 20, 2018

Package cwm. R topics documented: February 19, 2015

Package spcadjust. September 29, 2016

Package RCA. R topics documented: February 29, 2016

Package svd. R topics documented: September 26, 2017

Package madsim. December 7, 2016

Package hsiccca. February 20, 2015

Package maboost. R topics documented: February 20, 2015

Package ic10. September 23, 2015

Package spark. July 21, 2017

Package simmsm. March 3, 2015

Package GLDreg. February 28, 2017

Moving Beyond Linearity

Package Rtsne. April 14, 2017

Package gpr. February 20, 2015

Transcription:

Version 0.1-4 Date 2013/10/25 Title R Interface for GCVPACK Fortran Package Author Xianhong Xie <xianhong04@gmail.com> Package rgcvpack February 20, 2015 Maintainer Xianhong Xie <xianhong04@gmail.com> Depends R (>= 2.1.0) Description Thin plate spline fitting and prediction License GPL (>= 2) URL http://www.stat.wisc.edu/~xie NeedsCompilation yes Repository CRAN Date/Publication 2013-11-01 17:35:14 R topics documented: fittps............................................ 1 predict.tps......................................... 4 Index 6 fittps Fitting Thin Plate Smoothing Spline Description Usage Fit thin plate splines of any order with user specified knots fittps(x, y, m = 2, knots = NULL, scale.type = "range", method = "v", lambda = NULL, cost = 1, nstep.cv = 80, verbose = FALSE, tau = 0) 1

2 fittps Arguments x y m knots scale.type method lambda the design data points the observation vector the order of the spline the placement the thin plate spline basis "range" (default), the x and knots will be rescaled with respect to x; "none", nothing is done on x and knots "v", GCV is used for choosing lambda; "d", user specified lambda only used when method="d" cost the fudge factor for inflating the model degrees of freedom, default to be 1 nstep.cv verbose tau Details Value the number of initial steps for GCV grid search whether some computational details should be outputed the truncation ratio used in SVD when knots is specified by the user, some possible values are 1, 10, 100,... The minimization problem for this function is n (y i f(x i )) 2 + λ J m (f), where J m (.) is the m-the order thin plate spline penalty functional. i=1 If scale.type="range", each column of x is rescaled to [0 1] in the following way x = (x - min(x))/range(x), and the knots is rescaled w.r.t. min(x) and range(x) in the same way. When the cost argument is used, the GCV score is computed as GCV(λ) = A Tps object of the following components n RSS(λ) (n cost tr(a)) 2. x y m knots scale.type method lambda cost nstep.cv

fittps 3 tau df gcv xs ks c d yhat svals gcv.grid call model degrees of freedom gcv score of the model adjusted for the fudge factor scaled design points scaled knots design coefficient c coefficient d predicted values at the data points singular values of the matrix decomposition gcv grid table, number of rows=nstep.cv the call to this function Note This function uses GCVPACK fortran code with some addition and modification by the author. Author(s) Xianhong Xie References D. Bates, M. Lindstrom, G. Wahba, B. Yandell (1987), GCVPACK routines for generalized crossvalidation. Commun. Statist.-Simula., 16(1), 263-297. See Also predict.tps Examples #define the test function f <- function(x, y) {.75*exp(-((9*x-2)^2 + (9*y-2)^2)/4) +.75*exp(-((9*x+1)^2/49 + (9*y+1)^2/10)) +.50*exp(-((9*x-7)^2 + (9*y-3)^2)/4) -.20*exp(-((9*x-4)^2 + (9*y-7)^2)) } #generate a data set with the test function set.seed(200) N <- 13; xr <- (2*(1:N) - 1)/(2*N); yr <- xr zr <- outer(xr, yr, f); zrmax <- max(abs(zr)) noise <- rnorm(n^2, 0, 0.07*zrmax) zr <- zr + noise #this is the noisy data we will use #convert the data into column form xc <- rep(xr, N)

4 predict.tps yc <- rep(yr, rep(n,n)) zc <- as.vector(zr) #fit the thin plate spline with all the data points as knots tpsfit1 <- fittps(cbind(xc,yc), zc, m=2, scale.type="none") persp(xr, yr, matrix(predict(tpsfit1),n,n), theta=130, phi=20, expand=0.45, xlab="x1", ylab="x2", zlab="y", xlim=c(0,1), ylim=c(0,1),zlim=range(zc), ticktype="detailed", scale=false, main="gcv Smooth I") #fit the thin plate spline with subset of data points as knots grid.list <- list(xc=seq(2/13,11/13,len=10), yc=seq(2/13,11/13,len=10)) knots.grid <- expand.grid(grid.list) tpsfit2 <- fittps(cbind(xc,yc), zc, m=2, knots=knots.grid) persp(xr, yr, matrix(predict(tpsfit2),n,n), theta=130, phi=20, expand=0.45, xlab="x1", ylab="x2", zlab="y", xlim=c(0,1), ylim=c(0,1),zlim=range(zc), ticktype="detailed", scale=false, main="gcv Smooth II") predict.tps Predicting Thin Plate Smoothing Spline Description Predict the thin plate spline fitting at given new data points. Usage ## S3 method for class Tps predict(object, newdata = NULL,...) Arguments object a Tps object returned by fittps newdata the new data to be predicted at... currently not used Value A vector with the length = the number of rows in newdata. Note This function uses GCVPACK fortran code with some addition and modification by the author.

predict.tps 5 Author(s) Xianhong Xie See Also fittps Examples #the same test function as in fittps f <- function(x, y) {.75*exp(-((9*x-2)^2 + (9*y-2)^2)/4) +.75*exp(-((9*x+1)^2/49 + (9*y+1)^2/10)) +.50*exp(-((9*x-7)^2 + (9*y-3)^2)/4) -.20*exp(-((9*x-4)^2 + (9*y-7)^2)) } #generate a data set with the test function set.seed(200) N <- 13; xr <- (2*(1:N) - 1)/(2*N); yr <- xr zr <- outer(xr, yr, f); zrmax <- max(abs(zr)) noise <- rnorm(n^2, 0, 0.07*zrmax) zr <- zr + noise #this is the noisy data we will use #convert the data into column form xc <- rep(xr, N) yc <- rep(yr, rep(n,n)) zc <- as.vector(zr) #fit the thin plate spline with all the data points as knots tpsfit1 <- fittps(cbind(xc,yc), zc, m=2, scale.type="none") #predict the thin plate spline on a finer grid (50x50) xf <- seq(1/26, 25/26, length=50); yf <- xf zf <- predict(tpsfit1, expand.grid(xc=xf,yc=yf)) #plot the predicted result persp(xf, yf, matrix(zf,50,50), theta=130, phi=20, expand=0.45, xlab="x1", ylab="x2", zlab="y", xlim=c(0,1), ylim=c(0,1), zlim=range(zc), ticktype="detailed", scale=false, main="gcv Smoothing")

Index Topic smooth fittps, 1 predict.tps, 4 fittps, 1, 5 predict.tps, 3, 4 6