diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/.travis.yml b/fdapace.Rcheck/00_pkg_src/fdapace/.travis.yml deleted file mode 100644 index 8538a94d..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -language: r -#os: - #- osx -cache: packages -sudo: false - - -before_install: - - tlmgr update --self --all - - tlmgr install listings - - export DISPLAY=:99.0 - - sh -e /etc/init.d/xvfb start - -r_packages: - - survival - -addons: - apt: - packages: - - tcl-dev # - tcl-dev - - tk-dev # - tk-dev - - texlive-latex-extra - -warnings_are_errors: false - -#before_script: -# - R -e 'install.packages("http://cran.r-project.org/src/contrib/Archive/Rcpp/Rcpp_0.12.7.tar.gz", repos = NULL)' - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/DESCRIPTION b/fdapace.Rcheck/00_pkg_src/fdapace/DESCRIPTION deleted file mode 100644 index f45be4ee..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/DESCRIPTION +++ /dev/null @@ -1,46 +0,0 @@ -Package: fdapace -Type: Package -Title: Functional Data Analysis and Empirical Dynamics -URL: https://github.com/functionaldata/tPACE -BugReports: https://github.com/functionaldata/tPACE/issues -Version: 0.5.0 -Date: 2019-03-20, -Authors@R: c(person("Xiongtao","Dai", role=c("aut")), - person("Pantelis Z.","Hadjipantelis", email="pantelis@ucdavis.edu", role=c("aut","cre")), - person("Kynghee","Han", role="aut"), - person("Hao","Ji", role=c("aut")), - person("Shu-Chin", "Lin", role="ctb"), - person("Hans-Georg", "Mueller", role=c("cph","ths")), - person("Jane-Ling", "Wang", role=c("cph","ths"))) -Maintainer: Pantelis Z. Hadjipantelis -Description: Provides implementation of various methods of Functional Data - Analysis (FDA) and Empirical Dynamics. The core of this package is Functional - Principal Component Analysis (FPCA), a key technique for functional data - analysis, for sparsely or densely sampled random trajectories and time courses, - via the Principal Analysis by Conditional Estimation (PACE) algorithm or - numerical integration. PACE is useful for the analysis of data that have been - generated by a sample of underlying (but usually not fully observed) random - trajectories. It does not rely on pre-smoothing of trajectories, which is - problematic if functional data are sparsely sampled. PACE provides options - for functional regression and correlation, for Longitudinal Data Analysis, - the analysis of stochastic processes from samples of realized trajectories, - and for the analysis of underlying dynamics. The core computational algorithms - are implemented using the 'Eigen' C++ library for numerical linear algebra and - 'RcppEigen' "glue". -License: BSD_3_clause + file LICENSE -LazyData: false -Imports: Rcpp (>= 0.11.5), Hmisc, MASS, Matrix, pracma, numDeriv -LinkingTo: Rcpp, RcppEigen -Suggests: plot3D, rgl, aplpack, mgcv, ks, gtools, knitr, EMCluster, - minqa, testthat -NeedsCompilation: yes -RoxygenNote: 6.1.1 -VignetteBuilder: knitr -Packaged: 2019-04-25 04:51:14 UTC; ychen -Author: Xiongtao Dai [aut], - Pantelis Z. Hadjipantelis [aut, cre], - Kynghee Han [aut], - Hao Ji [aut], - Shu-Chin Lin [ctb], - Hans-Georg Mueller [cph, ths], - Jane-Ling Wang [cph, ths] diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/ISSUE_TEMPLATE.md b/fdapace.Rcheck/00_pkg_src/fdapace/ISSUE_TEMPLATE.md deleted file mode 100644 index a87d89a3..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,15 +0,0 @@ -If you are filing an enhancement/feature request, make sure you: - -- Provide at least one reference about it, or -- Provide at least one particular user case. - -If you are filing a bug, make sure these steps are followed before submitting your issue - it will help us help you more efficiently! - -- Start a new R session -- Make sure you are using the latest version of `fdapace` (eg. `update.packages(oldPkgs="fdapace", ask=FALSE)`) -- [Write a minimal reproducible example](http://stackoverflow.com/a/5963610) -- Run `sessionInfo()` - -If you are having a general question about using `fdapace` or its design: - -- Email us at first instance; this is not a Q&A forum. :D diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/LICENSE b/fdapace.Rcheck/00_pkg_src/fdapace/LICENSE deleted file mode 100644 index ddf8d7b9..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/LICENSE +++ /dev/null @@ -1,3 +0,0 @@ -YEAR: 2018 -COPYRIGHT HOLDER: Hans-Georg Mueller and Jane-Ling Wang -ORGANIZATION: University of California, Davis diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/NAMESPACE b/fdapace.Rcheck/00_pkg_src/fdapace/NAMESPACE deleted file mode 100644 index c5951a68..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/NAMESPACE +++ /dev/null @@ -1,118 +0,0 @@ -# Generated by roxygen2: do not edit by hand - -S3method(fitted,FPCA) -S3method(fitted,FPCAder) -S3method(plot,FPCA) -S3method(predict,FPCA) -S3method(print,FPCA) -S3method(print,FSVD) -S3method(print,WFDA) -S3method(str,FPCA) -export(BwNN) -export(CheckData) -export(CheckOptions) -export(ConvertSupport) -export(CreateBWPlot) -export(CreateBasis) -export(CreateCovPlot) -export(CreateDesignPlot) -export(CreateDiagnosticsPlot) -export(CreateFuncBoxPlot) -export(CreateModeOfVarPlot) -export(CreateOutliersPlot) -export(CreatePathPlot) -export(CreateScreePlot) -export(CreateStringingPlot) -export(DynCorr) -export(Dyn_test) -export(FAM) -export(FCCor) -export(FCReg) -export(FClust) -export(FOptDes) -export(FPCA) -export(FPCAder) -export(FPCReg) -export(FPCquantile) -export(FSVD) -export(FVPA) -export(GetCrCorYX) -export(GetCrCorYZ) -export(GetCrCovYX) -export(GetCrCovYZ) -export(GetNormalisedSample) -export(GetNormalizedSample) -export(Lwls1D) -export(Lwls2D) -export(Lwls2DDeriv) -export(MakeBWtoZscore02y) -export(MakeFPCAInputs) -export(MakeGPFunctionalData) -export(MakeHCtoZscore02y) -export(MakeLNtoZscore02y) -export(MakeSparseGP) -export(MultiFAM) -export(NormCurvToArea) -export(SBFitting) -export(SelectK) -export(SetOptions) -export(Sparsify) -export(Stringing) -export(TVAM) -export(VCAM) -export(WFDA) -export(Wiener) -export(cumtrapzRcpp) -export(kCFC) -export(trapzRcpp) -import(Rcpp) -importFrom(Hmisc,approxExtrap) -importFrom(MASS,isoMDS) -importFrom(MASS,mvrnorm) -importFrom(Matrix,Matrix) -importFrom(grDevices,colorRampPalette) -importFrom(grDevices,dev.new) -importFrom(grDevices,palette) -importFrom(graphics,abline) -importFrom(graphics,barplot) -importFrom(graphics,boxplot) -importFrom(graphics,grid) -importFrom(graphics,legend) -importFrom(graphics,lines) -importFrom(graphics,matlines) -importFrom(graphics,matplot) -importFrom(graphics,par) -importFrom(graphics,plot) -importFrom(graphics,points) -importFrom(graphics,polygon) -importFrom(numDeriv,grad) -importFrom(numDeriv,hessian) -importFrom(pracma,meshgrid) -importFrom(pracma,midpoint) -importFrom(pracma,mod) -importFrom(pracma,ones) -importFrom(pracma,uniq) -importFrom(stats,aggregate) -importFrom(stats,approx) -importFrom(stats,approxfun) -importFrom(stats,cor) -importFrom(stats,cov) -importFrom(stats,dist) -importFrom(stats,dunif) -importFrom(stats,fitted) -importFrom(stats,kmeans) -importFrom(stats,lm) -importFrom(stats,median) -importFrom(stats,na.omit) -importFrom(stats,optim) -importFrom(stats,poly) -importFrom(stats,predict) -importFrom(stats,quantile) -importFrom(stats,rnorm) -importFrom(stats,runif) -importFrom(stats,sd) -importFrom(stats,spline) -importFrom(stats,var) -importFrom(stats,weighted.mean) -importFrom(utils,installed.packages) -useDynLib(fdapace) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/NEWS b/fdapace.Rcheck/00_pkg_src/fdapace/NEWS deleted file mode 100644 index 1192a5d5..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/NEWS +++ /dev/null @@ -1,59 +0,0 @@ -Current version -============= -New functionality: -* Added functional additive models (MultiFAM, TVAMSBFitting, SBFitting). -* Added stringing (Stringing). -* Added functonal linear regression with functional response (FPCReg). - -Changes: -* Dropped argument `k` from SelectK. -* Vignette in HTML. -* FClust functionality uses `EMCluster` instead `Rmixmod`. -* Multiple minor bug fixes. - -fdapace v0.3.0 (Release date: 25-Jan-2017) -============= -New functionality: -* Added obsOnly option to CreatePathPlot. -* Added derivative estimators (FPCAder, fitted.FPCAder) -* Added functional concurrent correlation (FCCor). -* Added pairwise curve synchronization for functional data (WFDA). -* Added optimal designs for longitudinal or functional data (FOptDes). -* Miscellaneous update to utility functions (CreateBasis, MakeSparseGP) - -Changes: -* Covariance GCV bandwidth is modified to prevent oversmoothing. -* "Diagnostic plots" are renamed. -* GetNormalisedSample now uses fitted covariance. - -fdapace v0.2.5 (Release date: 14-Jul-2016) -============= -Changes: -* `K` is used for specifying the number of components in functions such as SelectK, fitted, CreatePathPlot, CreateFuncBoxPlot, etc, instead of `k`. -* GetCrCovYX is sped up. - -Minors: -* Improved the legend placing in CreateDesignPlot. -* Plot functions no longer show warnings. -* Changed clustering example in vignettes. - -Minors: -* Improved the legend placing in CreateDesignPlot. -* Plot functions no longer show warnings. - -fdapace v0.2.0 (Release date: 17-Jun-2016) -============== - -New functionality: -* Addition of Functional Variance Process Analysis (FVPA.R), Functional Clustering (FClust.R) and Functional Singular Value Decomposition (FSVD.R) functionality. - -Changes: -* Minor changes to the interface of functions FPCA.R and FCReg.R. -* New internal C++ smoother used. -* General improvements and bug fixes. -* Vignette with knitr. - -fdapace v0.1.1 (Release data: 15-Mar-2016) -============== - -* Initial release diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/BestDes_SR.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/BestDes_SR.R deleted file mode 100644 index b52299e0..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/BestDes_SR.R +++ /dev/null @@ -1,31 +0,0 @@ -# Find optimal designs for scalar response prediction -BestDes_SR <- function(p, ridge, workGrid, Cov, CCov, isSequential=FALSE){ - # select optimal designs for regression case, sequential method available - if(isSequential == FALSE){ - comblist <- utils::combn(1:length(workGrid), p) - temps <- rep(0,ncol(comblist)) - for(i in 1:ncol(comblist)){ temps[i] <- SRCri(comblist[,i], ridge, Cov, CCov) } - best <- sort(comblist[,min(which(temps==max(temps)))]) - return(list(best=best)) - } else{ # sequential selection - optdes <- c() - for(iter in 1:p){ - candidx <- which(!((1:length(workGrid)) %in% optdes)) - seqcri <- rep(NA, length(candidx)) - for(i in 1:length(candidx)){ - tempdes <- sort(c(optdes,candidx[i])) - seqcri[i] <- SRCri(tempdes, ridge, Cov, CCov) - } - optdes <- sort(c(optdes, candidx[min(which(seqcri == max(seqcri)))])) - } - return(list(best=optdes,med=NULL)) - } -} - -SRCri <- function(design,ridge,Cov,CCov){ - # Optimization criterion for SR - design <- sort(design) - ridgeCov <- Cov + diag(ridge,nrow(Cov)) - srcri <- t(CCov[design]) %*% solve(ridgeCov[design,design]) %*% CCov[design] - return(srcri) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/BestDes_TR.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/BestDes_TR.R deleted file mode 100644 index 8b439935..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/BestDes_TR.R +++ /dev/null @@ -1,37 +0,0 @@ -# Find optimal designs for trajectory recovery -BestDes_TR <- function(p, ridge, workGrid, Cov, isSequential=FALSE){ - # select optimal designs for trajectory recovery case, sequential method available - if(isSequential == FALSE){ # Global Selection - comblist <- utils::combn(1:length(workGrid),p) - temps <- rep(0,ncol(comblist)) - for(i in 1:ncol(comblist)){ temps[i] <- TRCri(comblist[,i], ridge, Cov, workGrid) } - best <- sort(comblist[,min(which(temps==max(temps)))]) - return(list(best=best)) - } else { # Sequential optimization - optdes <- c() - for(iter in 1:p){ - candidx <- which(!((1:length(workGrid)) %in% optdes)) - seqcri <- rep(NA, length(candidx)) - for(i in 1:length(candidx)){ - tempdes <- sort(c(optdes,candidx[i])) - seqcri[i] <- TRCri(tempdes, ridge, Cov, workGrid) - } - optdes <- sort(c(optdes, candidx[min(which(seqcri == max(seqcri)))])) - } - return(list(best=optdes,med=NULL)) # based on sequential selection - } -} - -TRCri <- function(design, ridge, Cov, workGrid){ - # Optimization criterion for TR - # Numerical Integration, equal to matrix multiplication if time grid is year - design <- sort(design) - RidgeCov <- Cov + diag(ridge, nrow(Cov)) - designcovinv <- solve(RidgeCov[design,design]) - if(length(design) > 1){ - trcri <- trapzRcpp(X=workGrid,Y=diag(t(Cov[design,])%*%designcovinv%*%(Cov[design,]))) - } else { - trcri <- trapzRcpp(X=workGrid,Y=diag(Cov[design,]%*%designcovinv%*%(Cov[design,]))) - } - return(trcri) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/BinData.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/BinData.R deleted file mode 100644 index 845dfbfe..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/BinData.R +++ /dev/null @@ -1,53 +0,0 @@ -BinData = function(y,t,optns){ - - # Bin the data 'y' - # y : n-by-1 list of vectors - # t : n-by-1 list of vectors - # dataType : indicator about structure of the data - # (dense (2), or dataType data with missing values (1) or sparse (0)) - # verbose gives warning messages - # numBins: number of bins (if set) - - BinDataOutput <- list( newy <- NULL, newt <- NULL); - - dataType = optns$dataType; - verbose = optns$verbose; - - n = length(t); - ni = sapply(FUN= length,t); - - if (dataType == 'Sparse'){ - m = median(ni) - } else { - m = max(ni); - } - - # Check the number of bins automatically - if (is.null(numBins)){ - numBins = GetBinNum(n,m,dataType,verbose) - }else if( numBins <1){ - warning("number of bins must be positive integer! We reset to the default number of bins!\n") - numBins = GetBinNum(n,m,dataType,verbose) - } - - # If it is determined to be NULL return the unbinned data - if (is.null(numBins)){ - BinDataOutput$newt = t; - BinDataOutput$newy = y; - return( BinDataOutput ) - } - - numBins = ceiling(numBins); - - tt = unlist(t); - a0 = min(tt); - b0 = max(tt); - - for (i in 1:n){ - res = GetBinnedCurve(t[[i]], y[[i]], numBins, TRUE, TRUE, c(a0, b0)); - BinDataOutput$newt[i] = res$midpoint; - BinDataOutput$newy[i] = res$newy; - } - - return( BinDataOutput ) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/BinRawCov.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/BinRawCov.R deleted file mode 100644 index 94cf6224..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/BinRawCov.R +++ /dev/null @@ -1,46 +0,0 @@ -# Bin a `RawCov` object. Observations with the same time pairs are binned together and only one entry will be returned, containting the mean value (`meanVals`), weight (`count`), and residual sums of squares at each point (`RSS`). If `rcov$diag` is used then also bin the diagonal of the raw covariance similarly (with fields `diagMeans`, `diagRSS`, and `diagCount`. -# rcov: A `RawCov` object. -# returns: A list of class `BinnedRawCov`. -BinRawCov <- function(rcov) { - - if ('RawCC' %in% class(rcov)) { - rcov$cxxn <- rcov$rawCCov - rcov$tPairs <- rcov$tpairn - } - # Get the count, mean raw cov, and residual sum of squares at each pair of observed time points. - tmp <- aggregate(rcov$cxxn, list(rcov$tPairs[, 1], rcov$tPairs[, 2]), - function(yy) c(RCPPmean(yy), length(yy), RCPPvar(yy) * (length(yy) - 1))) - - tPairs <- unname(as.matrix(tmp[, 1:2])) - summaryDat <- tmp[, 3] - meanVals <- summaryDat[, 1] - count <- summaryDat[, 2] - RSS <- summaryDat[, 3] # Residual sum of squares. For implementing GCV. - RSS[is.na(RSS)] <- 0 - - diagRSS <- diagCount <- diagMeans <- tDiag <- NULL - if (!is.null(rcov$diag)) { - tmp <- aggregate(rcov$diag[, 2], list(rcov$diag[, 1]), - function(yy) c(RCPPmean(yy), length(yy), RCPPvar(yy) * (length(yy) - 1))) - - tDiag <- tmp[, 1] - diagSummary <- tmp[, 2] - diagMeans <- diagSummary[, 1] - diagCount <- diagSummary[, 2] - diagRSS <- diagSummary[, 3] - diagRSS[is.na(diagRSS)] <- 0 - } - - res <- list(tPairs=tPairs, meanVals=meanVals, RSS=RSS, - tDiag=tDiag, diagMeans=diagMeans, diagRSS=diagRSS, - count=count, - diagCount=diagCount, - error=rcov$error, dataType=rcov$dataType) - if ('RawCC' %in% class(rcov)) { - class(res) <- 'BinnedRawCC' - } else { - class(res) <- 'BinnedRawCov' - } - - return(res) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/BwNN.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/BwNN.R deleted file mode 100644 index 6addcf56..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/BwNN.R +++ /dev/null @@ -1,59 +0,0 @@ -#' Minimum bandwidth based on kNN criterion. -#' -#' Input a list of time points Lt, and the number of unique neighbors k and get the minimum bandwidth garanteeing k unique neighbours. -#' -#' @param Lt n-by-1 list of vectors -#' @param k number of unique neighbors for cov and mu (default = 3) -#' @param onlyCov Indicator to return only the minium bandwidth for the covariance -#' @param onlyMean Indicator to return only the minimum bandwidth for the mean -#' @examples -#' tinyGrid = list(c(1,7), c(2,3), 6, c(2,4), c(4,5)) -#' BwNN(tinyGrid, k = 2) # c(3,2) -#' @export - -BwNN <- function(Lt, k=3, onlyMean = FALSE, onlyCov = FALSE) { - - tPairs <- do.call(rbind, lapply(Lt, function(t) { - expand.grid(t, t) - })) - - if( k <1){ - stop("You cannot have less than 1 neighbours.") - } - - if( onlyMean && onlyCov){ - stop("BwNN returns nothing!") - } - - distNN2 = NULL - distNN1 = NULL - - if( !onlyMean ){ - uniqTPairs <- unique(tPairs) - distNN2 <- FindNN(uniqTPairs, k) - } - - if( !is.null(distNN2) && is.infinite(distNN2)){ - stop("You are asking an unreasonable ammount of neighbours for the covariace.") - } - - if( !onlyCov ){ - gridPts <- sort(unique(uniqTPairs[, 1])) - distNN1 <- max(diff(gridPts, lag=k)) - } - - if( !is.null(distNN1) && is.infinite(distNN1)){ - stop("You are asking an unreasonable ammount of neighbours for the mean.") - } - - return(c(cov = distNN2, mu = distNN1)) -} - -FindNN <- function(mat, k=3) { - max(apply(mat, 1, function(x) { - d <- abs(mat - matrix(1, nrow(mat), 1) %*% x) - distTox <- pmax(d[, 1], d[, 2]) - sort(distTox, partial=k + 1)[k + 1] - })) -} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/CVLwls1D.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/CVLwls1D.R deleted file mode 100644 index 2c1ccabc..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/CVLwls1D.R +++ /dev/null @@ -1,112 +0,0 @@ -CVLwls1D <- function(y, t, kernel, npoly, nder, dataType, kFolds = 5, useBW1SE = FALSE ){ - - # If 'y' and 't' are vectors "cheat" and break them in a list of 10 elements - if ( is.vector(y) && is.vector(t) && !is.list(t) && !is.list(y) ){ - if (length(t) < 21) { - stop("You are trying to use a local linear weight smoother in a vector with less than 21 values.\n") - } - myPartition = c(1:10, sample(10, length(t)-10, replace=TRUE)); - y = split(y, myPartition) - t = split(t, myPartition) - dataType = 'Sparse'; - } - - # Make everything into vectors - ncohort = length(t); - tt = unlist(t); - yy = unlist(y); - ind = unlist(lapply( 1:ncohort, function(j) rep(j, times=length(t[[j]])))); - yyn = yy[order(tt)]; - ind = ind[order(tt)]; - ttn = sort(tt); - - # Get minimum reasonable bandwidth - a0=ttn[1]; - b0=ttn[length(ttn)]; - rang = b0-a0; - dstar = Minb(tt, npoly+2); - if (dataType != 'Dense'){ - h0 = 2.5*dstar; - } else { - h0 = dstar; - } - if (h0 > rang/4){ - h0 = h0*.75; - warning(sprintf("Warning: the min bandwith choice is too big, reduce to %f !", (h0) )) - } - - # Get the candidate bandwidths - nbw = 11; - bw = rep(0,nbw-1); - n = length(unique(tt)); - for (i in 1:(nbw-1)){ - bw[i]=2.5*rang/n*(n/2.5)^((i-1)/(nbw-1)); # Straight from MATLAB - } - bw = bw-min(bw)+h0; - - #ave = rep(0, length(t[[1]])); - # - #if (dataType == 'Dense'){ - # for (i in 1:ncohort){ - # ave = ave + t[[i]]/ncohort; - # } - #} - - cv = matrix(0, ncol = length(bw), nrow = kFolds); - #count = c(); - theFolds = CreateFolds(unique(ind), k= kFolds) - - for (j in 1:(nbw-1)){ - # cv[j]=0; - # count[j]=0; - #for (i in 1:ncohort){ - for (i in 1:kFolds){ - - xout= ttn[ ind %in% theFolds[[i]]]; - obs = yyn[ ind %in% theFolds[[i]]]; - xin = ttn[!ind %in% theFolds[[i]]]; - yin = yyn[!ind %in% theFolds[[i]]]; - - win=rep(1,length(yin)); - #win[ind==i] = NA; - #if(dataType=='Dense') { - # yyn=(ave*ncohort-t[[i]])/(ncohort-1); - # ttn=t[[1]]; - # win=pracma::ones(1,length(t[[1]])); - # yyn = yyn[order(ttn)] - # ttn = sort(ttn) - #} - - mu = tryCatch( - Lwls1D(bw= bw[j], kernel_type = kernel, npoly=npoly, nder= nder, xin = xin, yin= yin, xout=xout, win = win), - error=function(err) { - warning('Invalid bandwidth during CV. Try enlarging the window size.') - return(Inf) - }) - - cv[i,j] = sum((obs-mu)^2) - # print(cv) - if(is.na(cv[i,j])){ - cv[i,j] = Inf; - } - #count[j] = count[j]+1; - } - } - #cv = cv[(count/ncohort>0.90)]; - #bw = bw[(count/ncohort>0.90)]; - if(min(cv) == Inf){ - stop("All bandwidths resulted in infinite CV costs.") - } - if( useBW1SE ){ - # This will pick the bandwidth that is the max but it's average cost is at most - # 1 standard error of the minimum cost / I use means so it is more straighforward what the SE is. - bopt = bw[max(which( - colMeans(cv) < min(colMeans(cv)) + apply(cv,2, sd)[which.min(colMeans(cv))]/sqrt(kFolds)))] - } else { - bopt = bw[which.min( colMeans(cv))]; - } - - return(bopt) - -} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/CheckAndCreateCOPoptions.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/CheckAndCreateCOPoptions.R deleted file mode 100644 index 56fb1978..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/CheckAndCreateCOPoptions.R +++ /dev/null @@ -1,113 +0,0 @@ -### CheckAndCreateCOPoptions # COP = CreateOutliersPlot - -CheckAndCreateCOPoptions <- function(optns,fObjClass){ - - if(is.null(optns$ifactor)){ - ifactor = NULL - } else { - ifactor = optns$ifactor - } - - if(is.null(optns$outlierList)){ - outlierList = NULL - } else { - outlierList = optns$outlierList - } - - if(is.null(optns$unimodal)){ - unimodal = NULL - } else { - unimodal = optns$unimodal - } - - if(is.null(optns$colSpectrum)){ - colSpectrum = NULL - } else { - colSpectrum = optns$colSpectrum - } - - if(is.null(optns$groupingType)){ - groupingType = 'standard' - } else { - groupingType = optns$groupingType - } - - if(is.null(optns$variant)){ - variant = 'KDE' - } else { - variant = optns$variant - } - - if(is.null(optns$nSlices)){ - nSlices = 4 - } else { - nSlices = optns$nSlices - } - - - if(is.null(optns$showSlices)){ - showSlices = FALSE - } else { - showSlices = optns$showSlices - } - - if(is.null(optns$fIndeces)){ - if(fObjClass == 'FPCA'){ - fIndeces <- c(1,2) - } else { - fIndeces <- c(1,1) - } - } else { - if( 2 < length(optns$fIndeces)){ - warning("fIndeces has more than two elements; only the first two will be used.") - } - fIndeces <- (optns$fIndeces[1:2]) - } - - if( !any( groupingType == c('standard','slice')) ){ - stop("You request an groupingType method not currenty available.") - } - if( !any( variant == c('KDE','bagplot', 'NN')) ){ - stop("You request an outlier detection method not currenty available.") - } - if ( variant == 'bagplot' && !is.element('aplpack', installed.packages()[,1]) ){ - stop("Cannot the use the bagplot method; the package 'aplpack' is unavailable.") - } - if ( variant == 'KDE' && !is.element('ks', installed.packages()[,1]) ){ - stop("Cannot the use the KDE method; the package 'ks' is unavailable.") - } - if ( !is.null(unimodal) && !is.logical(unimodal) ){ - stop("The variable 'unimodal' must be logical.") - } - if (is.null(colSpectrum)){ - colFunc = colorRampPalette(c("red", "yellow", 'blue')); - } else { - colFunc = colorRampPalette(colSpectrum) - } - if (!is.null(ifactor) && (1 >= ifactor) ){ - warning("It is nonsensical for an inflation factor to be <= 1. 'ifactor' set to 1.1.") - ifactor = 1.1; - } - if ( !(2 <= nSlices) || !(16 >= nSlices) || !(nSlices %% 1 == 0) ){ - warning("nSlices must be between a natural number between 2 and 16. 'nSlices' set to 4.") - nSlices = 4; - } - if(diff(range(fIndeces)) < .Machine$double.eps){ - if( fObjClass == 'FPCA'){ - stop("You request a scatter over the same component; check the fIndeces.") - } - } - if(is.null(optns$maxVar)){ - maxVar = !( fObjClass == 'FPCA') - } else { - maxVar = optns$maxVar - } - - - perfOptns <- list(nSlices = nSlices, ifactor = ifactor, colFunc = colFunc, fIndeces = fIndeces, maxVar = maxVar, - showSlices = showSlices, - variant = variant, groupingType = groupingType, unimodal = unimodal, outlierList = outlierList) - return(perfOptns) - - -} \ No newline at end of file diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/CheckData.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/CheckData.R deleted file mode 100644 index 4c6c3f4e..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/CheckData.R +++ /dev/null @@ -1,46 +0,0 @@ -#' Check data format -#' -#' Check if there are problems with the form and basic structure of the functional data 'y' and the recorded times 't'. -#' -#' @param y is a n-by-1 list of vectors -#' @param t is a n-by-1 list of vectors -#' @export - - -CheckData = function(y,t){ - - if(!is.list(y)){ - stop('y should be list \n') - } - if(!is.list(t)){ - stop('t should be list \n') - } - - if( length(t) != length(y)){ - stop('t and y should have the same length \n') - } - - ni_y = unlist(lapply(y,function(x) sum(!is.na(x)))) - if(all(ni_y == 1)){ - stop("FPCA is aborted because the data do not contain repeated measurements in y!\n"); - } - ni_tt = unlist(lapply(t,function(x) sum(!is.na(x)))) - if(all(ni_tt == 1)){ - stop("FPCA is aborted because the data do not contain repeated measurements in t!\n"); - } - if( !all(unlist(lapply(y,function(x) typeof(x) %in% c('integer', 'double') ) ) ) ){ - stop("FPCA is aborted because 'y' members are not all of type double or integer! Try \"lapply(y,function(x) typeof(x))\" to see the current types \n"); - } - if( !all(unlist(lapply(t,function(x) typeof(x) %in% c('integer', 'double'))) ) ){ - stop("FPCA is aborted because 't' members are not all of type double or integer! Try \"lapply(t,function(x) typeof(x))\" to see the current types \n"); - } - - if(any( unlist( lapply(t, function(x) length(x) != length(unique(x))))) ){ - stop("FPCA is aborted because within-subject 't' members have duplicated values. Try \"which( unlist( lapply(t, function(x) length(x) != length(unique(x)))))\" to see potentially problematic entries. \n"); - } - if( any(sapply(t[seq_len(min(1001, length(t)))], is.unsorted, na.rm=TRUE)) ) { - stop('Each vector in t should be in ascending order') - } - -} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/CheckOptions.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/CheckOptions.R deleted file mode 100644 index 91a497be..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/CheckOptions.R +++ /dev/null @@ -1,181 +0,0 @@ -#' Check option format -#' -#' Check if the options structure is valid and set the ones that are NULL -#' -#' @param t is a n-by-1 list of vectors -#' @param optns is an initialized option list -#' @param n is a total number of sample curves -#' @export - -CheckOptions = function(t,optns,n){ - - - if( !( any(optns[['useBinnedData']] == c('FORCE','AUTO','OFF')) )){ - # Force, turn off or automatically decide about the use of bin data - stop("FPCA is aborted because the argument: useBinnedData is invalid!\n"); - } - if( !( (length(optns[['userBwMu']])==1) && is.numeric(optns[['userBwMu']]) && (0<=optns[['userBwMu']]) ) ){ - # bandwidth Bhoice for mean function is using CV or GCV - stop("FPCA is aborted because the argument: userBwMu is invalid!\n"); - } - if( !( any(optns[['methodBwMu']] == c('Default','CV','GCV','GMeanAndGCV')) )){ - # bandwidth choice for mean function is GCV if userBwMu = 0 - stop("FPCA is aborted because the argument: methodBwMu is invalid!\n"); - } - if(!(length(optns[['userBwCov']])==1) && is.numeric(optns[['userBwCov']]) && (all(optns[['userBwCov']]>=0))){ - # bandwidth choice for covariance function is CV or GCV - stop("FPCA is aborted because the argument: userBwCov is invalid!\n"); - } - if( !( any(optns[['methodBwCov']] == c('Default','CV','GCV','GMeanAndGCV') ) )){ - # bandwidth choice for covariance function is GCV if userBwCov = c(0,0) - stop("FPCA is aborted because the argument: methodBwCov is invalid!\n"); - } - - if (is.nan(optns[['kFoldMuCov']]) || optns[['kFoldMuCov']] < 2) { - stop('Invalid `kFoldMuCov` option') - } - - if( !(any(optns[['methodSelectK']] == c('FVE','AIC','BIC')))){ - if(is.numeric(optns[['methodSelectK']])){ - if(as.integer(optns[['methodSelectK']]) != optns[['methodSelectK']] || optns[['methodSelectK']] <= 0 || optns[['methodSelectK']] > n){ - stop('FPCA is aborted because the argument: methodSelectK is invalid!\n') - } - } else { - stop('FPCA is aborted because the argument: methodSelectK is invalid!\n') - } - } - if( ( (length(optns[['FVEthreshold']])==1) && is.numeric(optns[['FVEthreshold']]) ) ){ - if (!( (0<=optns[['FVEthreshold']]) && (optns[['FVEthreshold']]<=1) ) ){ - # the Fraction-of-Variance-Explained - stop("FPCA is aborted because the argument: FVEthreshold is invalid!\n"); - } - } - if( !( (length(optns[['maxK']])==1) && is.numeric(optns[['maxK']]) && (1<=optns[['maxK']]) && (optns[['maxK']]<=n) )){ - # maximum number of principal components to consider - stop("FPCA is aborted because the argument: maxK is invalid!\n"); - } - #if( !is.null(optns$numComponents) ) { - # if( !( (length(optns$numComponents)==1) && is.numeric(optns$numComponents) && (1<=optns$numComponents) && (optns$numComponents<=n) )){ - # # maximum number of principal components to return - # stop("FPCA is aborted because the argument: numComponents is invalid!\n"); - # } - #} - if( !( is.null(optns[['dataType']]) || any(optns[['dataType']]==c("Sparse","DenseWithMV","Dense","p>>n")) )){ - #do we have regualr or sparse functional data - stop("FPCA is aborted because the argument: dataType is invalid!\n"); - } - if( ( is.null(optns[['dataType']]) )){ - optns[['dataType']] = IsRegular(t) - } - if(!is.logical(optns[['error']])){ - # error assumption with measurement error - stop("FPCA is aborted because the error option is invalid!\n"); - } - if( !( (length(optns[['nRegGrid']])==1) && is.numeric(optns[['nRegGrid']]) && (1<=optns[['nRegGrid']]) && (optns[['nRegGrid']]>optns[['maxK']]) ) ){ - # number of support points in each direction of covariance surface - stop("FPCA is aborted because the argument: nRegGrid is invalid!\n"); - } - if( !(any(optns[['methodXi']] == c('CE','IN')))){ - #method to estimate the PC scores - stop("FPCA is aborted because the argument: methodXi is invalid!\n"); - } - # if (optns[['methodXi']] == 'IN' && optns[['dataType']] != 'Dense') { - # stop("integration method can only be applied on dense data now!") - # } - if(!(any(optns[['kernel']] == c('epan','gauss','rect','quar','gausvar')))){ - #method to estimate the PC scores - stop("FPCA is aborted because the argument: kernel is invalid!\n"); - } - if( !( ( is.numeric(optns[['numBins']]) && (optns[['numBins']]>1)) || is.null(optns[['numBins']]) ) ){ - # Check suitability of number of bins - stop("FPCA is aborted because the argument: numBins is invalid!\n"); - } - if( ( ( optns[['useBinnedData']] == 'FORCE') && is.null(optns[['numBins']]) ) ){ - # Check that we have a number of the bins if we force binning - stop("FPCA is aborted because the argument: numBins is NULL but you FORCE binning!\n"); - } - if(!is.character(optns[['yname']])){ - # name of the variable analysed - stop("FPCA is aborted because the argument: yname is invalid!\n"); - } - if(!is.logical(optns[['plot']])){ - # make plot - stop("FPCA is aborted because the argument: plot is invalid!\n"); - } - if(!(any(optns[['rho']] == c('cv-random', 'cv', 'none', 'no')))){ - # truncation threshold for the iterative residual that is used - stop("FPCA is aborted because the argument: rho is invalid!\n"); - } - if(!is.logical(optns[['verbose']])){ - # display diagnostic messages - stop("FPCA is aborted because the argument: verbose is invalid!\n"); - } - if (! ( is.null(optns[['userMu']]) || - (is.list(optns[['userMu']]) && is.vector(optns[['userMu']][['t']]) && is.vector(optns[['userMu']][['mu']]) && - ( length(optns[['userMu']][['t']]) == length(optns[['userMu']][['mu']]) ) ))){ - # display diagnostic messages - stop("FPCA is aborted because the argument: userMu is invalid!\n"); - } - if (! ( is.null(optns[['userCov']]) || - ( is.list(optns[['userCov']]) && is.vector(optns[['userCov']][['t']]) && is.matrix(optns[['userCov']][['cov']]) && - (length(optns[['userCov']][['t']]) == ncol(optns[['userCov']][['cov']]) ) && ( isSymmetric(optns[['userCov']][['cov']]) ) ) ) ){ - # display diagnostic messages - stop("FPCA is aborted because the argument: userCov is invalid! (eg. Check if 'cov' is symmetric and 't' is of appropriate size.)\n"); - return(TRUE); - } - if (!is.null(optns[['userSigma2']])) { - if (!(is.numeric(optns[['userSigma2']]) && - length(optns[['userSigma2']]) == 1 && - optns[['userSigma2']] >= 0)) { - stop('userSigma2 invalid.') - } - - if (optns[['userSigma2']] == 0 && optns[['error']]) { - stop('userSigma2 specified to be 0 but error = TRUE. If no measurement error is assumed then use error = FALSE.') - } - } - if (!is.null(optns[['userRho']])) { - if (!(is.numeric(optns[['userRho']]) && - length(optns[['userRho']]) == 1 && - optns[['userRho']] >= 0)) { - stop('userSigma2 invalid.') - } - if (optns[['userRho']] == 0 && optns[['error']]) { - stop('userRho specified to be 0 but error = TRUE. If no measurement error is assumed then use error = FALSE.') - } - } - #if(!(any(optns[['methodMu']] == c('PACE','RARE','CrossSectional')))){ - # # user-defined mean functions - # stop("FPCA is aborted because the argument: methodMu is invalid!\n"); - #} - if( !( (length(optns[['outPercent']])==2) && is.numeric(optns[['outPercent']]) && all(0<=optns[['outPercent']]) && all(optns[['outPercent']]<=1) )){ - # display diagnostic messages - stop("FPCA is aborted because the argument: outPercent is invalid!\n"); - } - if( !( (length(optns[['rotationCut']])==2) && is.numeric(optns[['rotationCut']]) && all(0<=optns[['rotationCut']]) && all(optns[['rotationCut']]<=1) )){ - # display diagnostic messages - stop("FPCA is aborted because the argument: rotationCut is invalid!\n"); - } - if(is.logical(optns[['userCov']])){ - # display diagnostic messages - stop("FPCA is aborted because the argument: userCov is invalid!\n"); - } - if(!(any(optns[['methodMuCovEst']] == c('smooth', 'cross-sectional')))){ - stop("FPCA is aborted because the argument: methodMuCovEst is invalid!\n"); - } - - if(!is.logical(optns[['lean']])){ - # error assumption with measurement error - stop("FPCA is aborted because the lean option is invalid!\n"); - } - - if(!is.logical(optns[['useBW1SE']])){ - # error assumption with measurement error - stop("FPCA is aborted because the useBW1SE option is invalid!\n"); - } -# if (optns[['methodMuCovEst']] == 'smooth' && optns[['dataType']] == 'DenseWithMV') { -# stop('Smoothing method not supported for \'DenseWithMV\' dataType. Use \'Sparse\' dataType instead') -# } - -} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/CheckSVDOptions.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/CheckSVDOptions.R deleted file mode 100644 index 4f7c50fb..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/CheckSVDOptions.R +++ /dev/null @@ -1,18 +0,0 @@ -### CheckSVDOptions - -CheckSVDOptions <- function(Ly1, Lt1, Ly2, Lt2, SVDoptns){ - - if( (SVDoptns[['dataType1']]=='Sparse' && is.null(SVDoptns[['userMu1']])) || - (SVDoptns[['dataType2']]=='Sparse' && is.null(SVDoptns[['userMu2']])) ){ - stop('User specified mean function required for sparse functional data for cross covariance estimation.') - } - if(is.numeric(SVDoptns$methodSelectK)){ - if(SVDoptns$methodSelectK != round(SVDoptns$methodSelectK) || - SVDoptns$methodSelectK <= 0){ - stop("FSVD is aborted: 'methodSelectK' is invalid!\n") - } - } - if( !(SVDoptns$regulRS %in% c('sigma2','rho') ) ){ - stop("FSVD is aborted: Unknown regularization option. The argument 'regulRS' should be 'rho' or 'sigma2'!") - } -} \ No newline at end of file diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/CompFntCent.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/CompFntCent.R deleted file mode 100644 index 877c6524..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/CompFntCent.R +++ /dev/null @@ -1,29 +0,0 @@ -##### -##### centering conponent function by marginal mean -##### - -##### input variables: -##### f: evaluated values of component functions at estimation grid (N*d matrix) -##### j: index of centering for the j-th component function (scalar) -##### x: estimation grid (N*d matrix) -##### MgnJntDensity: evaluated values of marginal and 2-dim. joint densities (2-dim. list, referred to the output of 'MgnJntDensity') - -##### output: -##### NW marginal regression function kernel estimators at estimation grid (N*d matrix) - - -# centering -CompFntCent <- function(f,j,x,MgnJntDens){ - - fj <- f[,j] - xj <- x[,j] - - pMatMgn <- MgnJntDens$pMatMgn - - tmp1 <- pMatMgn[,j] - tmp <- fj-trapzRcpp(sort(xj),(fj*tmp1)[order(xj)]) - - return(tmp) - -} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/CondProjection.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/CondProjection.R deleted file mode 100644 index f9350e17..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/CondProjection.R +++ /dev/null @@ -1,57 +0,0 @@ -##### -##### conditional projection -##### - -##### input variables: -##### f: evaluated values of component functions at estimation grid (N*d matrix) -##### kj: index of conditional projection for the k-th component function on the j-th component function space (2-dim. vector) -##### x: estimation grid (N*d matrix) -##### X: covariate observation grid (n*d matrix) -##### MgnJntDensity: evaluated values of marginal and 2-dim. joint densities (2-dim. list, referred to the output of 'MgnJntDensity') - -##### output: -##### conditional projection of the k-th component function on the j-th component function space (N-dim. vector) - - -CondProjection <- function(f, kj, x, X, MgnJntDens){ - - N <- nrow(x) - n <- nrow(X) - d <- ncol(X) - - k <- kj[1] - j <- kj[2] - - xj <- x[,j] - xk <- c() - - fk <- f[,k] - if (length(fk)==n) { - xk <- X[,k] - } else { - xk <- x[,k] - } - - asdf <- MgnJntDens$pMatMgn[,j] - - tmpInd <- which(asdf!=0) - qwer <- MgnJntDens$pArrJnt[,tmpInd,k,j] - - if (length(tmpInd)>0) { - - pHat <- matrix(0,nrow=length(xk),ncol=length(xj)) - - pHat[,tmpInd] <- t(t(qwer)/asdf[tmpInd]) - - tmp <- c() - for (l in 1:ncol(pHat)) { - tmptmp <- fk*c(pHat[,l]) - tmp[l] <- trapzRcpp(sort(xk),tmptmp[order(xk)]) - } - - return(tmp) - - } else { - return(0) - } -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/ConvertSupport.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/ConvertSupport.R deleted file mode 100644 index bd7931df..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/ConvertSupport.R +++ /dev/null @@ -1,42 +0,0 @@ -#' Convert support of a mu/phi/cov etc. to and from obsGrid and workGrid -#' -#' Convert the support of a given function 1-D or 2-D function from 'fromGrd' to 'toGrid'. -#' Both grids need to be sorted. This is a interpolation/convenience function. -#' -#' @param fromGrid vector of points with input grid to interpolate from -#' @param toGrid vector of points with the target grid to interpolate on -#' @param mu any vector of function to be interpolated -#' @param phi any matrix, each column containing a function to be interpolated -#' @param Cov a square matrix supported on fromGrid * fromGrid, to be interpolated to toGrid * toGrid. -#' @param isCrossCov logical, indicating whether the input covariance is a cross-covariance. If so then the output is not made symmetric. -#' -#' @export - - -ConvertSupport <- function(fromGrid, toGrid, mu=NULL, Cov=NULL, phi=NULL, isCrossCov=FALSE) { - - # In case the range of toGrid is larger than fromGrid due to numeric error - buff <- .Machine$double.eps * max(abs(fromGrid)) * 3 - if (abs(toGrid[1] - fromGrid[1]) < buff) - toGrid[1] <- fromGrid[1] - if (abs(toGrid[length(toGrid)] - fromGrid[length(fromGrid)]) < buff) - toGrid[length(toGrid)] <- fromGrid[length(fromGrid)] - if ( ( fromGrid[1] - buff > toGrid[1]) || - ( fromGrid[length(fromGrid)] + buff < toGrid[length(toGrid)]) ) { - stop("Insufficient size of 'fromGrid'.")} - - if (!is.null(mu)) {# convert mu - return(MapX1D(fromGrid, mu, toGrid)) - } else if (!is.null(Cov)) { - gd <- expand.grid(X=toGrid, Y=toGrid) - ret <- matrix(interp2lin(fromGrid, fromGrid, Cov, gd$X, gd$Y), nrow=length(toGrid)) - if (!isCrossCov) { # ensure that covariance is symmetric - ret <- 0.5 * (ret + t(ret)) - } - return(ret) - } else if (!is.null(phi)) { - return(MapX1D(fromGrid, phi, toGrid)) - } - -} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateBWPlot.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateBWPlot.R deleted file mode 100644 index 66100009..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateBWPlot.R +++ /dev/null @@ -1,110 +0,0 @@ -#' Functional Principal Component Analysis Bandwidth Diagnostics plot -#' -#' This function by default creates the mean and first principal modes of variation plots for -#' 50%, 75%, 100%, 125% and 150% of the defined bandwidth choices in the fpcaObj provided as input. -#' If provided with a derivative options object (?FPCAder) it will return the -#' differentiated mean and first two principal modes of variations for 50%, 75%, 100%, 125% and 150% of the defined bandwidth choice. -#' -#' @param fpcaObj An FPCA class object returned by FPCA(). -#' @param derOptns A list of options to control the derivation parameters; see ?FPCAder. If NULL standard diagnostics are returned -#' @param bwMultipliers A vector of multipliers that the original 'bwMu' and 'bwCov' will be multiplied by. (default: c(0.50, 0.75, 1.00, 1.25, 1.50)) -#' - default: NULL -#' -#' @examples -#' set.seed(1) -#' n <- 25 -#' pts <- seq(0, 1, by=0.05) -#' sampWiener <- Wiener(n, pts) -#' sampWiener <- Sparsify(sampWiener, pts, 10) -#' res1 <- FPCA(sampWiener$Ly, sampWiener$Lt, -#' list(dataType='Sparse', error=FALSE, kernel='epan', verbose=FALSE)) -#' CreateBWPlot(res1) -#' @export - -CreateBWPlot <-function(fpcaObj, derOptns = NULL, bwMultipliers = NULL){ - - if(class(fpcaObj) != 'FPCA'){ - stop("Input class is incorrect; CreateDiagnosticsPlot() is only usable from FPCA objects.") - } - oldPar <- par(no.readonly=TRUE) - on.exit(par(oldPar)) - if( is.null(bwMultipliers)){ - bwMultipliers = c(0.50, 0.75, 1.00, 1.25, 1.50) - # This is knowingly wasteful as 1.00 is already computed; not having it would perplex the code - # unnecessarily though. - } - - M <- length(bwMultipliers) - - if(is.null(derOptns) || !is.list(derOptns)){ - - if(fpcaObj$optns$lean){ - stop("FPCA bandwidth diagnostics are not available for lean FPCA objects.") - } - - newFPCA <- function(mlt){ - optnsNew = fpcaObj$optns; - optnsNew[c('userBwMu', 'userBwCov')] = mlt * unlist(fpcaObj[c('bwMu', 'bwCov')]) - return( FPCA(fpcaObj[['inputData']][['Ly']], fpcaObj[['inputData']][['Lt']], optnsNew) ) - } - - yy = lapply( bwMultipliers, function(x) tryCatch( newFPCA(x), error = function(err) { - #warning('Probable invalid bandwidth. Try enlarging the window size.') - stop( paste( collapse =' ', c('Multiplier :', x, 'failed to return valid FPCA object. Change multiplier values.'))) - return(NA)})) - # if( any(is.na(yy))){ - # warning( paste( collapse =' ', c('Multipliers :', bwMultipliers[is.na(yy)], 'fail to return valid FPCA objects.'))) - # bwMultipliers = bwMultipliers[!is.na(yy)] - # M = length(bwMultipliers) - # yy[[is.na(yy)]] = NULL - # } - - par(mfrow=c(1,3)) - - Z = rbind( sapply(1:M, function(x) yy[[x]]$mu)); - matplot(x = fpcaObj$workGrid, lty= 1, type='l', Z, ylab= expression(paste(collapse = '', mu, "(s)")), xlab = 's') - grid(); legend('topright', lty = 1, col=1:M, legend = apply( rbind( rep('bwMu: ',M), round( digits = 2, bwMultipliers * fpcaObj$bwMu)), 2, paste, collapse = '')) - - Z = rbind(sapply(1:M, function(x) yy[[x]]$phi[,1])); - matplot(x = fpcaObj$workGrid, lty= 1, type='l', Z, ylab= expression(paste(collapse = '', phi[1], "(s)")), xlab = 's') - grid(); legend('topright', lty = 1, col=1:M, legend = apply( rbind( rep('bwCov: ',M), round( digits = 2, bwMultipliers * fpcaObj$bwCov)), 2, paste, collapse = '')) - - Z = rbind(sapply(1:M, function(x) yy[[x]]$phi[,2])); - matplot(x = fpcaObj$workGrid, lty= 1, type='l', Z, ylab= expression(paste(collapse = '', phi[2], "(s)")), xlab = 's') - grid(); legend('topright', lty = 1, col=1:M, legend = apply( rbind( rep('bwCov: ',M), round( digits= 2, bwMultipliers * fpcaObj$bwCov)), 2, paste, collapse = '')) - - - } else { - - derOptns <- SetDerOptions(fpcaObj,derOptns = derOptns) - p <- derOptns[['p']] - method <- derOptns[['method']] - bw <- derOptns[['bw']] - kernelType <- derOptns[['kernelType']] - k <- derOptns[['k']] - if(p==0){ - stop("Derivative diagnostics are inapplicable when p = 0") - } - - yy = lapply( bwMultipliers * bw, function(x) FPCAder(fpcaObj, list(p=p, method = method, kernelType = kernelType, k = k, bw = x))) - - par(mfrow=c(1,3)) - - Z = rbind(sapply(1:M, function(x) yy[[x]]$muDer)); - matplot(x = fpcaObj$workGrid, lty= 1, type='l', Z, ylab= expression(paste(collapse = '', 'd', mu, "/ds")), - main= substitute(paste("Derivatives of order ", p, " of ", mu)), xlab = 's') - grid(); legend('topright', lty = 1, col=1:M, legend = apply( rbind( rep('bw: ',M), round( digits=2, bwMultipliers * bw)), 2, paste, collapse = '')) - - Z = rbind(sapply(1:M, function(x) yy[[x]]$phiDer[,1])); - matplot(x = fpcaObj$workGrid, lty= 1, type='l', Z, ylab= expression(paste(collapse = '', 'd', phi[1], "/ds")), - main= substitute(paste("Derivatives of order ", p, " of ", phi[1])), xlab = 's') - grid(); legend('topright', lty = 1, col=1:M, legend = apply( rbind( rep('bw: ',M), round(digits= 2, bwMultipliers * bw)), 2, paste, collapse = '')) - - Z = rbind(sapply(1:M, function(x) yy[[x]]$phiDer[,2])); - matplot(x = fpcaObj$workGrid, lty= 1, type='l', Z, ylab= expression(paste(collapse = '', 'd', phi[2], "/ds")), - main= substitute(paste("Derivatives of order ", p, " of ", phi[2])), xlab = 's') - grid(); legend('topleft', lty = 1, col=1:M, legend = apply( rbind( rep('bw: ',M), round( bwMultipliers * bw, digits=2) ), 2, paste, collapse = '')) - - } -} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateBasis.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateBasis.R deleted file mode 100644 index 4306b2cb..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateBasis.R +++ /dev/null @@ -1,78 +0,0 @@ -#' Create an orthogonal basis of K functions in [0, 1], with nGrid points. -#' -#' @param K A positive integer specifying the number of eigenfunctions to generate. -#' @param pts A vector specifying the time points to evaluate the basis functions. -#' @param type A string for the type of orthogonal basis. -#' @return A K by nGrid matrix, each column containing an basis function. -#' -#' @examples -#' basis <- CreateBasis(3, type='fourier') -#' head(basis) -#' -#' @export -CreateBasis <- function(K, pts=seq(0, 1, length.out=50), type=c('cos', 'sin', 'fourier', 'legendre01', 'poly')) { - - nGrid <- length(pts) - type <- match.arg(type) - - stopifnot(is.numeric(K) && length(K) == 1 && K > 0) - - if (type == 'cos') { - res <- sapply(seq_len(K), function(k) - if (k == 1) { - rep(1, nGrid) - } else { - sqrt(2) * cos((k - 1) * pi * pts) - } - ) - } else if (type == 'sin') { - res <- sapply(seq_len(K), function(k) sqrt(2) * sin(k * pi * pts)) - } else if (type == 'fourier') { - res <- sapply(seq_len(K), function(k) - if (k == 1) { - rep(1, nGrid) - } else if (k %% 2 == 0) { - sqrt(2) * sin(k * pi * pts) - } else { - sqrt(2) * cos((k - 1) * pi * pts) - } - ) - } else if (type == 'legendre01') { - # coefMat <- matrix(0, K, K) - if (K == 1) { - res <- matrix(1, length(pts), 1) - } else if (K > 1) { - coefMat <- sapply(seq_len(K), function(n) { - coef <- rep(0, K) - # # coef[1] <- (-1)^(n - 1) - for (k in seq_len(n)) { - coef[k] <- (-1)^(n - k) * choose(n - 1, k - 1) * - choose(n + k - 2, k - 1) - } - coef * sqrt(2 * n - 1) - }) - xMat <- cbind(1, stats::poly(pts, K - 1, raw=TRUE)) - res <- xMat %*% coefMat - # browser() - } - - if (K >= 25) { - warning('Numeric unstability may occur. Use K < 25.') - } - } else if (type == 'poly') { - if (K == 1) { - res <- matrix(1, length(pts), 1) - } else if (K > 1) { - res <- cbind(1, stats::poly(pts, K - 1, raw=TRUE)) - } - - if (K >= 25) { - warning('Numeric unstability may occur. Use K < 25.') - } - } else if (type == 'unknown') { - stop('unknown basis type') - } - - res <- matrix(res, ncol=K) # prevent single length pts - res -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateCovPlot.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateCovPlot.R deleted file mode 100644 index 8ebd0504..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateCovPlot.R +++ /dev/null @@ -1,108 +0,0 @@ -#' Create the covariance surface plot based on the results from FPCA() or FPCder(). -#' -#' This function will open a new device if not instructed otherwise. -#' -#' @param fpcaObj returned object from FPCA(). -#' @param covPlotType a string specifying the type of covariance surface to be plotted: -#' 'Smoothed': plot the smoothed cov surface -#' 'Fitted': plot the fitted cov surface -#' @param isInteractive an option for interactive plot: -#' TRUE: interactive plot; FALSE: printable plot -#' @param colSpectrum character vector to be use as input in the 'colorRampPalette' function defining the colouring scheme (default: c('blue','red')) -#' @param ... other arguments passed into persp3d, persp3D, plot3d or points3D for plotting options -#' -#' @examples -#' set.seed(1) -#' n <- 20 -#' pts <- seq(0, 1, by=0.05) -#' sampWiener <- Wiener(n, pts) -#' sampWiener <- Sparsify(sampWiener, pts, 10) -#' res <- FPCA(sampWiener$Ly, sampWiener$Lt, -#' list(dataType='Sparse', error=FALSE, kernel='epan', verbose=TRUE)) -#' CreateCovPlot(res) -#' @export - -CreateCovPlot = function(fpcaObj, covPlotType = 'Fitted', isInteractive = FALSE, colSpectrum = NULL, ...){ - - if(!(class(fpcaObj) %in% c('FPCA','FSVD','FPCAder'))){ - stop("Input object must be class: 'FPCA','FSVD' or 'FPCAder'.") - } - - if('FSVD' == class(fpcaObj)){ - if('Fitted' != covPlotType){ - stop("Only 'Fitted' cross-covariance is available when using FSVD objects.") - } - covPlotType == 'Fitted'; - } - - ## Check if plotting covariance surface for fitted covariance surface is proper - if(covPlotType == 'Fitted'){ - no_opt = ifelse('FSVD' == class(fpcaObj), length(fpcaObj$sValues), length(fpcaObj$lambda)) - if(length(no_opt) == 0){ - warning('Warning: Input is not a valid FPCA, FSVD or FPCder output.') - return() - } else if(no_opt == 1){ - warning('Warning: Covariance surface is not available when only one principal component is used.') - return() - } - } - - if(is.null(colSpectrum)){ - colFunc = colorRampPalette( c('blue','red') ); - } else { - colFunc = colorRampPalette(colSpectrum) - } - - ## Check if rgl is installed - if (isInteractive == FALSE && (!'plot3D' %in% installed.packages()[, ])) { - stop("CreateCovPlot requires package 'plot3D'") - } - if(isInteractive == TRUE && is.element('rgl', installed.packages()[,1]) == FALSE){ - stop("Interactive plot requires package 'rgl'") - } - - ## Define the variables to plot - if(covPlotType == 'Smoothed'){ - covSurf = fpcaObj$smoothedCov # smoothed covariance matrix - } else if(covPlotType == 'Fitted'){ - if('FSVD' == class(fpcaObj)){ - covSurf = fpcaObj$CrCov # fitted cross-covariance matrix - } else { - covSurf = fpcaObj$fittedCov # fitted covariance matrix - } - } else { - warning("Covariance plot type no recognised; using default ('Fitted').") - covSurf = fpcaObj$fittedCov - covPlotType = 'Fitted' - } - - ## Define the plotting arguments - args1 <- list( xlab='s', ylab='t', col = colFunc(24), zlab = 'C(s,t)', lighting=FALSE) - if( covPlotType == 'Fitted' ){ - if('FSVD' == class(fpcaObj)){ - args1$main = 'Fitted cross-covariance surface'; - } else { - args1$main = 'Fitted covariance surface'; - } - } else { - args1$main = 'Smoothed covariance surface'; - } - if (isInteractive){ # If is interactive make it blue instead of topological - args1$col = 'blue' - } - inargs <- list(...) - args1[names(inargs)] <- inargs - if('FSVD' == class(fpcaObj)){ - args2 = list (x = fpcaObj$grid1, y = fpcaObj$grid2, z = covSurf) - } else { - workGrid = fpcaObj$workGrid - args2 = list (x = workGrid, y = workGrid, z = covSurf) - } - - ## Plot the thing - if(isInteractive){ # Interactive Plot - do.call(rgl::persp3d, c(args2, args1)) - } else { # Static plot - do.call(plot3D::persp3D, c(args2, args1)) - } -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateDesignPlot.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateDesignPlot.R deleted file mode 100644 index ce442d54..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateDesignPlot.R +++ /dev/null @@ -1,125 +0,0 @@ -#' Create the design plot of the functional data. -#' -#' Display the scatter plot of \eqn{\{(T_{ij}, T_{il}\}_{i \le n,\, j,l \le n_i }}{{(T_{ij}, T_{il}}}, which is used to diagnose whether the design time points are sufficiently dense in the domain of interest so that the 2D smoothed covariance estimate is feasible. See Figure 2 of Yao et al (2005). This function will open a new device if not instructed otherwise. -#' -#' @param Lt a list of observed time points for functional data -#' @param obsGrid a vector of sorted observed time points. Default to the -#' unique time points in Lt. -#' @param isColorPlot an option for colorful plot: -#' TRUE: create color plot with color indicating counts -#' FALSE: create black and white plot with dots indicating observed time pairs -#' @param noDiagonal an option specifying plotting the diagonal design points: -#' TRUE: remove diagonal time pairs -#' FALSE: do not remove diagonal time pairs -#' @param addLegend Logical, default TRUE -#' @param ... Other arguments passed into \code{plot()}. -#' @references -#' \cite{Yao, Fang, Hans-Georg Mueller, and Jane-Ling Wang. "Functional data analysis for sparse longitudinal data." Journal of the American Statistical Association 100, no. 470 (2005): 577-590.} -#' -#' @examples -#' set.seed(1) -#' n <- 20 -#' pts <- seq(0, 1, by=0.05) -#' sampWiener <- Wiener(n, pts) -#' sampWiener <- Sparsify(sampWiener, pts, 10) -#' CreateDesignPlot(sampWiener$Lt, sort(unique(unlist(sampWiener$Lt)))) -#' @export - -CreateDesignPlot = function(Lt, obsGrid = NULL, isColorPlot=TRUE, noDiagonal=TRUE, addLegend= TRUE, ...){ - - if( class(Lt) != 'list'){ - stop("You do need to pass a list argument to 'CreateDesignPlot'!"); - } - if( is.null(obsGrid)){ - obsGrid = sort(unique(unlist(Lt))) - } - - args1 <- list( main="Design Plot", xlab= 'Observed time grid', ylab= 'Observed time grid', addLegend = addLegend) - inargs <- list(...) - args1[names(inargs)] <- inargs - - - # Check if we have very dense data (for visualization) on a regular grid - if( (length(obsGrid) > 101) & all(sapply(Lt, function(u) identical(obsGrid, u)))){ - res = matrix(length(Lt), nrow = 101, ncol = 101) - obsGrid = approx(x = seq(0,1,length.out = length(obsGrid)), y = obsGrid, - xout = seq(0,1,length.out = 101))$y - } else { - res = DesignPlotCount(Lt, obsGrid, noDiagonal, isColorPlot) - } - - oldpty <- par()[['pty']] - on.exit(par(pty=oldpty)) - par(pty="s") - if(isColorPlot == TRUE){ - createColorPlot(res, obsGrid, args1) - } else { - createBlackPlot(res, obsGrid, args1) - } - -} - -createBlackPlot = function(res, obsGrid, args1){ - - args1$addLegend = NULL - if( is.null(args1$col)){ - args1$col = 'black' - } - if (is.null(args1$cex)){ - args1$cex = 0.33 - } - if (is.null(args1$pch)){ - args1$pch = 19 - } - - u1 = as.vector(res) - u2 = as.vector(t(res)) - t1 = rep(obsGrid, times = length(obsGrid) ) - t2 = rep(obsGrid, each = length(obsGrid)) - do.call( plot, c(args1, list( x = t1[u1 != 0], y = t2[u2 !=0] ) ) ) - -} - -createColorPlot = function(res, obsGrid, args1){ - - res[res > 4] = 4; - notZero <- which(res != 0, arr.ind=TRUE) - nnres <- res[notZero] - - addLegend <- args1$addLegend; - args1$addLegend <- NULL - - if ( is.null(args1$col) ){ - colVec <- c(`1`='black', `2`='blue', `3`='green', `4`='red') - args1$col = colVec[nnres]; - } else { - colVec = args1$col; - } - - if ( is.null(args1$pch) ){ - pchVec <- rep(19, length(colVec)) - args1$pch = pchVec[nnres]; - } else { - pchVec = args1$pch; - } - - if ( is.null(args1$cex) ){ - cexVec <- seq(from=0.3, by=0.1, length.out=length(colVec)) - args1$cex <- cexVec[nnres] - } else { - cexVec <- args1$cex; - } - - do.call( plot, c(args1, list( x = obsGrid[notZero[, 1]], y = obsGrid[notZero[, 2]]) )) - - pars <- par() - # plotWidth <- (pars[['fin']][1] - sum(pars[['mai']][c(2, 4)])) - if(addLegend){ - if (!identical(unique(nnres), 1)){ - legend('right', c('1','2','3','4+'), pch = pchVec, col=colVec, pt.cex=1.5, title = 'Count',bg='white', - inset=-pars[['mai']][4] / pars[['pin']][1] * 1.5, xpd=TRUE) - } - } -} - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateDiagnosticsPlot.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateDiagnosticsPlot.R deleted file mode 100644 index e24d251b..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateDiagnosticsPlot.R +++ /dev/null @@ -1,12 +0,0 @@ -#' Functional Principal Component Analysis Diagnostics plot -#' -#' Deprecated. Use \code{plot.FPCA} instead. -#' @param ... passed into \code{plot.FPCA}. -#' @export -#' @rdname plot.FPCA - -CreateDiagnosticsPlot <-function(...){ - message('Deprecated and will be removed in the next version. Use plot.FPCA() instead.') - plot.FPCA(...) -} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateFolds.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateFolds.R deleted file mode 100644 index 33353563..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateFolds.R +++ /dev/null @@ -1,60 +0,0 @@ -# Returns the test sets indices for k-Fold cross-validation. Stratified sampling is used. -# y: the response vector, for stratifying -# k: number of folds -# returns: a list of length k, containing the test-set indices. -CreateFolds <- function(y, k=10) { - n <- length(y) - if (n == 0) - stop('response length is zero') - - uniqY <- unique(y) - if (!is.factor(y) && length(y) / length(uniqY) >= k) { -# Intepret the integer-valued y as class labels. Stratify if the number of class labels is <= 5. - y <- factor(y) - } else if (is.numeric(y)) { -# 5-stratum Stratified sampling - if (n >= 5 * k) { - breaks <- unique(quantile(y, probs=seq(0, 1, length.out=5))) - y <- as.integer(cut(y, breaks, include.lowest=TRUE)) - } else - y <- rep(1, length(y)) - } - - sampList <- tapply(seq_along(y), y, SimpleFolds, k=k, simplify=FALSE) - list0 <- list() - length(list0) <- k - samp <- Reduce(function(list1, list2) { - mapply(c, list1, list2, SIMPLIFY=FALSE) - }, sampList, list0) - - return(samp) -} - -# Simple k-fold test-set samples. -# Input a set of SAMPLES -# Returns: a list of length k, containing the SAMPLES. -SimpleFolds <- function(yy, k=10) { - if (length(yy) > 1) - allSamp <- sample(yy) - else - allSamp <- yy - - n <- length(yy) - nEach <- n %/% k - samp <- list() - length(samp) <- k - for (i in seq_along(samp)) { - if (nEach > 0) - samp[[i]] <- allSamp[1:nEach + (i - 1) * nEach] - else - samp[[i]] <- numeric(0) - } - restSamp <- allSamp[seq(nEach * k + 1, length(allSamp), length.out=length(allSamp) - nEach * k)] - restInd <- sample(k, length(restSamp)) - for (i in seq_along(restInd)) { - sampInd <- restInd[i] - samp[[sampInd]] <- c(samp[[sampInd]], restSamp[i]) - } - - return(samp) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateFuncBoxPlot.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateFuncBoxPlot.R deleted file mode 100644 index a60d226c..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateFuncBoxPlot.R +++ /dev/null @@ -1,247 +0,0 @@ -#' Create functional boxplot using 'bagplot', 'KDE' or 'pointwise' methodology -#' -#' Using an FPCA object create a functional box-plot based on the function scores. -#' The green line corresponds to the functional median, the dark grey area to the area spanned -#' by the curves within the 25th and 75-th percentile and the light gret to the area spanned -#' by the curves within the 2.5th and 97.5-th percentile. -#' -#' @param fpcaObj An object of class FPCA returned by the function FPCA(). -#' @param optns A list of options control parameters specified by \code{list(name=value)}. See `Details'. -#' @param ... Additional arguments for the 'plot' function. -#' -#' @details Available control options are -#' \describe{ -#' \item{ifactor}{inflation ifactor for the bag-plot defining the loop of bag-plot or multiplying ifactor the KDE pilot bandwidth matrix. (see ?aplpack::compute.bagplot; ?ks::Hpi respectively; default: 2.58; 2 respectively).} -#' \item{variant}{string defining the method used ('KDE', 'pointwise' or 'bagplot') (default: 'bagplot')} -#' \item{unimodal}{logical specifying if the KDE estimate should be unimodal (default: FALSE, relavant only for variant='KDE')} -#' \item{addIndx}{vector of indeces corresponding to which samples one should overlay (Default: NULL)} -#' \item{K}{integer number of the first K components used for the representation. (default: length(fpcaObj$lambda ))} -#' } -#' -#' @examples -#' set.seed(1) -#' n <- 20 -#' pts <- seq(0, 1, by=0.05) -#' sampWiener <- Wiener(n, pts) -#' sampWiener <- Sparsify(sampWiener, pts, 10) -#' res <- FPCA(sampWiener$Ly, sampWiener$Lt, -#' list(dataType='Sparse', error=FALSE, kernel='epan', verbose=TRUE)) -#' CreateFuncBoxPlot(res, list(addIndx=c(1:3)) ) -#' @references -#' \cite{P. J. Rousseeuw, I. Ruts, J. W. Tukey (1999): The bagplot: a bivariate boxplot, The American Statistician, vol. 53, no. 4, 382-387} -#' -#' @export - -CreateFuncBoxPlot <- function(fpcaObj, optns = list() , ...){ - - if (!is.null(optns[['k']])) { - optns[['K']] <- optns[['k']] - optns[['k']] <- NULL - warning("specifying 'k' is deprecated. Use 'K' instead!") - } - - if(is.null(optns$K)){ - K = length(fpcaObj$lambda) - } else { - K = optns$K - } - - if(is.null(optns$addIndx)){ - addIndx = NULL - } else { - addIndx = optns$addIndx - } - - if(is.null(optns$ifactor)){ - ifactor = NULL - } else { - ifactor = optns$ifactor - } - - if(is.null(optns$outlierList)){ - outlierList = NULL - } else { - outlierList = optns$outlierList - } - - if(is.null(optns$unimodal)){ - unimodal = FALSE - } else { - unimodal = optns$unimodal - } - - if(is.null(optns$variant)){ - variant = 'bagplot' - } else { - variant = optns$variant - } - if ( !is.null(unimodal) && !is.logical(unimodal) ){ - stop("The variable 'unimodal' must be logical.") - } - args1 <- list( xlab='s', ylab='') - inargs <- list(...) - args1[names(inargs)] <- inargs - if( is.na( any(match( variant, c('pointwise', 'bagplot', 'KDE') )) ) ){ - stop("This plotting utility function can only implement a 'KDE', 'bagplot' or 'pointwise' mapping.") - return(NULL) - } - if ( variant == 'bagplot' && !is.element('aplpack', installed.packages()[,1])){ - warning('Cannot use bagplot because aplpack::compute.bagplot is unavailable; reverting to point-wise'); - variant = 'pointwise' - } - if ( variant == 'KDE' && !is.element('ks', installed.packages()[,1])){ - warning('Cannot use KDE because ks::kde is unavailable; reverting to point-wise'); - variant = 'pointwise' - } - - fittedCurves <- fitted(fpcaObj, K = K, ...) - s <- fpcaObj$workGrid - N <- nrow(fittedCurves) - - if(is.null(args1$ylim)){ - args1$ylim = range(fittedCurves) - } - - do.call(plot, c(list(type='n'), list(x=s), list(y=s), - (args1))) - grid() - - if ( length(fpcaObj$lambda) <2) { - warning('There is a single component used. We will use a standard boxpot on the FPC scores.'); - bgObj = boxplot(plot=FALSE, fpcaObj$xiEst[,1] ) - fittedCurvesFence = fittedCurves[ (fpcaObj$xiEst > bgObj$stats[1]) & (fpcaObj$xiEst < bgObj$stats[5]),]; - fittedCurvesBag = fittedCurves[ (fpcaObj$xiEst > bgObj$stats[2]) & (fpcaObj$xiEst < bgObj$stats[4]),]; - polygon(x=c(s, rev(s)), y = c(apply(rbind(fittedCurvesFence, fittedCurvesBag),2, min), - rev(apply(rbind( fittedCurvesFence, fittedCurvesBag),2, max))), col= 'lightgrey',border=0) - polygon(x=c(s, rev(s)), y = c(apply(fittedCurvesBag,2, min), - rev(apply(fittedCurvesBag,2,max))), col= 'darkgrey',border=1) - lines(x=s, y= apply(fittedCurves,2, mean) , col='red') - } - - if ( length(fpcaObj$lambda)> 1) { - - if ( !is.null(ifactor) && (1 >= ifactor) ){ - warning("It is nonsensical for an inflation factor to be <= 1. 'ifactor' set to 1.1.") - ifactor = 1.1; - } - if ( variant == 'bagplot' ){ - - if ( is.null (ifactor) ){ - ifactor = 2.58 - } - - bgObj = aplpack::compute.bagplot(x= fpcaObj$xiEst[,1], y= fpcaObj$xiEst[,2], approx.limit=3333, factor = ifactor) - fittedCurvesFence = fittedCurves[ is.element( rowSums(fpcaObj$xiEst[,1:2]), rowSums(bgObj$pxy.outer) ),]; - fittedCurvesBag = fittedCurves[ is.element( rowSums(fpcaObj$xiEst[,1:2]), rowSums(bgObj$pxy.bag) ),]; - - Y95 = c(apply(rbind( fittedCurvesFence, fittedCurvesBag),2, min), - rev(apply(rbind( fittedCurvesFence, fittedCurvesBag),2, max))) - Y50 = c(apply(fittedCurvesBag,2, min), rev(apply(fittedCurvesBag,2,max))) - medianPoint = which.min( apply( fpcaObj$xiEst[,1:2], 1, function(x) sqrt(sum( (x- bgObj$center)^2)) ) ) - } else if (variant== 'pointwise'){ - Y95 = c(apply(fittedCurves,2, quantile, 0.025), - rev(apply(fittedCurves,2, quantile, 0.975))) - Y50 = c(apply(fittedCurves,2, quantile, 0.25), - rev(apply(fittedCurves,2, quantile, 0.75))) - mediansCurve = apply(fittedCurves,2, quantile, 0.50); - medianPoint = NULL - } else if (variant == 'KDE') { - if (is.null(ifactor)){ - ifactor = 2 - } - fhat <- ks::kde(x=fpcaObj$xiEst[,1:2], gridsize = c(400,400), compute.cont = TRUE, - H = ks::Hpi( x=fpcaObj$xiEst[,1:2], binned=TRUE, pilot="dscalar" ) * ifactor) - zin = fhat$estimate - - if( is.null(unimodal) || unimodal ){ - maxIndex = which( zin == max(zin), arr.ind = TRUE) - zin = monotoniseMatrix( fhat$estimate, maxIndex[1], maxIndex[2]) - } - - qq = quickNNeval(xin = fhat$eval.points[[1]], yin = fhat$eval.points[[2]], zin = zin, - xout = fpcaObj$xiEst[,1], yout = fpcaObj$xiEst[,2] ) - curves0to50= which(qq >= fhat$cont[50]) - curves50to95 = which(qq > fhat$cont[95] & qq <= fhat$cont[50]) - - fittedCurvesBag = fittedCurves[ c(curves0to50 ),]; - fittedCurvesFence = fittedCurves[ c( curves50to95,curves0to50), ]; - Y95 = c( apply(rbind(fittedCurvesFence, fittedCurvesBag),2, min), - rev(apply(rbind(fittedCurvesFence, fittedCurvesBag),2, max))) - Y50 = c(apply(fittedCurvesBag,2, min), rev(apply(fittedCurvesBag,2,max))) - medianPoint = which.min( apply( fpcaObj$xiEst[,1:2], 1, function(x) sqrt(sum( (x- c(0,0))^2)) ) ) - - } else { - stop('Additional variants are not yet implemented') - } - polygon(x=c(s, rev(s)), y = Y95, col= 'lightgrey',border=1) - polygon(x=c(s, rev(s)), y = Y50, col= 'darkgrey', border=1) - #n = length(Y95)*0.5 - #lines(x=s, y= apply( cbind(Y95[1:n],Y50[1:n]),1, min) , col='black', lwd=1) - #lines(x=s, y= apply( cbind(rev(Y95[n+(1:n)]), rev(Y50[n+(1:n)])),1, max) , col='black', lwd=1) - - if(!is.null(medianPoint)){ - mediansCurve = fittedCurves[medianPoint,] - } - - lines(x=s, col='green', lwd=2, y = mediansCurve) - } - - Ly = fpcaObj$inputData$Ly - Lt = fpcaObj$inputData$Lt - - #add sample lines - if (!is.null(addIndx) && !is.null(Ly) && !is.null(Lt) ){ - for (i in 1:length(addIndx) ) { - lines(x = Lt[[addIndx[i]]] , y= Ly[[addIndx[i]]], lwd = 1.5, type='o', pch=0, col=args1$col) - } - } -} - -quickNNeval <- function(xin,yin, zin, xout, yout){ - xindeces = sapply( xout, function(myArg) which.min( abs( xin - myArg) ), simplify = TRUE) - yindeces = sapply( yout, function(myArg) which.min( abs( yin - myArg) ), simplify = TRUE ) - return( zin[ cbind(xindeces,yindeces)] ) -} - -monotonise <- function(x, maxIndex = NULL){ - xq = x; - if (is.null(maxIndex)){ - maxIndex = which.max(x); - } - - if( maxIndex != length(x) ){ - for (i in 1:( length(x) - maxIndex)){ - if( xq[ i + maxIndex] > xq[maxIndex + i - 1] ){ - xq[ i + maxIndex] = xq[maxIndex + i - 1] - } - } - } - if (maxIndex >= 3){ - for (i in 1:(maxIndex - 2 )){ - if( xq[ - 1 - i + maxIndex] > xq[maxIndex - i] ){ - xq[ - 1- i + maxIndex] = xq[maxIndex - i] - } - } - } - return(xq) -} - -monotoniseMatrix = function(zin, xmaxind, ymaxind){ - if(is.null(xmaxind) && is.null(ymaxind)){ - maxIndx = which( max(zin) == zin, arr.ind = TRUE) - xmaxind = maxIndx[1] - ymaxind = maxIndx[2] - } - zq = zin; - for (j in 1:dim(zin)[2]){ - for (i in 1:dim(zin)[1]){ - if (i == 1 || j == 1 || j == dim(zin)[1] || i == dim(zin)[2]){ - sizeOut = max( abs(xmaxind - i) +1, abs(ymaxind - j) +1 ) - xcoord = round( ( seq(i, xmaxind , length.out = sizeOut) ) ) - ycoord = round( ( seq(j, ymaxind , length.out = sizeOut) ) ) - zq[ cbind(xcoord,ycoord) ] = monotonise( zq[ cbind(xcoord,ycoord) ]) - } - } - } - return(zq) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateModeOfVarPlot.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateModeOfVarPlot.R deleted file mode 100644 index 0f487350..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateModeOfVarPlot.R +++ /dev/null @@ -1,89 +0,0 @@ -#' Functional Principal Component Analysis mode of variation plot -#' -#' Create the k-th mode of variation plot around the mean. The red-line is -#' the functional mean, the grey shaded areas show the range of variations -#' around the mean: \eqn{ \pm Q \sqrt{\lambda_k} \phi_k}{+/- Q sqrt{lambda_k} phi_k} -#' for the dark grey area Q = 1, and for the light grey are Q = 2. In the case of 'rainbow' plot -#' the blue edge corresponds to Q = -3, the green edge to Q = +3 and the red-line to Q = 0 (the mean). -#' In the case of 'minimal' the blue line corresponds to Q = -2 and green line to Q = 2. -#' -#' @param fpcaObj An FPCA class object returned by FPCA(). -#' @param k The k-th mode of variation to plot (default k = 1) -#' @param plotType Character indicating the creation of "standard" shaded plot, a "rainbow"-plot or a "minimal" sketch plot (default: "standard") -#' @param colSpectrum Character vector to be use as input in the 'colorRampPalette' function defining the outliers colours (default: c("blue","red", "green"), relavant only for rainbowPlot=TRUE) -#' @param ... Additional arguments for the \code{plot} function. -#' -#' @examples -#' set.seed(1) -#' n <- 20 -#' pts <- seq(0, 1, by=0.05) -#' sampWiener <- Wiener(n, pts) -#' sampWiener <- Sparsify(sampWiener, pts, 10) -#' res <- FPCA(sampWiener$Ly, sampWiener$Lt, -#' list(dataType='Sparse', error=FALSE, kernel='epan', verbose=TRUE)) -#' CreateModeOfVarPlot(res) -#' @export - -CreateModeOfVarPlot <-function(fpcaObj, k = 1, plotType = "standard", colSpectrum = NULL, ...){ - - if( !(any(plotType %in% c("standard", "rainbow", "minimal") ) ) ){ - stop('Unknown plotType. Must be: "standard", "rainbow", "minimal".') - } - - if(k> length(fpcaObj$lambda) ){ - stop("You are asking to plot a mode of variation that is incomputable.") - } - - if( is.null(colSpectrum) ){ - colSpectrum = c("blue","red", "green") - } - - - args1 <- list( main=paste( collapse=" ", "Variation associated with FPC", k,":", round(digits= 2, fpcaObj$cumFVE[k]), "%" ), xlab='s', ylab='') - inargs <- list(...) - - obsGrid = fpcaObj$obsGrid - s = fpcaObj$workGrid - mu = fpcaObj$mu - - sigma = sqrt(fpcaObj$lambda[k]) - sigma1 = sqrt(fpcaObj$lambda[1]) - phi = fpcaObj$phi[,k] - phi1 = fpcaObj$phi[,1] - - if( is.null(inargs$ylim)){ - inargs$ylim=range(c( 3* sigma1 * phi1 + mu , -3* sigma1 * phi1 + mu )) - } - - args1[names(inargs)] <- inargs - - if(plotType != "rainbow"){ - do.call(plot, c(list(type='n'), list(x=s), list(y=s), args1)) - grid() - if(plotType == "standard"){ - - polygon(x=c(s, rev(s)), y = c( -2* sigma * phi + mu, - rev(2* sigma * phi + mu)), col= 'lightgrey',border=NA) - polygon(x=c(s, rev(s)), y = c( -1* sigma * phi + mu, - rev(1* sigma * phi + mu)), col= 'darkgrey',border=NA) - } else { - lines( x=s, y = -2* sigma * phi + mu, col = "blue", lwd= 2, lty= 3) - lines( x=s, y = +2* sigma * phi + mu, col = "green", lwd= 2, lty= 2) - } - lines(x=s, y=mu , col='red') - } else { - # The numver of modes as well as the colour palette could/shoud be possibly user-defined - numOfModes = 257 # Just a large number of make things look "somewhat solid". - thisColPalette = colorRampPalette(colSpectrum)(numOfModes) - - Qmatrix = (seq(-2 ,2 ,length.out = numOfModes) %*% t(fpcaObj$phi[,k] * sqrt(fpcaObj$lambda[k]))) + - matrix(rep(mu,numOfModes), nrow=numOfModes, byrow = TRUE) - - do.call(matplot, c(list(type='n'), list(x=s), list(y=t(Qmatrix)), args1)) - grid() - do.call(matplot, - c(list(type='l'), list(add=TRUE) , list(x=s), list(y=t(Qmatrix)), list(col= thisColPalette), list(lty=1), list(lwd=2))) - lines(x=s, y=mu , col= thisColPalette[129]) - - } -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateOutliersPlot.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateOutliersPlot.R deleted file mode 100644 index 397c429b..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateOutliersPlot.R +++ /dev/null @@ -1,309 +0,0 @@ -#' Functional Principal Component or Functional Singular Value Decomposition Scores Plot using 'bagplot' or 'KDE' methodology -#' -#' This function will create, using the first components scores, a set of convex hulls of the scores based on 'bagplot' or 'KDE' methodology. -#' -#' @param fObj A class object returned by FPCA() or FSVD(). -#' @param optns A list of options control parameters specified by \code{list(name=value)}. See `Details'. -#' @param ... Additional arguments for the 'plot' function. -#' -#' @details Available control options are -#' \describe{ -#' \item{ifactor}{inflation ifactor for the bag-plot defining the loop of bag-plot or multiplying ifactor the KDE pilot bandwidth matrix. (see ?aplpack::compute.bagplot; ?ks::Hpi respectively; default: 2.58; 2 respectively).} -#' \item{variant}{string defining the outlier method used ('KDE', 'NN' or 'bagplot') (default: 'KDE')} -#' \item{unimodal}{logical specifying if the KDE estimate should be unimodal (default: FALSE, relavant only for variant='KDE')} -#' \item{maxVar}{logical specifying if during slicing we should used the directions of maximum variance (default: FALSE for FPCA, TRUE for FSVD)} -#' \item{nSlices}{integer between 3 and 16, denoting the number of slices to be used (default: 4, relavant only for groupingType='slice') } -#' \item{showSlices}{logical specifying if during slicing we should show the outline of the slice (default: FALSE)} -#' \item{colSpectrum}{character vector to be use as input in the 'colorRampPalette' function defining the outliers colours (default: c("red", "yellow", 'blue'), relavant only for groupingType='slice') } -#' \item{groupingType}{string specifying if a slice grouping ('slice') or a standard percentile/bagplot grouping ('standard') should be returned (default: 'standard')} -#' \item{fIndeces}{a two-component vector with the index of the mode of variation to consider (default: c(1,2) for FPCA and c(1,1) for FSVD)} -#' } -#' -#' @return An (temporarily) invisible copy of a list containing the labels associated with each of sample curves. -#' -#' @examples -#' \dontrun{ -#' set.seed(1) -#' n <- 420 -#' pts <- seq(0, 1, by=0.05) -#' sampWiener <- Wiener(n, pts) -#' sampWiener <- Sparsify(sampWiener, pts, 10) -#' res <- FPCA(sampWiener$Ly, sampWiener$Lt, -#' list(dataType='Sparse', error=FALSE, kernel='epan', verbose=TRUE)) -#' CreateOutliersPlot(res) -#' } -#' @references -#' \cite{P. J. Rousseeuw, I. Ruts, J. W. Tukey (1999): The bagplot: a bivariate boxplot, The American Statistician, vol. 53, no. 4, 382-387} -#' \cite{R. J. Hyndman and H. L. Shang. (2010) Rainbow plots, bagplots, and boxplots for functional data, Journal of Computational and Graphical Statistics, 19(1), 29-45} -#' -#' @export - -CreateOutliersPlot <- function(fObj, optns = NULL, ...){ - - fObjClass <- class(fObj) - if( !(fObjClass %in% c('FSVD','FPCA')) ){ - stop("CreateOutliersPlot() expects an FPCA or an FSVD object as input.") - } - - newOptns <- CheckAndCreateCOPoptions(optns,fObjClass); - - nSlices = newOptns$nSlices; ifactor = newOptns$ifactor; - colFunc = newOptns$colFunc; fIndeces = newOptns$fIndeces; - variant = newOptns$variant; groupingType = newOptns$groupingType; - unimodal = newOptns$unimodal; outlierList = newOptns$outlierList; - maxVar = newOptns$maxVar; showSlices = newOptns$showSlices - - fVarAlls <- c(); - if(fObjClass == 'FPCA'){ - fVarAlls <- fObj$lambda - } else { - fVarAlls <- (fObj$sValues)^2 - } - - if(fIndeces[2] > length(fVarAlls)){ - stop("You requested a mode of variation that is not available.") - } - - fScores1 <- fScores2 <- c(); - if(fObjClass == 'FPCA'){ - fScores1 <- fObj$xiEst[,fIndeces[1]] - fScores2 <- fObj$xiEst[,fIndeces[2]] - } else { - fScores1 <- fObj$sScores1[,fIndeces[1]] - fScores2 <- fObj$sScores2[,fIndeces[2]] - } - fScoresAll <- cbind(fScores1, fScores2) - - xedge = 1.05 * max( abs(fScores1)) - yedge = 1.05 * max( abs(fScores2)) - - args1 <- list(); - if(fObjClass == 'FSVD'){ - args1 <- list( pch=10, xlab=paste('S1 FSC', fIndeces[1] ,' scores ', sep='' ), - ylab=paste('S2 FSC', fIndeces[2] ,' scores ', sep='' ), - xlim = c(-xedge, xedge), ylim =c(-yedge, yedge), lwd= 2) - } else { - args1 <- list( pch=10, xlab=paste('FPC', fIndeces[1] ,' scores ', round(fObj$cumFVE[fIndeces[1]]), '%', sep='' ), - ylab=paste('FPC', fIndeces[2] ,' scores ', round( diff( fObj$cumFVE[c(fIndeces[2]-1, fIndeces[2])])), '%', sep='' ), - xlim = c(-xedge, xedge), ylim =c(-yedge, yedge), lwd= 2) - } - inargs <- list(...) - args1[names(inargs)] <- inargs - - nComp <- length(fVarAlls) - - if(nComp <2 ){ - stop("This plotting utility function needs at least two functional components.") - return(NULL) - } - - if ( variant == 'bagplot' ){ - - if ( is.null((ifactor))){ ifactor = 2.58 } - bgObj = aplpack::compute.bagplot(x= fScores1, y= fScores2, approx.limit=3333 , factor = ifactor) - # I do this because panel.first() does not work with the do.call() - - if(groupingType =='standard'){ - - args2 = list(x= fScores1, y= fScores2, cex= .33, type='n' ) - do.call(plot, c(args2, args1)) - points(x = fScores1, y = fScores2, cex= .33, panel.first = grid(), lwd= 2) - lines( bgObj$hull.bag[c(1:nrow(bgObj$hull.bag),1),], col=2, lwd=2) - lines( bgObj$hull.loop[c(1:nrow(bgObj$hull.loop),1),], col=4, lwd=2) - legend(legend= c('0.500', 'The fence'), x='topright', col=c(2,4), lwd=2) - - return( invisible( list( - 'bag' = match( apply(bgObj$pxy.bag,1, prod), apply( bgObj$xydata,1, prod)), - 'loop'= match( apply(bgObj$pxy.outer,1, prod), apply( bgObj$xydata,1, prod)), - 'outlier' = ifelse( is.null(bgObj$pxy.outlier), NA, - match( apply(bgObj$pxy.outlier,1, prod) ,apply( bgObj$xydata,1, prod))) - ) ) ) - } else { # groupingType : slice - - N <- nrow(fScoresAll) - kNNindeces95plus <- (1:N %in% match( apply(bgObj$pxy.outlier,1, prod) ,apply( bgObj$xydata,1, prod))) - return( makeSlicePlot(nSlices, colFunc, p95plusInd = kNNindeces95plus, N, args1, - scoreEsts = fScoresAll , varEsts = fVarAlls[fIndeces], - useDirOfMaxVar = maxVar, showSlices = showSlices) ) - - } - } else if (variant == 'KDE') { # variant 'kde' - - if ( is.null((ifactor))){ ifactor = 2 } - fhat <- ks::kde(x=fScoresAll, gridsize = c(400,400), compute.cont = TRUE, - H = ks::Hpi( x=fScoresAll, binned=TRUE, pilot="dscalar" ) * ifactor) - zin = fhat$estimate - if( !is.null(unimodal) && unimodal ){ - maxIndex = which( fhat$estimate == max(fhat$estimate), arr.ind = TRUE) - zin = monotoniseMatrix( fhat$estimate, maxIndex[1], maxIndex[2]) - } - qq = quickNNeval(xin = fhat$eval.points[[1]], yin = fhat$eval.points[[2]], zin = zin, - xout = fScores1, yout = fScores2 ) - - if(groupingType =='standard'){ - args2 = list (x= fhat$eval.points[[1]], y=fhat$eval.points[[2]], z = zin, - labcex=1.66, col= c('black','blue','red'), levels = fhat$cont[c(50, 95, 99)], labels = c('50%', '95%', '99%')) - do.call(graphics::contour, c(args2, args1)); - grid(col = "#e6e6e6") - - points(fScoresAll[qq <= fhat$cont[99], ],cex=0.5, col='orange', pch=10 , lwd =2 ) - points(fScoresAll[qq > fhat$cont[99] & qq <= fhat$cont[95], ],cex=0.33, col='red', pch=10, lwd =2 ) - points(fScoresAll[qq > fhat$cont[95] & qq <= fhat$cont[50], ],cex=0.33, col='blue', pch=10 , lwd =2 ) - points(fScoresAll[qq >= fhat$cont[50], ],cex=0.33, col='black' , pch=10, lwd =2 ) - legend('bottomleft', c('< 50%','50%-95%','95%-99%','> 99%'), pch = 19, - col= c('black','blue','red', 'orange'), pt.cex=1.5, bg='white' ) - - return( invisible( list( 'p0to50'= which(qq >= fhat$cont[50]), - 'p50to95' = which(qq > fhat$cont[95] & qq <= fhat$cont[50]), - 'p95to99' = which(qq > fhat$cont[99] & qq <= fhat$cont[95]), - 'p99plus' = which(qq <= fhat$cont[99]) ))) - } else { # groupingType : slice - - kNNindeces95plus <- qq <= fhat$cont[95] - return( makeSlicePlot(nSlices, colFunc, p95plusInd = kNNindeces95plus, N, args1, - scoreEsts = fScoresAll , varEsts = fVarAlls[fIndeces], - useDirOfMaxVar = maxVar, showSlices = showSlices) ) - - } - } else if (variant == 'NN') { - - centrePoint = c(0,0); - distName = 'euclidean'; - N <- nrow(fScoresAll) - k99 <- floor(0.99*N); - k95 <- floor(0.95*N); - k50 <- floor(0.50*N); - scaledXi <- apply(fScoresAll, 2, scale) - distances <- apply(scaledXi, 1, function(aRow) dist(x = rbind(aRow, centrePoint), method = distName) ) - kNNindeces0to99 <- sort(x = distances, index.return = TRUE)$ix[1:k99] # Partial sort should be better - kNNindeces0to50 <- kNNindeces0to99[1:k50] - kNNindeces50to95 <- kNNindeces0to99[(1+k50):k95] - kNNindeces95to99 <- kNNindeces0to99[(1+k95):k99] - kNNindeces99plus <- setdiff(1:N, kNNindeces0to99) - - if(groupingType =='standard'){ - - args2 = list (x = fScores1, y = fScores2, cex= .33, type='n' ) - do.call(plot, c(args2, args1)) - grid(col = "#e6e6e6") - points(fScoresAll[kNNindeces99plus,],cex=0.5, col='orange', pch=10 , lwd =2 ) - points(fScoresAll[kNNindeces95to99,],cex=0.33, col='red', pch=10, lwd =2 ) - points(fScoresAll[kNNindeces50to95,],cex=0.33, col='blue', pch=10 , lwd =2 ) - points(fScoresAll[kNNindeces0to50, ],cex=0.33, col='black' , pch=10, lwd =2 ) - legend('bottomleft', c('< 50%','50%-95%','95%-99%','> 99%'), pch = 19, - col= c('black','blue','red', 'orange'), pt.cex=1.5, bg='white' ) - - return( invisible( list( 'p0to50'= kNNindeces0to50, - 'p50to95' = kNNindeces50to95, - 'p95to99' = kNNindeces95to99, - 'p99plus' = kNNindeces99plus))) - } else { # groupingType : slice - - kNNindeces95plus <- (1:N %in% setdiff(1:N, kNNindeces0to99[1:k95])) - return( makeSlicePlot(nSlices, colFunc, p95plusInd = kNNindeces95plus, N, args1, - scoreEsts = fScoresAll, varEsts = fVarAlls[fIndeces], - useDirOfMaxVar = maxVar, showSlices = showSlices) ) - - } - } -} - -makeSlicePlot <- function( nSlices, colFunc, p95plusInd, N, args1, args2, scoreEsts, varEsts, useDirOfMaxVar, showSlices){ - - - kNNindeces95plus <- p95plusInd - - args2 = list (x = scoreEsts[,1], y = scoreEsts[,2], cex= .33, type='n' ) - do.call(plot, c(args2, args1)) - grid(col = "#e6e6e6") - - points(scoreEsts[!p95plusInd, ],cex=0.33, col='black' , pch=10, lwd =2 ) - Qstr = apply(scoreEsts, 2, scale, center = FALSE) # - #scoreEsts / matrix( c( rep( sqrt(varEsts ), each= length(scoreEsts[,1]))), ncol=2); - - dirOfMaxVar <- c(1,0); - if(useDirOfMaxVar){ - dirOfMaxVar <- svd(scoreEsts, nv = 1)$v; - if(all(dirOfMaxVar <0) ){ - dirOfMaxVar = -dirOfMaxVar - } - abline(0, dirOfMaxVar[2]/dirOfMaxVar[1], col='magenta', lty=2) # Uncomment if you want to see the direction of max variance - } - - colPal = colFunc( nSlices ) - v = 1:nSlices; - colPal = colPal[v] # this just gives a smooth change and maximized the diffference between oppositve slices - outlierList <- list() - # steps = seq(-1, (nSlices-1) *2 -1 , by =2 ) - angles <- seq(0,2*pi, length.out = nSlices + 1) - 1*pi/nSlices + atan2(dirOfMaxVar[2],dirOfMaxVar[1]) - sd1 = sd(scoreEsts[,1]); - sd2 = sd(scoreEsts[,2]); - for( i in 1:nSlices){ - angle = angles[i] # atan2(dirOfMaxVar[2],dirOfMaxVar[1]) + steps[i] * pi/nSlices - multiplier1 = sign( sin( angle + pi/2) ) - multiplier2 = sign( cos( angle + pi/ (nSlices/2))) - qrtIndx = multiplier1 * Qstr[,2] > multiplier1 * tan(angle) * Qstr[,1] & - multiplier2 * Qstr[,2] < multiplier2 * tan(angle + pi/ (nSlices/2) ) * Qstr[,1] - outlierList[[i]] = qrtIndx & kNNindeces95plus - points(scoreEsts[ outlierList[[i]], c(1,2), drop=FALSE], cex=0.93, col= colPal[i], pch=3, lwd =2 ) - if(showSlices){ - bigNumber = 10 * max(abs(as.vector(scoreEsts))) - lines(x = c(0, bigNumber * multiplier1), col=colPal[i], - y = c(0, bigNumber * multiplier1 * tan(angle) * sd2 / sd1)) - #lines(x = c(0, bigNumber * multiplier2), col=colPal[i], - # y = c(0, bigNumber * multiplier2 * tan(angle + pi/ (nSlices/2) ) * sd2 / sd1)) - } - } - return( invisible( list( 'p0to95'= which(!p95plusInd), - 'outlier' = sapply(outlierList, which), - 'outlierColours' = colPal)) ) -} - -quickNNeval <- function(xin,yin, zin, xout, yout){ - xindeces = sapply( xout, function(myArg) which.min( abs( xin - myArg) ), simplify = TRUE) - yindeces = sapply( yout, function(myArg) which.min( abs( yin - myArg) ), simplify = TRUE ) - return( zin[ cbind(xindeces,yindeces)] ) -} - -monotonise <- function(x, maxIndex = NULL){ - xq = x; - if (is.null(maxIndex)){ - maxIndex = which.max(x); - } - - if( maxIndex != length(x) ){ - for (i in 1:( length(x) - maxIndex)){ - if( xq[ i + maxIndex] > xq[maxIndex + i - 1] ){ - xq[ i + maxIndex] = xq[maxIndex + i - 1] - } - } - } - if (maxIndex >= 3){ - for (i in 1:(maxIndex - 2 )){ - if( xq[ - 1 - i + maxIndex] > xq[maxIndex - i] ){ - xq[ - 1- i + maxIndex] = xq[maxIndex - i] - } - } - } - return(xq) -} - -monotoniseMatrix = function(zin, xmaxind, ymaxind){ - if(is.null(xmaxind) && is.null(ymaxind)){ - maxIndx = which( max(zin) == zin, arr.ind = TRUE) - xmaxind = maxIndx[1] - ymaxind = maxIndx[2] - } - zq = zin; - for (j in 1:dim(zin)[2]){ - for (i in 1:dim(zin)[1]){ - if (i == 1 || j == 1 || j == dim(zin)[1] || i == dim(zin)[2]){ - sizeOut = max( abs(xmaxind - i) +1, abs(ymaxind - j) +1 ) - xcoord = round( ( seq(i, xmaxind , length.out = sizeOut) ) ) - ycoord = round( ( seq(j, ymaxind , length.out = sizeOut) ) ) - zq[ cbind(xcoord,ycoord) ] = monotonise( zq[ cbind(xcoord,ycoord) ]) - } - } - } - return(zq) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/CreatePathPlot.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/CreatePathPlot.R deleted file mode 100644 index 72fea8e0..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/CreatePathPlot.R +++ /dev/null @@ -1,142 +0,0 @@ -#' Create the fitted sample path plot based on the results from FPCA(). -#' -#' @param fpcaObj Returned object from FPCA(). -#' @param subset A vector of indices or a logical vector for subsetting the -#' observations. -#' @param K The number of components to reconstruct the fitted sample paths. -#' @param inputData A list of length 2 containing the sparse/dense -#' (unsupported yet) observations. \code{inputData} needs to contain two -#' fields: \code{Lt} for a list of time points and \code{Ly} for a list of -#' observations. Default to the `inputData` field within `fpcaObj`. -#' @param showObs Whether to plot the original observations for each subject. -#' @param obsOnly Whether to show only the original curves. -#' @param showMean Whether to plot the mean function as a bold solid curve. -#' @param derOptns A list of options to control derivation parameters; see `fitted.FPCA'. (default = NULL) -#' @param ... other arguments passed into matplot for plotting options -#' @examples -#' set.seed(1) -#' n <- 20 -#' pts <- seq(0, 1, by=0.05) -#' sampWiener <- Wiener(n, pts) -#' sampWiener <- Sparsify(sampWiener, pts, 10) -#' res <- FPCA(sampWiener$Ly, sampWiener$Lt, -#' list(dataType='Sparse', error=FALSE, kernel='epan', -#' verbose=TRUE)) -#' CreatePathPlot(res, subset=1:5) -#' -#' # CreatePathPlot has a lot of usages: -#' \dontrun{ -#' CreatePathPlot(res) -#' CreatePathPlot(res, 1:20) -#' CreatePathPlot(res, 1:20, showObs=FALSE) -#' CreatePathPlot(res, 1:20, showMean=TRUE, showObs=FALSE) -#' CreatePathPlot(res, 1:20, obsOnly=TRUE) -#' CreatePathPlot(res, 1:20, obsOnly=TRUE, showObs=FALSE) -#' CreatePathPlot(inputData=sampWiener, subset=1:20, obsOnly=TRUE)} -#' -#' @export - -CreatePathPlot = function(fpcaObj, subset, K=NULL, - inputData=fpcaObj[['inputData']], - showObs=!is.null(inputData), - obsOnly=FALSE, showMean=FALSE, - derOptns = list(p=0), ...) { - - if (missing(fpcaObj)) { - showFit <- FALSE - n <- length(inputData[['Lt']]) - isDer <- FALSE - } else { - isDer <- 'FPCAder' %in% class(fpcaObj) || (!is.null(derOptns[['p']]) && - derOptns[['p']] >= 1) - showFit <- !obsOnly - n <- dim(fpcaObj[['xiEst']])[1] - } - - inargs <- list(...) - if (!is.null(inargs[['k']])) { - K <- inargs[['k']] - inargs[['k']] <- NULL - warning("specifying 'k' is deprecated. Use 'K' instead!") - } - - if (isDer && missing(showObs)) { - # makes no sense to show original observations with derivatives. - showObs <- FALSE - } - - if (!is.null(inputData)) { - if (!all(c('Lt', 'Ly') %in% names(inputData))) { - stop('inputData does not contain the required fields `Lt` and `Ly`') - } - } - - if (showObs) { - if (is.null(inputData)) { - stop('Cannot show the sparse observations due to unspecified input data') - } else { - if (length(inputData[['Lt']]) != n) - stop('length of inputData mismatches that in fpcaObj') - } - } - - if (missing(subset)) { - subset <- seq_len(n) - } - - if (!missing(fpcaObj)) { - workGrid <- fpcaObj[['workGrid']] - } else { - workGrid <- NA - } - - if (showFit) { - fit <- fitted(fpcaObj, K=K, derOptns = derOptns)[subset, , drop=FALSE] - } - - defaultColPalette = palette() - args1 <- list( xlab= 's', ylab= ' ',col = defaultColPalette, pch=1) - args1[names(inargs)] <- inargs - - #matplot(obst, obsy, type='p',...) - #args2 = list (x = obst, y = obsy, type='p' ) - - plotx <- ploty <- numeric(0) - - if( showObs || obsOnly ) { - # make a matrix with NAs for the sparse observations. - maxN_i <- max(sapply(inputData[['Lt']][subset], length)) - obst <- sapply(inputData[['Lt']][subset], function(x) c(x, rep(NA, maxN_i - length(x)))) - obsy <- sapply(inputData[['Ly']][subset], function(x) c(x, rep(NA, maxN_i - length(x)))) - plotx <- c(plotx, t(obst)) - ploty <- c(ploty, t(obsy)) - } - - if (showFit) { - plotx <- c(plotx, rep(workGrid, nrow(fit))) - ploty <- c(ploty, t(fit)) - } - - # Make canvas - do.call(plot, c(list(x=plotx, y=ploty, type='n'), args1)) - - if (obsOnly) { - do.call(matplot, c(list(x=obst, y=obsy, type='l', add=TRUE), args1)) - } - if (showObs) { - do.call(matplot, c(list(x=obst, y=obsy, type='p', add=TRUE), args1)) - } - if (showFit) { # plot fitted curves - do.call(matplot, c(list(x=workGrid, y=t(fit), type='l', add=TRUE ), args1)) - } - if (showMean) { - if (!isDer) { - meanCurve <- fpcaObj[['mu']] - } else { # isDer - meanCurve <- fpcaObj[['muDer']] - } - lines(workGrid, meanCurve, lty=1, lwd=2) - } - - invisible() -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateScreePlot.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateScreePlot.R deleted file mode 100644 index fa4111fb..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateScreePlot.R +++ /dev/null @@ -1,46 +0,0 @@ -#' Create the scree plot for the fitted eigenvalues -#' -#' This function will open a new device if not instructed otherwise. -#' -#' @param fpcaObj A object of class FPCA returned by the function FPCA(). -#' @param ... Additional arguments for the 'plot' function. -#' -#' @examples -#' set.seed(1) -#' n <- 20 -#' pts <- seq(0, 1, by=0.05) -#' sampWiener <- Wiener(n, pts) -#' sampWiener <- Sparsify(sampWiener, pts, 10) -#' res <- FPCA(sampWiener$Ly, sampWiener$Lt, -#' list(dataType='Sparse', error=FALSE, kernel='epan', verbose=TRUE)) -#' CreateScreePlot(res) -#' @export - -CreateScreePlot <-function(fpcaObj, ...){ - - args1 <- list( main="Scree-plot", ylab='Fraction of Variance Explained', xlab='Number of components') - inargs <- list(...) - args1[names(inargs)] <- inargs - - ys <- fpcaObj$cumFVE; - - - if( !is.vector(ys) ){ - stop('Please use a vector as input.') - } - if(max(ys) > 100){ - warning('The maximum number in the input vector is larger than 100; are sure it is right?'); - } - if(any(ys < 0) || any(diff(ys) <0) ){ - stop('This does not appear to be a valid cumulative FVE vector. Please check it carefully.') - } - - dfbar <- do.call( barplot, c( args1, list( ylim=c(0,105)), list(axes=FALSE), list(height = rep(NA,length(ys))) ) ) - - abline(h=(seq(0,100,5)), col="lightgray", lty="dotted") - barplot(c(ys[1], diff(ys)), add = TRUE ) - lines(dfbar, y= ys, col='red') - points(dfbar, y= ys, col='red') - legend("right", "Cumul. FVE", col='red', lty=1, pch=1, bty='n') - -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateStringingPlot.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateStringingPlot.R deleted file mode 100644 index c4772408..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateStringingPlot.R +++ /dev/null @@ -1,82 +0,0 @@ -#' Create plots for observed and stringed high dimensional data -#' -#' The function produces the following three plots: -#' 1) A plot of predictors (standardized if specified so during stringing) in original order for a subset of observations; -#' 2) A plot of predictors in stringed order for the same subset of observations; -#' 3) A plot of the stringing function, which is the stringed order vs. the original order. -#' -#' @param stringingObj A stringing object of class "Stringing", returned by the function Stringing. -#' @param subset A vector of indices or a logical vector for subsetting the observations. If missing, first min(n,50) observations will be plotted where n is the sample size. -#' @param ... Other arguments passed into matplot for plotting options -#' @examples -#' set.seed(1) -#' n <- 50 -#' wiener = Wiener(n = n)[,-1] -#' p = ncol(wiener) -#' rdmorder = sample(size = p, x=1:p, replace = FALSE) -#' stringingfit = Stringing(X = wiener[,rdmorder], disOptns = "correlation") -#' diff_norev = sum(abs(rdmorder[stringingfit$StringingOrder] - 1:p)) -#' diff_rev = sum(abs(rdmorder[stringingfit$StringingOrder] - p:1)) -#' if(diff_rev <= diff_norev){ -#' stringingfit$StringingOrder = rev(stringingfit$StringingOrder) -#' stringingfit$Ly = lapply(stringingfit$Ly, rev) -#' } -#' CreateStringingPlot(stringingfit, 1:20) -#' -#' @export - -CreateStringingPlot <- function(stringingObj, subset, ...){ - if(class(stringingObj) != "Stringing"){ - stop("Invalid input class for the stringing object. Need to be returned from the Stringing function.") - } - n <- nrow(stringingObj$Xin) - p <- ncol(stringingObj$Xin) - if(missing(subset)){ - subset <- seq_len(min(n, 50)) - } - subset = subset[which(subset > 0)] - subset = unique(subset) - if( !all(subset %in% seq_len(n)) ){ - stop("Invalid subset of subjects specified for generating plots. Need to be a subset of the set of row indices.") - } - ylabel = "Standardized Predictors" - X = stringingObj$Xstd - if(is.null(stringingObj$Xstd)){ - X = stringingObj$Xin - ylabel = "Observed Predictors" - } - - inargs = list(...) # additional options for plotting - - defaultColPalette = palette() - args1 <- list( xlab= 'Observed Order', ylab= ylabel, col = defaultColPalette, pch=1) - args1[names(inargs)] <- inargs - - args2 <- list( xlab= 'Stringed Order', ylab= ylabel, col = defaultColPalette, pch=1) - args2[names(inargs)] <- inargs - - plotx = matrix(rep(seq_len(p), length(subset)), nrow = length(subset), byrow = TRUE) - ploty1 = X[subset, ,drop = FALSE] - ploty2 = X[subset, stringingObj$StringingOrder, drop = FALSE] - - # 1. plot for the original observations - # Make canvas - do.call(plot, c(list(x=plotx, y=ploty1, type='n'), args1)) - # plot the observed/standardized predictors - do.call(matplot, c(list(x=t(plotx), y=t(ploty1), type='l', add = TRUE), args1)) - readline("Press enter to continue.") - - # 2. plot for the stringed observations - # Make canvas - do.call(plot, c(list(x=plotx, y=ploty2, type='n'), args2)) - # plot the stringed predictors - do.call(matplot, c(list(x=t(plotx), y=t(ploty2), type='l', add = TRUE), args2)) - readline("Press enter to continue.") - - # 3. plot the stringing function - plot(seq_len(ncol(X)), stringingObj$StringingOrder, - xlab="Observed Order", ylab="Stringed Order", pch = 18) - par(mfrow=c(1,1)) - - invisible() -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateTrueMean.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateTrueMean.R deleted file mode 100644 index 03c9f81d..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/CreateTrueMean.R +++ /dev/null @@ -1,8 +0,0 @@ -CreateTrueMean = function(tt,optns){ - # old mu_true - - tt[!(tt >= 0 & tt <= optns)] = 0 - mu = (tt+sin(tt)) - return(mu[!is.na(mu)]) - -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/DesignPlotCount.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/DesignPlotCount.R deleted file mode 100644 index 6a4303fe..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/DesignPlotCount.R +++ /dev/null @@ -1,46 +0,0 @@ -# This function is used to create count matrix based on -# observed pairs of time points for the raw covariance. - -###### -# Input: -###### -# t: n * 1 array contains time points for n subjects -# obsGrid: 1 * N vector contains sorted unique time points from t -# noDiagonal: TRUE: set diagonal count as 0 -# FALSE: don't set diagonal count as 0 -# isColorPlot: TRUE: the resulting matrix has 1 indicates there exists points for out1(i) and out1(j) -# FALSE: the resulting matrix contains counts of points for out1(i) and out1(j) -###### -# Output: -###### -# res: N * N matrix contains count for each distinct pairs of -# time points - -DesignPlotCount = function(t, obsGrid, noDiagonal, isColorPlot){ - N = length(obsGrid) # number of distinct observed time pts - res = matrix(0, nrow = N, ncol = N) - - for(cur in t){ - curidx = match(cur, obsGrid) - if(isColorPlot == FALSE){ - res[curidx, curidx] = 1 - } else { - res[curidx, curidx] = res[curidx, curidx] + 1 - } - } - - if(noDiagonal == TRUE){ - diag(res) = 0 - } - - return(res) -} - -# searchID = function(cur, obsGrid){ - # ni = length(cur) - # id = rep(0, ni) - # for(i in 1:ni){ - # id[i] = which(obsGrid == cur[i]) - # } - # return(id) -# } diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/DynCorr.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/DynCorr.R deleted file mode 100644 index ff78e068..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/DynCorr.R +++ /dev/null @@ -1,64 +0,0 @@ -#' @title Dynamical Correlation -#' @description Calculate Dynamical Correlation for 2 paired dense regular functional data observed on the same grid. -#' @param x a n by m matrix where rows representing subjects and columns representing measurements, missings are allowed. -#' @param y a n by m matrix where rows representing subjects and columns representing measurements, missings are allowed. -#' @param t a length m vector of time points where x,y are observed. -#' @return A length m vector of individual dynamic correlations -#' @examples -#' set.seed(10) -#' n=200 # sample size -#' t=seq(0,1,length.out=100) # length of data -#' mu_quad_x=8*t^2-4*t+5 -#' mu_quad_y=8*t^2-12*t+6 -#' fun=rbind(rep(1,length(t)),-t,t^2) -#' z1=matrix(0,n,3) -#' z1[,1]=rnorm(n,0,2) -#' z1[,2]=rnorm(n,0,16/3) -#' z1[,3]=rnorm(n,0,4) -#' x1_quad_error=y1_quad_error=matrix(0,nrow=n,ncol=length(t)) -#' for (i in 1:n){ -#' x1_quad_error[i,]=mu_quad_x+z1[i,]%*%fun+rnorm(length(t),0,0.01) -#' y1_quad_error[i,]=mu_quad_y+2*z1[i,]%*%fun +rnorm(length(t),0,0.01) -#' } -#' dyn1_quad=DynCorr(x1_quad_error,y1_quad_error,t) -#' @references -#' \cite{Dubin J A, M\"uller H G. Dynamical correlation for multivariate longitudinal data[J]. Journal of the American Statistical Association, 2005, 100(471): 872-881.} -#' \cite{Liu S, Zhou Y, Palumbo R, et al. Dynamical correlation: A new method for quantifying synchrony with multivariate intensive longitudinal data[J]. Psychological methods, 2016, 21(3): 291.} -#' @export - -DynCorr = function(x,y,t){ - if(dim(x)[1] != dim(y)[1] | dim(x)[2] != dim(y)[2]){ - stop("dimension of x and y does not match!") - } - if(dim(x)[2] != length(t)){ - stop("dimension of x,y does not match with t!") - } - na = sum(is.na(x)+is.na(y)) - - if (na>0) { - for (i in 1:dim(x)[1]){ - x[i,]=approx(t,x[i,],xout=t,rule=2)$y - y[i,]=approx(t,y[i,],xout=t,rule=2)$y - } - } - - temp1_x=temp1_y=matrix(0,nrow=dim(x)[1],ncol=dim(x)[2]) - temp2_x=temp2_y=matrix(0,nrow=dim(x)[1],ncol=dim(x)[2]) - M_x=M_y=z=numeric() - - for (i in 1:dim(x)[1]){ - aver_x=trapzRcpp(t,x[i,])/(tail(t,1)-head(t,1)) - aver_y=trapzRcpp(t,y[i,])/(tail(t,1)-head(t,1)) - temp1_x[i,]=x[i,]-aver_x - temp1_y[i,]=y[i,]-aver_y - } - - M_x=colMeans(temp1_x) - M_y=colMeans(temp1_y) - for (i in 1:dim(x)[1]){ - temp2_x[i,]=(temp1_x[i,]-M_x)/sqrt(trapzRcpp(t,(temp1_x[i,]-M_x)^2)/(tail(t,1)-head(t,1))) - temp2_y[i,]=(temp1_y[i,]-M_y)/sqrt(trapzRcpp(t,(temp1_y[i,]-M_y)^2)/(tail(t,1)-head(t,1))) - z[i]=trapzRcpp(t,temp2_x[i,]*temp2_y[i,])/(tail(t,1)-head(t,1)) - } - return(z) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/Dyn_test.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/Dyn_test.R deleted file mode 100644 index 4867de91..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/Dyn_test.R +++ /dev/null @@ -1,110 +0,0 @@ -#' @title Bootstrap test of Dynamic correlation -#' @description Perform one sample (H0: Dynamic correlation = 0) or two sample (H0:Dynamic_correlation_1 = Dynamic_correlation_2) bootstrap test of Dynamical Correlation. -#' @param x1 a n by m matrix where rows representing subjects and columns representing measurements, missings are allowed. -#' @param y1 a n by m matrix where rows representing subjects and columns representing measurements, missings are allowed. -#' @param t1 a vector of time points where x1,y1 are observed. -#' @param x2 (optional if missing will be one sample test) a n by m matrix where rows representing subjects and columns representing measurements, missings are allowed. -#' @param y2 (optional if missing will be one sample test) a n by m matrix where rows representing subjects and columns representing measurements, missings are allowed. -#' @param t2 (optional if missing will be one sample test) a vector of time points where x2,y2 are observed. -#' @param B number of bootstrap samples. -#' @return a list of the following -#' \item{stats: test statistics.} -#' \item{pval: p-value of the test.} -#' @examples -#' n=200 # sample size -#' t=seq(0,1,length.out=100) # length of data -#' mu_quad_x=8*t^2-4*t+5 -#' mu_quad_y=8*t^2-12*t+6 -#' fun=rbind(rep(1,length(t)),-t,t^2) -#' z1=matrix(0,n,3) -#' z1[,1]=rnorm(n,0,2) -#' z1[,2]=rnorm(n,0,16/3) -#' z1[,3]=rnorm(n,0,4) # covariance matrix of random effects -#' x1_quad_error=y1_quad_error=matrix(0,nrow=n,ncol=length(t)) -#' for (i in 1:n){ -#' x1_quad_error[i,]=mu_quad_x+z1[i,]%*%fun+rnorm(length(t),0,0.01) -#' y1_quad_error[i,]=mu_quad_y+2*z1[i,]%*%fun +rnorm(length(t),0,0.01) -#' } -#' bt_DC=Dyn_test(x1_quad_error,y1_quad_error,t,B=1000) -#' -#' @references -#' \cite{Dubin J A, M\"uller H G. Dynamical correlation for multivariate longitudinal data[J]. Journal of the American Statistical Association, 2005, 100(471): 872-881.} -#' -#' \cite{Liu S, Zhou Y, Palumbo R, et al. Dynamical correlation: A new method for quantifying synchrony with multivariate intensive longitudinal data[J]. Psychological methods, 2016, 21(3): 291.} -#' @export - -Dyn_test = function(x1,y1,t1,x2,y2,t2,B=1000){ - n=dim(x1)[1] - if (missing(x2)) { ### one-sample test ### - na1 = sum(is.na(x1)+is.na(y1)) - if(sum(is.na(x1[,1])+is.na(x1[,ncol(x1)]))+ sum(is.na(y1[,1])+is.na(y1[,ncol(y1)])) > 0){ - warning('extrapolations may make results unreliable') - } - if (na1>0) { ### impute missing values by linear interpolation ### - for (i in 1:n){ - x1[i,]=approx(t1,x1[i,],xout=t1,rule=2)$y - y1[i,]=approx(t1,y1[i,],xout=t1,rule=2)$y - } - } - dyncor_1=DynCorr(x1,y1,t1) ### observed DC ### - obs_1_stud=mean(dyncor_1)*sqrt(n)/sd(dyncor_1) ### observed standardized version ### - boot_1_stud=numeric() - boot_x1=boot_y1=matrix(0,nrow=n,ncol=length(t1)) - - for(b in 1:B){ - idx=sample(c(1:n),replace = TRUE) - boot_x1=x1[idx,] ### bootstrap replicates ### - boot_y1=y1[idx,] - boot_dyncor_1=DynCorr(boot_x1,boot_y1,t1) ### DC based on bootstrap samples ### - boot_1_stud[b]=mean(boot_dyncor_1-dyncor_1)*sqrt(n)/sd(boot_dyncor_1) ### bootstrap standardized version ### - } - - emp.stat=obs_1_stud ### bootstrap test statistic ### - emp.pval=length(boot_1_stud[boot_1_stud>abs(obs_1_stud) | boot_1_stud< -abs(obs_1_stud)])/B ### p-value based on bootstrap null distribution ### - outp=list(stats=emp.stat, pval=emp.pval) - return(outp) - } else { ### two-sample paired test (similar as above) ### - na1 = sum(is.na(x1)+is.na(y1)) - na2 = sum(is.na(x2)+is.na(y2)) #check missing - if (na1 > 0) { ### impute missing values by linear interpolation ### - for (i in 1:n){ - x1[i,]=approx(t1,x1[i,],xout=t1,rule=2)$y - y1[i,]=approx(t1,y1[i,],xout=t1,rule=2)$y - } - } - if (na2 > 0) { ### impute missing values by linear interpolation ### - for (i in 1:n){ - x2[i,]=approx(t1,x1[i,],xout=t1,rule=2)$y - y2[i,]=approx(t2,y2[i,],xout=t2,rule=2)$y - } - } - dyncor_1=DynCorr(x1,y1,t1) - dyncor_2=DynCorr(x2,y2,t2) - obs_1_stud=mean(dyncor_1)*sqrt(n)/sd(dyncor_1) - obs_2_stud=mean(dyncor_2)*sqrt(n)/sd(dyncor_2) - obsdiff=dyncor_2-dyncor_1 - obsdiff_stud=mean(obsdiff)*sqrt(n)/sd(obsdiff) - boot_1_stud=boot_2_stud=boot_diff_stud=numeric() - - boot_x1=boot_y1=matrix(0,nrow=n,ncol=length(t1)) - boot_x2=boot_y2=matrix(0,nrow=n,ncol=length(t2)) - - for(b in 1:B){ - idx=sample(c(1:n),replace = TRUE) - boot_x1=x1[idx,] - boot_y1=y1[idx,] - boot_x2=x2[idx,] - boot_y2=y2[idx,] - boot_dyncor_1=DynCorr(boot_x1,boot_y1,t1) - boot_dyncor_2=DynCorr(boot_x2,boot_y2,t2) - boot_1_stud[b]=mean(boot_dyncor_1-dyncor_1)*sqrt(n)/sd(boot_dyncor_1) - boot_2_stud[b]=mean(boot_dyncor_2-dyncor_2)*sqrt(n)/sd(boot_dyncor_2) - boot_diff_stud[b]=mean(boot_dyncor_2-boot_dyncor_1)*sqrt(n)/sd(boot_dyncor_2-boot_dyncor_1) - } - - emp.stat=obsdiff_stud - emp.pval=length(boot_diff_stud[boot_diff_stud>abs(obsdiff_stud) | boot_diff_stud< -abs(obsdiff_stud)])/B - outp=list(stats=emp.stat, pval=emp.pval) - return(outp) - } -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/FAM.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/FAM.R deleted file mode 100644 index 7626f4b8..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/FAM.R +++ /dev/null @@ -1,195 +0,0 @@ -#' Functional Additive Models -#' -#' Functional additive models with a single predictor process -#' -#' @param Y An \emph{n}-dimensional vector whose elements consist of scalar responses. -#' @param Lx A list of \emph{n} vectors containing the observed values for each individual. See \code{FPCA} for detail. -#' @param Lt A list of \emph{n} vectors containing the observation time points for each individual. Each vector should be sorted in ascending order. See \code{FPCA} for detail. -#' @param nEval The number of evaluation grid points for kernel smoothing (default is 51. If it is specified as 0, then estimated FPC scores in the training set are used for evaluation grid instead of equal grid). -#' @param newLx A list of the observed values for test set. See \code{predict.FPCA} for detail. -#' @param newLt A list of the observed time points for test set. See \code{predict.FPCA} for detail. -#' @param bwMethod The method of bandwidth selection for kernel smoothing, a positive value for designating K-fold cross-validtaion and zero for GCV (default is 50) -#' @param alpha The shrinkage factor (positive number) for bandwidth selection. See Han et al. (2016) (default is 0.7). -#' @param supp The lower and upper limits of kernel smoothing domain for studentized FPC scores, which FPC scores are divided by the square roots of eigenvalues (default is [-2,2]). -#' @param optns A list of options control parameters specified by list(name=value). See \code{FPCA}. -#' -#' @details \code{FAM} fits functional additive models for a scalar response and single predictor process proposed by Mueller and Yao (2007) that \deqn{E(Y | \mathbf{X}) = \sum_{k=1}^K g_{k}(\xi_{k}),} where \eqn{\xi_{k}} stand for the k-th FPC score of the the predictor process. -#' -#' @return A list containing the following fields: -#' \item{mu}{Mean estimator of \eqn{EY}} -#' \item{fam}{A \emph{N} by \emph{K} matrix whose column vectors consist of the component function estimators at the given estimation points.} -#' \item{xi}{An \emph{N} by \emph{K} matrix whose column vectors consist of \emph{N} vectors of estimation points for each component function.} -#' \item{bw}{A \emph{K}-dimensional bandwidth vector.} -#' \item{lambda}{A \emph{K}-dimensional vector containing eigenvalues.} -#' \item{phi}{An \emph{nWorkGrid} by \emph{K} matrix containing eigenfunctions, supported by \code{WorkGrid}. See \code{FPCA}.} -#' \item{workGrid}{An \emph{nWorkGrid} by \emph{K_j} working grid, the internal regular grid on which the eigen analysis is carried on. See \code{FPCA}.} -#' @examples -#' set.seed(1000) -#' -#' library(MASS) -#' -#' f1 <- function(t) 0.5*t -#' f2 <- function(t) 2*cos(2*pi*t/4) -#' f3 <- function(t) 1.5*sin(2*pi*t/4) -#' f4 <- function(t) 2*atan(2*pi*t/4) -#' -#' n<-250 -#' N<-500 -#' -#' sig <- diag(c(4.0,2.0,1.5,1.2)) -#' -#' scoreX <- mvrnorm(n,mu=rep(0,4),Sigma=sig) -#' scoreXTest <- mvrnorm(N,mu=rep(0,4),Sigma=sig) -#' -#' Y <- f1(scoreX[,1]) + f2(scoreX[,2]) + f3(scoreX[,3]) + f4(scoreX[,4]) + rnorm(n,0,0.1) -#' YTest <- f1(scoreXTest[,1]) + f2(scoreXTest[,2]) + -#' f3(scoreXTest[,3]) + f4(scoreXTest[,4]) + rnorm(N,0,0.1) -#' -#' phi1 <- function(t) sqrt(2)*sin(2*pi*t) -#' phi2 <- function(t) sqrt(2)*sin(4*pi*t) -#' phi3 <- function(t) sqrt(2)*cos(2*pi*t) -#' phi4 <- function(t) sqrt(2)*cos(4*pi*t) -#' -#' grid <- seq(0,1,length.out=21) -#' Lt <- Lx <- list() -#' for (i in 1:n) { -#' Lt[[i]] <- grid -#' Lx[[i]] <- scoreX[i,1]*phi1(grid) + scoreX[i,2]*phi2(grid) + -#' scoreX[i,3]*phi3(grid) + scoreX[i,4]*phi4(grid) + rnorm(1,0,0.01) -#' } -#' -#' LtTest <- LxTest <- list() -#' for (i in 1:N) { -#' LtTest[[i]] <- grid -#' LxTest[[i]] <- scoreXTest[i,1]*phi1(grid) + scoreXTest[i,2]*phi2(grid) + -#' scoreXTest[i,3]*phi3(grid) + scoreXTest[i,4]*phi4(grid) + rnorm(1,0,0.01) -#' } -#' -#' -#' # estimation -#' fit <- FAM(Y=Y,Lx=Lx,Lt=Lt) -#' -#' xi <- fit$xi -#' -#' par(mfrow=c(2,2)) -#' j <- 1 -#' g1 <- f1(sort(xi[,j])) -#' tmpSgn <- sign(sum(g1*fit$fam[,j])) -#' plot(sort(xi[,j]),g1,type='l',col=2,ylim=c(-2.5,2.5),xlab='xi1') -#' points(sort(xi[,j]),tmpSgn*fit$fam[order(xi[,j]),j],type='l') -#' -#' j <- 2 -#' g2 <- f2(sort(xi[,j])) -#' tmpSgn <- sign(sum(g2*fit$fam[,j])) -#' plot(sort(xi[,j]),g2,type='l',col=2,ylim=c(-2.5,2.5),xlab='xi2') -#' points(sort(xi[,j]),tmpSgn*fit$fam[order(xi[,j]),j],type='l') -#' -#' j <- 3 -#' g3 <- f3(sort(xi[,j])) -#' tmpSgn <- sign(sum(g3*fit$fam[,j])) -#' plot(sort(xi[,j]),g3,type='l',col=2,ylim=c(-2.5,2.5),xlab='xi3') -#' points(sort(xi[,j]),tmpSgn*fit$fam[order(xi[,j]),j],type='l') -#' -#' j <- 4 -#' g4 <- f4(sort(xi[,j])) -#' tmpSgn <- sign(sum(g4*fit$fam[,j])) -#' plot(sort(xi[,j]),g4,type='l',col=2,ylim=c(-2.5,2.5),xlab='xi4') -#' points(sort(xi[,j]),tmpSgn*fit$fam[order(xi[,j]),j],type='l') -#' -#' -#' # fitting -#' fit <- FAM(Y=Y,Lx=Lx,Lt=Lt,nEval=0) -#' yHat <- fit$mu+apply(fit$fam,1,'sum') -#' par(mfrow=c(1,1)) -#' plot(yHat,Y) -#' abline(coef=c(0,1),col=2) -#' -#' -#' # R^2 -#' R2 <- 1-sum((Y-yHat)^2)/sum((Y-mean(Y))^2) -#' R2 -#' -#' -#' # prediction -#' fit <- FAM(Y=Y,Lx=Lx,Lt=Lt,newLx=LxTest,newLt=LtTest) -#' yHat <- fit$mu+apply(fit$fam,1,'sum') -#' par(mfrow=c(1,1)) -#' plot(yHat,YTest,xlim=c(-10,10)) -#' abline(coef=c(0,1),col=2) -#' @references -#' \cite{Mueller, H.-G. and Yao, F. (2005), "Functional additive models", JASA, Vol.103, No.484, p.1534-1544.} -#' -#' @export - -FAM <- function(Y,Lx,Lt,nEval=51,newLx=NULL,newLt=NULL,bwMethod=0,alpha=0.7,supp=c(-2,2),optns=NULL){ - - - - if (is.null(optns)==TRUE) { - optns <- list() - } - - n <- length(Y) - - tmpFPCA <- FPCA(Ly=Lx, Lt=Lt, optns=optns) - - XiStd <- t(t(tmpFPCA$xiEst)/sqrt(tmpFPCA$lambda)) - d <- length(tmpFPCA$lambda) - - estLambda <- tmpFPCA$lambda - estEigen <- tmpFPCA$phi - workGrid <- tmpFPCA$workGrid - - N <- xiStdGrid <- c() - if (is.null(newLx)==TRUE | is.null(newLt)==TRUE) { - - if (nEval==0) { - N <- nrow(XiStd) - xiStdGrid <- XiStd - } else { - N <- nEval - xiStdGrid <- matrix(rep(seq(supp[1],supp[2],length.out=N),d),nrow=N,ncol=d) - } - - } else { - xiStdGrid <- predict.FPCA(tmpFPCA,newLy=newLx,newLt=newLt,K=d)%*%diag(1/sqrt(tmpFPCA$lambda)) - N <- nrow(xiStdGrid) - } - - h <- c() - for (j in 1:d) { - if (bwMethod>0) { - options(warn = -1) - h[j] <- CVLwls1D(y=(Y-mean(Y)),t=XiStd[,j],kernel='epan',npoly=1,nder=0,dataType='Sparse',kFolds=bwMethod) - options(warn = 0) - } else { - options(warn = -1) - h[j] <- GCVLwls1D1(yy=(Y-mean(Y)),tt=XiStd[,j],kernel='epan',npoly=1,nder=0,dataType='Sparse')$bOpt - options(warn = 0) - } - } - - h <- alpha*h - - fam <- matrix(nrow=N,ncol=d) - for (j in 1:d) { - xiTmp <- sort(xiStdGrid[,j]) - fitTmp <- Lwls1D(bw=h[j],kernel_type='epan',xin=sort(XiStd[,j]),yin=(Y[order(XiStd[,j])]-mean(Y)),xout=xiTmp,npoly=1,nder=0) - fam[,j] <- fitTmp[match(xiStdGrid[,j],xiTmp)] - - fam[,j] <- fam[,j] - mean(fam[,j]) - } - yMean <- mean(Y) - - xiGrid <- xiStdGrid%*%diag(sqrt(estLambda)) - bw <- h*sqrt(estLambda) - phi <- estEigen - - fit <- list(mu=yMean, fam=fam, xi=xiGrid, bw=bw, lambda=estLambda, phi=phi, workGrid=workGrid) - - return(fit) - -} - - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/FCCor.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/FCCor.R deleted file mode 100644 index 168aef24..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/FCCor.R +++ /dev/null @@ -1,83 +0,0 @@ -#' Calculate functional correlation between two simultaneously observed processes. -#' -#' @param x A list of function values corresponding to the first process. -#' @param y A list of function values corresponding to the second process. -#' @param Lt A list of time points for both \code{x} and \code{y}. -#' @param bw A numeric vector for bandwidth of length either 5 or 1, specifying the bandwidths for E(X), E(Y), var(X), var(Y), and cov(X, Y). If \code{bw} is a scalar then all five bandwidths are chosen to be the same. -#' @param kern Smoothing kernel for mu and covariance; "rect", "gauss", "epan", "gausvar", "quar" (default: "gauss") -#' @param Tout Output time points. Default to the sorted unique time points. -#' -#' @details \code{FCCor} calculate only the concurrent correlation corr(X(t), Y(t)) (note that the time points t are the same). It assumes no measurement error in the observed values. -#' @return A list with the following components: -#' \item{corr}{A vector of the correlation corr(X(t), Y(t)) evaluated at \code{Tout}.} -#' \item{Tout}{Same as the input Tout.} -#' \item{bw}{The bandwidths used for E(X), E(Y), var(X), var(Y), and cov(X, Y).} -#' -#' @examples -#' set.seed(1) -#' n <- 200 -#' nGridIn <- 50 -#' sparsity <- 1:5 # must have length > 1 -#' bw <- 0.2 -#' kern <- 'epan' -#' T <- matrix(seq(0.5, 1, length.out=nGridIn)) -#' -#' ## Corr(X(t), Y(t)) = 1/2 -#' A <- Wiener(n, T) -#' B <- Wiener(n, T) -#' C <- Wiener(n, T) + matrix((1:nGridIn) , n, nGridIn, byrow=TRUE) -#' X <- A + B -#' Y <- A + C -#' indEach <- lapply(1:n, function(x) sort(sample(nGridIn, sample(sparsity, 1)))) -#' tAll <- lapply(1:n, function(i) T[indEach[[i]]]) -#' Xsp <- lapply(1:n, function(i) X[i, indEach[[i]]]) -#' Ysp <- lapply(1:n, function(i) Y[i, indEach[[i]]]) -#' -#' plot(T, FCCor(Xsp, Ysp, tAll, bw)[['corr']], ylim=c(-1, 1)) -#' abline(h=0.5) -#' @export - -FCCor <- function(x, y, Lt, bw=stop('bw missing'), kern='epan', Tout=sort(unique(unlist(Lt)))) { - - stopifnot(!is.null(x) && !is.null(y) && !is.null(Lt)) - - Xvec <- unlist(x) - Yvec <- unlist(y) - tvec <- unlist(Lt) - ord <- order(tvec) - Xvec <- Xvec[ord] - Yvec <- Yvec[ord] - tvec <- tvec[ord] - Tall <- sort(unique(unlist(Lt))) - - if (length(bw) != 1 && length(bw) != 5) - stop('bw length incorrect.') - if (is.numeric(bw) && length(bw) == 1) - bw <- rep(bw, 5) - - muX <- Lwls1D(bw[1], kern, npoly=1L, nder=0L, xin=tvec, yin=Xvec, win=rep(1, length(tvec)), xout=Tall) - muY <- Lwls1D(bw[2], kern, npoly=1L, nder=0L, xin=tvec, yin=Yvec, win=rep(1, length(tvec)), xout=Tall) - names(muX) <- Tall - names(muY) <- Tall - - Xcent <- Xvec - muX[as.character(tvec)] - Ycent <- Yvec - muY[as.character(tvec)] - varX <- Lwls1D(bw[3], kern, npoly=1L, nder=0L, xin=tvec, yin=Xcent^2, win=rep(1, length(tvec)), xout=Tout) - varY <- Lwls1D(bw[4], kern, npoly=1L, nder=0L, xin=tvec, yin=Ycent^2, win=rep(1, length(tvec)), xout=Tout) - covXY <- Lwls1D(bw[5], kern, npoly=1L, nder=0L, xin=tvec, yin=Xcent * Ycent, win=rep(1, length(tvec)), xout=Tout) - -# The denominator variance esitmates may be negative sometimes. Set them to - # NaN. - varX[varX <= 0 ] <- NaN - varY[varY <= 0 ] <- NaN - - if (any(is.nan(varX)) || any(is.nan(varY))) - warning('NaN produced because the variance estimate is negative') - - res <- list(corr = covXY / sqrt(varX * varY), - Tout = Tout, - bw = bw) - - return(res) -} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/FCReg.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/FCReg.R deleted file mode 100644 index be4f3713..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/FCReg.R +++ /dev/null @@ -1,365 +0,0 @@ -#' Functional Concurrent Regression by 2D smoothing method. -#' -#' Functional concurrent regression with dense or sparse functional data for scalar or functional dependent variable. -#' -#' @param vars A list of input functional/scalar covariates. Each field corresponds to a functional (a list) or scalar (a vector) covariate. The last entry is assumed to be the response if no entry is names 'Y'. If a field corresponds to a functional covariate, it should have two fields: 'Lt', a list of time points, and 'Ly', a list of function values. -#' @param userBwMu A scalar with bandwidth used for smoothing the mean -#' @param userBwCov A scalar with bandwidth used for smoothing the auto- and cross-covariances -#' @param outGrid A vector with the output time points -#' @param kern Smoothing kernel choice, common for mu and covariance; "rect", "gauss", "epan", "gausvar", "quar" (default: "gauss") -#' @param measurementError Indicator measurement errors on the functional observations should be assumed. If TRUE the diagonal raw covariance will be removed when smoothing. (default: TRUE) -#' @param diag1D A string specifying whether to use 1D smoothing for the diagonal line of the covariance. -#' 'none': don't use 1D smoothing; 'cross': use 1D only for cross-covariances; 'all': use 1D for both auto- and cross-covariances. (default : 'none') -#' @param useGAM Indicator to use gam smoothing instead of local-linear smoothing (semi-parametric option) (default: FALSE) -#' @param returnCov Indicator to return the covariance surfaces, which is a four dimensional array. The first two dimensions correspond to outGrid -#' and the last two correspond to the covariates and the response, i.e. (i, j, k, l) entry being Cov(X_k(t_i), X_l(t_j)) (default: FALSE) -#' @param ... Additional arguments -#' -#' @details If measurement error is assumed, the diagonal elements of the raw covariance will be removed. This could result in highly unstable estimate if the design is very sparse, or strong seasonality presents. -#' @references -#' \cite{Yao, F., Mueller, H.G., Wang, J.L. "Functional Linear Regression Analysis for Longitudinal Data." Annals of Statistics 33, (2005): 2873-2903.(Dense data)} -#' -#' \cite{Senturk, D., Nguyen, D.V. "Varying Coefficient Models for Sparse Noise-contaminated Longitudinal Data", Statistica Sinica 21(4), (2011): 1831-1856. (Sparse data)} -#' @export -#' @examples -#' # Y(t) = \beta_0(t) + \beta_1(t) X_1(t) + \beta_2(t) Z_2 + \epsilon -#' -#' # Settings -#' set.seed(1) -#' n <- 75 -#' nGridIn <- 150 -#' sparsity <- 5:10 # Sparse data sparsity -#' T <- round(seq(0, 1, length.out=nGridIn), 4) # Functional data support -#' bw <- 0.1 -#' outGrid <- round(seq(min(T), 1, by=0.05), 2) -#' -#' # Simulate functional data -#' mu <- T * 2 # mean function for X_1 -#' sigma <- 1 -#' -#' beta_0 <- 0 -#' beta_1 <- 1 -#' beta_2 <- 1 -#' -#' Z <- MASS::mvrnorm(n, rep(0, 2), diag(2)) -#' X_1 <- Z[, 1, drop=FALSE] %*% matrix(1, 1, nGridIn) + matrix(mu, n, nGridIn, byrow=TRUE) -#' epsilon <- rnorm(n, sd=sigma) -#' Y <- matrix(NA, n, nGridIn) -#' for (i in seq_len(n)) { -#' Y[i, ] <- beta_0 + beta_1 * X_1[i, ] + beta_2 * Z[i, 2] + epsilon[i] -#' } -#' -#' # Sparsify functional data -#' set.seed(1) -#' X_1sp <- Sparsify(X_1, T, sparsity) -#' set.seed(1) -#' Ysp <- Sparsify(Y, T, sparsity) -#' vars <- list(X_1=X_1sp, Z_2=Z[, 2], Y=Ysp) -#' withError2D <- FCReg(vars, bw, bw, outGrid) - - -FCReg <- function(vars, userBwMu, userBwCov, outGrid, kern='gauss', measurementError=TRUE, diag1D='none', useGAM = FALSE, returnCov=TRUE) { - - n <- lengthVars(vars) - p <- length(vars) - 1 - if (p == 0) - stop('Too few covariates.') - - if (is.null(names(vars))) - names(vars) <- c(paste0('X', seq_len(length(vars) - 1)), 'Y') - - if ('Y' %in% names(vars)) { - vars <- c(vars[names(vars) != 'Y'], vars['Y']) - } else if (names(vars)[length(vars)] == '') { - names(vars)[length(vars)] <- 'Y' - } - - Yname <- names(vars)[length(vars)] - - # Handle NaN, int to double - vars[sapply(vars, is.list)] <- lapply( - vars[sapply(vars, is.list)], - function(v) HandleNumericsAndNAN(v[['Ly']], v[['Lt']]) - ) - # outGrid <- as.numeric(outGrid) - - # De-mean. - demeanedRes <- demean(vars, userBwMu, kern) - vars <- demeanedRes[['xList']] - muList <- demeanedRes[['muList']] - - allCov <- MvCov(vars, userBwCov, outGrid, kern, measurementError, center=FALSE, diag1D) - beta <- sapply(seq_len(dim(allCov)[1]), function(i) { - tmpCov <- allCov[i, i, , ] - beta_ti <- qr.solve(tmpCov[1:p, 1:p], tmpCov[1:p, p + 1]) - beta_ti - }) - if (is.null(nrow(beta))) - beta <- matrix(beta, 1) - rownames(beta) <- names(vars)[-length(vars)] - - # coefficient of determination: - # R2 = cov(X, Y)' var(X)^{-1} cov(X, Y) / var(Y) - R2 <- sapply(seq_len(dim(allCov)[1]), function(i) { - tmpCov <- allCov[i, i, , ] - tmpCov[p + 1, 1:p, drop=FALSE] %*% beta[, i, drop=FALSE] / tmpCov[p + 1, p + 1] - }) - - muBeta <- sapply(seq_len(p), function(j) { - if (!is.function(muList[[j]])) { # scalar mean - beta[j, ] * rep(muList[[j]], length(outGrid)) - } else { # functional mean - beta[j, ] * muList[[j]](outGrid) - } - }) - beta0 <- muList[[Yname]](outGrid) - colSums(t(muBeta)) - - res <- list(beta=beta, beta0 = beta0, outGrid=outGrid, cov=allCov, R2=R2, n=n) - if (!returnCov) - res[['cov']] <- NULL - res -} - -demean <- function(vars, userBwMu, kern) { - tmp <- lapply(vars, function(x) { - if (is.numeric(x)) { # scalar - xmu <- mean(x) - x <- x - xmu - } else if (is.list(x)) { # functional - Tin <- sort(unique(unlist(x[['Lt']]))) - xmu <- GetSmoothedMeanCurve(x[['Ly']], x[['Lt']], Tin, Tin[1], - list(userBwMu=userBwMu, kernel=kern))[['mu']] - muFun <- approxfun(Tin, xmu) - x[['Ly']] <- lapply(1:length(x[['Ly']]), function(i) - x[['Ly']][[i]]- muFun(x[['Lt']][[i]])) - xmu <- muFun - } - - list(x=x, mu=xmu) - }) - - xList <- lapply(tmp, `[[`, 'x') - muList <- lapply(tmp, `[[`, 'mu') - - list(xList = xList, muList = muList) -} - -## Multivariate function/scalar covariance. -# INPUTS: same as FCReg -# Output: a 4-D array containing the covariances. The first two dimensions corresponds to -# time s and t, and the last two dimensions correspond to the variables taken covariance upon. -MvCov <- function(vars, userBwCov, outGrid, kern, measurementError=TRUE, center=TRUE, diag1D='none') { - if (!is.list(vars) || length(vars) < 1) - stop('`vars` needs to be a list of length >= 1') - - if (diag1D == 'all' && measurementError) { - stop("Cannot assume measurement error when diag1D == 'all'") - } - isFuncVars <- sapply(vars, is.list) - p <- length(isFuncVars) - pFunc <- sum(isFuncVars) - pScaler <- sum(!isFuncVars) - - if (any(isFuncVars)) { - tAll <- do.call(c, lapply(vars[isFuncVars], function(x) unlist(x[['Lt']]))) - Tin <- sort(unique(tAll)) - - if (missing(outGrid)) - outGrid <- Tin - lenoutGrid <- length(outGrid) - - } else { - stop('No functional observation found') - } - - # First two dimensions are for s, t, and the last two dimensions are for matrix of # random variables. - res <- array(NA, c(lenoutGrid, lenoutGrid, p, p)) - for (j in seq_len(p)) { - for (i in seq_len(p)) { - if (j <= i) { - use1D <- diag1D == 'all' || ( diag1D == 'cross' && j != i ) - covRes <- uniCov(vars[[i]], vars[[j]], userBwCov, outGrid, kern, - rmDiag = (i == j) && measurementError, - center, use1D) - if (attr(covRes, 'covType') %in% c('FF', 'SS')) - res[, , i, j] <- covRes - else { - if (nrow(covRes) == 1) # cov(scalar, function) - res[, , i, j] <- matrix(covRes, lenoutGrid, lenoutGrid, byrow=TRUE) - else # cov(function, scalar) - res[, , i, j] <- matrix(covRes, lenoutGrid, lenoutGrid, byrow=FALSE) - } - } else { # fill up the symmetric cov(y, x) - res[, , i, j] <- t(res[, , j, i]) - } - } - } - - return(res) -} - -## Univariate function/scalar covariance. -# rmDiag: whether to remove the diagonal of the raw covariance. Ignored if 1D smoother is used. -# center: whether to center the covariates before calculate covariance. -# use1D: whether to use 1D smoothing for estimating the diagonal covariance. -uniCov <- function(X, Y, userBwCov, outGrid, kern='gauss', rmDiag=FALSE, center=TRUE, use1D=FALSE) { - flagScalerFunc <- FALSE - # Force X to be a function in the scalar-function case. - if (!is.list(X) && is.list(Y)) { - flagScalerFunc <- TRUE - tmp <- X - X <- Y - Y <- tmp - } - - # Scalar-scalar - if (!is.list(X) && !is.list(Y)) { - res <- cov(X, Y) - attr(res, 'covType') <- 'SS' - - # Scalar-function - } else if (is.list(X) && !is.list(Y)) { - Tin <- sort(unique(unlist(X[['Lt']]))) - if (center) { - Xmu <- GetSmoothedMeanCurve(X[['Ly']], X[['Lt']], Tin, Tin[1], list(userBwMu=userBwCov, kernel=kern))[['mu']] - Ymu <- mean(Y) - } else { - Xmu <- rep(0, length(Tin)) - Ymu <- 0 - } - res <- GetCrCovYZ(userBwCov, Y, Ymu, X[['Ly']], X[['Lt']], Xmu, Tin, kern)[['smoothedCC']] - res <- as.matrix(ConvertSupport(Tin, outGrid, mu=res)) - if (flagScalerFunc) - res <- t(res) - - attr(res, 'covType') <- 'FS' - - # function-function - } else { - TinX <- sort(unique(unlist(X[['Lt']]))) - TinY <- sort(unique(unlist(Y[['Lt']]))) - noutGrid <- length(outGrid) - if (center) { - if (min(TinX) > min(outGrid) || min(TinY) > min(outGrid) || - max(TinY) < max(outGrid) || max(TinX) < max(outGrid)) - stop('Observation time points coverage too low') - - Xmu <- GetSmoothedMeanCurve(X[['Ly']], X[['Lt']], TinX, TinX[1], - list(userBwMu=userBwCov, kernel=kern))[['mu']] - Ymu <- GetSmoothedMeanCurve(Y[['Ly']], Y[['Lt']], TinY, TinY[1], - list(userBwMu=userBwCov, kernel=kern))[['mu']] - } else { - Xmu <- rep(0, length(TinX)) - Ymu <- rep(0, length(TinY)) - } - names(Xmu) <- TinX - names(Ymu) <- TinY - - if (use1D) { - Xvec <- unlist(X[['Ly']]) - Yvec <- unlist(Y[['Ly']]) - tvecX <- unlist(X[['Lt']]) - tvecY <- unlist(Y[['Lt']]) - if (!identical(tvecX, tvecY)){ - stop('Cannot use 1D covariance smoothing if the observation time points for X and Y are different') - } - - ord <- order(tvecX) - tvecX <- tvecX[ord] - Xvec <- Xvec[ord] - Yvec <- Yvec[ord] - Xcent <- Xvec - Xmu[as.character(tvecX)] - Ycent <- Yvec - Ymu[as.character(tvecX)] - covXY <- Lwls1D(userBwCov, kern, npoly=1L, nder=0L, - xin=tvecX, yin=Xcent * Ycent, - win=rep(1, length(tvecX)), xout=outGrid) - res <- matrix(NA, noutGrid, noutGrid) - diag(res) <- covXY - } else { # use 2D smoothing - tmp <- GetCrCovYX(userBwCov, userBwCov, X[['Ly']], X[['Lt']], Xmu, - Y[['Ly']], Y[['Lt']], Ymu, rmDiag=rmDiag, kern=kern) - gd <- tmp[['smoothGrid']] - res <- matrix( - interp2lin(as.numeric(gd[, 1]), - as.numeric(gd[, 2]), - matrix(as.numeric(tmp[['smoothedCC']]), - nrow(tmp[['smoothedCC']]), - ncol(tmp[['smoothedCC']])), - rep(as.numeric(outGrid), times=noutGrid), - rep(as.numeric(outGrid), each=noutGrid)), - noutGrid, noutGrid) - } - attr(res, 'covType') <- 'FF' - } - - return(res) -} - -## Concurrent functional regression by imputation. This does not provide consistent estimates. -## FPCAlist: a list of functional covariates and response. Each field corresponds to a covariate. -# The last entry is assumed to be the response if no entry is names 'Y'. -imputeConReg <- function(FPCAlist, Z, outGrid) { - - if (is.null(names(FPCAlist))) - names(FPCAlist) <- c(paste0('X', seq_len(length(FPCAlist) - 1)), 'Y') - - if ('Y' %in% names(FPCAlist)) { - Yname <- 'Y' - FPCAlist <- c(FPCAlist[names(FPCAlist) != 'Y'], FPCAlist['Y']) - } else - Yname <- names(FPCAlist)[length(FPCAlist)] - - imputeCurves <- sapply(FPCAlist, function(x) - apply(fitted(x), 1, function(fit) - approx(x[['workGrid']], fit, outGrid)[['y']]), - simplify='array') - alphaBeta <- apply(imputeCurves, 1, function(XYt) { - Yt <- XYt[, ncol(XYt)] - designMat <- cbind(1, XYt[, -ncol(XYt), drop=FALSE], Z) - beta_t <- qr.solve(designMat, Yt) - return(beta_t) - }) - beta0 <- alphaBeta[1, ] - beta <- alphaBeta[-1, , drop=FALSE] - - return(list(beta0 = beta0, beta = beta, outGrid = outGrid)) -} - -## regObj: an object returned by mvConReg. -## vars: a list of input functional/scalar covariates. Each field can correspond to a covariate. -# The last entry is assumed to be the response if no entry is names 'Y'. -summaryConReg <- function(regObj, vars) { - -} - -## subset a list of covariates and responses. -subsetVars <- function(vars, subset) { - sapply(vars, function(x) { - if (is.list(x)) { - sapply(x, `[`, subset, drop=FALSE, simplify=FALSE) - } else if (is.numeric(x)) { - x[subset, drop=FALSE] - } else { - stop('Cannot subset variable') - } - }, simplify=FALSE) -} - -## get the number of subjects for a list of covariates and responses. -lengthVars <- function(vars, subset) { - lenEach <- sapply(vars, function(x) { - if (is.list(x)) { - sapply(x, length) - } else if (is.numeric(x)) { - length(x) - } else { - stop('Cannot subset variable') - } - }, simplify=FALSE) - len <- unique(unlist(lenEach)) - if (length(len) != 1) { - stop('Length of variables are not the same!') - } - - return(len) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/FClust.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/FClust.R deleted file mode 100644 index 1ccb7622..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/FClust.R +++ /dev/null @@ -1,78 +0,0 @@ -#' Functional clustering and identifying substructures of longitudinal data -#' -#' By default the function will cluster the data using the functional principal component (FPC) scores from the data's -#' FPC analysis using EMCluster (Chen and Maitra, 2015) or directly clustering the functional data using kCFC (Chiou and Li, 2007). -#' -#' Within EMCluster we examine the model initiated "EMCluster::em.EM" and return the optimal model based on 'EMCluster::emcluster'. -#' See ?EMCluster::emcluster for details. -#' -#' @param Ly A list of \emph{n} vectors containing the observed values for each individual. Missing values specified by \code{NA}s are supported for dense case (\code{dataType='dense'}). -#' @param Lt A list of \emph{n} vectors containing the observation time points for each individual corresponding to y. -#' @param k A scalar defining the number of clusters to define; default 3. -#' @param cmethod A string specifying the clusterig method to use ('EMCluster' or 'kCFC'); default: 'EMCluster'. -#' @param optnsFPCA A list of options control parameters specified by \code{list(name=value)} to be used for by FPCA on the sample y; by default: -#' "list( methodMuCovEst ='smooth', FVEthreshold= 0.90, methodBwCov = 'GCV', methodBwMu = 'GCV' )". See `Details in ?FPCA'. -#' @param optnsCS A list of options control parameters specified by \code{list(name=value)} to be used for cluster-specific FPCA from kCFC; by default: -#' "list( methodMuCovEst ='smooth', FVEthreshold= 0.70, methodBwCov = 'GCV', methodBwMu = 'GCV' )". See `Details in ?FPCA' and '?kCFC'. -#' -#' @return A list containing the following fields: -#' \item{cluster}{A vector of levels 1:k, indicating the cluster to which each curve is allocated.} -#' \item{fpca}{An FPCA object derived from the sample used by Rmixmod, otherwise NULL.} -#' \item{clusterObj}{Either a EMCluster object or kCFC object.} -#' -#' @examples -#' \dontrun{ -#' data(medfly25) -#' Flies <- MakeFPCAInputs(medfly25$ID, medfly25$Days, medfly25$nEggs) -#' newClust <- FClust(Flies$Ly, Flies$Lt, k = 2, optnsFPCA = -#' list(methodMuCovEst = 'smooth', userBwCov = 2, FVEthreshold = 0.90)) -#' -#' # We denote as 'veryLowCount' the group of flies that lay less -#' # than twenty-five eggs during the 25-day period examined. -#' -#' veryLowCount = ifelse( sapply( unique(medfly25$ID), function(u) -#' sum( medfly25$nEggs[medfly25$ID == u] )) < 25, 0, 1) -#' N <- length(unique(medfly25$ID)) -#' (correctRate <- sum( (1 + veryLowCount) == newClust$cluster) / N) # 99.6% -#' } -#' @references -#' \cite{Wei-Chen Chen and Ranjan Maitra, "EMCluster: EM Algorithm for Model-Based Clusttering of Finite Mixture Gaussian Distribution". (2015)} -#' -#' \cite{Julien Jacques and Cristian Preda, "Funclust: A curves clustering method using functional random variables density approximation". Neurocomputing 112 (2013): 164-171} -#' -#' \cite{Jeng-Min Chiou and Pai-Ling Li, "Functional clustering and identifying substructures of longitudinal data". Journal of the Royal Statistical Society B 69 (2007): 679-699} -#' @export - -FClust = function(Ly, Lt, k = 3, cmethod = 'EMCluster', optnsFPCA = NULL, optnsCS = NULL){ - - if(is.null(optnsFPCA)){ - optnsFPCA = list( methodMuCovEst = 'smooth', FVEthreshold = 0.90, methodBwCov = 'GCV', methodBwMu = 'GCV') - } - if(is.null(optnsCS)){ - optnsCS = list( methodMuCovEst = 'smooth', FVEthreshold = 0.70, methodBwCov = 'GCV', methodBwMu = 'GCV') - } - - if( (k <2) || (floor(length(Ly)*0.5) < k) ){ - warning("The value of 'k' is outside [2, 0.5*N]; clustering is possibly incoherent.") - } - if( !(cmethod %in% c("EMCluster", "kCFC")) ){ - stop("The clustering method specified in neither 'EMCluster' or 'kCFC'.") - } - - if( cmethod == 'EMCluster'){ - if( !is.element('EMCluster', installed.packages()[,1]) ) { - stop("Cannot the use the EMCluster method; the package 'EMCluster' is unavailable.") - } - # suppressMessages(library(EMCluster)) - fpcaObjY <- FPCA(Ly = Ly, Lt = Lt, optnsFPCA) - xiData <- as.data.frame(fpcaObjY$xiEst) - clusterObj <- EMCluster::emcluster(xiData, EMCluster::em.EM(xiData, nclass =k, EMC = EMCluster::.EMControl()), assign.class= TRUE, EMC = EMCluster::.EMControl() ) - clustConf = clusterObj$class - } else { - fpcaObjY <- NULL - clusterObj <- kCFC(y= Ly, t= Lt, k = k, optnsSW = optnsFPCA, optnsCS = optnsCS) - clustConf <- clusterObj$cluster - } - - return( list(cluster = clustConf, fpca = fpcaObjY, clusterObj = clusterObj) ) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/FOptDes.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/FOptDes.R deleted file mode 100644 index 19cede15..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/FOptDes.R +++ /dev/null @@ -1,132 +0,0 @@ -#' Optimal Designs for Functional and Longitudinal Data -#' for Trajectory Recovery or Scalar Response Prediction -#' -#' @param Ly A list of \emph{n} vectors containing the observed values for each individual. Missing values specified by \code{NA}s are supported for dense case (\code{dataType='dense'}). -#' @param Lt A list of \emph{n} vectors containing the observation time points for each individual corresponding to y. Each vector should be sorted in ascending order. -#' @param Resp A vector of response values, keep void for trajectory recovery, only necessary for scalar response prediction task. -#' @param p A fixed positive integer indicating the number of optimal design points requested, with default: 3. -#' @param optns A list of options control parameters specified by \code{list(name=value)} for FPCA, with default: list(). -#' @param isRegression A logical argument, indicating the purpose of the optimal designs: TRUE for scalar response prediction, FALSE for trajectory recovery, with default value !missing(Resp). -#' @param isSequential A logical argument, indicating whether to use the sequential optimization procedure for faster computation, recommended for relatively large p (default: FALSE). -#' @param RidgeCand A vector of positive numbers as ridge penalty candidates for regularization. The final value is selected via cross validation. If only 1 ridge parameter is specified, CV procedure is skipped. -#' -#' @details To select a proper RidgeCand, check with the returned optimal ridge parameter. If the selected parameter is the maximum/minimum values in the candidates, it is possible that the selected one is too small/big. -#' -#' @return A list containing the following fields: -#' \item{OptDes}{The vector of optimal design points of the regular time grid of the observed data.} -#' \item{R2}{Coefficient of determination. (Check the paper for details.)} -#' \item{R2adj}{Adjusted coefficient of determination.} -#' \item{OptRidge}{The selected ridge parameter.} -#' -#' @examples -#' set.seed(1) -#' n <- 50 -#' pts <- seq(0, 1, by=0.05) -#' sampWiener <- Wiener(n, pts) -#' sampWiener <- MakeFPCAInputs(IDs = rep(1:n, each=length(pts)), -#' tVec = rep(pts, times = n), -#' yVec = t(sampWiener)) -#' res <- FOptDes(Ly=sampWiener$Ly, Lt=sampWiener$Lt, p=2, -#' isSequential=FALSE, RidgeCand = seq(0.02,0.2,0.02)) -#' @references -#' \cite{Ji, H., Mueller, H.G. (2016) "Optimal Designs for Longitudinal and Functional Data" Journal of the Royal Statistical Society: Series B (Statistical Methodology)} -#' -#' @export - -FOptDes <- function(Ly, Lt, Resp, p = 3, optns = list(), - isRegression = !missing(Resp), isSequential = FALSE, RidgeCand = NULL){ - # check inputs - if(is.null(RidgeCand)){ - stop("RidgeCand missing! Need to specify at least one ridge candidate.") - } - if( !(is.vector(RidgeCand) && is.numeric(RidgeCand)) ){ - stop("RidgeCand does not have the correct input format! Need to be a vector of positive numbers.") - } - if(any(RidgeCand <= 0)){ - stop("Some ridge candidates are non-positive! Change RidgeCand to make sure all ridge candidates are postive") - } - if( !(is.numeric(p) && p==as.integer(p) && p > 0) ){ - stop("Argument 'p' is not a positive integer! Need to specify a positive integer as the number of design points to be selected.") - } - if(isRegression){ - if(!(is.numeric(Resp) && is.vector(Resp)) ){ - stop("Resp does not have the correct input format! Need to be a vector of numbers.") - } - if( length(Resp) != length(Ly) ){ - stop("Resp does not have the same length as Ly! Double check the data inputs.") - } - cat("Finding optimal designs for scalar response prediction.\n") - } else { - cat("Finding optimal designs for trajectory recovery.\n") - } - - CheckData(y = Ly, t = Lt); - inputData <- HandleNumericsAndNAN(Ly, Lt); - y <- inputData$Ly; - t <- inputData$Lt; - - obsGrid = sort(unique(c(unlist(t)))); - - optns$nRegGrid = as.integer(1+diff(range(obsGrid))/min(diff(obsGrid))); - # make sure that FPCA workGrid is a denser grid of obsGrid for cv - # if measurement times are random, bin data first before run the function. - optns = SetOptions(y, t, optns); - - numOfCurves = length(y); - CheckOptions(t, optns, numOfCurves); - if(optns$dataType == "Dense"){ - isDense = TRUE; - } else { - isDense = FALSE; # currently dense with missing is treated as sparse - } - - RegGrid = seq(min(obsGrid), max(obsGrid), length.out = optns$nRegGrid); - - # find the best ridge parameter via cross validation - if(length(RidgeCand) > 1){ - OptRidge <- MCVOptRidge(y = y, t = t, Resp = Resp, p = p, RidgeCand = RidgeCand, - isDense = isDense, - isRegression = isRegression, isSequential = isSequential) - optridge <- OptRidge$optridge - } else { # skip CV if only ridge is prespecified. - cat("Only 1 ridge candidate in RidgeCand. The candidate is used and cross validation is skipped.\n") - OptRidge <- RidgeCand - optridge <- RidgeCand - } - # find optdes with optridge - TrainFPCA <- FPCA(Ly=y, Lt=t, optns=optns) - if(isRegression == FALSE){ # Trajectory Recovery - BestDesTR <- BestDes_TR(p=p, ridge=optridge, workGrid=TrainFPCA$workGrid, - Cov=TrainFPCA$fittedCov, isSequential=isSequential)$best - # calculate R2_X - VarX <- sum(TrainFPCA$lambda) - mu <- TrainFPCA$mu - Cov <- TrainFPCA$fittedCov - ridgeCov <- TrainFPCA$fittedCov + diag(optridge, nrow(Cov)) - R2XNum <- sum(diag(Cov[,BestDesTR] %*% solve(ridgeCov[BestDesTR, BestDesTR]) %*% Cov[BestDesTR,]))*diff(RegGrid)[1] - R2X <- R2XNum/VarX - R2Xadj <- 1-(1-R2X)*(length(y)-1)/(length(y)-p-1) - if(R2X >= 1){ - warning("Coefficient of determination is greater than 1! Select other ridge candidates for proper regularization.") - } - return(list(OptDes = RegGrid[BestDesTR], R2 = R2X, R2adj = R2Xadj, OptRidge = OptRidge)) - } else{ # scalar response regression - mu <- TrainFPCA$mu - Cov <- TrainFPCA$fittedCov - ridgeCov <- TrainFPCA$fittedCov + diag(optridge, nrow(Cov)) - # FPCA for cross cov - y1 <- list() - for(subj in 1:length(y)){y1[[subj]] = y[[subj]]*Resp[subj]} - FPCACC <- FPCA(y1, t, optns) - CCov <- FPCACC$mu - mean(Resp)*mu - BestDesSR <- BestDes_SR(p=p, ridge=optridge, workGrid=TrainFPCA$workGrid, - Cov=TrainFPCA$fittedCov, CCov=CCov, isSequential=isSequential)$best - R2Y <- (var(Resp) - CCov[BestDesSR] %*% solve(ridgeCov[BestDesSR,BestDesSR]) %*% CCov[BestDesSR])/var(Resp) - R2Yadj <- 1-(1-R2Y)*(length(y)-1)/(length(y)-p-1) - if(R2Y >= 1){ - warning("Coefficient of determination is greater than 1! Select other ridge candidates for proper regularization.") - } - return(list(OptDes = RegGrid[BestDesSR], R2 = R2Y, R2adj = R2Yadj, OptRidge = OptRidge)) - } -} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/FPCA.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/FPCA.R deleted file mode 100644 index 40635b18..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/FPCA.R +++ /dev/null @@ -1,246 +0,0 @@ -#' Functional Principal Component Analysis -#' -#' FPCA for dense or sparse functional data. -#' -#' @param Ly A list of \emph{n} vectors containing the observed values for each individual. Missing values specified by \code{NA}s are supported for dense case (\code{dataType='dense'}). -#' @param Lt A list of \emph{n} vectors containing the observation time points for each individual corresponding to y. Each vector should be sorted in ascending order. -#' @param optns A list of options control parameters specified by \code{list(name=value)}. See `Details'. -#' -#' @details If the input is sparse data, make sure you check the design plot is dense and the 2D domain is well covered, using \code{plot} or \code{CreateDesignPlot}. Some study design such as snippet data (each subject is observed only on a sub-interval of the period of study) will have an ill-covered design plot, for which the covariance estimate will be unreliable. -#' -#' Available control options are -#' \describe{ -#' \item{userBwCov}{The bandwidth value for the smoothed covariance function; positive numeric - default: determine automatically based on 'methodBwCov'} -#' \item{methodBwCov}{The bandwidth choice method for the smoothed covariance function; 'GMeanAndGCV' (the geometric mean of the GCV bandwidth and the minimum bandwidth),'CV','GCV' - default: 10\% of the support} -#' \item{userBwMu}{The bandwidth value for the smoothed mean function (using 'CV' or 'GCV'); positive numeric - default: determine automatically based on 'methodBwMu'} -#' \item{methodBwMu}{The bandwidth choice method for the mean function; 'GMeanAndGCV' (the geometric mean of the GCV bandwidth and the minimum bandwidth),'CV','GCV' - default: 5\% of the support} -#' \item{dataType}{The type of design we have (usually distinguishing between sparse or dense functional data); 'Sparse', 'Dense', 'DenseWithMV', 'p>>n' - default: determine automatically based on 'IsRegular'} -#' \item{diagnosticsPlot}{Deprecated. Same as the option 'plot'} -#' \item{plot}{Plot FPCA results (design plot, mean, scree plot and first K (<=3) eigenfunctions); logical - default: FALSE} -#' \item{error}{Assume measurement error in the dataset; logical - default: TRUE} -#' \item{fitEigenValues}{Whether also to obtain a regression fit of the eigenvalues - default: FALSE} -#' \item{FVEthreshold}{Fraction-of-Variance-Explained threshold used during the SVD of the fitted covar. function; numeric (0,1] - default: 0.9999} -#' \item{kernel}{Smoothing kernel choice, common for mu and covariance; "rect", "gauss", "epan", "gausvar", "quar" - default: "gauss"; dense data are assumed noise-less so no smoothing is performed. } -#' \item{kFoldMuCov}{The number of folds to be used for mean and covariance smoothing. Default: 10} -#' \item{lean}{If TRUE the 'inputData' field in the output list is empty. Default: FALSE} -#' \item{maxK}{The maximum number of principal components to consider - default: min(20, N-1), N:# of curves} -#' \item{methodXi}{The method to estimate the PC scores; 'CE' (Condit. Expectation), 'IN' (Numerical Integration) - default: 'CE' for sparse data and dense data with missing values, 'IN' for dense data.} -#' \item{methodMuCovEst}{The method to estimate the mean and covariance in the case of dense functional data; 'cross-sectional', 'smooth' - default: 'cross-sectional'} -#' \item{nRegGrid}{The number of support points in each direction of covariance surface; numeric - default: 51} -#' \item{numBins}{The number of bins to bin the data into; positive integer > 10, default: NULL} -#' \item{methodSelectK}{The method of choosing the number of principal components K; 'FVE','AIC','BIC', or a positive integer as specified number of components: default 'FVE')} -#' \item{shrink}{Whether to use shrinkage method to estimate the scores in the dense case (see Yao et al 2003) - default FALSE} -#' \item{outPercent}{A 2-element vector in [0,1] indicating the outPercent data in the boundary - default (0,1)} -#' \item{rho}{The truncation threshold for the iterative residual. 'cv': choose rho by leave-one-observation out cross-validation; 'no': no regularization - default "cv" if error == TRUE, and "no" if error == FALSE.} -#' \item{rotationCut}{The 2-element vector in [0,1] indicating the percent of data truncated during sigma^2 estimation; default (0.25, 0.75))} -#' \item{useBinnedData}{Should the data be binned? 'FORCE' (Enforce the # of bins), 'AUTO' (Select the # of bins automatically), 'OFF' (Do not bin) - default: 'AUTO'} -#' \item{useBinnedCov}{Whether to use the binned raw covariance for smoothing; logical - default:TRUE} -#' \item{userCov}{The user-defined smoothed covariance function; list of two elements: numerical vector 't' and matrix 'cov', 't' must cover the support defined by 'Ly' - default: NULL} -#' \item{userMu}{The user-defined smoothed mean function; list of two numerical vector 't' and 'mu' of equal size, 't' must cover the support defined 'Ly' - default: NULL} -##' \item{userSigma2}{The user-defined measurement error variance. A positive scalar. If specified then no regularization is used (rho is set to 'no', unless specified otherwise). Default to `NULL`} -#' \item{userRho}{The user-defined measurement truncation threshold used for the calculation of functional principal components scores. A positive scalar. Default to `NULL`} -#' \item{useBW1SE}{Pick the largest bandwidth such that CV-error is within one Standard Error from the minimum CV-error, relevant only if methodBwMu ='CV' and/or methodBwCov ='CV'; logical - default: FALSE} -#' \item{verbose}{Display diagnostic messages; logical - default: FALSE} -#' } -#' @return A list containing the following fields: -#' \item{sigma2}{Variance for measure error.} -#' \item{lambda}{A vector of length \emph{K} containing eigenvalues.} -#' \item{phi}{An nWorkGrid by \emph{K} matrix containing eigenfunctions, supported on workGrid.} -#' \item{xiEst}{A \emph{n} by \emph{K} matrix containing the FPC estimates.} -#' \item{xiVar}{A list of length \emph{n}, each entry containing the variance estimates for the FPC estimates.} -#' \item{obsGrid}{The (sorted) grid points where all observation points are pooled.} -#' \item{mu}{A vector of length nWorkGrid containing the mean function estimate.} -#' \item{workGrid}{A vector of length nWorkGrid. The internal regular grid on which the eigen analysis is carried on.} -#' \item{smoothedCov}{A nWorkGrid by nWorkGrid matrix of the smoothed covariance surface.} -#' \item{fittedCov}{A nWorkGrid by nWorkGrid matrix of the fitted covariance surface, which is guaranteed to be non-negative definite.} -#' \item{optns}{A list of actually used options.} -#' \item{timings}{A vector with execution times for the basic parts of the FPCA call.} -#' \item{bwMu}{The selected (or user specified) bandwidth for smoothing the mean function.} -#' \item{bwCov}{The selected (or user specified) bandwidth for smoothing the covariance function.} -#' \item{rho}{A regularizing scalar for the measurement error variance estimate.} -#' \item{cumFVE}{A vector with the percentages of the total variance explained by each FPC. Increase to almost 1.} -#' \item{FVE}{A percentage indicating the total variance explained by chosen FPCs with corresponding 'FVEthreshold'.} -#' \item{criterionValue}{A scalar specifying the criterion value obtained by the selected number of components with specific methodSelectK: FVE,AIC,BIC values or NULL for fixedK.} -#' \item{inputData}{A list containting the original 'Ly' and 'Lt' lists used as inputs to FPCA. NULL if 'lean' was specified to be TRUE.} -#' @examples -#' set.seed(1) -#' n <- 20 -#' pts <- seq(0, 1, by=0.05) -#' sampWiener <- Wiener(n, pts) -#' sampWiener <- Sparsify(sampWiener, pts, 10) -#' res <- FPCA(sampWiener$Ly, sampWiener$Lt, -#' list(dataType='Sparse', error=FALSE, kernel='epan', verbose=TRUE)) -#' plot(res) # The design plot covers [0, 1] * [0, 1] well. -#' CreateCovPlot(res, 'Fitted') -#' @references -#' \cite{Yao, F., Mueller, H.G., Clifford, A.J., Dueker, S.R., Follett, J., Lin, Y., Buchholz, B., Vogel, J.S. (2003). "Shrinkage estimation for functional principal component scores, with application to the population kinetics of plasma folate." Biometrics 59, 676-685. (Shrinkage estimates for dense data)} -#' -#' \cite{Yao, Fang, Hans-Georg Mueller, and Jane-Ling Wang. "Functional data analysis for sparse longitudinal data." Journal of the American Statistical Association 100, no. 470 (2005): 577-590. (Sparse data FPCA)} -#' -#' \cite{Liu, Bitao, and Hans-Georg Mueller. "Estimating derivatives for samples of sparsely observed functions, with application to online auction dynamics." Journal of the American Statistical Association 104, no. 486 (2009): 704-717. (Sparse data FPCA)} -#' -#' \cite{Castro, P. E., W. H. Lawton, and E. A. Sylvestre. "Principal modes of variation for processes with continuous sample curves." Technometrics 28, no. 4 (1986): 329-337. (Dense data FPCA)} -#' @export - -FPCA = function(Ly, Lt, optns = list()){ - - firsttsFPCA <- Sys.time() #First time-stamp for FPCA - # Check the data validity for further analysis - CheckData(Ly,Lt) - - # Force the data to be list of numeric members and handle NA's - #Ly <- lapply(Ly, as.numeric) - #Lt <- lapply(Lt, as.numeric) - #Lt <- lapply(Lt, signif, 14) - #inputData <- list(Ly=Ly, Lt=Lt); - - inputData <- HandleNumericsAndNAN(Ly,Lt); - Ly <- inputData$Ly; - Lt <- inputData$Lt; - - # Set the options structure members that are still NULL - optns = SetOptions(Ly, Lt, optns); - - # Check the options validity for the PCA function. - numOfCurves = length(Ly); - CheckOptions(Lt, optns,numOfCurves) - - # Bin the data - if ( optns$useBinnedData != 'OFF'){ - BinnedDataset <- GetBinnedDataset(Ly,Lt,optns) - Ly = BinnedDataset$newy; - Lt = BinnedDataset$newt; - optns[['nRegGrid']] <- min(optns[['nRegGrid']], - BinnedDataset[['numBins']]) - inputData$Ly <- Ly - inputData$Lt <- Lt - } - - # Generate basic grids: - # obsGrid: the unique sorted pooled time points of the sample and the new - # data - # regGrid: the grid of time points for which the smoothed covariance - # surface assumes values - # cutRegGrid: truncated grid specified by optns$outPercent for the cov - # functions - obsGrid = sort(unique( c(unlist(Lt)))); - regGrid = seq(min(obsGrid), max(obsGrid),length.out = optns$nRegGrid); - outPercent <- optns$outPercent - buff <- .Machine$double.eps * max(abs(obsGrid)) * 10 - rangeGrid <- range(regGrid) - minGrid <- rangeGrid[1] - maxGrid <- rangeGrid[2] - cutRegGrid <- regGrid[regGrid > minGrid + diff(rangeGrid) * outPercent[1] - - buff & - regGrid < minGrid + diff(rangeGrid) * outPercent[2] + - buff] - - ymat <- List2Mat(Ly, Lt) - - ## Mean function - # If the user provided a mean function use it - firsttsMu <- Sys.time() #First time-stamp for calculation of the mean - userMu <- optns$userMu - if ( is.list(userMu) && (length(userMu$mu) == length(userMu$t))){ - smcObj <- GetUserMeanCurve(optns, obsGrid, regGrid, buff) - smcObj$muDense = ConvertSupport(obsGrid, regGrid, mu = smcObj$mu) - } else if (optns$methodMuCovEst == 'smooth') { # smooth mean - smcObj = GetSmoothedMeanCurve(Ly, Lt, obsGrid, regGrid, optns) - } else if (optns$methodMuCovEst == 'cross-sectional') { # cross-sectional mean - smcObj = GetMeanDense(ymat, obsGrid, optns) - } -# mu: the smoothed mean curve evaluated at times 'obsGrid' - mu <- smcObj$mu - lasttsMu <- Sys.time() - - - firsttsCov <- Sys.time() #First time-stamp for calculation of the covariance -## Covariance function and sigma2 - if (!is.null(optns$userCov) && optns$methodMuCovEst != 'smooth') { - scsObj <- GetUserCov(optns, obsGrid, cutRegGrid, buff, ymat) - } else if (optns$methodMuCovEst == 'smooth') { -# smooth cov and/or sigma2 - scsObj = GetSmoothedCovarSurface(Ly, Lt, mu, obsGrid, regGrid, optns, - optns$useBinnedCov) - } else if (optns$methodMuCovEst == 'cross-sectional') { - scsObj = GetCovDense(ymat, mu, optns) - if (length(obsGrid) != length(cutRegGrid) || !all.equal(obsGrid, cutRegGrid)) { - scsObj$smoothCov = ConvertSupport(obsGrid, cutRegGrid, Cov = - scsObj$smoothCov) - } - scsObj$outGrid <- cutRegGrid - } - sigma2 <- scsObj[['sigma2']] - lasttsCov <- Sys.time() - firsttsPACE <- Sys.time() #First time-stamp for calculation of PACE - # workGrid: possibly truncated version of the regGrid - workGrid <- scsObj$outGrid - - - # convert mu to truncated workGrid - muWork <- ConvertSupport(obsGrid, toGrid = workGrid, mu=smcObj$mu) - - # Get the results for the eigen-analysis - eigObj = GetEigenAnalysisResults(smoothCov = scsObj$smoothCov, workGrid, optns, muWork = muWork) - - # Truncated obsGrid, and observations. Empty observation due to truncation has length 0. - truncObsGrid <- obsGrid - if (!all(abs(optns$outPercent - c(0, 1)) < .Machine$double.eps * 2)) { - truncObsGrid <- truncObsGrid[truncObsGrid >= min(workGrid) - buff & - truncObsGrid <= max(workGrid) + buff] - tmp <- TruncateObs(Ly, Lt, truncObsGrid) - Ly <- tmp$Ly - Lt <- tmp$Lt - } - - # convert phi and fittedCov to obsGrid. - muObs <- ConvertSupport(obsGrid, truncObsGrid, mu=mu) - phiObs <- ConvertSupport(workGrid, truncObsGrid, phi=eigObj$phi) - if (optns$methodXi == 'CE') { - CovObs <- ConvertSupport(workGrid, truncObsGrid, Cov=eigObj$fittedCov) - } - - # Get scores - if (optns$methodXi == 'CE') { - if (optns$rho != 'no') { - if( is.null(optns$userRho) ){ - if( length(Ly) > 2048 ){ - randIndx <- sample( length(Ly), 2048) - rho <- GetRho(Ly[randIndx], Lt[randIndx], optns, muObs, truncObsGrid, CovObs, eigObj$lambda, phiObs, sigma2) - } else { - rho <- GetRho(Ly, Lt, optns, muObs, truncObsGrid, CovObs, eigObj$lambda, phiObs, sigma2) - } - } else { - rho = optns$userRho; - } - sigma2 <- rho - } - scoresObj <- GetCEScores(Ly, Lt, optns, muObs, truncObsGrid, CovObs, eigObj$lambda, phiObs, sigma2) - } else if (optns$methodXi == 'IN') { - ymat = List2Mat(Ly,Lt) - scoresObj <- GetINScores(ymat, Lt, optns, muObs, eigObj$lambda, phiObs, sigma2) - } - - if (optns$fitEigenValues) { - fitLambda <- FitEigenValues(scsObj$rcov, workGrid, eigObj$phi, optns$maxK) - } else { - fitLambda <- NULL - } - - lasttsPACE <- Sys.time() - # Make the return object by MakeResultFPCA - ret <- MakeResultFPCA(optns, smcObj, muObs, scsObj, eigObj, - inputData = inputData, - scoresObj, truncObsGrid, workGrid, - rho = if (optns$rho != 'no') rho else NULL, - fitLambda=fitLambda, - timestamps = c(lasttsMu, lasttsCov, lasttsPACE, firsttsFPCA, firsttsMu, firsttsCov, firsttsPACE) ) - - # Plot the results - if(optns$plot){ - plot.FPCA(ret) - } - - return(ret); -} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/FPCAder.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/FPCAder.R deleted file mode 100644 index 11d71682..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/FPCAder.R +++ /dev/null @@ -1,276 +0,0 @@ -#' Take derivative of an FPCA object -#' -#' @param fpcaObj A object of class FPCA returned by the function FPCA(). -#' @param derOptns A list of options to control the derivation parameters specified by \code{list(name=value)}. See `Details'. (default = NULL) -#' -#' @details Available derivation control options are -#' \describe{ -#' \item{method}{The method used for obtaining the derivatives (default: 'FPC'). 'DPC': derivatives principal component, with G^(1,1) estimated by first kernel local smoothing G^(1,0), and then apply a 1D smoother on the second direction; 'FPC': functional principal component, based on smoothing the eigenfunctions; 'FPC1': functional principal component, based on smoothing G^(1,0). May produce better estimate than 'FPC' but is slower.} -#' \item{p}{The order of the derivatives returned (default: 1, max: 2). } -#' \item{bw}{Bandwidth for the 1D and the 2D smoothers (default: p * 0.1 * S).} -#' \item{kernelType}{Smoothing kernel choice; same available types are FPCA(). default('epan')} -#' } -#' -#' @references -#' \cite{Dai, Xiongtao, Hans-Georg Mueller, and Wenwen Tao. "Derivative Principal Component Analysis for Representing the Time Dynamics of Longitudinal and Functional Data." Submitted (DPC)} -#' \cite{Liu, Bitao, and Hans-Georg Mueller. "Estimating derivatives for samples of sparsely observed functions, with application to online auction dynamics." Journal of the American Statistical Association 104, no. 486 (2009): 704-717. (FPC)} -#' @examples -#' -#' bw <- 0.2 -#' kern <- 'epan' -#' set.seed(1) -#' n <- 100 -#' M <- 40 -#' pts <- seq(0, 1, length.out=M) -#' lambdaTrue <- c(1, 0.8, 0.1)^2 -#' sigma2 <- 0.1 -#' -#' samp2 <- MakeGPFunctionalData(n, M, pts, K=length(lambdaTrue), -#' lambda=lambdaTrue, sigma=sqrt(sigma2), basisType='legendre01') -#' samp2 <- c(samp2, MakeFPCAInputs(tVec=pts, yVec=samp2$Yn)) -#' fpcaObj <- FPCA(samp2$Ly, samp2$Lt, list(methodMuCovEst='smooth', -#' userBwCov=bw, userBwMu=bw, kernel=kern, error=TRUE)) -#' CreatePathPlot(fpcaObj, showObs=FALSE) -#' -#' FPCoptn <- list(bw=bw, kernelType=kern, method='FPC') -#' DPCoptn <- list(bw=bw, kernelType=kern, method='DPC') -#' FPC <- FPCAder(fpcaObj, FPCoptn) -#' DPC <- FPCAder(fpcaObj, DPCoptn) -#' -#' CreatePathPlot(FPC, ylim=c(-5, 10)) -#' CreatePathPlot(DPC, ylim=c(-5, 10)) -#' -#' # Get the true derivatives -#' phi <- CreateBasis(K=3, type='legendre01', pts=pts) -#' basisDerMat <- apply(phi, 2, function(x) -#' ConvertSupport(seq(0, 1, length.out=M - 1), pts, diff(x) * (M - 1))) -#' trueDer <- matrix(1, n, M, byrow=TRUE) + tcrossprod(samp2$xi, basisDerMat) -#' matplot(t(trueDer), type='l', ylim=c(-5, 10)) -#' -#' # DPC is slightly better in terms of RMSE -#' mean((fitted(FPC) - trueDer)^2) -#' mean((fitted(DPC) - trueDer)^2) -#' -#' @export - - -FPCAder <- function (fpcaObj, derOptns = list(p=1)) { - - derOptns <- SetDerOptions(fpcaObj,derOptns = derOptns) - p <- derOptns[['p']] - method <- derOptns[['method']] - bwMu <- derOptns[['bwMu']] - bwCov <- derOptns[['bwCov']] - kernelType <- derOptns[['kernelType']] - # K <- derOptns[['K']] - - # TODO: truncated workGrid/obsGrid may not work - obsGrid <- fpcaObj$obsGrid - workGrid <- fpcaObj$workGrid - nWorkGrid <- length(workGrid) - gridSize <- workGrid[2] - workGrid[1] - Lt <- fpcaObj[['inputData']][['Lt']] - Ly <- fpcaObj[['inputData']][['Ly']] - phi <- fpcaObj[['phi']] - fittedCov <- fpcaObj[['fittedCov']] - lambda <- fpcaObj[['lambda']] - - if (!class(fpcaObj) %in% 'FPCA'){ - stop("FPCAder() requires an FPCA class object as basic input") - } - - if( ! (p %in% c(1, 2))){ - stop("The derivative order p should be in {1, 2}!") - } - - if (p == 2 && (substr(method, 1, 3) == 'DPC' || method == 'FPC1')) { - stop('Only \'FPC\' supports p = 2') - } - - if (p == 2) { - warning('Second derivative is experimental only.') - } - - if (substr(method, 1, 3) == 'DPC') { - # if (!derOptns$useTrue) { - # Get mu'(t) - xin <- unlist(Lt) - yin <- unlist(Ly) - ord <- order(xin) - xin <- xin[ord] - yin <- yin[ord] - muDense <- Lwls1D(bwMu, kernelType, xin=xin, yin=yin, xout=obsGrid) - mu1 <- Lwls1D(bwMu, kernelType, xin=xin, yin=yin, xout=workGrid, npoly=p + 1, nder=p) - - # Get raw covariance - rcov <- BinRawCov(GetRawCov(Ly, Lt, obsGrid, muDense, 'Sparse', TRUE)) - - # Use 1D smoothing on G(s, t) for G^(1,0)(s, t) - # if (is.null(derOptns[['G10_1D']]) || !derOptns[['G10_1D']]) { - # cov10 <- Lwls2DDeriv(bwCov, kernelType, xin=rcov$tPairs, yin=rcov$meanVals, - # win=rcov$count, xout1=workGrid, xout2=workGrid, - # npoly=1L, nder1=1L, nder2=0L) - # } else { - tmpGrid <- seq(min(workGrid), max(workGrid), length=nWorkGrid - 1) - cov10 <- ConvertSupport(tmpGrid, workGrid, apply(fpcaObj[['smoothedCov']], 2, diff) / gridSize) - # } - - if (method == 'DPC') { - # 1D smooth cov10 to get cov11 - cov11 <- apply(cov10, 1, function(x) - Lwls1D(bwCov, kernelType, xin=workGrid, yin=x, xout=workGrid, npoly=2, - nder=1) - ) - } - cov11 <- (cov11 + t(cov11)) / 2 - # } else { # use true values - # muDense <- rep(0, length(obsGrid)) - # mu1 <- rep(0, nWorkGrid) - # cov10 <- ConvertSupport(obsGrid, workGrid, Cov=cov10True, isCrossCov=TRUE) - # cov11 <- ConvertSupport(obsGrid, workGrid, Cov=cov11True) - # cov10T <- ConvertSupport(obsGrid, workGrid, Cov=cov10True, isCrossCov=TRUE) - # cov11T <- ConvertSupport(obsGrid, workGrid, Cov=cov11True) - # rgl::persp3d(workGrid, workGrid, cov10, xlab='s', ylab='t') - # rgl::persp3d(workGrid, workGrid, cov10T, xlab='s', ylab='t') - # rgl::persp3d(workGrid, workGrid, cov11) - # rgl::persp3d(workGrid, workGrid, cov11T, xlab='s', ylab='t') - # } - # browser() - eig <- eigen(cov11) - positiveInd <- eig[['values']] >= 0 - if (sum(positiveInd) == 0) { - stop('Derivative surface is negative definite') - } - lambda1 <- eig[['values']][positiveInd] * gridSize - FVE1 <- cumsum(lambda1) / sum(lambda1) - # TODO: select number of derivative components - FVEthreshold1 <- 0.9999 - K <- min(which(FVE1 >= FVEthreshold1)) - lambda1 <- lambda1[seq_len(K)] - phi1 <- apply(eig[['vectors']][, positiveInd, drop=FALSE][, seq_len(K), drop=FALSE], 2, - function(tmp) - tmp / sqrt(trapzRcpp(as.numeric(workGrid), - as.numeric(tmp^2)))) - # phi1 <- eig[['vectors']][, seq_len(ncol(phi))] - - # fittedCov1 <- phi1 %*% diag(lambda1, K) %*% t(phi1) - - # rgl::persp3d(workGrid, workGrid, fittedCov1) - # rgl::persp3d(workGrid, workGrid, cov11) - # rgl::persp3d(workGrid, workGrid, cov10) - - # convert phi and fittedCov to obsGrid. - zeta <- crossprod(cov10, phi1) * gridSize - zetaObs <- ConvertSupport(workGrid, obsGrid, phi=zeta) - CovObs <- ConvertSupport(workGrid, obsGrid, Cov=fittedCov) - phiObs <- ConvertSupport(workGrid, obsGrid, phi=phi) - - # conditional expectation - sigma2 <- ifelse(is.null(fpcaObj[['rho']]), fpcaObj[['sigma2']], - max(fpcaObj[['sigma2']], fpcaObj[['rho']])) - - # browser() - - # For estimating the xiVar1, Estimate lambdaDer from the difference - # quotient surface constructed from smoothedCov, and xiVar1 by truncating - # the negative eigenvalues - # noSmooth <- !is.null(derOptns[['lambdaDerNoSmooth']]) && - # derOptns[['lambdaDerNoSmooth']] - # if (noSmooth) { - d <- function(x) diff(x) / gridSize - cov11diff <- apply(apply(fpcaObj[['smoothedCov']], 2, d), 1, d) - cov11diff <- (cov11diff + t(cov11diff)) / 2 - lambdaDerNoSmooth <- eigen(cov11diff)[['values']] * gridSize - lambdaDerNoSmooth <- lambdaDerNoSmooth[seq_len(K)] - # } else { - # lambdaDerNoSmooth <- lambda1 - # } - - xi1 <- GetCEScores(Ly, Lt, list(verbose=FALSE), - muDense, obsGrid, CovObs, - lambda=lambdaDerNoSmooth, - phi=zetaObs %*% diag(1 / lambdaDerNoSmooth , - length(lambdaDerNoSmooth )), - sigma2=sigma2) - xiEst1 <- t(do.call(cbind, xi1['xiEst', ])) - # if (is.null(derOptns[['truncxiVar1']]) || derOptns[['truncxiVar1']]) { - # # truncate negative eigenvalues because cov10 is smoothed--the joint - # # covariance of xi1 and Yi is not garanteed to be PD. Default to truncate - xiVar1 <- lapply(xi1['xiVar', ], function(x) { - eig <- eigen(x) - keep <- eig[['values']] > 0 - if (sum(keep) == 0) { - # warning('xiVarDer is unrealiable due to degeneracy') - return(matrix(0, nrow(x), ncol(x))) - } else { - return(eig[['vectors']][, keep, drop=FALSE] %*% - diag(eig[['values']][keep], sum(keep)) %*% - t(eig[['vectors']][, keep, drop=FALSE])) - }}) - # } else { - # xiVar1 <- xi1['xiVar', ] - # } - - # xi <- GetCEScores(Ly, Lt, list(verbose=FALSE), - # muDense, obsGrid, CovObs, - # lambda=lambda, phiObs, - # ifelse(is.null(fpcaObj[['rho']]), - # fpcaObj[['sigma2']], fpcaObj[['rho']])) - # xiEst <- t(simplify2array(xi['xiEst', ], higher=FALSE)) - - ret <- append(fpcaObj, list(muDer=mu1, phiDer=phi1, - xiDer=xiEst1, xiVarDer=xiVar1, - lambdaDer=lambda1, - zeta=zeta, - derOptns=derOptns)) - # if (noSmooth) { - # ret <- append(ret, list(lambdaDerNoSmooth = lambdaDerNoSmooth)) - # } - } else if (method == 'FPC') { - # smooth phi to get phi1 - muDer <- Lwls1D(bwMu, kernelType, rep(1, nWorkGrid), workGrid, fpcaObj$mu, workGrid, p+0, nder= p) - phiDer <- apply(phi, 2, function(phij) Lwls1D(bwCov, kernelType, rep(1, nWorkGrid), workGrid, phij, workGrid, p+0, nder= p)) - - # muDer2<- fpcaObj$mu - # phiDer2 <- fpcaObj$phi - # for (i in seq_len(p)) { - # # derivative - # muDer2 <- getDerivative(y = muDer2, t = obsGrid, ord=p) - # phiDer2 <- apply(phiDer2, 2, getDerivative, t= workGrid, ord=p) - # # smooth - # muDer2 <- getSmoothCurve(t=obsGrid, - # ft= muDer2, - # GCV = TRUE, - # kernelType = kernelType, mult=2) - # phiDer2 <- apply(phiDer2, 2, function(x) - # getSmoothCurve(t=workGrid, ft=x, GCV =TRUE, kernelType = kernelType, mult=1)) - # } - - ret <- append(fpcaObj, list(muDer = muDer, phiDer = phiDer, derOptns = derOptns)) - } else if (method == 'FPC1') { - # Smooth out cov10 first and then estimate phi1 - xin <- unlist(Lt) - yin <- unlist(Ly) - ord <- order(xin) - xin <- xin[ord] - yin <- yin[ord] - muDense <- Lwls1D(bwMu, kernelType, xin=xin, yin=yin, xout=obsGrid) - muDer <- Lwls1D(bwMu, kernelType, xin=xin, yin=yin, xout=workGrid, npoly=p + 1, nder=p) - - # Get raw covariance - rcov <- BinRawCov(GetRawCov(Ly, Lt, obsGrid, muDense, 'Sparse', TRUE)) - - if (p != 1) { - stop("'FPC1' is available only for p=1") - } - cov10 <- Lwls2DDeriv(bwCov, kernelType, xin=rcov$tPairs, yin=rcov$meanVals, - win=rcov$count, xout1=workGrid, xout2=workGrid, - npoly=1L, nder1=1L, nder2=0L) - phiDer <- cov10 %*% phi %*% diag(1 / lambda[seq_len(ncol(phi))], ncol(phi)) * gridSize - - ret <- append(fpcaObj, list(muDer = muDer, phiDer = phiDer, derOptns = derOptns)) - } - - class(ret) <- c('FPCAder', class(fpcaObj)) - return(ret) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/FPCReg.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/FPCReg.R deleted file mode 100644 index 0300fee0..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/FPCReg.R +++ /dev/null @@ -1,637 +0,0 @@ -#' Function for performing functonal linear regression where the covariates are functions X1(t1),X2(t2),.. and the response is a function Y(t_y). -#' -#' @param vars A list of input functional covariates with name of "X1", "X2",.. and a functional response with name "Y". Each field should have two fields: 'Lt', a list (sparse) or a matrix (Dense) specifying the time of observations, and 'Ly', a list (Sparse) or a matrix (Dense) of the observations. -#' @param varsOptns A list of options named by "X1", "X2",..."Y". Each filed specify the paramaters that control the corresponding variables. (default: see details of FPCA()) -#' @param isNewSub A 1*n vector of 0s or 1s, where n is the total count of subjects. 0 denotes the corresponding subject is only used for estimation and 1 denotes the corresponding subject is only used for prediction. (default: 0's) -#' @param method The method used for selecting the number of principal components of functional predictors X's used in functional regression , including 'AIC', 'BIC' and 'FVE'. (default: "AIC") -#' @param FVEthreshold A scalar specifying the proportion used for 'FVE'. (default: 0.99) -#' @param alpha A scalar specifying the level of the confidence bands. (default: 0.05) -#' @param Kx The number of principal components of functional predictors X's used in functional regression. -#' -#' @return A list containing the following fields: -#' \item{estiBeta}{A list with fields of estimated beta_XiY(s,t) defiend on [range(Xi),range(Y)]} -#' \item{predictY}{A list containing fitted or predicted (when is NewSub is true) functions for E(Y|X).} -#' \item{cbandY}{A list with confidence bands of E(Y|X).} -#' \item{Q}{Quasi R-square} -#' \item{r2}{Functional R-square.} -#' \item{varsMean}{A list with mean function of covariates and response.} -#' \item{Kx}{The number of principal components of functional predictors X's used in functional regression.} -#' -#' @references -#' \cite{Yao, F., Mueller, H.G., Wang, J.L. "Functional Linear Regression Analysis for Longitudinal Data." Annals of Statistics 33, (2005): 2873-2903.} -#' -#' @export -#' @examples -#' set.seed(1000) -#' #Model: E(Y(t)|X) = int(beta(s,t)*X(s)) -#' n <- 200 #number of subjects -#' ngrids <- 51 #number of grids in [0,1] for X(s) -#' ngridt <- 101 #number of grids in [0,1] for Y(t) -#' grids <- seq(0, 1, length.out=ngrids) #regular grids in [0,1] for X(s) -#' gridt <- seq(0, 1, length.out=ngridt) #regular grids in [0,1] for Y(t) -#' -#' #generate X -#' #{1, sqrt(2)*sin(2*pi*s), sqrt(2)*cos(2*pi*t)} are used to generate X. -#' eigenFun <- list( function(s){1 + 0 * s}, -#' function(s){sqrt(2) * sin(2*pi*s)}, -#' function(s){sqrt(2) * cos(2*pi*s)}) -#' -#' sig <- matrix(c(1.5, 0.0, 0.0, 0.9, -.5, 0.1, -#' 0.0, 1.2, 0.0, -.3, 0.8, 0.4, -#' 0.0, 0.0, 1.0, 0.4, -.3, 0.7, -#' 0.9, -.3, 0.4, 2.0, 0.0, 0.0, -#' -.5, 0.8, -.3, 0.0, 1.5, 0.0, -#' 0.1, 0.4, 0.7, 0.0, 0.0, 1.0), -#' nrow=6,ncol=6) -#' -#' scoreX <- MASS::mvrnorm(n,mu=rep(0,6),Sigma=sig) -#' scoreX1 <- scoreX[,1:3] -#' scoreX2 <- scoreX[,4:6] -#' -#' basisX1 <- sapply(eigenFun,function(x){x(grids)}) -#' latentX1 <- scoreX1 %*% t(basisX1) -#' measErrX1 <- sqrt(0.03) * matrix(rnorm(n * ngrids), n, ngrids) #0.01 is sigma^2. -#' denseX1 <- latentX1 + measErrX1 -#' -#' basisX2 <- sapply(eigenFun,function(x){x(grids)}) -#' latentX2 <- scoreX2 %*% t(basisX2) -#' measErrX2 <- sqrt(0.03) * matrix(rnorm(n * ngrids), n, ngrids) #0.01 is sigma^2. -#' denseX2 <- latentX2 + measErrX2 -#' -#' #generate Y -#' #beta(s, t) <- sin(2 * pi * s)*cos(2 * pi * t) -#' betaEigen1 <- function(t){f <- function(s){ -#' sin(2*pi*s) * cos(2*pi*t) * (1+0*s)}; return(f)} -#' betaEigen2 <- function(t){f <- function(s){ -#' sin(2*pi*s) * cos(2*pi*t) * (sqrt(2)*sin(2*pi*s))}; return(f)} -#' betaEigen3 <- function(t){f <- function(s){ -#' sin(2*pi*s) * cos(2*pi*t) * (sqrt(2)*cos(2*pi*s))}; return(f)} -#' betaEigen <- list(betaEigen1, betaEigen2, betaEigen3) -#' basisY <- array(0,c(ngridt, 3)) -#' for(i in 1:3){ -#' intbetaEigen <- function (t) {integrate(betaEigen[[i]](t), lower = 0, upper = 1)$value} -#' basisY[, i] <- sapply(1:ngridt, function(x){intbetaEigen(gridt[x])}) -#' } -#' latentY <- scoreX1 %*% t(basisY) - scoreX2 %*% t(basisY) -#' measErrY <- sqrt(0.01) * matrix(rnorm(n*ngridt), n, ngridt) #0.01 is sigma^2 -#' denseY <- latentY + measErrY -#' -#' #======Dense data=============================================== -#' timeX <- t(matrix(rep(grids, n),length(grids), n)) -#' timeY <- t(matrix(rep(gridt, n),length(gridt), n)) -#' denseVars <- list(X1 = list(Ly = denseX1, Lt = timeX), -#' X2 = list(Ly = denseX2, Lt = timeX), -#' Y=list(Ly = denseY,Lt = timeY)) -#' -#' resuDense <- FPCReg(denseVars, method="FVE") -#' -#' par(mfrow=c(1,2)) -#' estiBetaX1Y_Dense <- resuDense$estiBeta$betaX1Y -#' args1 <- list(xlab = 's', ylab = 't', zlab = 'estiBetaX1Y_Dense(s, t)', -#' lighting = FALSE, phi = 45, theta = 45) -#' args2 <- list(x = 1:ngrids, y = 1:ngridt, z = estiBetaX1Y_Dense[1:ngrids, 1:ngridt]) -#' do.call(plot3D::persp3D,c(args2, args1)) -#' -#' estiBetaX2Y_Dense <- resuDense$estiBeta$betaX2Y -#' args1 <- list(xlab = 's', ylab = 't', zlab = 'estiBetaX2Y_Dense(s, t)', -#' lighting = FALSE, phi = 45, theta = 45) -#' args2 <- list(x = 1:ngrids, y = 1:ngridt, z = estiBetaX2Y_Dense[1:ngrids, 1:ngridt]) -#' # do.call(plot3D::persp3D,c(args2, args1)) -#' -#' #======Sparse data=============================================== -#' \dontrun{ -#' sparsity = 5:8 -#' sparseX1 <- Sparsify(denseX1, grids, sparsity) -#' sparseX2 <- Sparsify(denseX2, grids, sparsity) -#' sparseY <- Sparsify(denseY, gridt, sparsity) -#' sparseVars <- list(X1 = sparseX1, X2 = sparseX2, Y = sparseY) -#' -#' resuSparse <- FPCReg(sparseVars, method="FVE", FVEthreshold=0.98) -#' #or resuSparse <- FPCReg(vars = sparseVars, -#' # varsOptns = list(X1=list(userBwCov = 0.03))) -#' -#' par(mfrow=c(1,2)) -#' estiBetaX1Y_Sparse = resuSparse$estiBeta$betaX1Y -#' args1 = list(xlab = 's', ylab = 't', zlab = 'estiBetaX1Y_Sparse(s,t)', -#' lighting = FALSE, phi = 45,theta = 45) -#' args2 = list(x = 1:51, y = 1:51, z = estiBetaX1Y_Sparse[1:51, 1:51]) -#' do.call(plot3D::persp3D, c(args2, args1)) -#' -#' estiBetaX2Y_Sparse = resuSparse$estiBeta$betaX2Y -#' args1 = list(xlab = 's', ylab = 't', zlab = 'estiBetaX2Y_Sparse(s,t)', -#' lighting = FALSE, phi = 45,theta = 45) -#' args2 = list(x = 1:51, y = 1:51, z = estiBetaX2Y_Sparse[1:51, 1:51]) -#' do.call(plot3D::persp3D, c(args2, args1)) -#' -#' par(mfrow=c(2,3)) -#' for(i in 1:6){ -#' plot(sparseVars[['Y']]$Lt[[i]], sparseVars[['Y']]$Ly[[i]], -#' xlab = 'time', ylab = 'observations', ylim = c(-1.5, 1.5)) -#' lines(seq(0, 1, length.out = 51), resuSparse$predictY[[i]]) -#' lines(seq(0, 1, length.out = 51), resuSparse$cbandY[[i]][,2], lty = 2) -#' lines(seq(0, 1, length.out = 51), resuSparse$cbandY[[i]][,1], lty = 2) -#' } -#' } - -FPCReg <- function(vars, varsOptns = NULL, isNewSub = NULL, method = 'AIC', FVEthreshold = 0.99, alpha = 0.05, Kx = NULL){ - #===============data checking and manipulation=============== - p <- length(vars) - 1 - if (p == 0) stop('Too few covariates.') - if (!'Y' %in% names(vars)|"" %in% names(vars)) stop('Missing name of the response which should be "Y".') - if (!'X1' %in% names(vars)|"" %in% names(vars)) stop('Missing name of preictors which should be "X1","X2",...') - if (anyDuplicated(names(vars)) > 0) stop('Duplicated Names.') - if ('Y' %in% names(vars)) {vars <- c(vars[names(vars) != 'Y'], vars['Y'])} - - #Set Lt in [0,1] for dense data without Lt. - for (i in 1:(p+1)) { - if (is.null(vars[[i]]$Lt) & is.matrix(vars[[i]]$Ly)) { - n1 <- dim(vars[[i]]$Ly)[1] - n2 <- dim(vars[[i]]$Ly)[2] - vars[[i]]$Lt <- t(matrix(rep(seq(0, 1, length.out = n2), n1), n2, n1)) - } - } - - #Dense==1 iff all covariates and response are Matrix - if (sum(sapply(vars, function(x){is.matrix(x$Ly)}) * sapply(vars, function(x){is.matrix(x$Lt)}))) {Dense <- 1} else {Dense <- 0} - - #set options - #varsOptnsDef is the default - #specific default setting for optns now and output grids for sparse is fixed at 51 now due to the cross-cov. - if (Dense == 1) {optns <- list(dataType = "Dense" ,error = 1, kernel='gauss', nRegGrid=51, useBinnedData='OFF')} else {optns <- list(dataType = "Sparse", error = TRUE, kernel = 'gauss' ,nRegGrid = 51, useBinnedData = 'OFF')} - for (i in 1:(p+1)) { - if (i == 1) {varsOptnsDef <- list(optns)} else {varsOptnsDef <- c(varsOptnsDef, list(optns))} - } - names(varsOptnsDef) <- names(vars) - if (is.null(varsOptns)) {varsOptns <- varsOptnsDef} else if (!is.list(varsOptns)) {stop('wrong inpiut of varsOptns.')} - if (!sum(names(varsOptns) %in% names(vars)) == length(names(varsOptns))) stop('Check names of varsOptns which should be X1,X2..Y.') - for (i in 1:(p+1)) { - name1=names(varsOptns) - if (!names(vars)[i]%in%names(varsOptns)) {varsOptns <- c(varsOptns, list(optns)); names(varsOptns) = c(name1, names(vars)[i])} - if (is.null(varsOptns[names(vars)[i]]$dataType) & Dense == 0) {varsOptns[[names(vars)[i]]] <- c(varsOptns[[names(vars)[i]]], dataType = "Sparse") - }else if(is.null(varsOptns[names(vars)[i]]$dataType) & Dense==1){ - varsOptns[[names(vars)[i]]] <- c(varsOptns[[names(vars)[i]]], dataType = "Dense") - } - if (is.null(varsOptns[names(vars)[i]]$nRegGrid) & Dense == 0) {varsOptns[[names(vars)[i]]] <- c(varsOptns[[names(vars)[i]]], nRegGrid = 51)} - if (is.null(varsOptns[names(vars)[i]]$error)) {varsOptns[[names(vars)[i]]] <- c(varsOptns[[names(vars)[i]]], error = TRUE)} - if (Dense == 1) {varsOptns[[names(vars)[i]]]$nRegGrid <- dim(vars[[i]]$Ly)[2]} - } - varsOptns <- varsOptns[names(vars)] - - #nRegGrids determine the numbers of ouput grids - if (Dense == 0) {nRegGrids <- sapply(varsOptns, function(x){x$nRegGrid})} - - for ( i in 1:(p+1)) { - if (!'Ly' %in% names(vars[[i]])) stop('Insert the name "Ly" for the predictors and response to indicate time of data.') - if (!'Lt' %in% names(vars[[i]])) stop('Insert the name "Lt" for the predictors and response to indicate time of data.') - if (! length(names(vars[[i]])) == 2) stop('Check data.') - } - - #list dense data for using HandleNumericsAndNAN and demeanFuc func. - for (i in 1:(p+1)) { - if (is.list(vars[[i]]$Lt) == 0) {vars[[i]]$Lt <- lapply(1:nrow(vars[[i]]$Lt), function(j) vars[[i]]$Lt[j, ])} - if (is.list(vars[[i]]$Ly) == 0) {vars[[i]]$Ly <- lapply(1:nrow(vars[[i]]$Ly), function(j) vars[[i]]$Ly[j, ])} - } - vars[sapply(vars, is.list)] <- lapply(vars[sapply(vars, is.list)], function(v) HandleNumericsAndNAN(v[['Ly']], v[['Lt']])) - - if (is.null(isNewSub)) {isNewSub <- rep(0, length(vars[[1]]$Lt))} - varsTrain <- vars - for (i in 1:(p+1)) { - varsTrain[[i]]$Lt <- vars[[i]]$Lt[which(isNewSub == 0)] - varsTrain[[i]]$Ly <- vars[[i]]$Ly[which(isNewSub == 0)] - } - - #===============population parameters=============== - demeanedRes <- demeanFuc(p, varsTrain, kern='gauss', varsOptns) #Centered predictors. Using gauss for demeanFuc, but may be relaxed. - varsTrain <- demeanedRes[['xList']] - muList <- demeanedRes[['muList']] - intLen <- array(0, p+1) #lengthes of time window - gridNum <- array(0, p+1) #number of grids for varss - regGrid <- list() - varsMean <- list() - for (i in 1:(p+1)) { - intLen[i] <- max(c(unlist(varsTrain[[i]]$Lt)))-min(c(unlist(varsTrain[[i]]$Lt))) - gridNum[i] <- if (Dense==1) {length(varsTrain[[i]]$Ly[[1]])} else {nRegGrids[i]} #sparse output grids is fixed to be 51 so far. - regGrid[[i]] <- seq(min(unlist(varsTrain[[i]]$Lt)), max(unlist(varsTrain[[i]]$Lt)), length.out=gridNum[i]) #time grids for output mean and beta. - varsMean[[i]] <- muList[[i]](regGrid[[i]]) - } - brkX <- c(0, cumsum(gridNum[1:p])) #break points for matrix products - dxMatrix <- dx(p, intLen[1:p], gridNum[1:p], brkX) #generate the inner product for multivariate predictors - - #matrilize the dense data. - if (Dense == 1) { - for (i in 1:(p+1)) { - varsTrain[[i]]$Lt <- do.call(rbind, varsTrain[[i]]$Lt) - varsTrain[[i]]$Ly <- do.call(rbind, varsTrain[[i]]$Ly) - } - } - - varsCov <- if (Dense == 1) {denseCov(p, varsTrain, brkX, dxMatrix, gridNum, varsOptns)} else {sparseCov(p, varsTrain, brkX, varsOptns, vars, muList, gridNum, dxMatrix, regGrid)} - xCov <- varsCov[['xCov']] - croCov <- varsCov[['croCov']] - yCov <- varsCov[['yCov']] - varsSigma2 <- varsCov[['varsSigma2']] - numposiEigen <- varsCov[['numposiEigen']] #number of positive eigenvalues - eigenValue <- varsCov[['eigenValue']] - eigenFun <- varsCov[['eigenFun']] - - #estimate score - if (Dense == 1) { - diagSigma2 <- varsCov[['diagSigma2']] - for (i in 1:p) { - if (i == 1) {varsMatrix <- t(sapply(vars[[1]]$Ly, c))}else{varsMatrix <- cbind(varsMatrix, t(sapply(vars[[i]]$Ly, c)))} - if (i == 1) {muListX <- muList[[1]](regGrid[[i]])}else{muListX <- c(muListX, muList[[i]](regGrid[[i]]))} - } - varsMatrixDemean <- apply(varsMatrix,1, '-', muListX) - varsMatrixDemean <- t(varsMatrixDemean) - denseScore <- innerProd(varsMatrixDemean, eigenFun, brkX, intLen[1:p]) #for dense data, he score is directly estimated by integral(x,ei) - } else { - varsDemean <- varsCov[['varsDemean']] - subCov <- varsCov[['subCov']] - subEigenFun <- varsCov[['subEigenFun']] - subMeanX <- varsCov[['subMeanX']] - diagSigma2 <- varsCov[['diagSigma2']] - numposiEigen <- varsCov[['numposiEigen']] - #for sparse data, empute score is estimated in sparseCov() - invSigma <- lapply(subCov, function(x){as.matrix(solve(x))}) - invSigmaY <- mapply(function(X, Y){X %*% Y}, X=invSigma, Y=varsDemean, SIMPLIFY=FALSE) - emputeScore <- mapply(function(X, Y){diag(eigenValue[1:numposiEigen]) %*% X %*% Y}, X = subEigenFun, Y = invSigmaY, SIMPLIFY = FALSE) - } - - #if (Dense == 0) {Kx <- sparseComp(emputeScore, varsDemean, method, FVEthreshold, eigenValue, numposiEigen, isNewSub, diagSigma2, subEigenFun)} else {Kx <- denseComp(method, varsMatrixDemean, denseScore, eigenFun, eigenValue, isNewSub, diagSigma2, numposiEigen, FVEthreshold)} - if(!is.null(Kx)==1) {Kx <- Kx} else if (Dense == 0) {Kx <- sparseComp(emputeScore, varsDemean, method, FVEthreshold, eigenValue, numposiEigen, isNewSub, diagSigma2, subEigenFun)} else {Kx <- denseComp(method, varsMatrixDemean, denseScore, eigenFun, eigenValue, isNewSub, diagSigma2, numposiEigen, FVEthreshold)} - - - #prodedure of FPCA Regression - pcaBeta <- array(0, c(dim(croCov))) - for (i in 1:Kx) { - pcaBeta <- pcaBeta + (1/eigenValue[i]) * eigenFun[, i] %*% innerProd(t(eigenFun[, i]), croCov, brkX, intLen) - } - estiBeta <- list() - #divide beta for output - for (i in 1:p) { - estiBeta[[i]] <- pcaBeta[(brkX[i]+1):brkX[i+1],] - } - names(estiBeta) <- lapply(names(vars)[1:p], function(x){paste("beta", x, "Y", sep = '')}) - - intBetaPhi <- innerProd(t(pcaBeta), as.matrix(eigenFun[, 1:Kx]), brkX, intLen) - diagYcov <- diag(yCov) ; diagYcov[which(diagYcov<0)] <- min(diagYcov[diagYcov>0]) - varY <- innerProd(t(diagYcov), as.matrix(rep(1, gridNum[p+1])), c(0,gridNum[p+1]), intLen[p+1]) - varYX <- sum(innerProd(t(intBetaPhi^2), as.matrix(rep(1, gridNum[p+1])),c(0, gridNum[p+1]), intLen[p+1]) * eigenValue[1:Kx]) - - Q <- min(varYX / varY, 1) #quasi R^2? - - r2 <- apply(intBetaPhi^2 %*% diag(eigenValue[1:Kx]), 1, sum) / diagYcov #functional R^2? - r2 <- sapply(r2, function(x){min(x, 1)}) - #R2=innerProd(t(r2),as.matrix(rep(1,gridNum[p+1])),c(0,gridNum[p+1]),intLen[p+1])/intLen[p+1] - - #===============the predictions=============== - if (Dense == 1) { - meanY <- varsMean[[p+1]] - names(varsMean) <- names(vars) - predictY <- meanY + intBetaPhi%*%t(denseScore[, 1:Kx]) - predictY <- t(predictY) - diageValue <- diag(eigenValue[1:Kx]) - for (i in 1:p) { - if (i == 1) { - diagSigma2 <- c(rep(varsSigma2[1], gridNum[1])) - }else{ - diagSigma2 = c(diagSigma2, rep(varsSigma2[i],gridNum[i])) - } - } - SigmaY <- xCov + diag(diagSigma2) #This part may be considered to use raw cov - Omega <- diageValue - diageValue %*% t(eigenFun[, 1:Kx]) %*% solve(SigmaY) %*% eigenFun[, 1:Kx] %*% t(diageValue) - pwVar <- diag(intBetaPhi %*% Omega %*% t(intBetaPhi)) - upCI <- t(apply(predictY, 1, '+', stats::qnorm(1-alpha / 2) * sqrt(pwVar))) - lwCI <- t(apply(predictY, 1, '-', stats::qnorm(1-alpha / 2) * sqrt(pwVar))) - cbandY <- list(upCI = upCI, lwCI = lwCI) - } else { - score <- lapply(emputeScore, function(x){x[1:Kx]}) - imputeY <- lapply(score, function(x){intBetaPhi %*% x}) - meanY <- varsMean[[p+1]] - names(varsMean) <- names(vars) - predmean <- innerProd(t(pcaBeta), as.matrix(subMeanX), brkX, intLen[1:p]) - predictY <- lapply(imputeY, function(x){x + meanY}) - diageValue <- diag(eigenValue[1:Kx]) - H <- lapply(subEigenFun, function(x){diag(eigenValue[1:Kx]) %*% x[1:Kx, ]}) - Omega <- mapply(function(X, Y){diageValue - X %*% Y %*% t(X)}, X=H, Y=invSigma, SIMPLIFY = FALSE) - pwVar <- lapply(Omega, function(x){diag(intBetaPhi %*% x %*% t(intBetaPhi))}) - upCI <- mapply(function(X, Y){X + stats::qnorm(1 - alpha / 2)*sqrt(Y)}, X = predictY, Y = pwVar) - lwCI <- mapply(function(X, Y){X - stats::qnorm(1 - alpha / 2)*sqrt(Y)}, X = predictY, Y = pwVar) - cbandY <- lapply(1:dim(lwCI)[2], function(x){CI = cbind(lwCI[, x], upCI[, x]) ; colnames(CI) = c('lwCI', 'upCI') ; return(CI)}) - } - - res <- list(estiBeta = estiBeta, predictY = predictY, cbandY = cbandY, Q = Q, r2 = r2, Kx = Kx, varsMean = varsMean) - res -} - -demeanFuc <- function(p, varsTrain, kern, varsOptns) { - for (i in 1:(p+1)) { - userBwMuXi <- SetOptions(varsTrain[[i]]$Ly, varsTrain[[i]]$Lt, varsOptns[[i]])$userBwMu - varsTrain[[i]] <- list(Lt = varsTrain[[i]]$Lt, Ly = varsTrain[[i]]$Ly, userBwMu = userBwMuXi) - } - tmp <- lapply(varsTrain, function(x) { - Tin <- sort(unique(unlist(x[['Lt']]))) - xmu <- GetSmoothedMeanCurve(x[['Ly']], x[['Lt']], Tin, Tin[1], list(userBwMu = x[['userBwMu']], kernel=kern))[['mu']] - muFun<-approxfun(Tin, xmu) - x[['Ly']] <- lapply(1:length(x[['Ly']]), function(i) x[['Ly']][[i]] - muFun(x[['Lt']][[i]])) - xmu <- muFun - list(x = x, mu = xmu) - }) - xList <- lapply(tmp, `[[`, 'x') - muList <- lapply(tmp, `[[`, 'mu') - list(xList = xList, muList = muList) -} - -innerProd <- function(A, B, gridbrk, intlen){ - brkX <- gridbrk - oupmat <- array(0, c(dim(A)[1], dim(B)[2])) - for (i in 1:(length(brkX)-1)) { - a1 <- brkX[i] + 1 - a2 <- brkX[i + 1] - A[,a1] <- A[, a1] / 2 ; A[, a2] = A[, a2] / 2 - oupmat <- oupmat + A[, a1:a2] %*% B[a1:a2, ] * intlen[i] / (a2 - a1) - } - return(oupmat) -} - -dx <- function(p, intLenX, gridNumX, brkX){ - for(i in 1:p){ - if (i == 1) {dxMatrix <- diag(intLenX[1] / (gridNumX[1] - 1), gridNumX[1])}else{dxMatrix <- cdiag(dxMatrix, diag(intLenX[i] / (gridNumX[i]-1), gridNumX[i]))} - dxMatrix[brkX[i]+1, brkX[i]+1] <- dxMatrix[brkX[i]+1, brkX[i]+1]/2 - dxMatrix[brkX[i+1], brkX[i+1]] <- dxMatrix[brkX[i+1], brkX[i+1]]/2 - } - dxMatrix <- sqrt(as.matrix(dxMatrix)) - return(dxMatrix) -} - -denseCov <- function(p, varsTrain, brkX, dxMatrix, gridNum, varsOptns){ - indRaw <- varsTrain[[1]]$Ly - if (varsOptns[[1]]$error == 1) {covDense <- GetCovDense(indRaw, optns=varsOptns[[1]]) ; blkCov <- covDense$smoothCov ; varsSigma2 = covDense$sigma2} else {blkCov <- cov(indRaw)} - if (p >= 2) { - for (i in 2:p) { - indRaw <- varsTrain[[i]]$Ly - if (varsOptns[[i]]$error == 1) {covDense <- GetCovDense(indRaw, optns=varsOptns[[i]]) ; blkCov <- cdiag(blkCov, covDense$smoothCov) ; varsSigma2 <- c(varsSigma2, covDense$sigma2)} else {blkCov <- cdiag(blkCov, cov(indRaw))} - } - - for (i in 1:p) { - gridBrk1 <- brkX[i]+1 - gridBrk2 <- brkX[i+1] - for (j in 1:p) { - if (j > i) { - gridBrk3 <- brkX[j]+1 - gridBrk4 <- brkX[j+1] - blkCov[gridBrk1:gridBrk2, gridBrk3:gridBrk4] <- cov(varsTrain[[i]]$Ly, varsTrain[[j]]$Ly) - blkCov[gridBrk3:gridBrk4, gridBrk1:gridBrk2] <- t(as.matrix(blkCov[gridBrk1:gridBrk2, gridBrk3:gridBrk4])) - } - } - } - } - xCov <- as.matrix(blkCov) - adjxCov <- eigen(dxMatrix %*% xCov %*% dxMatrix) - eigenValue <- adjxCov$value - eigenValue <- sapply(eigenValue, function(x){max(x, 0)}) - numposiEigen <- sum(eigenValue > 0) - eigenFun <- diag(diag(1 / dxMatrix)) %*% adjxCov$vector - xCov <- eigenFun %*% diag(eigenValue) %*% t(eigenFun) - - for (i in 1:p) { - if(i==1) {croCov <- cov(varsTrain[[i]]$Ly, varsTrain[[p+1]]$Ly)} else {croCov <- rbind(croCov, cov(varsTrain[[i]]$Ly, varsTrain[[p+1]]$Ly))} - } - indRaw <- varsTrain[[p+1]]$Ly - if (varsOptns[[p+1]]$error == 1) {yCov <- GetCovDense(indRaw, optns = varsOptns[[p+1]])$smoothCov} else {yCov <- cov(indRaw)} - for (i in 1:p) { - if(i == 1){diagSigma2 <- c(rep(varsSigma2[1], gridNum[1]))}else{diagSigma2 <- c(diagSigma2, rep(varsSigma2[i], gridNum[i]))} - } - return(list(xCov = xCov, croCov = croCov, yCov = yCov, varsSigma2 = varsSigma2, eigenValue = eigenValue, eigenFun = eigenFun, diagSigma2 = diagSigma2, numposiEigen = numposiEigen)) -} - -#gridNum may be used in the future to generalize the output grids, not restricted by 51. -sparseCov <- function(p, varsTrain, brkX, varsOptns, vars, muList, gridNum, dxMatrix, regGrid){ - Ly <- varsTrain[[1]]$Ly ; Lt=varsTrain[[1]]$Lt; - optns <- SetOptions(Ly, Lt, varsOptns[[1]]) - obsGrid <- sort(unique(c(unlist(Lt)))) - meanCr <- array(0,c(length(obsGrid))) - meanCrAll <- list(meanCr) #meanCrAll is a input required by GetCrCovYX(). It's zero since varsTrain is demeaned. - rfpca <- FPCA(Ly, Lt, optns) - blkCov <- rfpca$smoothedCov - varsSigma2 <- rfpca$sigma2 - varsbwMu <- list(rfpca$bwMu) - varsbwCov <- list(rfpca$bwCov) - - if (p>=2) { - for (i in 2:p) { - Ly <- varsTrain[[i]]$Ly ; Lt = varsTrain[[i]]$Lt; - optns <- SetOptions(Ly, Lt, varsOptns[[i]]) - obsGrid <- sort(unique(c(unlist(Lt)))) - meanCr <- array(0, c(length(obsGrid))) - meanCrAll[[i]] <- meanCr - rfpca <- FPCA(Ly, Lt, optns) - mx_temp1 <- rfpca$smoothedCov - assign(paste("sigma_", i, sep = ""), rfpca$sigma2) - varsSigma2 <- c(varsSigma2, get(paste("sigma_", i, sep = ""))) - blkCov <- cdiag(blkCov, mx_temp1) - varsbwMu[[i]] <- rfpca$bwMu - varsbwCov[[i]] <- rfpca$bwCov - } - - for (i in 1:p) { - gridBrk1 <- brkX[i]+1 - gridBrk2 <- brkX[i+1] - for (j in 1:p) { - if (j>i) { - gridBrk3 <- brkX[j]+1 - gridBrk4 <- brkX[j+1] - blkCov[gridBrk1:gridBrk2, gridBrk3:gridBrk4] <- GetCrCovYX(bw1 = varsbwCov[[i]], bw2 = varsbwCov[[j]], Ly1 = varsTrain[[i]]$Ly, Lt1 = varsTrain[[i]]$Lt, Ymu1 = meanCrAll[[i]], Ly2 = varsTrain[[j]]$Ly, Lt2 = varsTrain[[j]]$Lt, Ymu2 = meanCrAll[[j]])$smoothedCC - blkCov[gridBrk3:gridBrk4, gridBrk1:gridBrk2] <- t(as.matrix(blkCov[gridBrk1:gridBrk2, gridBrk3:gridBrk4])) - } - } - } - } - xCov <- as.matrix(blkCov) - adjxCov <- eigen(dxMatrix %*% xCov %*% dxMatrix) - eigenValue <- adjxCov$value - eigenValue <- sapply(eigenValue, function(x){max(x, 0)}) - numposiEigen <- sum(eigenValue > 0) - eigenFun <- diag(diag(1 / dxMatrix)) %*% adjxCov$vector - xCov <- eigenFun %*% diag(eigenValue) %*% t(eigenFun) - - Ly <- varsTrain[[p+1]]$Ly ; Lt <- varsTrain[[p+1]]$Lt; - optns <- SetOptions(Ly, Lt, varsOptns[[p+1]]) - obsGrid <- sort(unique(c(unlist(Lt)))) - yfpca <- FPCA(Ly, Lt, optns) - yCov <- yfpca$fittedCov - varsbwMu[[p+1]] <- yfpca$bwMu - varsbwCov[[p+1]] <- yfpca$bwCov - meanCrY <- array(0, c(length(obsGrid))) - for(i in 1:p){ - if (i==1) {croCov <- GetCrCovYX(bw1 = varsbwCov[[i]], bw2 = varsbwCov[[p+1]], Ly1 = varsTrain[[i]]$Ly, Lt1 = varsTrain[[i]]$Lt, Ymu1 = meanCrAll[[i]], Ly2 = varsTrain[[p+1]]$Ly, Lt2 = varsTrain[[p+1]]$Lt, Ymu2 = meanCrY)$smoothedCC - }else { - croCov <- rbind(croCov,GetCrCovYX(bw1 = varsbwCov[[i]], bw2 = varsbwCov[[p+1]], Ly1 = varsTrain[[i]]$Ly, Lt1 = varsTrain[[i]]$Lt, Ymu1 = meanCrAll[[i]], Ly2 = varsTrain[[p+1]]$Ly, Lt2 = varsTrain[[p+1]]$Lt, Ymu2 = meanCrY)$smoothedCC) - } - } - #========================== - for (i in 1:p) { - varDemean <- mapply('-',vars[[i]]$Ly, lapply(vars[[i]]$Lt, muList[[i]]), SIMPLIFY = FALSE) - if(i==1){varsDemean <- varDemean}else{varsDemean <- mapply(function(X, Y){c(X, Y)}, X = varsDemean, Y = varDemean, SIMPLIFY = FALSE)} - } - nZero <- rep(list(0), lengthVarsFPCReg(vars)) - for (i in 1:p) { - varPnumber <- sapply(vars[[i]]$Lt, length) - nZero <- mapply(c, nZero, varPnumber, SIMPLIFY=FALSE) - } - varsPnumber <- lapply(nZero, cumsum) - if(p == 1){diagSigma2 <- lapply(nZero, function(x){if(x[2]==1){sv <- as.matrix(rep(varsSigma2[1], x[2]))}else{sv <- rep(varsSigma2[1], x[2])};C <- diag(sv)}) - }else{ - diagSigma2 <- lapply(nZero, function(x){if(x[2]==1){sv <- as.matrix(rep(varsSigma2[1], x[2]))}else{sv <- rep(varsSigma2[1], x[2])}; C <- diag(sv) ; for (i in 2:p) {if(x[i+1]==1){sv <- as.matrix(rep(varsSigma2[i], x[i+1]))}else{sv <- rep(varsSigma2[i], x[i+1])};C <- cdiag(C, diag(sv))} ; return(as.matrix(C))}) - } - - a1 <- brkX[1]+1 - a2 <- brkX[1+1] - subCov <- lapply(vars[[1]]$Lt,function(x){ConvertSupport(regGrid[[1]],x,Cov= xCov[a1:a2, a1:a2])}) - - if (p>=2) { - for (i in 2:p) { - a1 <- brkX[i]+1 - a2 <- brkX[i+1] - assign(paste("subMx_", i, i, sep = ""),lapply(vars[[i]]$Lt,function(x){ConvertSupport(regGrid[[i]],x,Cov= xCov[a1:a2, a1:a2])})) - subCov <- mapply(function(X, Y){cdiag(X, Y)}, subCov, get(paste("subMx_", i, i, sep = "")),SIMPLIFY=FALSE) - } - - for (i in 1:p) { - gridBrk1 <- brkX[i]+1 - gridBrk2 <- brkX[i+1] - for(j in 1:p){ - if (j > i) { - gridBrk3 <- brkX[j]+1 - gridBrk4 <- brkX[j+1] - assign(paste("subMx_", i, j, sep = ""), mapply(function(X, Y){gd <- expand.grid(X,Y); matrix(interp2lin(regGrid[[i]], regGrid[[j]], xCov[gridBrk1:gridBrk2, gridBrk3:gridBrk4], gd$Var1, gd$Var2), nrow=length(X))}, X = vars[[i]]$Lt, Y = vars[[j]]$Lt,SIMPLIFY=FALSE)) - subMxx <- get(paste("subMx_", i, j,sep = "")) - subCov <- mapply(function(X, Y, Z){ - pnumber1 = Z[i] + 1 - pnumber2 = Z[i + 1] - pnumber3 = Z[j] + 1 - pnumber4 = Z[j + 1] - X[pnumber1:pnumber2, pnumber3:pnumber4] = Y - X[pnumber3:pnumber4, pnumber1:pnumber2] = t(Y) - return(X) - }, X = subCov, Y = subMxx, Z = varsPnumber ,SIMPLIFY=FALSE) - } - } - } - } - subCov <- mapply('+', subCov, diagSigma2, SIMPLIFY=FALSE) - listEigenFun <- lapply(1:numposiEigen, function(i) eigenFun[,i]) - - for (i in 1:p) { - a1 <- brkX[i]+1 - a2 <- brkX[i+1] - eigenFunXi <- eigenFun[a1:a2] - listEigenFunXi <- lapply(listEigenFun,'[', a1:a2) - phimx0 <- lapply(vars[[i]]$Lt,function(Y){t(sapply(listEigenFunXi, function(x){approxfun(regGrid[[i]], x)(Y)}))}) - phimx0 <- lapply(phimx0,function(x){if(dim(x)[1]==1){x <- t(x)}else{x <- x}}) - if (i == 1) {subEigenFun <- phimx0} else {subEigenFun <- mapply(function(X, Y){cbind(X, Y)}, X = subEigenFun, Y = phimx0 ,SIMPLIFY=FALSE)} - if (i == 1) {subMeanX <- muList[[i]](regGrid[[i]])} else {subMeanX <- c(subMeanX, muList[[i]](regGrid[[i]]))} - } - - return(list(xCov = xCov, croCov = croCov, varsSigma2 = varsSigma2, yCov = yCov, varsbwMu = varsbwMu, varsbwCov = varsbwCov, varsDemean = varsDemean, subCov = subCov, subEigenFun = subEigenFun, subMeanX = subMeanX, numposiEigen = numposiEigen, diagSigma2 = diagSigma2, eigenValue = eigenValue, eigenFun = eigenFun)) -} - -lengthVarsFPCReg <- function(varsTrain, subset) { - lenEach <- sapply(varsTrain, function(x) { - if (is.list(x)) { - x[['userBwMu']] <- NULL - x[['userBwCov']] <- NULL - sapply(x, length) - } else { - stop('Cannot subset variable') - } - }, simplify = FALSE) - len <- unique(unlist(lenEach)) - if (length(len) != 1) { - stop('Length of variables are not the same!') - } - return(len) -} - -sparseComp <- function(emputeScore, varsDemean, method, FVEthreshold, eigenValue, numposiEigen, isNewSub, diagSigma2, subEigenFun){ - if (length(which(isNewSub == 1)) == 0) {varsDemeanTrain <- varsDemean}else{varsDemeanTrain <- varsDemean[-which(isNewSub == 1)]} - if (length(which(isNewSub == 1)) == 0) {emputeScoreTrain <- emputeScore}else{emputeScoreTrain <- emputeScore[-which(isNewSub == 1)]} - if (length(which(isNewSub == 1)) == 0) {subEigenFunTrain <- subEigenFun}else{subEigenFunTrain <- subEigenFun[-which(isNewSub == 1)]} - if (length(which(isNewSub == 1)) == 0) {diagSigma2Train <- diagSigma2}else{diagSigma2Train <- diagSigma2[-which(isNewSub == 1)]} - if (method == 'FVE') {ratio <- cumsum(eigenValue[which(eigenValue > 0)]) / sum(eigenValue[which(eigenValue > 0)]); Kx <- min(which(ratio > FVEthreshold))} - if (method == 'AIC') { - psuLogli <- array(0, c(numposiEigen)) - for (i in 1:numposiEigen) { - if(i == 1) {psuVec <- mapply(function(X, Y, Z){Z - as.matrix(X[1:i, ]) * Y[1:i]}, X = subEigenFunTrain, Y = emputeScoreTrain, Z = varsDemeanTrain, SIMPLIFY=FALSE)} else {psuVec <- mapply(function(X, Y, Z){Z - as.matrix(t(X[1:i, ]))%*%as.matrix(Y[1:i])}, X = subEigenFunTrain, Y = emputeScoreTrain, Z = varsDemeanTrain, SIMPLIFY=FALSE)} - #psuLogli[i] <- sum(mapply(function(X, Y){t(Y) %*% diag(1/diag(X)) %*% Y / 2}, X = diagSigma2Train, Y = psuVec)) + i - psuLogli[i] <- sum(mapply(function(X, Y){t(Y) %*% solve(X) %*% Y / 2}, X = diagSigma2Train, Y = psuVec)) + i - } - diffRatio <- (max(psuLogli) - psuLogli) / diff(range(psuLogli)) - Kx <- min(which(diffRatio > 0.95)) - #diffRatio=abs(psuLogli/min(psuLogli)) - #Kx=min(which(diffRatio<1.2)) - #Kx=which.min(psuLogli>min(psuLogli)*1.1) - } - - if (method == 'BIC') { - psuLogli <- array(0, c(numposiEigen)) - for (i in 1:numposiEigen) { - if (i==1) {psuVec <- mapply(function(X, Y, Z){Z - as.matrix(X[1:i, ]) * Y[1:i]}, X = subEigenFunTrain, Y = emputeScoreTrain, Z = varsDemeanTrain, SIMPLIFY=FALSE)} else {psuVec <- mapply(function(X, Y, Z){Z - as.matrix(t(X[1:i, ])) %*% as.matrix(Y[1:i])}, X = subEigenFunTrain, Y = emputeScoreTrain, Z = varsDemeanTrain, SIMPLIFY=FALSE)} - #psuLogli[i] <- sum(mapply(function(X, Y){t(Y) %*% diag(1 / diag(X)) %*% Y / 2}, X = diagSigma2Train,Y=psuVec)) + i * log(length(unlist(varsDemeanTrain))) / 2 - psuLogli[i] <- sum(mapply(function(X, Y){t(Y) %*% solve(X) %*% Y / 2}, X = diagSigma2Train,Y=psuVec)) + i * log(length(unlist(varsDemeanTrain))) / 2 - } - diffRatio <- (max(psuLogli) - psuLogli)/diff(range(psuLogli)) - Kx <- min(which(diffRatio > 0.95)) - #diffRatio=abs(psuLogli/min(psuLogli)) - #Kx=min(which(diffRatio<1.2)) - #Kx=which.min(psuLogli>min(psuLogli)*1.2) - } - Kx -} - - -denseComp <- function(method, varsMatrixDemean, denseScore, eigenFun, eigenValue, isNewSub, diagSigma2, numposiEigen, FVEthreshold){ - if (method=='FVE') {ratio <- cumsum(eigenValue[which(eigenValue > 0)]) / sum(eigenValue[which(eigenValue > 0)]) ; Kx <- min(which(ratio > FVEthreshold))} - if (method=='AIC') { - if (length(which(isNewSub == 1)) == 0) {varsMatrixDemeanTrain <- varsMatrixDemean} else {varsMatrixDemeanTrain <- varsMatrixDemean[-which(isNewSub == 1), ]} - if (length(which(isNewSub == 1)) == 0) {denseScoreTrain <- denseScore} else {denseScoreTrain <- denseScore[-which(isNewSub == 1), ]} - psuLogli <- array(0, c(numposiEigen)) - for (i in 1:numposiEigen) { - psuVec <- varsMatrixDemeanTrain-denseScoreTrain[, 1:i] %*% t(eigenFun[, 1:i]) - psuLogli[i] <- sum(diag(psuVec %*% diag(1 / diagSigma2) %*% t(psuVec))) / 2 + i - } - diffRatio <- (max(psuLogli) - psuLogli) / diff(range(psuLogli)) - Kx <- min(which(diffRatio > 0.95)) - #diffRatio=abs(psuLogli/min(psuLogli)) - #Kx=min(which(diffRatio<1.3)) - } - if (method == 'BIC') { - if (length(which(isNewSub == 1)) == 0) {varsMatrixDemeanTrain <- varsMatrixDemean} else {varsMatrixDemeanTrain <- varsMatrixDemean[-which(isNewSub == 1), ]} - if (length(which(isNewSub == 1)) == 0) {denseScoreTrain <- denseScore} else {denseScoreTrain <- denseScore[-which(isNewSub == 1), ]} - total_p <- length(varsMatrixDemeanTrain) - psuLogli <- array(0, c(numposiEigen)) - for (i in 1:numposiEigen) { - psuVec <- varsMatrixDemeanTrain - denseScoreTrain[, 1:i] %*% t(eigenFun[, 1:i]) - psuLogli[i] <- sum(diag(psuVec %*% diag(1 / diagSigma2) %*% t(psuVec))) / 2 + i * log(total_p) / 2 - } - diffRatio <- (max(psuLogli) - psuLogli) / diff(range(psuLogli)) - Kx <- min(which(diffRatio > 0.95)) - #diffRatio=abs(psuLogli/min(psuLogli)) - #Kx=min(which(diffRatio<1.3)) - } - return(Kx) -} - -cdiag <- function(A,B){ - if(is.matrix(A)==0){A <- as.matrix(A)} - if(is.matrix(B)==0){B <- as.matrix(B)} - nrow <- dim(A)[1]+dim(B)[1] - ncol <- dim(A)[2]+dim(B)[2] - C <- array(0,c(nrow,ncol)) - C[1:dim(A)[1],1:dim(A)[2]] <- A - C[(dim(A)[1]+1):(dim(A)[1]+dim(B)[1]),(dim(A)[2]+1):(dim(A)[2]+dim(B)[2])] <- B - return(C) -} - - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/FPCquantile.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/FPCquantile.R deleted file mode 100644 index a9adf7fb..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/FPCquantile.R +++ /dev/null @@ -1,134 +0,0 @@ -#'@title Conditional Quantile estimation with functional covariates -#' -#'@description Main function to implement conditional Quantile estimation with functional covariates and scalar response. The method includes 3 steps: -#'1) FPCA using the PACE method for X(t_x) -#'2) Computation of the conditional distribution function through a functional generalized linear model. -#'3) Prediction of quantiles for given predictor values -#' -#'@param Lx A length n list of predictor function where x[[i]] is the row vector of measurements for ith subject, i=1,...,n -#'@param Lt_x A length n list where the observations of x are taken, t_x[[i]] is a row vector of time points where x[[i]] are observed, i=1,...,n -#'@param y A 1*n vector for scalar response y. y[i] is the response value for the ith subject, i = 1,...,n. -#'@param outQ A vector of desired quantile levels with default value outQ = c(0.1, 0.25, 0.5, 0.75, 0.9). -#'@param optns_x A list of options for predictor x with control parameters specified by list(name=value) with default NA. See function FPCA for details. -#'@param isNewSub A 1*n vector of 0s or 1s, where n is the total count of subjects. 0 denotes the corresponding subject is only used for training and 1 denotes the corresponding subject is only used for prediction. (default: 0's) -#' -#'@return A list of the following -#'\item{pred_quantile: a matrix of n*length(outQ) where the the first nn (number of 0s in isNewSub) rows containing fitted conditional quantiles of Y corresponding to the trainning subjects, and the last n-nn rows containing predicted conditional quantiles of Y corresponding to the subjects isNewSub ==1.} -#'\item{pred_CDF: a matrix of n*100. The ith row contains the fitted or predicted conditional distribution function \eqn{F(y|X_i)}, evaluated at an equally spaced grid of 100 points.} -#'\item{b: a matrix of 50*(K+1) contains the coefficient functions, defined as \eqn{F(y|X) = g(\sum_(k=0)^K b_k(y)\xi_k)}, see equation (5) in the paper for details, where K is the number of components selected to expand the predictor functions X, and \eqn{\xi_k} is the kth principal component score.} -#' -#'@examples -#'set.seed(10) -#' -#'n = 200 -#'npred = 50 -#'m = 50 -#'xi <- Wiener(n, 0:m/m) -#' -#'x=list() -#'t_x=list() -#'y=numeric(n) -#'for(i in 1:n){ -#' t_x = c(t_x,list(0:m/m)) -#' x = c(x,list(xi[i,])) -#' y[i] = 5*rnorm(1)+2*sum(xi[i,]) -#'} -#' -#'outQ = c(0.1,0.25,0.5,0.75,0.9,0.95) -#'isNewsub = c(rep(0,150),rep(1,50)) -#'qtreg = FPCquantile(x, t_x, y, outQ,optns_x = NULL,isNewsub) -#' -#'@references -#' \cite{Chen, K., M\"uller, H.G. (2011). Conditional quantile analysis when covariates are functions, with application to growth data. J. Royal Statistical Society B.} -#' @export - - -FPCquantile = function(Lx,Lt_x,y,outQ=c(0.1,0.25,0.5,0.75,0.9),optns_x = NULL,isNewsub = NULL){ - CheckData(Lx,Lt_x) - if(min(outQ) < 0 || max(outQ) > 1){ - stop("quantile levels must be between 0 and 1") - } - if(length(Lx) != length(y)){ - stop('length of Lx and y must agree') - } - n = length(Lx) - if(is.null(isNewsub)){ - isNewsub = rep(0,n) - } - nn = sum(isNewsub == 0) - Lx_e = list() - Lt_x_e = list() - Lnewx = list() - Lnewt_x = list() - for(i in 1:n){ - if(isNewsub[i] == 0){ - Lx_e = c(Lx_e,list(Lx[[i]])) - Lt_x_e = c(Lt_x_e,list(Lt_x[[i]])) - }else{ - Lnewx = c(Lnewx,list(Lx[[i]])) - Lnewt_x = c(Lnewt_x,list(Lt_x[[i]])) - } - } - ty= y[isNewsub==0] - optns_x = SetOptions(Lx, Lt_x, optns_x) - CheckOptions(Lt_x, optns_x,n) - verbose_x = optns_x$verbose - if(verbose_x == TRUE){ - print('Obtain functional object for x:\n') - } - xfpca = FPCA(Lx_e, Lt_x_e, optns_x) - xitrain = xfpca$xiEst - optns = xfpca$optns - - zm = 50 - ysort = sort(ty) - zgrid= seq(ysort[5], ysort[nn-5], length.out=zm) - K_x = ncol(xitrain) - b = matrix(0,zm,K_x+1) - for(i in 1:zm){ - z=zgrid[i] - ytrain =array(0,nn) - ytrain[ty<=z]=1 - glmfit= glm(ytrain ~ xitrain, family = binomial(link= 'logit')) - b[i,] = glmfit$coefficients - } - xi = matrix(0,n, K_x) - xi[1:nn,] = xitrain - if(length(Lnewx) > 0){ - xi[(nn+1):n,] = predict.FPCA(xfpca,Lnewx,Lnewt_x,K = K_x,xiMethod = optns$methodXi) - } - - m = 100 - outF = seq(ysort[5], ysort[nn-5], length.out=m) - predF = matrix(0,n, m) - nQ = length(outQ) - predQ = matrix(0,n, nQ) - - bw = 4*(zgrid[2]-zgrid[1]) - for(i in 1:n){ - CDF = 1:zm - for(j in 1:zm){ - eta = b[j,] %*% c(1,xi[i,]) - if(eta>=30){ - CDF[j] = 1 - }else if(eta <= -30){ - CDF[j] = 0 - }else{ - CDF[j] = exp(eta)/(1+exp(eta)) - } - } - win=array(1,zm); - predF[i,] =Lwls1D(bw,'epan', win, zgrid, CDF, outF) - } - - for(i in 1:n){ - for(j in 1:nQ){ - if(predF[i,m] <= outQ[j]){ - predQ[i,j]= outF[m] - }else{ - predQ[i,j]= outF[which(predF[i,] > outQ[j])[1]] - } - } - } - return(list(pred_quantile = predQ,pred_CDF = predF,beta = b)) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/FSVD.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/FSVD.R deleted file mode 100644 index 3141941a..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/FSVD.R +++ /dev/null @@ -1,256 +0,0 @@ -#' Functional Singular Value Decomposition -#' -#' FSVD for a pair of dense or sparse functional data. -#' -#' @param Ly1 A list of \emph{n} vectors containing the observed values for each individual. Missing values specified by \code{NA}s are supported for dense case (\code{dataType='dense'}). -#' @param Lt1 A list of \emph{n} vectors containing the observation time points for each individual corresponding to y. Each vector should be sorted in ascending order. -#' @param Ly2 A list of \emph{n} vectors containing the observed values for each individual. Missing values specified by \code{NA}s are supported for dense case (\code{dataType='dense'}). -#' @param Lt2 A list of \emph{n} vectors containing the observation time points for each individual corresponding to y. Each vector should be sorted in ascending order. -#' @param FPCAoptns1 A list of options control parameters specified by \code{list(name=value)} for the FPC analysis of sample 1. See `?FPCA'. -#' @param FPCAoptns2 A list of options control parameters specified by \code{list(name=value)} for the FPC analysis of sample 2. See `?FPCA'. -#' @param SVDoptns A list of options control parameters specified by \code{list(name=value)} for the FSVD analysis of samples 1 & 2. See `Details`. -#' -#' @details Available control options for SVDoptns are: -#' \describe{ -#' \item{bw1}{The bandwidth value for the smoothed cross-covariance function across the direction of sample 1; positive numeric - default: determine automatically based on 'methodBwCov'} -#' \item{bw2}{The bandwidth value for the smoothed cross-covariance function across the direction of sample 2; positive numeric - default: determine automatically based on 'methodBwCov'} -#' \item{methodBwCov}{The bandwidth choice method for the smoothed covariance function; 'GMeanAndGCV' (the geometric mean of the GCV bandwidth and the minimum bandwidth),'CV','GCV' - default: 10\% of the support} -#' \item{userMu1}{The user defined mean of sample 1 used to centre it prior to the cross-covariance estimation. - default: determine automatically based by the FPCA of sample 1} -#' \item{userMu2}{The user defined mean of sample 2 used to centre it prior to the cross-covariance estimation. - default: determine automatically based by the FPCA of sample 2} -#' \item{maxK}{The maximum number of singular components to consider; default: min(20, N-1), N:# of curves.} -#' \item{kernel}{Smoothing kernel choice, common for mu and covariance; "rect", "gauss", "epan", "gausvar", "quar" - default: "gauss"; dense data are assumed noise-less so no smoothing is performed.} -#' \item{rmDiag}{Logical describing if the routine should remove diagonal raw cov for cross cov estimation (default: FALSE) } -#' \item{noScores}{Logical describing if the routine should return functional singular scores or not (default: TRUE) } -#' \item{regulRS}{String describing if the regularisation of the compositie cross-covariance matrix should be done using 'sigma1' or 'rho' (see ?FPCA for details) (default: 'sigma2') } -#' \item{bwRoutine}{String specifying the routine used to find the optimal bandwidth 'grid-search', 'bobyqa', 'l-bfgs-b' (default: 'l-bfgs-b')} -#' \item{flip}{Logical describing if the routine should flip the sign of the singular components functions or not after the SVD of the cross-covariance matrix. (default: FALSE)} -#' \item{useGAM}{Indicator to use gam smoothing instead of local-linear smoothing (semi-parametric option) (default: FALSE)} -#' \item{dataType1}{The type of design we have for sample 1 (usually distinguishing between sparse or dense functional data); 'Sparse', 'Dense', 'DenseWithMV' - default: determine automatically based on 'IsRegular'} -#' \item{dataType2}{The type of design we have for sample 2 (usually distinguishing between sparse or dense functional data); 'Sparse', 'Dense', 'DenseWithMV' - default: determine automatically based on 'IsRegular'} -#' } -#' -#' @return A list containing the following fields: -#' \item{bw1}{The selected (or user specified) bandwidth for smoothing the cross-covariance function across the support of sample 1.} -#' \item{bw2}{The selected (or user specified) bandwidth for smoothing the cross-covariance function across the support of sample 2.} -#' \item{CrCov}{The smoothed cross-covariance between samples 1 & 2.} -#' \item{sValues}{A list of length \emph{nsvd}, each entry containing the singuar value estimates for the FSC estimates.} -#' \item{nsvd}{The number of singular componentes used.} -#' \item{canCorr}{The canonical correlations for each dimension.} -#' \item{FVE}{A percentage indicating the total variance explained by chosen FSCs with corresponding 'FVEthreshold'.} -#' \item{sFun1}{An nWorkGrid by \emph{K} matrix containing the estimated singular functions for sample 1.} -#' \item{sFun2}{An nWorkGrid by \emph{K} matrix containing the estimated singular functions for sample 2.} -#' \item{grid1}{A vector of length nWorkGrid1. The internal regular grid on which the singular analysis is carried on the support of sample 1.} -#' \item{grid2}{A vector of length nWorkGrid2. The internal regular grid on which the singular analysis is carried on the support of sample 2.} -#' \item{sScores1}{A \emph{n} by \emph{K} matrix containing the singular scores for sample 1.} -#' \item{sScores2}{A \emph{n} by \emph{K} matrix containing the singular scores for sample 2.} -#' \item{optns}{A list of options used by the SVD and the FPCA's procedures.} -#' -#' @export - -FSVD <- function(Ly1, Lt1, Ly2, Lt2, FPCAoptns1 = NULL, FPCAoptns2 = NULL, SVDoptns = list()){ - # Check and refine data - CheckData(Ly1, Lt1) - CheckData(Ly2, Lt2) - inputData1 <- HandleNumericsAndNAN(Ly1,Lt1); - ly1 <- inputData1$Ly; - lt1 <- inputData1$Lt; - inputData2 <- HandleNumericsAndNAN(Ly2,Lt2); - ly2 <- inputData2$Ly; - lt2 <- inputData2$Lt; - - # set up and check options - numOfCurves = length(ly1) - SVDoptns = SetSVDOptions(Ly1=ly1, Lt1=lt1, Ly2=ly2, Lt2=lt2, SVDoptns=SVDoptns) - #CheckSVDOptions(Ly1=y1, Lt1=t1, Ly2=y2, Lt2=t2, SVDoptns=SVDoptns) - - if(is.null(FPCAoptns1)){ - FPCAoptns1 = SetOptions(ly1, lt1, optns = list(dataType = SVDoptns$dataType1, nRegGrid = SVDoptns$nRegGrid1)) - CheckOptions(lt1, FPCAoptns1, numOfCurves) - } - - if(is.null(FPCAoptns2)){ - FPCAoptns2 = SetOptions(ly2, lt2, optns = list(dataType = SVDoptns$dataType2, - nRegGrid = SVDoptns$nRegGrid2)) - CheckOptions(lt2, FPCAoptns2, numOfCurves) - } - - # Obtain regular grid for both samples - obsGrid1 = sort(unique( c(unlist(lt1)))) - #regGrid1 = seq(min(obsGrid1), max(obsGrid1),length.out = SVDoptns$nRegGrid1) - obsGrid2 = sort(unique( c(unlist(lt2)))) - #regGrid2 = seq(min(obsGrid2), max(obsGrid2),length.out = SVDoptns$nRegGrid2) - - ### FPCA on both functional objects - FPCAObj1 = FPCA(Ly = ly1, Lt = lt1, optns = FPCAoptns1) - Ymu1 = ConvertSupport(fromGrid = FPCAObj1$workGrid, toGrid = FPCAObj1$obsGrid, mu = FPCAObj1$mu) - FPCAObj2 = FPCA(Ly = ly2, Lt = lt2, optns = FPCAoptns2) - Ymu2 = ConvertSupport(fromGrid = FPCAObj2$workGrid, toGrid = FPCAObj2$obsGrid, mu = FPCAObj2$mu) - if(!is.null(SVDoptns$userMu1)){ - Ymu1 = SVDoptns$userMu1 - } - if(!is.null(SVDoptns$userMu2)){ - Ymu2 = SVDoptns$userMu2 - } - - ### Estimate cross covariance - if(SVDoptns$dataType1 != 'Dense' || SVDoptns$dataType2 != 'Dense'){ # sparse or missing data - CrCovObj = GetCrCovYX(bw1 = SVDoptns$bw1, bw2 = SVDoptns$bw2, Ly1 = ly1, Lt1 = lt1, - Ymu1 = Ymu1, Ly2 = ly2, Lt2 = lt2, Ymu2 = Ymu2, - useGAM = SVDoptns$useGAM, rmDiag=SVDoptns$rmDiag, kern=SVDoptns$kernel, - bwRoutine = SVDoptns$bwRoutine) - CrCov = CrCovObj$smoothedCC - grid1 = CrCovObj$smoothGrid[,1] - grid2 = CrCovObj$smoothGrid[,2] - bw1 <- CrCovObj$bw[1] - bw2 <- CrCovObj$bw[2] - } else { # dense data, use sample cross covariance - y1mat = matrix(unlist(ly1), nrow = numOfCurves, byrow = TRUE) - y2mat = matrix(unlist(ly2), nrow = numOfCurves, byrow = TRUE) - mudf = 0 - if(!is.null(SVDoptns$userMu1)){ - mudf = mudf + 1 - } - if(!is.null(SVDoptns$userMu2)){ - mudf = mudf + 1 - } - CrCov = (t(y1mat) - Ymu1) %*% t(t(y2mat) - Ymu2)/(numOfCurves - 2 + mudf) - grid1 = obsGrid1 - grid2 = obsGrid2 - bw1 = NULL # not used for dense data - bw2 = NULL - } - gridSize1 = grid1[2] - grid1[1] - gridSize2 = grid2[2] - grid2[1] - - # SVD on smoothed cross covariance - SVDObj <- svd(CrCov) - sValues<- SVDObj$d - sValues<- sValues[sValues>0] # pick only positive singular values - if(length(sValues) > SVDoptns$maxK){ # reset number of singular component as maxK - sValues<- sValues[seq_len(SVDoptns$maxK)] - } - # determine number of singular component retained - if(is.numeric(SVDoptns$methodSelectK)){ # user specified number of singular components - nsvd = SVDoptns$methodSelectK - if(length(sValues) < nsvd){ - nsvd <- length(sValues) - warning(sprintf("Only %d Singular Components are available, pre-specified nsvd set to %d. \n", - length(sValues), length(sValues))) - } - } else { # select nsvd using FVEthreshold - nsvd <- min(which(cumsum(sValues^2)/sum(sValues^2) >= SVDoptns$FVEthreshold), SVDoptns$maxK) - } - - FVE <- sum(sValues[seq_len(nsvd)]^2)/sum(sValues^2) # fraction of variation explained - sValues<- sValues[seq_len(nsvd)] - # singular functions - sfun1 <- SVDObj$u[,seq_len(nsvd)] - sfun2 <- SVDObj$v[,seq_len(nsvd)] - # normalizing singular functions - sFun1 <- apply(sfun1, 2, function(x) { - x <- x / sqrt(trapzRcpp(grid1, x^2)) - return(x* ifelse(SVDoptns$flip, -1, 1)) - }) - sFun2 <- apply(sfun2, 2, function(x) { - x <- x / sqrt(trapzRcpp(grid2, x^2)) - return(x * ifelse(SVDoptns$flip, -1, 1)) - }) - # Grid size correction - sValues<- sqrt(gridSize1 * gridSize2) * sValues - - ### calculate canonical correlations - canCorr = rep(0, nsvd) - for(i in seq_len(nsvd)){ - canCorr[i] = sValues[i] * (gridSize1^2 * t(sFun1[,i]) %*% FPCAObj1$fittedCov %*% (sFun1[,i]))^(-0.5) * - (gridSize2^2 * t(sFun2[,i]) %*% FPCAObj2$fittedCov %*% (sFun2[,i]))^(-0.5) - } - canCorr <- ifelse(abs(canCorr)>1,1,abs(canCorr)) * sign(canCorr) # confine this to [-1,1] - - if(!SVDoptns$noScores){ - - ### calculate the singular scores - if(SVDoptns$dataType1 != 'Dense' || SVDoptns$dataType2 != 'Dense'){ - # sparse data (not both dense): conditional expectation - # patch the covariance matrix for stacked processes - StackSmoothCov = rbind(cbind(FPCAObj1$smoothedCov, CrCov), - cbind(t(CrCov), FPCAObj2$smoothedCov)) - eig = eigen(StackSmoothCov) - positiveInd <- eig[['values']] >= 0 - if (sum(positiveInd) == 0) { - stop('All eigenvalues are negative. The covariance estimate is incorrect.') - } - d <- eig[['values']][positiveInd] - eigenV <- eig[['vectors']][, positiveInd, drop=FALSE] - StackFittedCov <- eigenV %*% diag(x=d, nrow = length(d)) %*% t(eigenV) - # regularize with rho/sigma2 in FPCA objects - if( SVDoptns$regulRS == 'sigma2'){ - samp1minRS2 <- FPCAObj1$sigma2; - samp2minRS2 <- FPCAObj2$sigma2; - if(is.null(samp1minRS2) ||is.null(samp2minRS2)){ - stop("Check the FPCA arguments used. At least one of the FPCA objects created does not have 'sigma2'!") - } - } else { #( SVDoptns$regulRS == 'rho' ) - samp1minRS2 <- FPCAObj1$rho; - samp2minRS2 <- FPCAObj2$rho; - if(is.null(samp1minRS2) ||is.null(samp2minRS2)){ - stop("Check the FPCA arguments used. At least one of the FPCA objects created does not have 'rho'!") - } - } - - StackRegCov <- StackFittedCov + diag(x = c(rep(samp1minRS2,length(FPCAObj1$workGrid)), - rep(samp2minRS2,length(FPCAObj2$workGrid))), - nrow = length(FPCAObj1$workGrid)+length(FPCAObj2$workGrid) ) - StackworkGrid12 = c(FPCAObj1$workGrid, FPCAObj2$workGrid + max(FPCAObj1$workGrid) + gridSize1) - StackobsGrid12 = c(FPCAObj1$obsGrid, FPCAObj2$obsGrid + max(FPCAObj1$obsGrid) + gridSize1) - StackRegCovObs = ConvertSupport(fromGrid = StackworkGrid12, toGrid = StackobsGrid12, - Cov = StackRegCov) - Pim = list(); Qik = list() - Sigmai1 = list(); Sigmai2 = list() - fittedCovObs1 = ConvertSupport(fromGrid = FPCAObj1$workGrid, toGrid = FPCAObj1$obsGrid, Cov = FPCAObj1$fittedCov) - sfObs1 = ConvertSupport(fromGrid = grid1, toGrid = FPCAObj1$obsGrid, phi = sFun1) - fittedCovObs2 = ConvertSupport(fromGrid = FPCAObj2$workGrid, toGrid = FPCAObj2$obsGrid, Cov = FPCAObj2$fittedCov) - sfObs2 = ConvertSupport(fromGrid = grid2, toGrid = FPCAObj2$obsGrid, phi = sFun2) - - # declare singular components - sScores1 = matrix(0, nrow = numOfCurves, ncol = nsvd) - sScores2 = matrix(0, nrow = numOfCurves, ncol = nsvd) - for(i in seq_len(numOfCurves)){ # calculate singular component for each obs pair - Pim[[i]] = matrix(0, nrow=length(lt1[[i]]), ncol=nsvd) - Qik[[i]] = matrix(0, nrow=length(lt2[[i]]), ncol=nsvd) - Tind1 = which(FPCAObj1$obsGrid %in% lt1[[i]]) - Tind2 = which(FPCAObj2$obsGrid %in% lt2[[i]]) - Tind12 = c(Tind1, length(FPCAObj1$obsGrid) + Tind2) - for(j in seq_len(nsvd)){ - Pim[[i]][,j] = apply(fittedCovObs1[,Tind1, drop=FALSE], 2, function(x){ - pij = trapzRcpp(X = FPCAObj1$obsGrid, Y = x*sfObs1[,j]) - }) - Qik[[i]][,j] = apply(fittedCovObs2[,Tind2, drop=FALSE], 2, function(x){ - qij = trapzRcpp(X = FPCAObj2$obsGrid, Y = x*sfObs2[,j]) - }) - } - Sigmai1[[i]] = rbind(Pim[[i]], t(sValues* t(sfObs2))[Tind2, ]) - Sigmai2[[i]] = rbind(t(sValues* t(sfObs1))[Tind1, ], Qik[[i]]) - sScores1[i,] = c( t(Sigmai1[[i]]) %*% solve(StackRegCovObs[Tind12, Tind12], c(ly1[[i]] - Ymu1[Tind1], ly2[[i]] - Ymu2[Tind2])) ) - sScores2[i,] = c( t(Sigmai2[[i]]) %*% solve(StackRegCovObs[Tind12, Tind12], c(ly1[[i]] - Ymu1[Tind1], ly2[[i]] - Ymu2[Tind2])) ) - } - - } else { # both are dense, utilize GetINscores as it does the same job - # sFun1/sFun2 are already in obsGrid1/obsGrid2 in dense case - sScores1 = GetINScores(ymat = y1mat, t = lt1, optns = FPCAoptns1, - mu = Ymu1, lambda = sValues, phi = sFun1, sigma2 = FPCAObj1$sigma2)$xiEst - sScores2 = GetINScores(ymat = y2mat, t = lt2, optns = FPCAoptns2, - mu = Ymu2, lambda = sValues, phi = sFun2, sigma2 = FPCAObj2$sigma2)$xiEst - } - - } else { - sScores1 <- NULL - sScores2 <- NULL - } - - res <- list(bw1 = bw1, bw2 = bw2, CrCov = CrCov, sValues= sValues, nsvd = nsvd, - canCorr = canCorr, FVE = FVE, sFun1 = sFun1, grid1 = grid1, sScores1 = sScores1, - sFun2 = sFun2, grid2 = grid2, sScores2 = sScores2, - optns = list(SVDopts = SVDoptns, FPCA1opts = FPCAObj1$optns, FPCA2opts = FPCAObj2$optns)) - class(res) <- 'FSVD' - return(res) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/FVPA.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/FVPA.R deleted file mode 100644 index 6d23e5ad..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/FVPA.R +++ /dev/null @@ -1,73 +0,0 @@ -#' Functional Variance Process Analysis for dense functional data -#' -#' @param y A list of \emph{n} vectors containing the observed values for each individual. Missing values specified by \code{NA}s are supported for dense case (\code{dataType='dense'}). -#' @param t A list of \emph{n} vectors containing the observation time points for each individual corresponding to y. -#' @param q A scalar defining the percentile of the pooled sample residual sample used for adjustment before taking log (default: 0.1). -#' @param optns A list of options control parameters specified by \code{list(name=value)}; by default: 'error' has to be TRUE, 'FVEthreshold' is set to 0.90. See `Details in ?FPCA'. -#' -#' -#' @return A list containing the following fields: -#' \item{sigma2}{Variance estimator of the functional variance process.} -#' \item{fpcaObjY}{FPCA object for the original data.} -#' \item{fpcaObjR}{FPCA object for the functional variance process associated with the original data.} -#' -#' @examples -#' set.seed(1) -#' n <- 25 -#' pts <- seq(0, 1, by=0.01) -#' sampWiener <- Wiener(n, pts) -#' # Data have to dense for FVPA to be relevant! -#' sampWiener <- Sparsify(sampWiener, pts, 101) -#' fvpaObj <- FVPA(sampWiener$Ly, sampWiener$Lt) -#' @references -#' \cite{Hans-Georg Mueller, Ulrich Stadtmuller and Fang Yao, "Functional variance processes." Journal of the American Statistical Association 101 (2006): 1007-1018} -#' @export - -FVPA = function(y, t, q= 0.1, optns = list(error=TRUE, FVEthreshold = 0.9)){ - - if( (q <0) || (1 < q) ){ - warning("The value of 'q' is outside [0,1]; reseting to 0.1.") - } - if(is.null(optns$error)){ - stop("User provided 'optns' has to provided 'error' information.") - } - if(is.null(optns$FVEthreshold)){ - stop("User provided 'optns' has to provided 'FVEthreshold' information.") - } - if(!optns$error){ - stop("FVPA is irrelevant if no error is assumed") - } - if (!is.null(optns[['useBinnedData']]) && optns[['useBinnedData']] == 'FORCE') { - stop("optns$useBinnedData cannot be 'FORCE'") - } - optns[['useBinnedData']] <- 'OFF' - - fpcaObjY <- FPCA(y, t, optns) - - if( fpcaObjY$optns$dataType != 'Dense' ){ - - stop(paste0("The data has to be 'Dense' for FVPA to be relevant; the current dataType is : '", fpcaObjY$optns$dataType,"'!") ) - } - - yFitted <- fitted(fpcaObjY); - rawRes = GetVarianceProcess(y, t, yFitted, workGrid = fpcaObjY$workGrid, delta = 0, logarithm = FALSE ) - delta = quantile(unlist(rawRes), q); - rm(rawRes) - logRes = GetVarianceProcess(y, t, yFitted, workGrid = fpcaObjY$workGrid, delta = delta, logarithm = TRUE ) - - fpcaObjR = FPCA(logRes, t, optns); - return( list( sigma2 = fpcaObjR$sigma2, fpcaObjY = fpcaObjY, fpcaObjR = fpcaObjR)) -} - -GetVarianceProcess = function(y, t, yFitted, workGrid, delta =0.0, logarithm = FALSE){ - r <- list() - for (i in 1:nrow(yFitted)){ - tempV = delta + ( y[[i]] - approx(x = workGrid, y = yFitted[i,], xout = t[[i]])$y )^2 - if(logarithm){ - r[[i]] = log(tempV); - } else { - r[[i]] = tempV; - } - } - return(r) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/FitEigenValues.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/FitEigenValues.R deleted file mode 100644 index 411a6328..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/FitEigenValues.R +++ /dev/null @@ -1,34 +0,0 @@ -FitEigenValues <- function(rcov, phiGrid, phi, noEig) { - buff <- .Machine$double.eps * max(abs(phiGrid)) * 3 - - if (is.null(noEig)) - noEig <- ncol(phi) - - # Get design matrix X: - X <- apply(phi[, 1:noEig], 2, function(y) - approx(phiGrid, y, rcov$tPairs[, 1])$y * approx(phiGrid, y, rcov$tPairs[, 2])$y - ) - - if (class(rcov) == 'RawCov') { - dat <- cbind(y=rcov[['cxxn']], X) - dat <- dat[rcov$tPairs[, 1] > min(phiGrid) - buff & - rcov$tPairs[, 1] < max(phiGrid) + buff & - rcov$tPairs[, 2] > min(phiGrid) - buff & - rcov$tPairs[, 2] < max(phiGrid) + buff, ] - mod <- lm(y ~ . - 1, data.frame(dat)) - } else if (class(rcov) == 'BinnedRawCov') { - dat <- cbind(y=rcov[['meanVals']], X) - dat <- dat[rcov$tPairs[, 1] > min(phiGrid) - buff & - rcov$tPairs[, 1] < max(phiGrid) + buff & - rcov$tPairs[, 2] > min(phiGrid) - buff & - rcov$tPairs[, 2] < max(phiGrid) + buff, ] - mod <- lm(y ~ . - 1, data.frame(dat), weights=rcov[['count']]) - } - - lam <- unname(mod[['coefficients']]) - - if (any(lam <= 0)) - warning('Fit method produces negative estimates of eigenvalues') - - return(lam) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GCVLwls1D1.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GCVLwls1D1.R deleted file mode 100644 index cbab065b..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GCVLwls1D1.R +++ /dev/null @@ -1,99 +0,0 @@ -# This function computes the optimal bandwidth choice for the mean -# function use GCV method by pooling the longitudinal data together. -# verbose is unused for now -# this is compatible with PACE because the GCV is calculated in a same way - -GCVLwls1D1 <- function(yy,tt, kernel, npoly, nder, dataType, verbose=TRUE) { - - # If 'yy' and 't' are vectors "cheat" and break them in - # a list of 10 elements - if ( is.vector(yy) && is.vector(tt) && !is.list(yy) && !is.list(tt) ){ - if (length(tt) < 21) { - stop("You are trying to use a local linear weight smoother in a vector with less than 21 values.\n") - } - myPartition = c(1:10, sample(10, length(tt)-10, replace=TRUE)); - yy = split(yy, myPartition) - tt = split(tt, myPartition) - dataType = 'Sparse'; - } - - t = unlist(tt); - y = unlist(yy)[order(t)]; - - t = sort(t); - - # r = diff(range(t)) - N = length(t); - r = t[N] - t[1]; - - # Specify the starting bandwidth candidates - if ( dataType == "Sparse") { - dstar = Minb(t, npoly+2); - if ( dstar > r*0.25){ - dstar = dstar * 0.75; - warning( c( "The min bandwidth choice is too big, reduce to ", dstar, "!\n")) - } - h0 = 2.5 * dstar; - }else if(dataType == "DenseWithMV"){ - h0 = 2.0 * Minb(t, npoly+1); - } else { - h0 = 1.5 * Minb(t,npoly+1); - } - if ( is.nan(h0) ){ - if ( kernel == "gauss" ){ - h0 = 0.2 * r; - }else{ - stop("The data is too sparse, no suitable bandwidth can be found! Try Gaussian kernel instead!\n") - } - } - h0 <- min(h0,r) - q = (r/(4*h0))^(1/9); - bwCandidates = sort(q^(0:9)*h0) ; - - # idx = apply(X= sapply(X=t, FUN='==', ...=sort(unique(t)) ),MARGIN=2, FUN=which) - idx = pracma::uniq(t)$n; # pracma - # This is to make sure we get the same as MATLAB PACE - # I would write them in a function (equivalent of mykernel.m) if it is worth it - # Similarly there is no reason to repeat the FOR-loop twice; this too can go into a seperate function - k0_candidates <- list('quar' = 0.9375, 'epan' = 0.7500, 'rect' = 0.5000, - 'gausvar' = 0.498677, 'gausvar1' = 0.598413, 'gausvar2' = 0.298415, 'other' = 0.398942) - if( any(names(k0_candidates) == kernel)){ - k0 = as.numeric(k0_candidates[kernel]) - } else { - k0 = as.numeric(k0_candidates$other) - } - gcvScores <- c() - # Get the corresponding GCV scores - for(i in 1:length(bwCandidates)){ - # newmu = Lwls1D(bwCandidates[i], kern=kernel, npoly=npoly, nder=nder, xin = t,yin= y,xout= sort(unique(t)))[idx] - newmu = Lwls1D(bwCandidates[i], kernel_type=kernel, npoly=npoly, nder=nder, xin = t,yin= y, win = rep(1,length(y)),xout= sort(unique(t)))[idx] - cvsum = sum((newmu -y)^2 ) - gcvScores[i] =cvsum/(1-(r*k0)/(N*bwCandidates[i]))^2 - } - - # If no bandwith gives a finite gcvScore increase the candidate bandwith and retry on a finer grid - if(all((is.infinite(gcvScores)))){ - bwCandidates = seq( max(bwCandidates), r, length.out = 2*length(bwCandidates)) - for(i in 1:length(bwCandidates)){ - # newmu = Lwls1D(bwCandidates[i], kern=kernel, npoly=npoly, nder=nder, xin = t,yin= y,xout= sort(unique(t)))[idx] - newmu = Lwls1D(bwCandidates[i], kernel_type =kernel, npoly=npoly, nder=nder, xin = t,yin= y, win = rep(1,length(y)), xout= sort(unique(t)))[idx] - cvsum = sum((newmu -y)^2 ) - gcvScores[i] =cvsum/(1-(r*k0)/(N*bwCandidates[i]))^2 - } - } - - # If the problem persist we clearly have too sparse data - if(all((is.infinite(gcvScores)))){ - stop("The data is too sparse, no suitable bandwidth can be found! Try Gaussian kernel instead!\n") - } - - bInd = which(gcvScores == min(gcvScores)); - bScr = gcvScores[bInd][1] - bOpt = max(bwCandidates[bInd]); - - if( bOpt == r){ - warning("data is too sparse, optimal bandwidth includes all the data!You may want to change to Gaussian kernel!\n") - } - bOptList <- list( 'bOpt' = bOpt, 'bScore' = bScr) - return( bOptList) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GCVLwls2DV2.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GCVLwls2DV2.R deleted file mode 100644 index 5f4f7c5e..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GCVLwls2DV2.R +++ /dev/null @@ -1,251 +0,0 @@ -GCVLwls2DV2 <- function(obsGrid, regGrid, ngrid=NULL, dataType=rcov$dataType, error=rcov$error, kern, - rcov, h0=NULL, verbose=FALSE, CV=FALSE, t, useBW1SE = FALSE) { - - # TODO:? get the residual values only within truncated regGrid - - # Returns: a list of length 2, containing the optimal bandwidth and the gcv score. - # obsGrid: observation points. - # ngrid: I think this should not be used in the gcv function. - # CV: whether to use CV rather than GCV. Default to FALSE as not using CV. If CV is used use an integer value to specify the number of cross-validation folds. - - # This function computes the optimal bandwidth choice for the covariance surface. - # function use GCV method by pooling the longitudinal data together. - # verbose is unused for now - # this follows exactly the matlab 2D gcv selector. - - ## Get minimal bandwidth and range - r <- diff(range(obsGrid)) * sqrt(2) # sqrt(2) because the window is circular. - minBW <- GetMinb(t, dataType=rcov$dataType, obsGrid=obsGrid) - - if (missing(h0)) { - h0 <- minBW - } - - if (is.null(h0)){ - stop('the data is too sparse, no suitable bandwidth can be found! Try Gaussian Kernel instead!\n') - } - - if (kern == 'gauss') { - h0 = h0 * 0.2; - } - - ## Get Candidate Bandwidths - h0 <- min(h0, r/4) - if (h0 < r/4) { - q <- (r / (4 * h0)) ^ (1/9) - } else if (h0 < r/2) { - q <- (r / (2 * h0)) ^ (1/9) - } else if (h0 < r) { - q <- (r / h0) ^ (1/9) - } else { - stop('Data is too sparse. The minimal bandwidth is the range of data') - } - bw <- (q ^ seq(0,9,length.out = 10)) * h0 # from h0 to r / 4 - - - ## Set GCV/CV options - opth <- h0 - - leave <- FALSE - iter <- 0 - maxIter <- 1 - if (CV != FALSE) { - # We partition the raw covariance rather than partition the individuals. - fold <- CV - partition <- CreateFolds(1:nrow(rcov$tPairs), k=fold) - } - - minBWInvalid <- FALSE - while (!leave && iter < maxIter) { - if (minBWInvalid){ - minBW <- bw[1] - } - - #Scores <- rep(Inf, length(bw)) - Scores <- matrix(Inf, nrow = length(bw), ncol = 2); colnames(Scores) <- c('SUM','SD'); - # try the bandwidths large to small in order to save time due to sparseness in the windows. - for (i in rev(seq_along(bw))) { - h <- bw[i] - - if (class(rcov) == 'BinnedRawCov') { - if (CV == FALSE) # GCV - Scores[i,'SUM'] <- getGCVscoresV2(h, kern, rcov$tPairs, rcov$meanVals, win=rcov$count, regGrid=regGrid, RSS=rcov$RSS, verbose=verbose) - else # CV - Scores[i,] <- getCVscoresV2(partition, h, kern, rcov$tPairs, rcov$meanVals, win=rcov$count, regGrid=regGrid, RSS=rcov$RSS, verbose=verbose) - } else { - if (CV == FALSE) # GCV - Scores[i,'SUM'] <- getGCVscoresV2(h, kern, rcov$tPairs, rcov$cxxn, regGrid=regGrid, verbose=verbose) - else # CV - Scores[i,] <- getCVscoresV2(partition, h, kern, rcov$tPairs, rcov$cxxn, regGrid=regGrid, verbose=verbose) - } - - if (is.infinite(Scores[i,'SUM'])) { - minBWInvalid <- TRUE - if (i < length(bw)) { - if (minBWInvalid) { - minBW <- bw[i + 1] - minBWInvalid <- FALSE - } - } - break; # This will help break out of the loop if the BW is too small to make sense - } - } - - #optInd <- which.min(Scores) - #opth <- bw[optInd] - #optgcv <- Scores[optInd] - - if(is.infinite(min(Scores[,'SUM']))){ - opth <- max(bw) - optgcv <- Inf - # } else if( sum(!is.infinite(Scores)) >= 2 ){ # Given we have at least two points we can fit "something" - # nonInf = which(!is.infinite(Scores)); - # costSpline = spline(bw[nonInf], Scores[nonInf]) - # opth = costSpline$x[which.min(costSpline$y)] - # optgcv = min(costSpline$y) - } else { - if(useBW1SE){ - ind = max(which( (Scores[,'SUM']/fold) < (min(Scores[,'SUM'])/fold) + Scores[which.min(Scores[,'SUM']),'SD']/sqrt(fold) )) - opth <- bw[ind] - optgcv <- Scores[ind,'SUM'] - } else { - ind <- which.min(Scores[,'SUM']) - opth <- bw[ind] - optgcv <- Scores[ind,'SUM'] - } - } - - ## Check that what we found is coherent. - if (opth >= r - 1e-12) { - minBW <- r - leave <- TRUE - stop('Data is too sparse. The optimal bandwidth equals to the range of input time points. Try Gaussian kernel.') - } - if ( (abs(opth - max(bw)) > 1e-12) && !is.infinite(optgcv)) - leave <- TRUE - else if (is.infinite(optgcv)) { - if (verbose) - warning('Data is too sparse, retry with larger bandwidths!') - h0 <- max(bw) * 1.01 - } else if ( (abs(opth - max(bw)) > 1e-12) ) { - warning('Optimal bandwidth not found in the candidate bandwidths. Retry with larger bandwidths') - h0 <- max(bw) - } - if (!leave) { - newr <- seq(0.5, 1, by=0.05) * r # ??? this can be quite slow - ind <- which(newr > h0)[1] - q <- (newr[ind] / h0) ^ (1/9) - bw <- q ^ (0:9) * h0 - if (verbose) { - message('New bwuserCov candidates:\n') - print(bw) - } - iter <- iter + 1 - } - } # The "while (!leave && iter < maxIter) ..." end here - - ret <- list(h=opth, gcv=optgcv, minBW=minBW) - if (CV != FALSE) - names(ret)[2] <- 'cv' - - return(ret) - -} - - -getGCVscoresV2 <- function(bw, kern, xin, yin, win=NULL, regGrid, RSS=NULL, verbose=FALSE) { - # ...: passed on to Lwls2D - # RSS: for implementing GCV of binned rcov. - # browser() - if (is.null(win)) - win <- rep(1, length(yin)) - - fit <- tryCatch(Lwls2D(bw, kern, xin=xin, yin=yin, win=win, xout1=regGrid, xout2=regGrid), error=function(err) { - if (verbose) { - message('Invalid bandwidth. Try enlarging the window size.\n') - } - return(Inf) - }) - - # Catch - if (is.infinite(fit[1])) - return(Inf) - - # workaround for degenerate case. - if (any(is.nan(fit))) - return(Inf) - - obsFit <- interp2lin(regGrid, regGrid, fit, xin[, 1], xin[, 2]) - - # residual sum of squares - res <- sum((yin - obsFit) ^ 2 * win) - if (!is.null(RSS)) - res <- res + sum(RSS) - - # kernel at x=0 - k0 <- KernelAt0(kern) - N <- sum(win) - r <- diff(range(xin[, 1])) - bottom <- max(1 - 3 * (1 / N) * (r * k0 / bw)^2, 0) - GCV <- res / bottom^2 - - return(GCV) -} - -# k-fold CV -# partition: a list of testset observation indices, returned by caret::createFolds -# ...: passed on to Lwls2D -getCVscoresV2 <- function(partition, bw, kern, xin, yin, win=NULL, regGrid, RSS=NULL, verbose=FALSE) { - - if (is.null(win)) - win <- rep(1, length(yin)) - - n <- length(yin) - - # browser() - cvSubSum <- sapply(partition, function(testSet) { - # browser() - fit <- tryCatch(Lwls2D(bw, kern, xin=xin, yin=yin, win=win, xout1=regGrid, xout2=regGrid, subset=-testSet), error=function(err) { - if (verbose) { - message('Invalid bandwidth. Try enlarging the window size.\n') - } - return(Inf) - }) - - # Catch - if (is.infinite(fit[1])) - return(Inf) - - # workaround for degenerate case. - if (any(is.nan(fit))) - return(Inf) - - obsPred <- interp2lin(regGrid, regGrid, fit, xin[testSet, 1], xin[testSet, 2]) - tmpSum <- sum((yin[testSet] - obsPred) ^ 2 * win[testSet]) - - # residual sum of squares - if (!is.null(RSS)) - tmpSum <- tmpSum + sum(RSS[testSet]) - - return(tmpSum) - }) - - return(c(sum(cvSubSum), sd(cvSubSum))) -} - -KernelAt0 <- function(kern) { - if (kern == 'quar') - k0 <- 0.9375 - else if (kern == 'epan') - k0 <- 0.75 - else if (kern == 'rect') - k0 <- 0.5 - else if (kern == 'gausvar') - k0 <- 0.498677850501791 - else if (kern == 'gauss') - k0 <- 0.398942280401433 - else - stop('Unknown kernel') - - return(k0) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GenerateFunctionalData.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GenerateFunctionalData.R deleted file mode 100644 index 2473400c..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GenerateFunctionalData.R +++ /dev/null @@ -1,32 +0,0 @@ -GenerateFunctionalData <-function(N, M, mu=NULL, lambda=NULL, k = 2, basisType='cos'){ - - if(N <2){ - stop("Sampes of size 1 are irrelevant.") - } - if(M <20){ - stop("Dense samples with less than 20 observations per subject are irrelevant.") - } - s <- seq(0,1,length.out = M) - if(is.null(mu)){ - mu = rep(0,M); - } - if(length(mu) != M){ - stop("Make sure that 'M' and the number of points over which 'mu' is evaluated is the same.") - } - if(is.null(lambda)){ - lambda = seq(k,1,-1) - } - if(k != length(lambda)){ - stop("Make sure you provide 'lambda's for all 'k' modes of variation.") - } - if( !(basisType %in% c('cos','sin','fourier'))){ - stop("Make sure you provide a valid parametric basis.") - } - - Ksi <- apply(matrix(rnorm(N*k), ncol=k), 2, scale) %*% diag(lambda, k) - Phi <- CreateBasis(pts= s, type= basisType, K = k) - - yTrue <- t(matrix(rep(mu,N), nrow=M)) + Ksi %*% t(Phi) - return(list(Y = yTrue, Phi = Phi) ) -} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetBinNum.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GetBinNum.R deleted file mode 100644 index b73cac82..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetBinNum.R +++ /dev/null @@ -1,45 +0,0 @@ -GetBinNum = function(n, m, dataType, verbose ){ - - # Get the number of bins - # n : number of curves - # m : median or max value of number of time-points - # dataType : indicator about structure of the data - # (dense (2), or dataType data with missing values (1) or sparse (0)) - # verbose : outpit diagnostics/progress - - numBin = NULL; - if (m <= 20){ - if (dataType =='Sparse'){ - str = 'Median of ni'; - } else { - str = 'Maximum of ni'; - } - if (verbose){ - message(paste0(str, 'is no more than 20! No binning is performed!\n')) - } - return(NULL) - } - - - if (m >400){ - numBin = 400; - } - - if (n > 5000){ - mstar = max(20,(((5000-n)*19)/2250)+400); - if (mstar < m){ - numBin = ceiling(mstar); - } else { - if (verbose){ - message('No binning is needed!\n'); - } - return(NULL) - } - } - - if( verbose && is.null(numBin) ) { - message('No binning is needed!\n'); - } - - return(numBin) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetBinnedCurve.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GetBinnedCurve.R deleted file mode 100644 index 697c2f20..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetBinnedCurve.R +++ /dev/null @@ -1,120 +0,0 @@ -GetBinnedCurve <- function(x, y, M = 10, isMnumBin = TRUE, - nonEmptyOnly = FALSE, limits = c(min(x),max(x)) ){ - - # x : 1 * n vector of values to be binned - # y : 1 * n vector of values corresponding to x - # M : positive interger denotes the number of bins to be use or - # positive value of the width of each equidistant bin - # isMnumBin : use number of bin (TRUE) or bandwith h (FALSE) - # nonEmptyOnly : output only non-empty bins (TRUE) - # limits : lower and upper limit of domain x (a0, b0) - - - # Function 'GetBinnedCurve' starts here - if( M<0 ){ - stop("GetBinnedCurve is aborted because the argument: M is invalid!\n"); - } - - if(!isMnumBin){ - # Use bandwidth h - h = M; - if ( h >= diff(range(x))){ - res = getResMisOne(x,y,h) - return(res); - } - - xx = seq(limits[1],limits[2],by=h) - M = length(xx)-1; - N = M + 1; - midpoint = xx[1:(N-1)]+(h/2); - print(midpoint) - zList = GetBins(x,y,xx) - newy = zList$newy - count = zList$count - - if (nonEmptyOnly){ - midpoint = midpoint[count > 0]; - newy = newy[count > 0]; - count = count[count > 0]; - M = length(midpoint); - } - - res = list(midpoint, newy, count, M, h) - return(res); - } else { - # Use number of bins M - M = ceiling(M) - if (M == 1){ - res = getResMisOne(x,y); - return(res); - } else { - h <- diff(limits) / M - xx <- c(limits[1], - seq(limits[1] + h / 2, limits[2] - h / 2, length.out=M - 1), - limits[2]) - N <- length(xx); - midpoint <- seq(limits[1], limits[2], length.out=M) - # browser() - - zList = GetBins(x,y,xx) - newy = zList$newy - count = zList$count - - if (nonEmptyOnly){ - midpoint = midpoint[count > 0]; - newy = newy[count > 0]; - count = count[count > 0]; - M = length(midpoint); - } - - res = list(midpoint = midpoint, newy = newy, count = count, numBin = M, binWidth = h) - return(res); - } - - } -} - -# Auxilary function 'GetBins' -GetBins <- function(x,y, xx){ - N <- length(xx) - count = rep(0,N-1); - newy = count; - - for (i in 2:(N-1)){ - ids = ((x >= xx[i-1]) & (x < xx[i])); - if (all(ids == 0)){ - count[i-1] = 0; - newy[i-1] = NaN; - } else { - count[i-1] = sum(ids); - newy[i-1] = mean(y[ids]); - } - } - - # print('GetBins used') - # for the last bin, include the left and right end point - ids = ((x >= xx[i]) &(x <= xx[i+1])); - if (all(ids == 0)){ - count[i] = 0; - newy[i] = NaN; - }else { - count[i] = sum(ids); - newy[i] = mean(y[ids]); - } - - zList = list(newy = newy, count = count) - return( zList ); -} - - # Auxilary function 'GetResMisOne' -getResMisOne <- function(x, y, h = diff(range(x))){ - r = h; - M = 1; - midpoint = r*0.5; - count = length(x); - newy = mean(y); - zList = list(midpoint, newy, count, M, h) - return( zList ); - -} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetBinnedDataset.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GetBinnedDataset.R deleted file mode 100644 index 109d7edf..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetBinnedDataset.R +++ /dev/null @@ -1,56 +0,0 @@ -GetBinnedDataset <- function (y, t, optns){ - - # Bin the data 'y' - # y : n-by-1 list of vectors - # t : n-by-1 list of vectors - - BinDataOutput <- list( newy=NULL, newt=NULL); - - dataType = optns$dataType; - verbose = optns$verbose; - numBins = optns$numBins; - tt = unlist(t); - a0 = min(tt); - b0 = max(tt); - - n = length(t); - ni = sapply(FUN= length,t); - - if (dataType == 'Sparse'){ - m = median(ni) - } else { - m = max(ni); - } - - # Determine the number of bins automatically if numBins is null - if (is.null(numBins) && optns$useBinnedData =='AUTO'){ - numBins = GetBinNum(n,m,dataType,verbose) - # and if it is still NULL return the unbinned data - if (is.null(numBins)){ - BinDataOutput$newt = t; - BinDataOutput$newy = y; - return( BinDataOutput ) - } else if (optns$useBinnedData == 'AUTO') { - warning('Automatically binning measurements. To turn off this warning set option useBinnedData to \'FORCE\' or \'OFF\'') - } - } - # otherwise use the one provided by the user (ceiled) - numBins = ceiling(numBins); - - resList <- lapply(1:n, function(i) - GetBinnedCurve(t[[i]], y[[i]], numBins, TRUE, TRUE, c(a0, b0))) - BinDataOutput[['newt']] <- lapply(resList, `[[`, 'midpoint') - BinDataOutput[['newy']] <- lapply(resList, `[[`, 'newy') - - # for (i in 1:n){ - # res = GetBinnedCurve(t[[i]], y[[i]], numBins, TRUE, TRUE, c(a0, b0)); - # BinDataOutput$newt[[i]] = res$midpoint; - # BinDataOutput$newy[[i]] = res$newy; - # } - - result <- list( 'newt' = BinDataOutput$newt, 'newy' = BinDataOutput$newy, - numBins = numBins) - return(result) -} - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetCEScores.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GetCEScores.R deleted file mode 100644 index 0f047445..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetCEScores.R +++ /dev/null @@ -1,105 +0,0 @@ -# obsGrid: supports fittedCov and phi. May be a truncated version. -# Assumes each tVec in t are all supported on obsGrid. -# return: ret is a 3 by n array, with the first row containing the xiEst, second row containing the xiVar, and the third containing the fitted values. -GetCEScores <- function(y, t, optns, mu, obsGrid, fittedCov, lambda, phi, sigma2) { - - if (length(lambda) != ncol(phi)) - stop('No of eigenvalues is not the same as the no of eigenfunctions.') - - if (is.null(sigma2)) - sigma2 <- 0 - - Sigma_Y <- fittedCov + diag(sigma2, nrow(phi)) - - MuPhiSig <- GetMuPhiSig(t, obsGrid, mu, phi, Sigma_Y) - ret <- mapply(function(yVec, muphisig) - GetIndCEScores(yVec, muphisig$muVec, lambda, muphisig$phiMat, muphisig$Sigma_Yi, verbose=optns$verbose), - y, MuPhiSig) - - return(ret) -} - - -GetMuPhiSig <- function(t, obsGrid, mu, phi, Sigma_Y) { - - #obsGrid <- signif(obsGrid, 14) - ret <- lapply(t, function(tvec) { - #ind <- match(signif(tvec, 14), obsGrid) - ind <- match(tvec, obsGrid) - if (sum(is.na(ind)) != 0) - stop('Time point not found in obsGrid.') - - return(list(muVec=mu[ind], phiMat=phi[ind, , drop=FALSE], Sigma_Yi=Sigma_Y[ind, ind, drop=FALSE])) - }) - - return(ret) -} - - -GetIndCEScores <- function(yVec, muVec, lamVec, phiMat, Sigma_Yi, newyInd=NULL, verbose=FALSE) { - - if (length(yVec) == 0) { - if (verbose) { - warning('Empty observation found, possibly due to truncation') - } - return(list(xiEst=matrix(NA, length(lamVec)), xiVar=matrix(NA, length(lamVec), length(lamVec)), fittedY=matrix(NA, 0, 0))) - } - -# -## When an individual has only one observation, the leave-one-out predicted Y is NA. -# if (length(yVec) == 1 && !is.null(newyInd)) { -# newPhi <- matrix(NA, ncol=length(lamVec)) -# newMu <- NA -# } -# -# if (!is.null(newyInd) && length(yVec) != 1) { -# # newy <- yVec[newyInd] -# newPhi <- phiMat[newyInd, , drop=FALSE] -# newMu <- muVec[newyInd] -# -# yVec <- yVec[-newyInd] -# muVec <- muVec[-newyInd] -# phiMat <- phiMat[-newyInd, , drop=FALSE] -# Sigma_Yi <- Sigma_Yi[-newyInd, -newyInd, drop=FALSE] -# } -# -# Lam <- diag(x=lamVec, nrow = length(lamVec)) -# LamPhi <- Lam %*% t(phiMat) -# LamPhiSig <- LamPhi %*% solve(Sigma_Yi) -# xiEst <- LamPhiSig %*% matrix(yVec - muVec, ncol=1) -# xiVar <- Lam - LamPhi %*% t(LamPhiSig) -# -# -# fittedY <- if(is.null(newyInd)) -# muVec + phiMat %*% xiEst else -# newMu + newPhi %*% xiEst -# -# ret <- list(xiEst=xiEst, xiVar=xiVar, fittedY=fittedY) -# -# return(ret) - - # Do all subscripting stuff in R - if (!is.null(newyInd)) { - if (length(yVec) != 1){ - newPhi <- phiMat[newyInd, , drop=FALSE] - newMu <- muVec[newyInd] - yVec <- yVec[-newyInd] - muVec <- muVec[-newyInd] - phiMat <- phiMat[-newyInd, , drop=FALSE] - Sigma_Yi <- Sigma_Yi[-newyInd, -newyInd, drop=FALSE] - return ( GetIndCEScoresCPPnewInd( yVec, muVec, lamVec, phiMat, Sigma_Yi, newPhi, newMu) ) - } else { - # This should be an uncommon scenario - Lam <- diag(x=lamVec, nrow = length(lamVec)) - LamPhi <- Lam %*% t(phiMat) - LamPhiSig <- LamPhi %*% solve(Sigma_Yi) - xiEst <- LamPhiSig %*% matrix(yVec - muVec, ncol=1) - xiVar <- Lam - LamPhi %*% t(LamPhiSig) - return( list(xiEst=xiEst, xiVar = xiVar, fittedY=NA) ) - } - } - return( GetIndCEScoresCPP( yVec, muVec, lamVec, phiMat, Sigma_Yi) ) - # Unfortunately function overloading is not yet available in Rcpp - # GetIndCEScoresCPPnewInd and GetIndCEScoresCPP are nearly identical. - -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetCount.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GetCount.R deleted file mode 100644 index fb3c0c06..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetCount.R +++ /dev/null @@ -1,15 +0,0 @@ -# get the count number of time pairs output by GetRawCov -# Output: a data.frame of three columns: t1, t2, count -GetCount <- function(tpairs) { - # browser() - tab <- table(tpairs[, 1], tpairs[, 2]) - pts <- sort(unique(as.numeric(tpairs))) - ret <- data.frame(expand.grid(pts, pts), as.numeric(tab)) - names(ret) <- c('t1', 't2', 'count') - ret <- ret[ret$count != 0, ] - - return(ret) -} - - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetCovDense.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GetCovDense.R deleted file mode 100644 index 2f2e3086..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetCovDense.R +++ /dev/null @@ -1,71 +0,0 @@ -# This function obtains the sample covariance matrix at observed grid -# for dense regular functional data - -###### -# Input: -###### -# ymat: n by p matrix of dense regular functional data -# mu: p-dim vector, estimated cross-sectional mean -# optns: options for FPCA function -# y: list of amplitude information -# t: list of time information -###### -# Output: -###### -# a SmoothCov object containing: -# - p by p matrix of sample cov surface estimation on observed grid -# - NULL for all other entires -########################################################################## - -GetCovDense <- function(ymat, mu, optns) { - if(!(optns$dataType %in% c('Dense', 'DenseWithMV'))){ - stop('Sample Covariance is only applicable for option: dataType = "Dense" or "DenseWithMV"!') - } - # if( optns$muCovEstMethod == 'cross-sectional' ){ - n = nrow(ymat) - m = ncol(ymat) - if( !is.null(optns$userMu) ){ - ymat = ymat - matrix(rep(times= nrow(ymat), mu), ncol= ncol(ymat), byrow=TRUE) - K = matrix( rep(0,m^2), m) - for( i in (1:m)){ - for( j in (1:m)){ - XcNaNindx = which(is.na(ymat[,i])); - YcNaNindx = which(is.na(ymat[,j])); - NaNrows = union(XcNaNindx, YcNaNindx); - # Find inner product of the columns with no NaN values - indx = setdiff( 1:n, NaNrows) - K[i,j] = sum(ymat[indx,i] * ymat[indx,j]) * (1/(n-1-length(NaNrows))); - } - } - } else { - K = cov(ymat, use = 'pairwise.complete.obs') # sample variance using non-missing data - } - K = 0.5 * (K + t(K)) # ensure that K is symmetric - - if (any(is.na(K))) { - stop("Data is too sparse to be considered DenseWithMV. Remove sparse observations or specify dataType='Sparse' for FPCA") - } - - if (optns[['error']] == TRUE) { - # 2nd order difference method for finding sigma2 - if (!is.null(optns[['userSigma2']])) { - sigma2 <- optns[['userSigma2']] - } else { - #browser() - ord <- 2 - sigma2 <- mean(diff(t(ymat), differences=ord)^2, na.rm=TRUE) / - choose(2 * ord, ord) - diag(K) <- diag(K) - sigma2 - } - } else { - sigma2 <- NULL - } - - ret = list('rawCov' = NULL, 'smoothCov' = K, 'bwCov' = NULL, - 'sigma2' = sigma2, outGrid = NULL) - class(ret) = "SmoothCov" - return(ret) - # } else { - # stop('optns$muCovEstMethod is unknown!\n') - # } -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetCrCorYX.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GetCrCorYX.R deleted file mode 100644 index dec532d8..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetCrCorYX.R +++ /dev/null @@ -1,61 +0,0 @@ -#' Make cross-correlation matrix from auto- and cross-covariance matrix -#' -#' Make cross-correlation matrix from auto- andcross-covariance matrix -#' -#' @param ccXY The cross-covariance matrix between variables X and Y. -#' @param ccXX The auto-covariance matrix of variable X or the diagonal of that matrix. -#' @param ccYY The auto-covariance matrix of variable Y or the diagonal of that matrix. -#' -#' @return A cross-correlation matrix between variables X and Y. -#' -#' @export -#' -#' -GetCrCorYX <- function(ccXY, ccXX , ccYY){ - - if(!is.matrix(ccXY)){ - stop('The cross-covariance matrix is must be a matrix.') - } - - if(!is.matrix(ccXX) && !is.vector(ccXX)){ - stop('The auto-covariance matrix for X must be a matrix or vector.') - } - - if(!is.matrix(ccYY) && !is.vector(ccYY)){ - stop('The auto-covariance matrix for Y must be a matrix or vector.') - } - - if(is.matrix(ccYY)){ - diagYY = diag(ccYY) - } else { - diagYY =(ccYY) - } - - if(is.matrix(ccXX)){ - diagXX = diag(ccXX) - } else { - diagXX =(ccXX) - } - - if( length(diagXX) != dim(ccXY)[1] ){ - stop('The cross-covariance matrix for XY and the provided covariance for X are incompatible.') - } - - if( length(diagYY) != dim(ccXY)[2] ){ - stop('The cross-covariance matrix for XY and the provided covariance for Y are incompatible.') - } - - if( any(1e-12> diagXX)){ - stop('The provided covariance for X are unreasonable small or negative. Rescale/check your data.') - } - - if( any(1e-12> diagYY)){ - stop('The provided covariance for X are unreasonable small or negative. Rescale/check your data.') - } - - # return (solve(sqrt(diag(diagXX))) %*% ccXY %*% solve(sqrt(diag(diagYY)))) - return( diag(1/sqrt(diagXX) , nrow = length(diagXX)) %*% ccXY %*% diag(1/sqrt(diagYY), nrow = length(diagYY)) ) -} - - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetCrCorYZ.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GetCrCorYZ.R deleted file mode 100644 index 6d8adcc5..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetCrCorYZ.R +++ /dev/null @@ -1,56 +0,0 @@ -#' Make cross-correlation matrix from auto- and cross-covariance matrix -#' -#' Make cross-correlation matrix from auto- andcross-covariance matrix -#' -#' @param ccYZ The cross-covariance vector between variables Y and Z (n-by-1). -#' @param acYY The auto-covariance n-by-n matrix of variable Y or the (n-by-1) diagonal of that matrix. -#' @param covZ The (scalar) covariance of variable Z. -#' -#' @return A cross-correlation matrix between variables Y (functional) and Z (scalar). -#' -#' @export -#' -GetCrCorYZ <- function(ccYZ, acYY , covZ){ - - acYY = as.matrix(acYY); # Such a messy things because R does not treat vectors as matrices. - - # Check basic sizes - if(1 != length(covZ)){ - stop('The variance of Z must be a scalar.') - } - if(!is.matrix(ccYZ) && !is.vector(ccYZ)){ - stop('The cross-covariance of Y and Z is must be a matrix or a vector.') - } - if( is.matrix(ccYZ) && (1 != dim(ccYZ)[2]) ){ - stop('The cross-covariance matrix of a functional variable Y and a scalar variable Z is not n-by-1.') - } - N = length(ccYZ); - - if( N^2 == length(acYY)){ - diagYY = diag(acYY) - } else { - if( 1 != dim(acYY)[2]){ - stop('The auto-covariance is not n-by-n or n-by-1 ') - } else { - diagYY = as.vector(acYY) - } - } - - diagZ =(covZ[1]) - - if( length(diagYY) != length(ccYZ) ){ - stop('The cross-covariance for YZ and the provided covariance for Y are of incompatible sizes.') - } - if( any(1e-12> diagYY)){ - stop('The provided covariance for X are unreasonable small or negative. Rescale/check your data.') - } - if( any(1e-12> diagZ)){ - stop('The provided covariance for Z are unreasonable small or negative. Rescale/check your data.') - } - - # return (solve(sqrt(diag(diagYY))) %*% ccYZ %*% solve(sqrt(diag(diagZ)))) - return( diag(1/sqrt(diagYY) , nrow = length(diagYY)) %*% ccYZ %*% diag(1/sqrt(diagZ), nrow = length(diagZ)) ) -} - - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetCrCovYX.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GetCrCovYX.R deleted file mode 100644 index c28fff72..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetCrCovYX.R +++ /dev/null @@ -1,247 +0,0 @@ -#' Functional Cross Covariance between longitudinal variable Y and longitudinal variable X -#' -#' Calculate the raw and the smoothed cross-covariance between functional predictors using bandwidth bw or estimate that bw using GCV. -#' -#' @param Ly1 List of N vectors with amplitude information (Y) -#' @param Lt1 List of N vectors with timing information (Y) -#' @param Ymu1 Vector Q-1 Vector of length nObsGrid containing the mean function estimate (Y) -#' @param bw1 Scalar bandwidth for smoothing the cross-covariance function (if NULL it will be automatically estimated) (Y) -#' @param Ly2 List of N vectors with amplitude information (X) -#' @param Lt2 List of N vectors with timing information (X) -#' @param Ymu2 Vector Q-1 Vector of length nObsGrid containing the mean function estimate (X) -#' @param bw2 Scalar bandwidth for smoothing the cross-covariance function (if NULL it will be automatically estimated) (X) -#' @param useGAM Indicator to use gam smoothing instead of local-linear smoothing (semi-parametric option) (default: FALSE) -#' @param rmDiag Indicator to remove the diagonal element when smoothing (default: FALSE) -#' @param kern String specifying the kernel type (default: FALSE; see ?FPCA for details) -#' @param bwRoutine String specifying the routine used to find the optimal bandwidth 'grid-search', 'bobyqa', 'l-bfgs-b' (default: 'l-bfgs-b') -#' If the variables Ly1 and Ly2 are in matrix form the data are assumed dense -#' and only the raw cross-covariance is returned. One can obtain Ymu1 and Ymu2 -#' from \code{FPCA} and \code{ConvertSupport}. -#' @return A list containing: -#' \item{smoothedCC}{The smoothed cross-covariance as a matrix (currently only 51 by 51)} -#' \item{rawCC}{The raw cross-covariance as a list} -#' \item{bw}{The bandwidth used for smoohting as a vector of lengh 2} -#' \item{score}{The GCV score associated with the scalar used} -#' \item{smoothGrid}{The grid over which the smoothed cross-covariance is evaluated} -#' @examples -#' Ly1= list( rep(2.1,7), rep(2.1,3),2.1 ); -#' Lt1 = list(1:7,1:3, 1); -#' Ly2 = list( rep(1.1,7), rep(1.1,3),1.1); -#' Lt2 = list(1:7,1:3, 1); -#' Ymu1 = rep(55,7); -#' Ymu2 = rep(1.1,7); -#' AA<-GetCrCovYX(Ly1 = Ly1, Ly2= Ly2, Lt1=Lt1, Lt2=Lt2, Ymu1=Ymu1, Ymu2=Ymu2) -#' -#' @references -#' \cite{Yang, Wenjing, Hans-Georg Mueller, and Ulrich Stadtmueller. "Functional singular component analysis." Journal of the Royal Statistical Society: Series B (Statistical Methodology) 73.3 (2011): 303-324} -#' @export - -GetCrCovYX <- function(bw1 = NULL, bw2 = NULL, Ly1, Lt1 = NULL, Ymu1 = NULL, Ly2, Lt2 = NULL, Ymu2 = NULL, - useGAM = FALSE, rmDiag=FALSE, kern='gauss', bwRoutine = 'l-bfgs-b') { - - if (kern != 'gauss' && (is.null(bw1) || is.null(bw2))) { - stop('Cannot select bandwidth for non-Gaussian kernel') - } - - if( !(bwRoutine %in% c('grid-search', 'bobyqa', 'l-bfgs-b') ) ){ - stop("'bwRoutine' argument is invalid.") - } - - # If only Ly1 and Ly2 are available assume DENSE data - if( is.matrix(Ly1) && is.null(Lt1) && is.null(Ymu1) && is.matrix(Ly2) && is.null(Lt2) && is.null(Ymu2)){ - rawCC <- GetRawCrCovFuncFunc(Ly1 = Ly1, Ly2 = Ly2) - return ( list(smoothedCC = NULL, rawCC = rawCC, bw = NULL, score = NULL) ) - } - - # Otherwise assume you have SPARSE data - if( is.null(Ymu1) || is.null(Ymu2)){ - stop("Both functional means must be provided.") - } - - # Get the Raw Cross-covariance - rawCC = GetRawCrCovFuncFunc(Ly1 = Ly1, Lt1 = Lt1, Ymu1 = Ymu1, Ly2 = Ly2, Lt2 = Lt2, Ymu2 = Ymu2) - # Use a heuristic to decide when to bin - if (!useGAM && sum(duplicated(rawCC$tpairn)) >= 0.2 * length(rawCC$rawCCov)) { - # message('Binning rawCC') - rawCC <- BinRawCov(rawCC) - } else { - # rename the fields to be the same as the binned rawCC - names(rawCC)[names(rawCC) == 'rawCCov'] <- 'meanVals' - names(rawCC)[names(rawCC) == 'tpairn'] <- 'tPairs' - rawCC$count <- rep(1, length(rawCC$meanVals)) - } - - if (rmDiag) { - diagInd <- rawCC$tPairs[, 1] == rawCC$tPairs[, 2] - rawCC$tDiag <- rawCC$tPairs[diagInd, , drop=FALSE] - rawCC$diagMeans <- rawCC$meanVals[diagInd] - rawCC$diagCount <- rawCC$count[diagInd] - rawCC$diagRSS <- rawCC$RSS[diagInd] - rawCC$tPairs <- rawCC$tPairs[!diagInd, , drop=FALSE] - rawCC$meanVals <- rawCC$meanVals[!diagInd] - rawCC$count <- rawCC$count[!diagInd] - rawCC$RSS <- rawCC$RSS[!diagInd] - } - - # Calculate the observation and the working grids - ulLt1 = unlist(Lt1); ulLt2 = unlist(Lt2) - obsGrid1 = sort(unique(ulLt1)); obsGrid2 = sort(unique(ulLt2)) - - workGrid1 = seq(obsGrid1[1], max(obsGrid1), length.out = 51) - workGrid2 = seq(obsGrid2[1], max(obsGrid2), length.out = 51) - workGrid12 = matrix(c(workGrid1, workGrid2),ncol= 2) - - if (useGAM == TRUE){ - # stop('Cannot be used on binned rawCC') # we cannot use binning for useGAM - Qdata = data.frame(x = rawCC$tPairs[,1], y = rawCC$tPairs[,2], z = rawCC$meanVals, group = rawCC$IDs ) - # I comparsed with 're', ds' and 'gp' too, and 'tp' seems to have a slight edge for what we want - # myGAM = mgcv::gamm( z ~ s(x,y, bs =c('tp','tp')), random=list(group=~1) , data= Qdata)$gam - myGAM = mgcv::gam( z ~ s(x,y, bs =c('tp','tp')), data= Qdata) - estPoints = data.frame( x= rep(workGrid1, times=51), y= rep(workGrid2, each =51), group = rep(3,51*51 )) - smoothedCC = matrix(predict(myGAM, estPoints), 51) - return ( list(smoothedCC = smoothedCC, rawCC = rawCC, bw = NULL, score = NULL) ) - } - - # If the bandwidth is known already smooth the raw CrCov - if( is.numeric(bw1) && is.numeric(bw2)){ - smoothedCC <- smoothRCC2D(rcov =rawCC, bw1, bw2, workGrid1, workGrid2, - kern=kern) - # potentially incorrect GCV score if the kernel is non-Gaussian - score = GCVgauss2D(smoothedCC = smoothedCC, smoothGrid = workGrid12, - rawCC = rawCC$meanVals, rawGrid = rawCC$tPairs, - bw1 = bw1, bw2 = bw2) - return ( list(smoothedCC = smoothedCC, rawCC = rawCC, bw = c(bw1, bw2), score = score, smoothGrid = workGrid12 ) ) - - # If the bandwidths are unknown use GCV to take find it - } else { - # Construct candidate bw's - bwCandidates <- getBWidths(Lt1, Lt2) - minGcvScores = Inf - - if(bwRoutine == 'grid-search'){ - # Find their associated GCV scores - gcvScores = rep(Inf, nrow(bwCandidates)) - for (i in 1:length(bwCandidates)){ - gcvScores[i] = theCostFunc(bwCandidates[i,], rawCC, workGrid1, workGrid2, kern, workGrid12) - } - # Pick the one with the smallest score - minimumScore = min(gcvScores, na.rm=TRUE) - if( minimumScore == Inf) { - stop("It seems that the minimum GCV score equals infinity. Stopping 'GetCrCovYX'") - } - bInd = which(gcvScores == minimumScore); - bOpt1 = max(bwCandidates[bInd,1]); - bOpt2 = max(bwCandidates[bInd,2]); - minGcvScores = minimumScore - } else { - - bwRanges = apply(bwCandidates,2, range) - upperB = bwRanges[2,] - lowerB = bwRanges[1,] - - if( !is.element('minqa', installed.packages()[,1]) && bwRoutine == 'bobyqa'){ - warning("Cannot use 'minqa::bobyqa' to find the optimal bandwidths. 'minqa' is not installed. We will do an 'L-BFGS-B' search.") - bwRoutine == 'l-bfgs-b' - } - - if( bwRoutine == 'l-bfgs-b' ){ - theSols = optim(fn = theCostFunc, par = upperB*0.95, # Starting value that "is safe" - upper = upperB, lower = lowerB, method ='L-BFGS-B', control = list(maxit = 51), - rawCC = rawCC, workGrid1 = workGrid1, workGrid2 = workGrid2, kern = kern, workGrid12 = workGrid12) - minGcvScores = theSols$value - } else { # when BOBYQA is available - theSols = minqa::bobyqa(fn = theCostFunc, par = upperB*0.95, # Starting value that "is safe" - upper = upperB, lower = lowerB, control = list(maxfun = 41), - rawCC, workGrid1, workGrid2, kern, workGrid12) - minGcvScores = theSols$fval - } - - bOpt1 = theSols$par[1] - bOpt2 = theSols$par[2] - - if( bOpt1 > 0.75 * upperB[1] && bOpt2 > 0.75 * upperB[2] ){ - warning('It seems that the bandwidth selected by the solvers is somewhat large. Maybe you are in local minima.') - } - } - smoothedCC <- smoothRCC2D(rcov=rawCC, bw1 =bOpt1, bw2 =bOpt2, workGrid1, workGrid2, kern=kern) - return ( list(smoothedCC = smoothedCC, rawCC = rawCC, bw = c(bOpt1, bOpt2), smoothGrid = workGrid12, - score = minGcvScores) ) - } -} - -theCostFunc <- function(xBW, rawCC, workGrid1, workGrid2, kern, workGrid12){ - smoothedCC <- try(silent=TRUE, smoothRCC2D(rcov=rawCC, bw1 = xBW[1], bw2 = xBW[2], - workGrid1, workGrid2, kern=kern) ) - if( is.numeric(smoothedCC) ){ - theCost = GCVgauss2D( smoothedCC = smoothedCC, smoothGrid = workGrid12, - rawCC = rawCC$meanVals, rawGrid = rawCC$tPairs, bw1 = xBW[1], bw2 = xBW[2]) - } else { - theCost = Inf - } - return(theCost) -} - -getBWidths <- function(Lt1, Lt2){ - - numPoints = 10; - oldVersion = FALSE - if(oldVersion == TRUE){ - - # bwCandidates <- matrix(rep(0,numPoints * numPoints * 2),ncol=2) - # h0 = 2.0 * Minb( sort(ulLt1), 2+1); # 2x the bandwidth needed for at least 3 points in a window - # r = diff(range(ulLt1)) - # q = (r/(4*h0))^(1/9); - # bwCandidates[,1] = rep( sort(q^( seq(0,12,length.out=numPoints) )*h0), times= numPoints); - # h0 = 2.0 * Minb( sort(ulLt2), 2+1); # 2x the bandwidth needed for at least 3 points in a window - # r1 = diff(range(ulLt2)) - # q = (r/(4*h0))^(1/9); - # bwCandidates[,2] = rep( sort(q^( seq(0,12,length.out=numPoints) )*h0), each= numPoints); - - } else { - - bwCandidates <- matrix(rep(0,numPoints * numPoints * 2),ncol=2) - bwCandidates[,1] = rep( seq( BwNN(Lt1, onlyCov = TRUE, k = 5), BwNN(Lt1, onlyCov = TRUE, k = 45), - length.out=numPoints), times= numPoints); - bwCandidates[,2] = rep( seq( BwNN(Lt2, onlyCov = TRUE, k = 5), BwNN(Lt2, onlyCov = TRUE, k = 45), - length.out=numPoints), each= numPoints); - - } - - return(bwCandidates) -} - -smoothRCC2D <- function(rcov,bw1, bw2, xout1, xout2, kern='gauss'){ - # Calculate the smooth Covariances between two functional variables - # rcov : raw cross covariance list object returned by BinRawCov(GetRawCrCovFuncFunc()) - # bw1 : scalar - # bw2 : scalar - # xout1 : vector M-1 - # xout2 : vector L-1 - # returns : matrix M-L - # browser() - return( Lwls2D( bw = c(bw1, bw2), kern = kern, xin=rcov$tPairs, - yin=rcov$meanVals, win=rcov$count, xout1=xout1, xout2=xout2, crosscov=TRUE) ) -} - -GCVgauss2D <- function( smoothedCC, smoothGrid, rawCC, rawGrid, bw1, bw2){ - # Calculate GCV cost off smoothed sample assuming a Gaussian kernel - # smoothedY : vector M-1 - # smoothedX : vector M-1 - # rawX : vector N-1 - # rawY : vector N-1 - # bw : scalar - # returns : scalar - obsFit <- interp2lin(smoothGrid[,1], smoothGrid[,2], smoothedCC, as.numeric(rawGrid[, 1]), - as.numeric(rawGrid[, 2])) - # workaround for degenerate case. - if (any(is.nan(obsFit)) || any(is.infinite(obsFit)) ){ - return(Inf) - } - # residual sum of squares - cvsum <- sum((rawCC - obsFit) ^ 2) - N = length( rawCC ) - r1 = diff( range(smoothGrid[,1] ) ) - r2 = diff( range(smoothGrid[,2] ) ) - k0 = 0.398942; # hard-coded constant for Gaussian kernel - return( cvsum / (1 - (1/N) * (r1 * k0 * r2 * k0) /(bw1 * bw2))^2 ) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetCrCovYX_old.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GetCrCovYX_old.R deleted file mode 100644 index 5d3d4900..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetCrCovYX_old.R +++ /dev/null @@ -1,214 +0,0 @@ -# #' Functional Cross Covariance between longitudinal variable Y and longitudinal variable X -# #' -# #' Calculate the raw and the smoothed cross-covariance between functional predictors using bandwidth bw or estimate that bw using GCV. -# #' -# #' @param Ly1 List of N vectors with amplitude information (Y) -# #' @param Lt1 List of N vectors with timing information (Y) -# #' @param Ymu1 Vector Q-1 Vector of length nObsGrid containing the mean function estimate (You can get that from FPCA) (Y) -# #' @param bw1 Scalar bandwidth for smoothing the cross-covariance function (if NULL it will be automatically estimated) (Y) -# #' @param Ly2 List of N vectors with amplitude information (X) -# #' @param Lt2 List of N vectors with timing information (X) -# #' @param Ymu2 Vector Q-1 Vector of length nObsGrid containing the mean function estimate (You can get that from FPCA) (X) -# #' @param bw2 Scalar bandwidth for smoothing the cross-covariance function (if NULL it will be automatically estimated) (X) -# #' @param useGAM Indicator to use gam smoothing instead of local-linear smoothing (semi-parametric option) (default: FALSE) -# #' @param rmDiag Indicator to remove the diagonal element when smoothing (default: FALSE) -# #' @param kern String specifying the kernel type (default: FALSE; see ?FPCA for details) -# #' @param bwRoutine String specifying the routine used to find the optimal bandwidth 'grid-search', 'bobyqa', 'l-bfgs-b' (default: 'l-bfgs-b') -# #' If the variables Ly1 and Ly2 are in matrix form the data are assumed dense and only the raw cross-covariance is returned. -# #' @return A list containing: -# #' \item{smoothedCC}{The smoothed cross-covariance as a matrix (currently only 51 by 51)} -# #' \item{rawCC}{The raw cross-covariance as a list} -# #' \item{bw}{The bandwidth used for smoohting as a vector of lengh 2} -# #' \item{score}{The GCV score associated with the scalar used} -# #' \item{smoothGrid}{The grid over which the smoothed cross-covariance is evaluated} -# #' @examples -# #' Ly1= list( rep(2.1,7), rep(2.1,3),2.1 ); -# #' Lt1 = list(1:7,1:3, 1); -# #' Ly2 = list( rep(1.1,7), rep(1.1,3),1.1); -# #' Lt2 = list(1:7,1:3, 1); -# #' Ymu1 = rep(55,7); -# #' Ymu2 = rep(1.1,7); -# #' AA<-GetCrCovYX(Ly1 = Ly1, Ly2= Ly2, Lt1=Lt1, Lt2=Lt2, Ymu1=Ymu1, Ymu2=Ymu2) -# #' -# #' @references -# #' \cite{Yang, Wenjing, Hans-Georg Mueller, and Ulrich Stadtmueller. "Functional singular component analysis." Journal of the Royal Statistical Society: Series B (Statistical Methodology) 73.3 (2011): 303-324} -# #' @export - -GetCrCovYX_old <- function(bw1 = NULL, bw2 = NULL, Ly1, Lt1 = NULL, Ymu1 = NULL, Ly2, Lt2 = NULL, Ymu2 = NULL, - useGAM = FALSE, rmDiag=FALSE, kern='gauss', bwRoutine = 'l-bfgs-b') { - - if (kern != 'gauss' && (is.null(bw1) || is.null(bw2))) { - stop('Cannot select bandwidth for non-Gaussian kernel') - } - - if( !(bwRoutine %in% c('grid-search', 'bobyqa', 'l-bfgs-b') ) ){ - stop("'bwRoutine' argument is invalid.") - } - - # If only Ly1 and Ly2 are available assume DENSE data - if( is.matrix(Ly1) && is.null(Lt1) && is.null(Ymu1) && is.matrix(Ly2) && is.null(Lt2) && is.null(Ymu2)){ - rawCC <- GetRawCrCovFuncFunc(Ly1 = Ly1, Ly2 = Ly2) - return ( list(smoothedCC = NULL, rawCC = rawCC, bw = NULL, score = NULL) ) - } - - # Otherwise assume you have SPARSE data - if( is.null(Ymu1) || is.null(Ymu2)){ - stop("Both functional means must be provided.") - } - - # Get the Raw Cross-covariance - rawCC = GetRawCrCovFuncFunc(Ly1 = Ly1, Lt1 = Lt1, Ymu1 = Ymu1, Ly2 = Ly2, Lt2 = Lt2, Ymu2 = Ymu2) - - if (rmDiag) { - diagInd <- rawCC$tpairn[, 1] == rawCC$tpairn[, 2] - rawCC$tpairn <- rawCC$tpairn[!diagInd, , drop=FALSE] - rawCC$rawCCov <- rawCC$rawCCov[!diagInd] - } - - # Calculate the observation and the working grids - ulLt1 = unlist(Lt1); ulLt2 = unlist(Lt2) - obsGrid1 = sort(unique(ulLt1)); obsGrid2 = sort(unique(ulLt2)) - - workGrid1 = seq(obsGrid1[1], max(obsGrid1), length.out = 51) - workGrid2 = seq(obsGrid2[1], max(obsGrid2), length.out = 51) - workGrid12 = matrix(c(workGrid1, workGrid2),ncol= 2) - - if (useGAM == TRUE){ - Qdata = data.frame(x = rawCC$tpairn[,1], y = rawCC$tpairn[,2], z = rawCC$rawCCov, group = rawCC$IDs ) - # I comparsed with 're', ds' and 'gp' too, and 'tp' seems to have a slight edge for what we want - # myGAM = mgcv::gamm( z ~ s(x,y, bs =c('tp','tp')), random=list(group=~1) , data= Qdata)$gam - myGAM = mgcv::gam( z ~ s(x,y, bs =c('tp','tp')), data= Qdata) - estPoints = data.frame( x= rep(workGrid1, times=51), y= rep(workGrid2, each =51), group = rep(3,51*51 )) - smoothedCC = matrix(predict(myGAM, estPoints), 51) - return ( list(smoothedCC = smoothedCC, rawCC = rawCC, bw = NULL, score = NULL) ) - } - - # If the bandwidth is known already smooth the raw CrCov - if( is.numeric(bw1) && is.numeric(bw2)){ - smoothedCC <- smoothRCC2D_old(rcov =rawCC, bw1, bw2, workGrid1, workGrid2, - kern=kern) - # potentially incorrect GCV score if the kernel is non-Gaussian - score = GCVgauss2D_old(smoothedCC = smoothedCC, smoothGrid = workGrid12, - rawCC = rawCC$rawCCov, rawGrid = rawCC$tpairn, - bw1 = bw1, bw2 = bw2) - return ( list(smoothedCC = smoothedCC, rawCC = rawCC, bw = c(bw1, bw2), score = score, smoothGrid = workGrid12 ) ) - - # If the bandwidths are unknown use GCV to take find it - } else { - # Construct candidate bw's - bwCandidates <- getBWidths_old(ulLt1, ulLt2) - minGcvScores = Inf - - if(bwRoutine == 'grid-search'){ - # Find their associated GCV scores - gcvScores = rep(Inf, nrow(bwCandidates)) - for (i in 1:length(bwCandidates)){ - gcvScores[i] = theCostFunc_old(bwCandidates[i,], rawCC, workGrid1, workGrid2, kern, workGrid12) - } - # Pick the one with the smallest score - minimumScore = min(gcvScores, na.rm=TRUE) - if( minimumScore == Inf) { - stop("It seems that the minimum GCV score equals infinity. Stopping 'GetCrCovYX'") - } - bInd = which(gcvScores == minimumScore); - bOpt1 = max(bwCandidates[bInd,1]); - bOpt2 = max(bwCandidates[bInd,2]); - minGcvScores = minimumScore - } else { - - bwRanges = apply(bwCandidates,2, range) - upperB = bwRanges[2,] - lowerB = bwRanges[1,] - - if( !is.element('minqa', installed.packages()[,1]) && bwRoutine == 'bobyqa'){ - warning("Cannot use 'minqa::bobyqa' to find the optimal bandwidths. 'minqa' is not installed. We will do an 'L-BFGS-B' search.") - bwRoutine == 'l-bfgs-b' - } - - if( bwRoutine == 'l-bfgs-b' ){ - theSols = optim(fn = theCostFunc_old, par = upperB*0.95, # Starting value that "is safe" - upper = upperB, lower = lowerB, method ='L-BFGS-B', control = list(maxit = 51), - rawCC = rawCC, workGrid1 = workGrid1, workGrid2 = workGrid2, kern = kern, workGrid12 = workGrid12) - minGcvScores = theSols$value - } else { # when BOBYQA is available - theSols = minqa::bobyqa(fn = theCostFunc_old, par = upperB*0.95, # Starting value that "is safe" - upper = upperB, lower = lowerB, control = list(maxfun = 41), - rawCC, workGrid1, workGrid2, kern, workGrid12) - minGcvScores = theSols$fval - } - - bOpt1 = theSols$par[1] - bOpt2 = theSols$par[2] - - if( bOpt1 > 0.75 * upperB[1] && bOpt2 > 0.75 * upperB[2] ){ - warning('It seems that the bandwidth selected by the solvers is somewhat large. Maybe you are in local minima.') - } - } - smoothedCC <- smoothRCC2D_old(rcov=rawCC, bw1 =bOpt1, bw2 =bOpt2, workGrid1, workGrid2, kern=kern) - return ( list(smoothedCC = smoothedCC, rawCC = rawCC, bw = c(bOpt1, bOpt2), smoothGrid = workGrid12, - score = minGcvScores) ) - } -} - -theCostFunc_old <- function(xBW, rawCC, workGrid1, workGrid2, kern, workGrid12){ - smoothedCC <- try(silent=TRUE, smoothRCC2D_old(rcov=rawCC, bw1 = xBW[1], bw2 = xBW[2], - workGrid1, workGrid2, kern=kern) ) - if( is.numeric(smoothedCC) ){ - theCost = GCVgauss2D_old( smoothedCC = smoothedCC, smoothGrid = workGrid12, - rawCC = rawCC$rawCCov, rawGrid = rawCC$tpairn, bw1 = xBW[1], bw2 = xBW[2]) - } else { - theCost = Inf - } - return(theCost) -} - -getBWidths_old <- function(ulLt1, ulLt2){ - numPoints = 10; - bwCandidates <- matrix(rep(0,numPoints * numPoints * 2),ncol=2) - h0 = 2.0 * Minb( sort(ulLt1), 2+1); # 2x the bandwidth needed for at least 3 points in a window - r = diff(range(ulLt1)) - q = (r/(4*h0))^(1/9); - bwCandidates[,1] = rep( sort(q^( seq(0,12,length.out=numPoints) )*h0), times= numPoints); - h0 = 2.0 * Minb( sort(ulLt2), 2+1); # 2x the bandwidth needed for at least 3 points in a window - r1 = diff(range(ulLt2)) - q = (r/(4*h0))^(1/9); - bwCandidates[,2] = rep( sort(q^( seq(0,12,length.out=numPoints) )*h0), each= numPoints); - - return(bwCandidates) -} - -smoothRCC2D_old <- function(rcov,bw1, bw2, xout1, xout2, kern='gauss'){ - # Calculate the smooth Covariances between two functional variables - # rcov : raw cross covariance list object returned by GetRawCrCovFuncFunc - # bw1 : scalar - # bw2 : scalar - # xout1 : vector M-1 - # xout2 : vector L-1 - # returns : matrix M-L - # browser() - return( Lwls2D( bw = c(bw1, bw2), kern = kern, xin=rcov$tpairn, - yin=rcov$rawCC, xout1=xout1, xout2=xout2, crosscov=TRUE) ) -} - -GCVgauss2D_old <- function( smoothedCC, smoothGrid, rawCC, rawGrid, bw1, bw2){ - # Calculate GCV cost off smoothed sample assuming a Gaussian kernel - # smoothedY : vector M-1 - # smoothedX : vector M-1 - # rawX : vector N-1 - # rawY : vector N-1 - # bw : scalar - # returns : scalar - obsFit <- interp2lin(smoothGrid[,1], smoothGrid[,2], smoothedCC, as.numeric(rawGrid[, 1]), - as.numeric(rawGrid[, 2])) - # workaround for degenerate case. - if (any(is.nan(obsFit)) || any(is.infinite(obsFit)) ){ - return(Inf) - } - # residual sum of squares - cvsum <- sum((rawCC - obsFit) ^ 2) - N = length( rawCC ) - r1 = diff( range(smoothGrid[,1] ) ) - r2 = diff( range(smoothGrid[,2] ) ) - k0 = 0.398942; # hard-coded constant for Gaussian kernel - return( cvsum / (1 - (1/N) * (r1 * k0 * r2 * k0) /(bw1 * bw2))^2 ) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetCrCovYZ.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GetCrCovYZ.R deleted file mode 100644 index 5924ca25..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetCrCovYZ.R +++ /dev/null @@ -1,120 +0,0 @@ -#' Functional Cross Covariance between longitudinal variable Y and scalar variable Z -#' -#' Calculate the raw and the smoothed cross-covariance between functional -#' and scalar predictors using bandwidth bw or estimate that bw using GCV -#' -#' @param Ly List of N vectors with amplitude information -#' @param Lt List of N vectors with timing information -#' @param Ymu Vector Q-1 Vector of length nObsGrid containing the mean function estimate -#' @param bw Scalar bandwidth for smoothing the cross-covariance function (if NULL it will be automatically estimated) -#' @param Z Vector N-1 Vector of length N with the scalar function values -#' @param Zmu Scalar with the mean of Z (if NULL it will be automaticall estimated) -#' @param support Vector of unique and sorted values for the support of the smoothed cross-covariance function (if NULL it will be automatically estimated) -#' @param kern Kernel type to be used. See ?FPCA for more details. (defult: 'gauss') -#' If the variables Ly1 is in matrix form the data are assumed dense and only -#' the raw cross-covariance is returned. One can obtain Ymu1 -#' from \code{FPCA} and \code{ConvertSupport}. - -#' @return A list containing: -#' \item{smoothedCC}{The smoothed cross-covariance as a vector} -#' \item{rawCC}{The raw cross-covariance as a vector } -#' \item{bw}{The bandwidth used for smoohting as a scalar} -#' \item{score}{The GCV score associated with the scalar used} -#' @examples -#' Ly <- list( runif(5), c(1:3), c(2:4), c(4)) -#' Lt <- list( c(1:5), c(1:3), c(1:3), 4) -#' Z = rep(4,4) # Constant vector so the covariance has to be zero. -#' sccObj = GetCrCovYZ(bw=1, Z= Z, Ly=Ly, Lt=Lt, Ymu=rep(4,5)) -#' @references -#' \cite{Yang, Wenjing, Hans-Georg Mueller, and Ulrich Stadtmueller. "Functional singular component analysis." Journal of the Royal Statistical Society: Series B (Statistical Methodology) 73.3 (2011): 303-324} -#' @export - -GetCrCovYZ <- function(bw = NULL, Z, Zmu = NULL, Ly, Lt = NULL, Ymu = NULL, support = NULL, kern='gauss') { - - if (is.null(bw) && kern != 'gauss') { - stop('Cannot select bandwidth for non-Gaussian kernels') - } - - # If only Ly and Z are available assume DENSE data - if( is.matrix(Ly) && is.null(Lt) && is.null(Ymu) ){ - rawCC <- GetRawCrCovFuncScal(Ly = Ly, Z = Z) - return ( list(smoothedCC = NULL, rawCC = rawCC, bw = bw, score = NULL) ) - } - # Otherwise assume you have SPARSE data - if( is.null(Zmu) ){ - Zmu = mean(Z,na.rm = TRUE); - } - # Get the Raw Cross-covariance - ulLt = unlist(Lt) - if (is.null(support) ){ - obsGrid = sort(unique(ulLt)) - } else { - obsGrid = support - } - # Check that the length of Z and the length of Ly are compatible - if (length(Z) != length(Ly)){ - stop("Ly and Z are not compatible (possibly different number of subjects).") - } - - if (is.null(Ymu)){ - stop("Ymu is missing without default.") - } - - rawCC = GetRawCrCovFuncScal(Ly = Ly, Lt = Lt, Ymu = Ymu, Z = Z, Zmu = Zmu ) - - # If the bandwidth is known already smooth the raw CrCov - if( is.numeric(bw) ){ - smoothedCC <- smoothRCC(rawCC, bw, obsGrid, kern=kern) - score = GCVgauss1D( smoothedY = smoothedCC, smoothedX = obsGrid, - rawX = rawCC$tpairn, rawY = rawCC$rawCCov, bw = bw) - return ( list(smoothedCC = smoothedCC, rawCC = rawCC, bw = bw, score = score) ) - # If the bandwidth is unknown use GCV to take find it - } else { - # Construct candidate bw's - h0 = 1.5 * Minb( sort(ulLt), 2+1); # 1.5x the bandwidth needed for at least 3 points in a window - r = diff(range(ulLt)) - q = (r/(4*h0))^(1/9); - bwCandidates = sort(q^(0:19)*h0); - # Find their associated GCV scores - gcvScores = rep(Inf, length(bwCandidates)) - for (i in 1:length(bwCandidates)){ - smoothedCC <- try(silent=TRUE, smoothRCC(rawCC, bw = bwCandidates[i], xout = obsGrid, kern=kern)) - if( is.numeric(smoothedCC) ){ - gcvScores[i] = GCVgauss1D( smoothedY = smoothedCC, smoothedX = obsGrid, - rawX = rawCC$tpairn, rawY = rawCC$rawCCov, bw = bwCandidates[i]) - } - } -#browser() - # Pick the one with the smallest score - bInd = which(gcvScores == min(gcvScores, na.rm=TRUE)); - bOpt = max(bwCandidates[bInd]); - smoothedCC <- smoothRCC( rawCC, bw = bOpt, obsGrid, kern=kern ) - return ( list(smoothedCC = smoothedCC, rawCC = rawCC, bw = bOpt, score = min(gcvScores, na.rm=TRUE)) ) - } -} - -# Calculate the smooth Covariances between functional and scalar predictors -# rCC : raw cross covariance list object returned by GetRawCrCovFuncScal -# bw : scalar -# xout : vector M-1 -# returns : vector M-1 -smoothRCC <- function(rCC,bw,xout, kern='gauss'){ - x = matrix( unlist(rCC), ncol=2) - x= x[order(x[,1]),] - return( Lwls1D(bw=bw, win=rep(1,nrow(x)), yin=x[,2], xin=x[,1], kern, xout=xout) ) -} - -# Calculate GCV cost off smoothed sample assuming a Gaussian kernel -# smoothedY : vector M-1 -# smoothedX : vector M-1 -# rawX : vector N-1 -# rawY : vector N-1 -# bw : scalar -# returns : scalar -GCVgauss1D <- function( smoothedY, smoothedX, rawX, rawY, bw){ - cvsum = sum( (rawY - approx(x=smoothedX, y=smoothedY, xout=rawX)$y)^2 ); - k0 = 0.398942; # hard-coded constant for Gaussian kernel - N = length(rawX) - r = diff(range(rawX)) - return( cvsum / (1-(r*k0)/(N*bw))^2 ) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetEigenAnalysisResults.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GetEigenAnalysisResults.R deleted file mode 100644 index adc415af..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetEigenAnalysisResults.R +++ /dev/null @@ -1,55 +0,0 @@ -# phi: a nRegGrid * no_FVE -# The input smoothCov is possibly truncated. - -GetEigenAnalysisResults <- function(smoothCov, regGrid, optns, muWork = NULL) { - - maxK <- optns$maxK - FVEthreshold <- optns$FVEthreshold - verbose <- optns$verbose - - gridSize <- regGrid[2] - regGrid[1] - numGrids <- nrow(smoothCov) - - eig <- eigen(smoothCov) - - positiveInd <- eig[['values']] >= 0 - if (sum(positiveInd) == 0) { - stop('All eigenvalues are negative. The covariance estimate is incorrect.') - } - d <- eig[['values']][positiveInd] - eigenV <- eig[['vectors']][, positiveInd, drop=FALSE] - - if (maxK < length(d)) { - if (optns[['verbose']]) { - message(sprintf("At most %d number of PC can be selected, thresholded by `maxK` = %d. \n", length(d), maxK)) - } - - d <- d[1:maxK] - eigenV <- eigenV[, 1:maxK, drop=FALSE] - } - - # thresholding for corresponding FVE option - #(not before to avoid not being able to reach the FVEthreshold when pos eigenvalues > maxk) - # i.e. default FVE 0.9999 outputs all components remained here. - FVE <- cumsum(d) / sum(d) * 100 # cumulative FVE for all available eigenvalues from fitted cov - no_opt <- min(which(FVE >= FVEthreshold * 100)) # final number of component chosen based on FVE - - # normalization - if (is.null(muWork)) { - muWork = 1:dim(eigenV)[1] - } - - phi <- apply(eigenV, 2, function(x) { - x <- x / sqrt(trapzRcpp(regGrid, x^2)) - if ( 0 <= sum(x*muWork) ) - return(x) - else - return(-x) - }) - lambda <- gridSize * d; - - fittedCov <- phi %*% diag(x=lambda, nrow = length(lambda)) %*% t(phi) - - return(list(lambda = lambda[1:no_opt], phi = phi[,1:no_opt, drop=FALSE], - cumFVE = FVE, kChoosen=no_opt, fittedCov=fittedCov)) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetINScores.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GetINScores.R deleted file mode 100644 index bf19a2bd..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetINScores.R +++ /dev/null @@ -1,45 +0,0 @@ -# This function obtains the FPC scores for dense -# regular functional data by trapezoidal rule integration - -###### -# Input: -###### -# ymat: n by p matrix of dense regular functional observations -# t: list of observed time grids for the functional observations -###### -# Output: -###### -# ret: a list of: -# xiEst: n by length(lambda) matrix of estimated FPC scores -# fittedY: n by p matrix of fitted/recovered functional observations -########################################################################## - -GetINScores <- function(ymat, t, optns, mu, lambda, phi, sigma2=NULL){ - if(length(lambda) != ncol(phi)){ - stop('No. of eigenvalues is not the same as the no. of eigenfunctions.') - } - - n = nrow(ymat) - tau = sort(unique(signif( unlist(t),14 ))) # get observed time grid - ranget <- diff(range(tau)) - mumat = matrix(rep(mu, n), nrow = n, byrow = TRUE) - cymat = ymat - mumat - - xiEst = matrix(0, nrow = n, ncol = length(lambda)) - # Get Scores xiEst - for(i in 1:length(lambda)){ - tempmat = cymat * matrix(rep(phi[,i],n), nrow = n, byrow = TRUE) - xiEst[,i] = sapply(1:n, function(j) trapzRcpp(X = tau[!is.na(tempmat[j,])], Y = tempmat[j, !is.na(tempmat[j,])])) - if (optns[['shrink']] && !is.null(sigma2)) { - xiEst[, i] <- xiEst[, i] * lambda[i] / - (lambda[i] + ranget * sigma2 / length(tau)) - } - } - - # Get Fitted Y: n by p matrix on observed time grid - fittedY = mumat + t(phi %*% t(xiEst)) - - ret = list('xiEst' = xiEst, xiVar = NULL, 'fittedY' = fittedY) - - return(ret) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetLogLik.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GetLogLik.R deleted file mode 100644 index e341e6c0..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetLogLik.R +++ /dev/null @@ -1,73 +0,0 @@ -# K: input denoting number of components used -# returns -2 times log-likelihood -GetLogLik = function(fpcaObj, K, Ly = NULL, Lt = NULL){ - if(fpcaObj$optns$lean == TRUE && (is.null(Ly) || is.null(Lt))){ - stop("Option lean is TRUE, need input data Ly and measurement time list Lt to calculate log-likelihood.") - } - if(fpcaObj$optns$lean == FALSE){ # when input data is in fpcaObj - Ly <- fpcaObj$inputData$Ly - Lt <- fpcaObj$inputData$Lt - } - lambda = fpcaObj$lambda[1:K] - sigma2 = fpcaObj$sigma2 - if(is.null(sigma2) && fpcaObj$optns$dataType == "Dense"){ - ymat = matrix(unlist(Ly),nrow=length(Ly), byrow=TRUE) - sddiag = sqrt(diag(var(ymat))) - sigma2 = sddiag*1e-4 - sigma2 = ConvertSupport(fromGrid = fpcaObj$obsGrid, toGrid = fpcaObj$workGrid, mu = sigma2) - } - logLik = 0 - phi = fpcaObj$phi[,1:K, drop=FALSE] - - if(fpcaObj$optns$dataType %in% c('Dense' - #, 'DenseWithMV' # need extra imputation step - )){ - if(K == 1){ - Sigma_y = phi %*% (lambda*diag(K)) %*% t(phi) + sigma2*diag(rep(1,nrow(phi))) - } else { - Sigma_y = phi %*% diag(lambda, length(lambda)) %*% t(phi) + sigma2*diag(rep(1,nrow(phi))) - } - detSigma_y = prod(c(lambda,rep(0,nrow(phi)-K))[1:length(lambda)]+sigma2) - #detSigma_y = det(Sigma_y) - if(detSigma_y == 0){ - logLik = NULL - return(logLik) - } - # calculate loglikelihood via matrix multiplication - ymatcenter = matrix(unlist(Ly)-fpcaObj$mu, nrow = length(Ly), byrow = TRUE) - svd_Sigma_y = svd(Sigma_y) - Sigma_y_inv = svd_Sigma_y$v %*% diag(1/svd_Sigma_y$d, length(svd_Sigma_y$d)) %*% t(svd_Sigma_y$u) - logLik = sum(diag(t(Sigma_y_inv %*% t(ymatcenter)) %*% t(ymatcenter))) + length(Ly)*log(detSigma_y) - return(logLik) - } else { # Sparse case - if(is.null(sigma2)){ sigma2 <- fpcaObj$rho } - if(fpcaObj$optns$error == TRUE && sigma2 <= fpcaObj$rho){ - # especially for the case when sigma2 is estimated to be <=0 and set to 1e-6 - sigma2 <- fpcaObj$rho - } - for(i in 1:length(Ly)){ - if(length(Lt[[i]]) == 1){ - phi_i = t(as.matrix(ConvertSupport(fromGrid = fpcaObj$workGrid, toGrid = Lt[[i]], - phi = phi))) - } else { - phi_i = ConvertSupport(fromGrid = fpcaObj$workGrid, toGrid = Lt[[i]], - phi = phi) - } - mu_i = ConvertSupport(fromGrid = fpcaObj$workGrid, toGrid = Lt[[i]], - mu = fpcaObj$mu) - if(K == 1){ - Sigma_yi = phi_i %*% (lambda*diag(K)) %*% t(phi_i) + sigma2 * diag(rep(1,length(mu_i))) - } else{ - Sigma_yi = phi_i %*% diag(lambda, length(lambda)) %*% t(phi_i) + sigma2 * diag(rep(1,length(mu_i))) - } - detSigma_yi = det(Sigma_yi) - if(detSigma_yi == 0){ - logLik = NULL - return(logLik) - } - invtempi = solve(Sigma_yi, Ly[[i]] - mu_i) - logLik = logLik + log(detSigma_yi) + invtempi %*% (Ly[[i]] - mu_i) - } - return(logLik) - } -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetMeanDense.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GetMeanDense.R deleted file mode 100644 index 6309e50c..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetMeanDense.R +++ /dev/null @@ -1,36 +0,0 @@ -# This function obtains the cross sectional mean function at observed grid -# for dense regular functional data - -###### -# Input: -###### -# ymat: matrix of dense regular functional data -# optns: options for FPCA function -###### -# Output: -###### -# a SMC object containing: -# - mu: p-dim vector of mean function estimation, i.e. on observed grid -# - NULL for other entries -########################################################################## - -GetMeanDense <- function(ymat, obsGrid, optns){ - # Check optns - if(!(optns$dataType %in% c('Dense', 'DenseWithMV'))){ - stop('Cross sectional mean is only applicable for option: dataType = "Dense" or "DenseWithMV"!') - } - - if ( is.null(optns$userMu) ){ - mu = colMeans(ymat, na.rm = TRUE) # use non-missing data only - } else { - mu = spline(optns$userMu$t, optns$userMu$mu, xout= obsGrid)$y; - } - - if(any(is.na(mu))){ - stop('The cross sectional mean is appears to have NaN! Consider setting your dataType to \'Sparse\' manually') - } - - ret = list('mu' = mu, 'muDense' = NULL, 'mu_bw' = NULL) - class(ret) = "SMC" - return(ret) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetMinb.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GetMinb.R deleted file mode 100644 index 38b2eab4..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetMinb.R +++ /dev/null @@ -1,39 +0,0 @@ -# Approximate the minimum bandwidth choice for% for the covariance function. -# In stead of the getMinb.m functionality we can garantee minimal number of neighboring points in here. -# TODO: distMat is memory inefficient. -GetMinb <- function(t, obsGrid, dataType='Sparse', npoly=1, minUniqPts=3, minPts=6, legacyCode = FALSE) { - - - if( legacyCode ){ - if (dataType == 'Sparse') { - dstar <- Minb(obsGrid, 2 + npoly) # rough 1D initial value - n_obs = length(obsGrid); - tmp1 = matrix( rep(0, n_obs^2), ncol = n_obs) - - # Find the pair against which we have measurements in the same curve - for (i in 1:length(t)){ - idx = match( t[[i]], obsGrid) - tmp1[idx, idx] = 1 - } - res = tmp1 - diag(n_obs); - # First and last timepoint are always considered observed - res[c(1, n_obs),] = 1; - ids = matrix(res > 0); - b = matrix( rep(obsGrid, n_obs), nrow=n_obs); - # Use half of the largest difference between two consequative points in the same - # as curve as your candidate bandwith. We do no worry about the difference - # between to [t_j(end) - t_{1+j}(1)] because this will be negative. This bandwidth tends to be conservative (too large). - # dstar = max(dstar, max(diff(b[ids])/2)); # Original code - dstar = max(dstar, quantile( diff(b[ids]), 0.95)/2 ); # Fix to avoid outliers - } else if (dataType == 'RegularWithMV') { - dstar <- Minb(obsGrid, 1 + npoly) * 2; - } else if (dataType == 'Dense') { - dstar = Minb(obsGrid, 2 + npoly) * 1.5; - } - return(dstar) - } - - dstar = BwNN(t, k= 2 + npoly, onlyCov = TRUE)['cov'] - - return(dstar) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetNormalisedSample.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GetNormalisedSample.R deleted file mode 100644 index ff681862..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetNormalisedSample.R +++ /dev/null @@ -1,50 +0,0 @@ -#' Normalise sparse functional sample -#' -#' Normalise sparse functional sample given in an FPCA object -#' -#' @param fpcaObj An FPCA object. -#' @param errorSigma Indicator to use sigma^2 error variance when normalising the data (default: FALSE) -#' -#' @return A list containing the normalised sample 'y' at times 't' -#' -#' @references -#' \cite{Chiou, Jeng-Min and Chen, Yu-Ting and Yang, Ya-Fang. "Multivariate Functional Principal Component Analysis: A Normalization Approach" Statistica Sinica 24 (2014): 1571-1596} -#' @examples -#' set.seed(1) -#' n <- 100 -#' M <- 51 -#' pts <- seq(0, 1, length.out=M) -#' mu <- rep(0, length(pts)) -#' sampDense <- MakeGPFunctionalData(n, M, mu, K=1, basisType='sin', sigma=0.01) -#' samp4 <- MakeFPCAInputs(tVec=sampDense$pts, yVec=sampDense$Yn) -#' res4E <- FPCA(samp4$Ly, samp4$Lt, list(error=TRUE)) -#' sampN <- GetNormalisedSample(res4E, errorSigma=TRUE) -#' -#' CreatePathPlot(subset=1:20, inputData=samp4, obsOnly=TRUE, showObs=FALSE) -#' CreatePathPlot(subset=1:20, inputData=sampN, obsOnly=TRUE, showObs=FALSE) -#' @export -GetNormalisedSample<- function(fpcaObj, errorSigma = FALSE){ - if (any( 0>=diag(fpcaObj$fittedCov)) ){ - stop("The fitted autocovariance functions appears to have negative or zero values.") - } - - if (errorSigma){ - sigmaE = fpcaObj$sigma2 - } else { - sigmaE = 0 - } - - ynorm = mapply(FUN = function(vy, vt){ - return( ( vy - approx(y = fpcaObj$mu, x =fpcaObj$workGrid, xout = vt)$y) / - approx(y = sqrt(sigmaE + diag(fpcaObj$fittedCov)), x =fpcaObj$workGrid, xout = vt)$y) - }, vy = fpcaObj$inputData$Ly, vt = fpcaObj$inputData$Lt, SIMPLIFY = FALSE) - return(list(Ly = ynorm, Lt = fpcaObj$inputData$Lt )) -} - -#' \code{GetNormalizedSample} is an alias of \code{GetNormalizedSample} -#' @param ... Passed into GetNormalisedSample -#' @export -#' @rdname GetNormalisedSample -GetNormalizedSample <- function(...) { - GetNormalisedSample(...) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetRawCov.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GetRawCov.R deleted file mode 100644 index e740bceb..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetRawCov.R +++ /dev/null @@ -1,118 +0,0 @@ -GetRawCov <- function(y,t,obsGridnew, mu, dataType, error){ -# obtain raw covariance -# Input y : 1*n cell array of the observed repeated measurements from n subjects -# Input t : 1*n cell array of the observed time points from n subjects -# Input obsGridnew: 1*m vector of time points correspond to mu -# Input mu: 1*m vector of fitted mean functions from Step I, corresponding to -# pooled unique time points from t -# Input dataType: Output of IsRegular() -# Input error: TRUE with measurement error assumption -# FALSE without measurement error assumption -# -# Output res: a list that contains tPairs, cxxn, indx,win and cyy -# tPairs: N * 2 vector denotes the pairs of time points for subject -# concatenating as two vectors -# if error = 1, all (t_ij, t_ij) will be removed -# cxxn: 1 * N vector of raw covariance corresponding to tPairs -# indx: 1 * N vector of indices for each subject -# win: 1 * N weight matrix for the 2-D smoother for covariance function -# cyy: 1 * M vector of raw covariance corresponding to all pairs of time points, -# i.e., it is the same as cxxn if error = 0 -# diag: if error == TRUE: 2-column matrix recording raw covariance along the diagonal direction (col 2) -# and the corresponding observed time points (col 1) -# if error == FALSE: NULL - - ncohort <- length(y); - obsGrid <- sort(unique(unlist(t))) - mu <- MapX1D(x = obsGridnew, y = mu, newx = obsGrid); - count <- NULL - indx = NULL - diag = NULL - - if(dataType %in% c('Sparse', 'DenseWithMV')){ - - Ys = lapply(X = y, FUN=pracma::meshgrid) #pracma - Xs = lapply(X = t, FUN=pracma::meshgrid) #pracma - - # vectorise the grids for y & t - xx1 = unlist(do.call(rbind, lapply(Xs, '[', 'X')) ) - xx2 = unlist(do.call(rbind, lapply(Xs, '[', 'Y')) ) - yy2 = unlist(do.call(rbind, lapply(Ys, '[', 'Y')) ) - yy1 = unlist(do.call(rbind, lapply(Ys, '[', 'X')) ) - - # get id1/2 such that xx1/2 = q(id1/2), where q = unique(xx1/2) - # id1 = apply(X= sapply(X=xx1, FUN='==', ...=sort(unique(xx1)) ),MARGIN=2, FUN=which) - # id2 = apply(X= sapply(X=xx2, FUN='==', ...=sort(unique(xx2)) ),MARGIN=2, FUN=which) - # This is more stable and faster. - id1 = uniqueM(xx1) - id2 = uniqueM(xx2) - cyy = ( yy1 - mu[ id1]) * (yy2 - mu[id2] ) - - # index for subject i - # indx = unlist(sapply( 1:length(y), function(x) rep(x, (unlist(lapply(length, X= y))[x])^2) )) - # This is more stable and faster. - indx = rep( 1:length(y), times = unlist(lapply(y, length))^2) - - tPairs = matrix( c(xx1, xx2), nrow=length(xx1), ncol=2); - - if(error){ - tneq = which(xx1 != xx2) - teq = which(xx1 == xx2) - indx = indx[tneq]; - diag = matrix(c(tPairs[teq,1], cyy[teq]), ncol = 2) - tPairs = tPairs[tneq,]; - cxxn = cyy[tneq]; - }else{ - cxxn = cyy; - } - - # win = pracma::ones(1, length(cxxn)); - # count = GetCount(tPairs)... - - }else if(dataType == 'Dense'){ - - yy = t(matrix(unlist(y), length(y[[1]]), ncohort)) - MU = t(matrix( rep(mu, times=length(y)), ncol=length(y))) - t1 = t[[1]] - yy = yy - MU; - cyy = t(yy) %*% yy / ncohort - cyy = as.vector(t(cyy)) - cxxn = cyy; - xxyy = pracma::meshgrid(t1); # pracma - - tPairs = (matrix( c(c(xxyy$X), c(xxyy$Y)), ncol = 2)) - - if(error){ - tneq = which(tPairs[,1] != tPairs[,2]) - teq = which(tPairs[,1] == tPairs[,2]) - diag = matrix(c(tPairs[teq,1], cyy[teq]), ncol = 2) - tPairs = tPairs[tneq,]; - cxxn = cyy[tneq]; - }else{ - cxxn = cyy; - } - - # win = pracma::ones(1, length(cxxn)); - }else if(dataType == 'RegularWithMV'){ - stop("This is not implemented yet. Contact Pantelis!") - }else { - stop("Invalid 'dataType' argument type") - } - - result <- list( 'tPairs' = tPairs, 'cxxn' = cxxn, 'indx' = indx, # 'win' = win, - 'cyy' = cyy, 'diag' = diag, 'count' = count, 'error' = error, 'dataType' = dataType); - - class(result) <- "RawCov" - return(result) -} - - uniqueM <- function(x){ - g = sort(unique(x)) - id1 = rep(0, length(x)); - for( i in 1:length(g)){ - id1[which(x == g[i])] = i; - } - return(id1) - } - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetRawCrCovFuncFunc.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GetRawCrCovFuncFunc.R deleted file mode 100644 index 736efd1e..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetRawCrCovFuncFunc.R +++ /dev/null @@ -1,61 +0,0 @@ -GetRawCrCovFuncFunc <- function(Ly1, Lt1 = NULL, Ymu1, Ly2, Lt2 = NULL, Ymu2){ - - # If Ly1 and Ly2 are both matrices and Lt1 and Lt2 are both null then assume DENSE - if ( is.matrix(Ly1) && is.matrix(Ly2) && is.null(Lt1) && is.null(Lt2) ){ - if( dim(Ly1)[1] != dim(Ly2)[1] ){ - stop("Ly1 and Ly2 are not compatible") - } - KK = cov(Ly1,Ly2,use="pairwise.complete.obs") - RCC <- list(rawCCov = 1 * (KK), tpairn = NULL) - class(RCC) <- 'RawCCDense' - return( RCC ) - } - # otherwise assume SPARSE - if ( ! CheckEqualLengths(Lt1,Ly1)){ - stop("Lt1 and Ly1 are not compatible") - } - if ( ! CheckEqualLengths(Lt2,Ly2) ){ - stop("Lt2 and Ly2 are not compatible") - } - ulLt1 = unlist(Lt1) - ulLt2 = unlist(Lt2) - if ( ! CheckEqualLengths(unique(ulLt1), Ymu1)){ - stop("Lt1 and Ymu1 are not compatible") - } - if ( ! CheckEqualLengths(unique(ulLt2), Ymu2)){ - stop("Lt2 and Ymu2 are not compatible") - } - - # Centre both lists according to their means - muY1 <- approxfun(x= sort(unique(ulLt1)), y = Ymu1) - Ly1c <- lapply(1:length(Ly1), function(i) Ly1[[i]]- muY1( Lt1[[i]]) ) - muY2 <- approxfun(x= sort(unique(ulLt2)), y = Ymu2) - Ly2c <- lapply(1:length(Ly2), function(i) Ly2[[i]]- muY2( Lt2[[i]]) ) - - # I keep this so the functional code below is understandable in iterative form - # tPairs1 <- c() - # tPairs2 <- c() - # cyy <- c() - # for (i in 1:length(Ly1c)){ - # q = length(Ly1c[[i]]) - # p = length(Ly2c[[i]]) - # cyy <- c( cyy, rep(x= Ly1c[[i]],each=p) * rep(x= Ly2c[[i]],times=q) ) - # tPairs1 <- c( tPairs1, rep(Lt1[[i]],each=p)) - # tPairs2 <- c( tPairs2, rep(Lt2[[i]],times=q)) - # } - - cyy <- as.vector(unlist (mapply(FUN = function(v1, v2){ return( rep(v1,times = length(v2)) * rep(v2, each = length(v1) )) }, v1= Ly2c, v2 = Ly1c)) ) - tPairs2 <- as.vector(unlist (mapply(FUN = function(v1, v2){ return(rep(v1,times = length(v2))) }, v1= Lt2, v2 = Ly1c)) ) - tPairs1 <- as.vector(unlist (mapply(FUN = function(v1, v2){ return(rep(v1, each = length(v2))) }, v1= Lt1, v2 = Ly2c)) ) - - RCC <-list() - RCC$rawCCov = cyy - RCC$tpairn = cbind(tPairs1, tPairs2) - RCC$IDs = rep( 1:length(Lt1), times = sapply(Lt1, length) * sapply(Lt2, length) ) - class(RCC) <- 'RawCC' - return(RCC) -} - -CheckEqualLengths <- function(x1,x2){ - return( all.equal( unname(sapply(x1, length)), unname(sapply(x2, length) ))) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetRawCrCovFuncScal.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GetRawCrCovFuncScal.R deleted file mode 100644 index 98d8660b..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetRawCrCovFuncScal.R +++ /dev/null @@ -1,25 +0,0 @@ -GetRawCrCovFuncScal <- function(Ly, Lt = NULL, Ymu, Z, Zmu ){ - # Sparse case if Ly and Lt are both lists - if( is.list(Ly) && is.list(Lt) ){ - ulLt = unlist(Lt) - if (length(Ymu) != length(unique(ulLt))){ - stop("Ymu and Lt are of the same size.") - } else { - zstar = Z - Zmu; - RCC <- list(tpairn = ulLt, - rawCCov = rep(zstar, times = unlist( lapply(Ly, length))) * - (unlist(Ly) - approx(x= sort(unique(ulLt)), y = Ymu, xout = ulLt)$y ) ) - return(RCC) - } - # Dense case if Ly is a matrix and Lt is empty - } else if ( is.matrix(Ly) && is.null(Lt)) { - if( length(Z) != dim(Ly)[1] ) { - stop("Ly and Z are not compatible (possibly different number of subjects).") - } - RCC <- list( tpairn = NULL, - rawCCov = cov( Ly, Z, use="pairwise.complete.obs" )) - } else { - stop("It appears you do no refine a valid cross-covariance type.") - } -} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetRho.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GetRho.R deleted file mode 100644 index 630d764b..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetRho.R +++ /dev/null @@ -1,57 +0,0 @@ -GetRho <- function(y, t, optns, mu, obsGrid, fittedCov, lambda, phi, sigma2) { - - optnsTmp <- optns - optnsTmp$verbose <- FALSE - for (j in 1:2) { - yhat <- GetCEScores(y, t, optnsTmp, mu, obsGrid, fittedCov, lambda, phi, sigma2)[3, ] - sigma2 <- mean(mapply(function(a, b) mean((a - b)^2, na.rm=TRUE), yhat, y), na.rm=TRUE) - } - - R <- sqrt((trapzRcpp(obsGrid, mu ^ 2) + sum(lambda)) / diff(range(obsGrid))) - a1 <- 0.01; a2 <- 0.22 - etaCand <- seq(a1, a2, length.out=50) - rhoCand <- etaCand * R - rhoCand <- rhoCand[rhoCand > sigma2] - rhoCand <- c(sigma2, rhoCand) - - leaveOutInd <- RandTime(t, isRandom=FALSE) - - cvScores <- sapply(rhoCand, cvRho, leaveOutInd=leaveOutInd, y=y, t=t, optns=optns, mu=mu, obsGrid=obsGrid, fittedCov=fittedCov, lambda=lambda, phi=phi) - - return(rhoCand[which.min(cvScores)]) -} - - -# sigma2* = max(rho, sigma2) = rho -# Get the CV score for a given rho. Correspond to getScores2.m -cvRho <- function(rho, leaveOutInd, y, t, optns, mu, obsGrid, fittedCov, lambda, phi) { - - Sigma_Y <- fittedCov + diag(rho, nrow(phi)) - - MuPhiSig <- GetMuPhiSig(t, obsGrid, mu, phi, Sigma_Y) - - yhat <- mapply(function(yVec, muphisig, ind) - GetIndCEScores(yVec, muphisig$muVec, lambda, muphisig$phiMat, - muphisig$Sigma_Yi, newyInd=ind)$fittedY, - y, MuPhiSig, leaveOutInd) - - yobs <- mapply(`[`, y, leaveOutInd) - - return(sum((na.omit(unlist(yobs)) - unlist(yhat))^2, na.rm=TRUE)) -} - - -# sample one observation from each tVec in t. The 'non-random' sampling is for testing against Matlab. -RandTime <- function(t, isRandom=TRUE) { - ni <- sapply(t, length) - if (all(ni <= 1)) - stop('None of the individuals have >= 2 observations. Cannot use rho') - - if (isRandom) { - ind <- sapply(ni, sample, size=1) - } else { - ind <- ((1000 + 1:length(t)) %% ni) + 1 - } - - return(ind) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetSmoothedCovarSurface.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GetSmoothedCovarSurface.R deleted file mode 100644 index cf8e687d..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetSmoothedCovarSurface.R +++ /dev/null @@ -1,122 +0,0 @@ -# The output outGrid of this function is the (potentially) truncated greid. -GetSmoothedCovarSurface <- function(y, t, mu, obsGrid, regGrid, optns, useBinnedCov=FALSE) { - - dataType <- optns$dataType - error <- optns$error - kern <- optns$kernel - userBwCov <- optns$userBwCov - methodBwCov <- optns$methodBwCov - verbose <- optns$verbose - rotationCut <- optns$rotationCut - - # get the truncation of the output grids. - outPercent <- optns$outPercent - buff <- .Machine$double.eps * max(abs(obsGrid)) * 10 - rangeGrid <- range(regGrid) - minGrid <- rangeGrid[1] - maxGrid <- rangeGrid[2] - cutRegGrid <- regGrid[regGrid > minGrid + diff(rangeGrid) * outPercent[1] - - buff & - regGrid < minGrid + diff(rangeGrid) * outPercent[2] + - buff] - - # Get raw covariance, unless user covariance/sigma2 are specified. - if (is.null(optns[['userCov']]) || - (is.null(optns[['userSigma2']]) && error)) { - - rcov <- GetRawCov(y, t, obsGrid, mu, dataType, error) - if (useBinnedCov && methodBwCov == 'CV') { - stop('If methodBwCov == \'CV\' then we must use the unbinned rcov.') - } - - if (useBinnedCov) { - rcov <- BinRawCov(rcov) - } - } else { - rcov <- NULL - } - - # Obtain smoothed covariance. - if( !is.null(optns$userCov)) { # If covariance function is provided - rangeUser <- range(optns$userCov$t) - rangeCut <- range(cutRegGrid) - if( rangeUser[1] > rangeCut[1] + buff || - rangeUser[2] < rangeCut[2] - buff ) { - stop('The range defined by the user provided covariance does not cover the support of the data.') - } - - bwCov = NULL - smoothCov = ConvertSupport(fromGrid = optns$userCov$t, cutRegGrid, Cov = optns$userCov$cov) - - } else { # estimate the smoothed covariance - - if (userBwCov == 0) { # bandwidth selection - if (methodBwCov %in% c('GCV', 'GMeanAndGCV')) { # GCV - gcvObj <- GCVLwls2DV2(obsGrid, regGrid, kern=kern, rcov=rcov, verbose=verbose, t=t) - bwCov <- gcvObj$h - if (methodBwCov == 'GMeanAndGCV') { - bwCov <- sqrt(bwCov * gcvObj$minBW) - } - } else if (methodBwCov == 'CV') { # CV 10 fold - gcvObj <- GCVLwls2DV2(obsGrid, regGrid, kern=kern, rcov=rcov, t=t, - verbose=optns$verbose, - CV=optns[['kFoldMuCov']], useBW1SE = optns$useBW1SE) - bwCov <- gcvObj$h - } - } else if (userBwCov != 0) { - bwCov <- userBwCov - } - - if (!useBinnedCov) { - smoothCov <- Lwls2D(bwCov, kern, xin=rcov$tPairs, yin=rcov$cxxn, - xout1=cutRegGrid, xout2=cutRegGrid) - } else { - smoothCov <- Lwls2D(bwCov, kern, xin=rcov$tPairs, yin=rcov$meanVals, - win=rcov$count, xout1=cutRegGrid, xout2=cutRegGrid) - } - } - - # Obtain the error sigma2. - if (error) { - if (!is.null(optns[['userSigma2']])) { - sigma2 <- optns[['userSigma2']] - } else if (!is.null(optns[['userCov']])) { - a0 = min(regGrid) - b0 = max(regGrid) - lint = b0 - a0 - middleCutRegGrid <- cutRegGrid > a0 + lint * rotationCut[1] - buff & - cutRegGrid < a0 + lint * rotationCut[2] + buff - if (useBinnedCov) { - diagT <- rcov[['tDiag']] - diagVal <- rcov[['diagMeans']] - } else { - diagTV <- aggregate(rcov[['diag']][, 2], list(rcov[['diag']][, 1]), mean) - diagT <- diagTV[, 1] - diagVal <- diagTV[, 2] - } - diagEst <- approx(diagT, diagVal, cutRegGrid[middleCutRegGrid])[['y']] - sigma2 <- mean(diagEst - diag(smoothCov)[middleCutRegGrid]) - - } else { # has to estimate sigma2 from scratch - sigma2 <- PC_CovE(obsGrid, regGrid, bwCov, rotationCut=rotationCut, kernel=kern, rcov=rcov)$sigma2 - } - - if(sigma2 < 0) { - if(verbose){ - warning("Estimated sigma2 is negative and thus is reset to 1e-6.") - } - sigma2 <- 1e-6 - } - - } else { # error=FALSE - sigma2 <- NULL - } - - res <- list(rawCov = rcov, - smoothCov = (smoothCov + t(smoothCov)) / 2, - bwCov = bwCov, - sigma2 = sigma2, - outGrid = cutRegGrid) - class(res) <- "SmoothCov" - return(res) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetSmoothedMeanCurve.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GetSmoothedMeanCurve.R deleted file mode 100644 index 1fcb4013..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetSmoothedMeanCurve.R +++ /dev/null @@ -1,68 +0,0 @@ -GetSmoothedMeanCurve <- function (y, t, obsGrid, regGrid, optns){ - - # Note : If binned data we should use weighted mean response for each time-point. - # This is not currently implemented. \hat{y}_i = \sum_i w_i y_i where w_i are the - # same points for common t_is. so we have: \hat{y}_i = n_t w_i \bar{y} - - userMu = optns$userMu; - methodBwMu = optns$methodBwMu; - npoly = 1 - nder = 0 - userBwMu = optns$userBwMu; - kernel = optns$kernel - - # If the user provided a mean function use it - if ( is.list(userMu) && (length(userMu$mu) == length(userMu$t))){ - - buff <- .Machine$double.eps * max(abs(obsGrid)) * 10 - rangeUser <- range(optns$userMu$t) - rangeObs <- range(obsGrid) - if( rangeUser[1] > rangeObs[1] + buff || - rangeUser[2] < rangeObs[2] - buff ) { - stop('The range defined by the user provided mean does not cover the support of the data.') - } - - mu = spline(userMu$t, userMu$mu, xout= obsGrid)$y; - muDense = spline(obsGrid,mu, xout=regGrid)$y; - bw_mu = NULL; - - # otherwise if the user provided a mean bandwidth use it to estimate the mean function (below) - } else { - if (userBwMu > 0){ - bw_mu = userBwMu; - #otherwise estimate the mean bandwith via the method selected to estimnate the mean function (below) - } else { - if( any(methodBwMu == c('GCV','GMeanAndGCV') )){ - # get the bandwidth using GCV - bw_mu = unlist(GCVLwls1D1(yy = y, tt = t, kernel = kernel, npoly = npoly, nder = nder, dataType = optns$dataType) )[1] - if ( 0 == length(bw_mu)){ - stop('The data is too sparse to estimate a mean function. Get more data!\n') - } - # Uncomment to ensure MATLAB compatibility (AdjustBW1 is removed (3-Jun-16); check older versions.) - # bw_mu = AdjustBW1(kernel=kernel,bopt=bw_mu,npoly=npoly,dataType=optns$dataType,nder=nder) - # get the geometric mean between the minimum bandwidth and GCV bandwidth to estimnate the mean function (below) - if ( methodBwMu == 'GMeanAndGCV') { - minbw = Minb( unlist(t),2) - bw_mu = sqrt(minbw*bw_mu); - } - } else { - # get the bandwidth using CV to estimnate the mean function (below) - bw_mu = CVLwls1D(y, t, kernel= kernel, npoly=npoly, nder=nder, dataType= optns$dataType, kFolds = optns$kFoldMuCov, - useBW1SE = optns$useBW1SE); - } - } - # Get the mean function using the bandwith estimated above: - xin = unlist(t); - yin = unlist(y)[order(xin)]; - xin = sort(xin); - win = rep(1, length(xin)); - mu = Lwls1D(bw_mu, kernel_type = kernel, npoly = npoly, nder = nder, xin = xin, yin= yin, xout = obsGrid, win = win) - muDense = Lwls1D(bw_mu, kernel_type = kernel, npoly = npoly, nder = nder, xin = xin, yin= yin, xout = regGrid, win = win) - } - - result <- list( 'mu' = mu, 'muDense'= muDense, 'bw_mu' = bw_mu); - class(result) <- "SMC" - return(result) -} - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetUserCov.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GetUserCov.R deleted file mode 100644 index 57d0c759..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetUserCov.R +++ /dev/null @@ -1,35 +0,0 @@ -GetUserCov <- function(optns, obsGrid, cutRegGrid, buff, ymat) { -# If covariance function is provided - - - rangeUser <- range(optns$userCov$t) - rangeCut <- range(cutRegGrid) - if( rangeUser[1] > rangeCut[1] + buff || - rangeUser[2] < rangeCut[2] - buff ) { - stop('The range defined by the user provided covariance does not cover the support of the data.') - } - - bwCov = NULL - smoothCov = ConvertSupport(fromGrid = optns$userCov$t, cutRegGrid, Cov = optns$userCov$cov) - - if (optns$error) { # error == TRUE - if (!is.null(optns[['userSigma2']])) { - sigma2 <- optns[['userSigma2']] - } else if (optns$dataType %in% c('Dense', 'DenseWithMV')) { - ord <- 2 - sigma2 <- mean(diff(t(ymat), differences=ord)^2, na.rm=TRUE) / choose(2 * ord, ord) - } else { - stop('Use GetSmoothedCovarSurface instead!') - } - } else { # error == FALSE - sigma2 <- NULL - } - - res <- list(rawCov = NULL, - smoothCov = (smoothCov + t(smoothCov)) / 2, - bwCov = NULL, - sigma2 = sigma2, - outGrid = cutRegGrid) - class(res) <- "SmoothCov" - return(res) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetUserMeanCurve.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/GetUserMeanCurve.R deleted file mode 100644 index b6201fe3..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/GetUserMeanCurve.R +++ /dev/null @@ -1,19 +0,0 @@ -GetUserMeanCurve <- function (optns, obsGrid, regGrid, buff) { - # If the user provided a mean function use it - - userMu = optns$userMu - rangeUser <- range(optns$userMu$t) - rangeObs <- range(obsGrid) - if( rangeUser[1] > rangeObs[1] + buff || - rangeUser[2] < rangeObs[2] - buff ) { - stop('The range defined by the user provided mean does not cover the support of the data.') - } - - mu = spline(userMu$t, userMu$mu, xout= obsGrid)$y - muDense = spline(obsGrid,mu, xout=regGrid)$y - bw_mu = NULL - - result <- list( 'mu' = mu, 'muDense'= muDense, 'bw_mu' = bw_mu) - class(result) <- "SMC" - return(result) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/HandleNumericsAndNAN.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/HandleNumericsAndNAN.R deleted file mode 100644 index fb171a83..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/HandleNumericsAndNAN.R +++ /dev/null @@ -1,38 +0,0 @@ -# #' Check if NaN are present in the data and if yes remove them -# #' -# #' Check if there are problems cause by missing values with the form and basic structure of the functional data 'Ly' and the recorded times 'Lt'. -# #' -# #' @param Ly is a n-by-1 list of vectors -# #' @param Lt is a n-by-1 list of vectors - -HandleNumericsAndNAN <- function(Ly,Lt){ - - # Check for the presense of NA and remove them (if they exist) from the two lists in a pairwise manner - if( any(is.na(unlist(Lt))) || any(is.na(unlist(Ly))) ){ - - helperF <- function(x) which(!is.na(unlist(x))) - L <- list(); for(j in 1:length(Ly)) L[[j]] = list(Ly[[j]],Lt[[j]]) - validIndexes = lapply(L, function(x) intersect(helperF(x[1]), helperF(x[2]) )) - - Ly = lapply(1:length(Ly), function(i) Ly[[i]][validIndexes[[i]]]) - Lt = lapply(1:length(Ly), function(i) Lt[[i]][validIndexes[[i]]]) - - if( any(unlist(lapply(Ly, function(x) length(x) == 0))) ){ - stop('Subjects with only NA values are not allowed.\n') - } - - ni_y = unlist(lapply(Ly,function(x) sum(!is.na(x)))) - if(all(ni_y == 1)){ - stop("FPCA is aborted because the data do not contain repeated measurements after removing NA values.\n"); - } - } - - - - # Force the data to be list of numeric members - Ly <- lapply(Ly, as.numeric) - Lt <- lapply(Lt, as.numeric) - Lt <- lapply(Lt, signif, 14) - return( inputData <- list(Ly=Ly, Lt=Lt)); - -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/IsRegular.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/IsRegular.R deleted file mode 100644 index fbd15e68..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/IsRegular.R +++ /dev/null @@ -1,15 +0,0 @@ -IsRegular = function(t){ - - # Check the if we have dense (2), or dataType data with missing values (1) or sparse (0) data - # t : n-by-1 list of vectors - - tt = unlist(t); - f = length(tt)/length(unique(tt))/length(t); - if (f == 1){ - return('Dense'); # for either regular and irregular data - } else if(f > 0.80){ - return('DenseWithMV'); - } else { - return('Sparse'); - } -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/List2Mat.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/List2Mat.R deleted file mode 100644 index a21f69f8..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/List2Mat.R +++ /dev/null @@ -1,18 +0,0 @@ -# This function converts dense regular functional input list -# to a matrix for easier dense case implementation -########################################################################## -# Input: - y: list of n dense regular observed p-dim functional objects -########################################################################## -# Output: - ymat: n by p matrix containing all functional data -########################################################################## - -List2Mat <- function(y,t){ - n = length(y) - obsGrid = sort(unique(unlist(t))) - ymat = matrix( rep(NA, n * length(obsGrid)), nrow = n, byrow = TRUE) - - for (i in 1:n){ - ymat[i, is.element(obsGrid, t[[i]])] = y[[i]] - } - return(ymat) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/Lwls1D.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/Lwls1D.R deleted file mode 100644 index fd1089d3..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/Lwls1D.R +++ /dev/null @@ -1,44 +0,0 @@ -#' One dimensional local linear kernel smoother -#' -#' One dimensional local linear kernel smoother for longitudinal data. -#' -#' @param bw Scalar holding the bandwidth -#' @param kernel_type Character holding the kernel type (see ?FPCA for supported kernels) -#' @param win Vector of length N with weights -#' @param xin Vector of length N with measurement points -#' @param yin Vector of length N with measurement values -#' @param xout Vector of length M with output measurement points -#' @param npoly Scalar (integer) degree of polynomial fitted (default 1) -#' @param nder Scalar (integer) degree of derivative fitted (default 0) -#' -#' @return Vector of length M with measurement values at the the point speficied by 'xout' -#' -#' @export - - -Lwls1D <- function( bw, kernel_type, win=rep(1L, length(xin)), xin, yin, xout, npoly = 1L, nder = 0L){ - - if(is.unsorted(xin)){ - stop('`xin` needs to be sorted in increasing order') - } - - if(is.unsorted(xout)){ - stop('`xout` needs to be sorted in increasing order') - } - - if(all(is.na(win)) || all(is.na(xin)) || all(is.na(yin))){ - stop(' win, xin or yin contain only NAs!') - } - - # Deal with NA/NaN measurement values - NAinY = is.na(xin) | is.na(yin) | is.na(win) - if(any(NAinY)){ - win = win[!NAinY] - xin = xin[!NAinY] - yin = yin[!NAinY] - } - - return( CPPlwls1d(bw= as.numeric(bw), kernel_type = kernel_type, npoly= as.integer(npoly), nder= as.integer(nder), - xin = as.numeric(xin), yin= as.numeric(yin), xout= as.numeric(xout), win = as.numeric(win))) -} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/Lwls2D.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/Lwls2D.R deleted file mode 100644 index e317da5c..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/Lwls2D.R +++ /dev/null @@ -1,93 +0,0 @@ -#' Two dimensional local linear kernel smoother. -#' -#' Two dimensional local weighted least squares smoother. Only local linear smoother for estimating the original curve is available (no higher order, no derivative). -#' @param bw A scalar or a vector of length 2 specifying the bandwidth. -#' @param kern Kernel used: 'gauss', 'rect', 'gausvar', 'epan' (default), 'quar'. -#' @param xin An n by 2 data frame or matrix of x-coordinate. -#' @param yin A vector of y-coordinate. -#' @param win A vector of weights on the observations. -#' @param xout1 a p1-vector of first output coordinate grid. Defaults to the input gridpoints if left unspecified. -#' @param xout2 a p2-vector of second output coordinate grid. Defaults to the input gridpoints if left unspecified. -#' @param xout alternative to xout1 and xout2. A matrix of p by 2 specifying the output points (may be inefficient if the size of \code{xout} is small). -#' @param crosscov using function for cross-covariance estimation (Default: FALSE) -#' @param subset a vector with the indices of x-/y-/w-in to be used (Default: NULL) -#' @param method should one try to sort the values xin and yin before using the lwls smoother? if yes ('sort2' - default for non-Gaussian kernels), if no ('plain' - fully stable; de) -#' @return a p1 by p2 matrix of fitted values if xout is not specified. Otherwise a vector of length p corresponding to the rows of xout. -#' @export - -Lwls2D <- function(bw, kern='epan', xin, yin, win=NULL, xout1=NULL, xout2=NULL, xout=NULL, subset=NULL, crosscov = FALSE, method = ifelse(kern == 'gauss', 'plain', 'sort2')) { - - # only support epan kernel now. - # stopifnot(kern == 'epan') - - if (length(bw) == 1){ - bw <- c(bw, bw) - } - if (!is.matrix(xin) || (dim(xin)[2] != 2) ){ - stop('xin needs to be a n by 2 matrix') - } - # xin <- matrix(xin, ncol=2) # This causes unexcepted/wrong results. - - if (is.null(win)){ - win <- rep(1, nrow(xin)) - } - if (!(nrow(xin) == length(yin) && nrow(xin) == length(win))) { - stop('The length of xin, yin, and win (if specified) must be the same') - } - if (!is.null(subset)) { - xin <- xin[subset, ] - yin <- yin[subset] - win <- win[subset] - } - - if (!is.null(xout1) && !is.null(xout2) && !is.null(xout)) { - stop('Either xout1/xout2 or xout should be specified, but not both.') - } - - if (is.null(xout1)) - xout1 <- sort(unique(xin[, 1])) - - if (is.null(xout2)) - xout2 <- sort(unique(xin[, 2])) - - # For passing numerics into the cpp smoother. - storage.mode(bw) <- 'numeric' - storage.mode(xin) <- 'numeric' - storage.mode(yin) <- 'numeric' - storage.mode(win) <- 'numeric' - storage.mode(xout1) <- 'numeric' - storage.mode(xout2) <- 'numeric' - if (!is.null(xout)) - storage.mode(xout) <- 'numeric' - if (crosscov == TRUE){ - if (method == 'sort2') { - ord <- order(xin[, 1]) - xin <- xin[ord, ] - yin <- yin[ord] - win <- win[ord] - # browser() - #ret <- RmullwlskCCsort2(bw, kern, t(xin), yin, win, xout1, xout2, FALSE) - ret <- RmullwlskUniversal(bw, kern, t(xin), yin, win, xout1, xout2, FALSE, autoCov = FALSE) - } else if (method == 'plain') { - ret <- RmullwlskCC(bw, kern, t(xin), yin, win, xout1, xout2, FALSE) - } - } else { - #browser() - if(method == 'plain'){ - ret <- Rmullwlsk(bw, kern, t(xin), yin, win, xout1, xout2, FALSE) - } else if (method == 'sort2'){ - ord <- order(xin[, 1]) - xin <- xin[ord, ] - yin <- yin[ord] - win <- win[ord] - # browser() - ret <- RmullwlskUniversal(bw, kern, t(xin), yin, win, xout1, xout2, FALSE, autoCov = TRUE) - } - } - - if (!is.null(xout)) { - ret <- interp2lin(xout1, xout2, ret, xout[, 1], xout[, 2]) - } - - return(ret) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/Lwls2DDeriv.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/Lwls2DDeriv.R deleted file mode 100644 index 6a4b30a3..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/Lwls2DDeriv.R +++ /dev/null @@ -1,90 +0,0 @@ -#' Two dimensional local linear kernel smoother with derivatives. -#' -#' Two dimensional local weighted least squares smoother. Only local linear smoother for estimating the original curve is available (no higher order, no derivative). -#' @param bw A scalar or a vector of length 2 specifying the bandwidth. -#' @param kern Kernel used: 'gauss', 'rect', 'gausvar', 'epan' (default), 'quar'. -#' @param xin An n by 2 data frame or matrix of x-coordinate. -#' @param yin A vector of y-coordinate. -#' @param win A vector of weights on the observations. -#' @param xout1 a p1-vector of first output coordinate grid. Defaults to the input gridpoints if left unspecified. -#' @param xout2 a p2-vector of second output coordinate grid. Defaults to the input gridpoints if left unspecified. -#' @param xout alternative to xout1 and xout2. A matrix of p by 2 specifying the output points (may be inefficient if the size of \code{xout} is small). -#' @param npoly The degree of polynomials (include all \eqn{x^a y^b} terms where \eqn{a + b <= npoly}) -#' @param nder1 Order of derivative in the first direction -#' @param nder2 Order of derivative in the second direction -#' @param crosscov using function for cross-covariance estimation (Default: TRUE) -#' @param subset a vector with the indices of x-/y-/w-in to be used (Default: NULL) -#' @param method should one try to sort the values xin and yin before using the lwls smoother? if yes ('sort2' - default for non-Gaussian kernels), if no ('plain' - fully stable; de) -#' @return a p1 by p2 matrix of fitted values if xout is not specified. Otherwise a vector of length p corresponding to the rows of xout. -#' @export - -Lwls2DDeriv <- function( - bw, kern='epan', xin, yin, win=NULL, xout1=NULL, xout2=NULL, xout=NULL, - npoly=1L, nder1=0L, nder2=0L, subset=NULL, - crosscov = TRUE, method = 'sort2' -) { - - # only support epan kernel now. - # stopifnot(kern == 'epan') - - if (length(bw) == 1){ - bw <- c(bw, bw) - } - if (is.data.frame(xin)) { - xin <- as.matrix(xin) - } - if (!is.matrix(xin) || (dim(xin)[2] != 2) ){ - stop('xin needs to be a n by 2 matrix') - } - # xin <- matrix(xin, ncol=2) # This causes unexcepted/wrong results. - - if (is.null(win)){ - win <- rep(1, nrow(xin)) - } - if (!is.null(subset)) { - xin <- xin[subset, ] - yin <- yin[subset] - win <- win[subset] - } - - if (!is.null(xout1) && !is.null(xout2) && !is.null(xout)) { - stop('Either xout1/xout2 or xout should be specified, but not both.') - } - - if (is.null(xout1)) - xout1 <- sort(unique(xin[, 1])) - - if (is.null(xout2)) - xout2 <- sort(unique(xin[, 2])) - - # For passing numerics into the cpp smoother. - storage.mode(bw) <- 'numeric' - storage.mode(xin) <- 'numeric' - storage.mode(yin) <- 'numeric' - storage.mode(win) <- 'numeric' - storage.mode(xout1) <- 'numeric' - storage.mode(xout2) <- 'numeric' - if (!is.null(xout)) - storage.mode(xout) <- 'numeric' - storage.mode(npoly) <- 'integer' - storage.mode(nder1) <- 'integer' - storage.mode(nder2) <- 'integer' - - if (method == 'sort2') { - ord <- order(xin[, 1]) - xin <- xin[ord, ] - yin <- yin[ord] - win <- win[ord] - # browser() - ret <- RmullwlskUniversalDeriv(bw, kern, t(xin), yin, win, - xout1, xout2, npoly, nder1, nder2, FALSE, !crosscov) - } else if (method == 'plain') { # MAYBE IMPROVE THIS - ret <- RmullwlskCC(bw, kern, t(xin), yin, win, xout1, xout2, FALSE) - } - - if (!is.null(xout)) { - ret <- interp2lin(xout1, xout2, ret, xout[, 1], xout[, 2]) - } - - return(ret) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/MCVOptRidge.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/MCVOptRidge.R deleted file mode 100644 index 8004dea1..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/MCVOptRidge.R +++ /dev/null @@ -1,188 +0,0 @@ -### Functional Optimal Designs: modified cross validation for ridge parameter selection -MCVOptRidge <- function(y, t, Resp, p, RidgeCand, isDense = FALSE, - isRegression = FALSE, isSequential = TRUE){ - # Modified CV approach for ridge parameter selection - n <- length(y) - ridgecrit <- matrix(NA,ncol=2,nrow=length(RidgeCand)) - for(cviter in 1:length(RidgeCand)){ # cv loop - ngrouping = 10 - if(isDense){ngrouping = 2} - crittemp <- matrix(NA, ncol=2, nrow=ngrouping) - for(ii in 1:ngrouping){ - idxA <- sort(sample(1:n, round(n/4))) # for FPCA and model component est - idxB <- sort((1:n)[-idxA]) # for evaluation of optimal design - yA <- y[idxA]; tA <- t[idxA] - yB <- y[idxB]; tB <- t[idxB] - - obsGridA = signif(sort(unique(c(unlist(tA)))),8); - - nRegGridA = as.integer(1+diff(range(obsGridA))/min(diff(obsGridA))); - - optnsA <- SetOptions(y = yA, t = tA, optns = list(nRegGrid = nRegGridA)) - CheckOptions(t = tA, optns = optnsA, n = length(yA)) - - FPCAA <- FPCA(yA, tA, optnsA) - CovA <- FPCAA$fittedCov; muA <- FPCAA$mu - workGridA <- signif(FPCAA$workGrid,8); - - DesPoolB <- matrix(NA, ncol = 0, nrow = p) - n_DesB <- length(idxB) - if(isDense){n_DesB <- 1} - for(j in 1:n_DesB){ - if(length(tB[[j]]) >= p){ - subidxj <- which(workGridA %in% tB[[j]]) - if(length(subidxj) < p){cat(subidxj,"\n")} - DesPoolB <- cbind(DesPoolB, utils::combn(subidxj,p)) - } - } - DesPoolB <- t(unique(t(DesPoolB))) # take only unique designs - if(isRegression == TRUE){ - # Get CCovA - RespA <- Resp[idxA]; RespB <- Resp[idxB] - yA1 <- list() - for(l in 1:length(idxA)){yA1[[l]] <- yA[[l]] * RespA[l]} - FPCAAcross <- FPCA(yA1, tA, optnsA) - CCovAtemp <- FPCAAcross$mu - muA*mean(RespA) - CCovA = CCovAtemp - #CCovA <- ConvertSupport(fromGrid = signif(FPCAAcross$obsGrid,8), toGrid = workGridA, - # mu = CCovAtemp) - # then find optdes for SR - optdesii <- BestDes_SR_CV(p = p, ridge = RidgeCand[cviter], DesPool = DesPoolB, - workGrid = workGridA, Cov = CovA, - CCov = CCovA, isDense = isDense, isSequential = isSequential) - # check out the subjects that has measurements at selected designs - idxB2Prd <- rep(0, length(idxB)) - for(ll in 1:length(idxB)){ - if(sum(workGridA[optdesii] %in% tB[[ll]]) == p) idxB2Prd[ll] <- 1 - } - #if(!isDense){ - #cat(paste("idxB2Prd is", length(which(idxB2Prd==1)),"...\n")) - #} - yB2Prd <- yB[which(idxB2Prd == 1)] - tB2Prd <- tB[which(idxB2Prd == 1)] - RespB2Prd <- RespB[which(idxB2Prd == 1)] - # make predictions - FittedB <- RespPrd_CV(design = optdesii, ylist2Prd = yB2Prd, tlist2Prd = tB2Prd, - mu = FPCAA$mu, RespTrain = RespA, - obsGrid = obsGridA, workGrid = workGridA, - ridge = RidgeCand[cviter], Cov = CovA, CCov = CCovA) - # calculate performance criterion - crittemp[ii,] <- APE_CV(RespB2Prd, FittedB$yres) - } else { # for TR - optdesii <- BestDes_TR_CV(p = p, ridge = RidgeCand[cviter], DesPool = DesPoolB, - workGrid = workGridA, Cov = CovA, isDense = isDense, - isSequential = isSequential) - # check out the subjects that has measurements at selected designs - idxB2Prd <- rep(0, length(idxB)) - for(ll in 1:length(idxB)){ - if(sum(workGridA[optdesii] %in% tB[[ll]]) == p) idxB2Prd[ll] <- 1 - } - #if(!isDense){ - #cat(paste("idxB2Prd is", length(which(idxB2Prd==1)),"...\n")) - #} - yB2Prd <- yB[which(idxB2Prd == 1)] - tB2Prd <- tB[which(idxB2Prd == 1)] - FittedB <- TrajRec_CV(design = optdesii, ylist2Prd = yB2Prd, tlist2Prd = tB2Prd, - mu = FPCAA$mu, obsGrid = obsGridA, workGrid = workGridA, - ridge = RidgeCand[cviter], Cov = CovA) - # returns the fitted list at observed time points - # calculate performance criterion - yB2PrdAdj <- list() - for(rr in 1:length(yB2Prd)){ - ttemp <- which( ( signif(tB2Prd[[rr]],8) %in% signif(workGridA,8) ) == TRUE) - yB2PrdAdj[[rr]] <- yB2Prd[[rr]][ttemp] - } - crittemp[ii,] <- ARE_CV(yB2PrdAdj, FittedB$yres) - } - } - ridgecrit[cviter,] <- colMeans(crittemp, na.rm = TRUE) - cat(paste("CV for",cviter,"out of",length(RidgeCand), "ridge parameters complete!\n")) - } - optridge = RidgeCand[which(ridgecrit[,1] == min(ridgecrit[,1]))] - return(list(optridge = optridge, RidgeError = cbind(RidgeCand,ridgecrit))) -} - -BestDes_TR_CV <- function(p, ridge, DesPool, workGrid, Cov, isDense = TRUE, isSequential = FALSE){ - # select the optimal designs for trajectory recovery case in cv - if(isDense){ - best <- BestDes_TR(p, ridge, workGrid, Cov, isSequential=isSequential)$best - } - else { # sparse case - comblist = DesPool - temps <- rep(0,ncol(comblist)) - for(i in 1:ncol(comblist)){ temps[i] <- TRCri(comblist[,i], ridge, Cov, workGrid) } - best <- sort(comblist[,min(which(temps==max(temps)))]) - return(best) - # sequential method not used for sparse case - } -} - -BestDes_SR_CV <- function(p, ridge, DesPool, workGrid, Cov, CCov, isDense = TRUE, isSequential = FALSE){ - # select the optimal designs for regression case in cv - if(isDense){ - best <- BestDes_SR(p, ridge, workGrid, Cov, CCov, isSequential=isSequential)$best - } else { - comblist <- DesPool - temps <- rep(0,ncol(comblist)) - for(i in 1:ncol(comblist)){ temps[i] <- SRCri(comblist[,i], ridge, Cov, CCov) } - best <- sort(comblist[,min(which(temps==max(temps)))]) - return(best) - # sequential method not used for sparse case - } -} - -TrajRec_CV <- function(design, ylist2Prd, tlist2Prd, mu, obsGrid, workGrid, ridge, Cov){ - # recover the trajectories based on a given design vector (for cv) - if(length(ylist2Prd) == 0){ return(list(yres = list(), tres = list()))} - ridgeCov <- Cov + diag(ridge, nrow(Cov)) - if(length(mu) != length(workGrid)){ - mu <- ConvertSupport(fromGrid = obsGrid, toGrid = workGrid, mu = mu) - } - yres <- list() - for(i in 1:length(ylist2Prd)){ - obsidx <- which((signif(workGrid,digits=8) %in% signif(tlist2Prd[[i]],8)) == TRUE) - obsdesidx <- which( (signif(tlist2Prd[[i]],8) %in% signif(workGrid[design],8) ) == TRUE ) - yres[[i]] <- mu[obsidx] + Cov[obsidx,design] %*% solve(ridgeCov[design,design]) %*% - ((ylist2Prd[[i]][obsdesidx]) - mu[design]) - } - return(list(yres = yres, tres = tlist2Prd)) -} - -RespPrd_CV <- function(design, ylist2Prd, tlist2Prd, mu, RespTrain, obsGrid, - workGrid, ridge, Cov, CCov){ - # predict the response based on a given design vector (for cv) - if(length(ylist2Prd) == 0){ return(list(yres = c(), tres = list()))} - ridgeCov <- Cov + diag(ridge,nrow(Cov)) - if(length(mu) != length(workGrid) || length(CCov) != length(workGrid)){ - mu <- ConvertSupport(fromGrid = obsGrid, toGrid = workGrid, mu = mu) - CCov <- ConvertSupport(fromGrid = obsGrid, toGrid = workGrid, mu = CCov) - } - Ybar <- mean(RespTrain) - res <- rep(NA, length(ylist2Prd)) - for(i in 1:length(ylist2Prd)){ - obsdesidx <- which( ( signif(tlist2Prd[[i]],8) %in% signif(workGrid[design],8)) == TRUE) - res[i] <- Ybar + CCov[design] %*% solve(ridgeCov[design,design]) %*% - (ylist2Prd[[i]][obsdesidx] - mu[design]) - } - return(list(yres = res, tres = tlist2Prd)) -} - -ARE_CV <- function(ObsTraj, RecTraj){ - # error cirterion: MISE for trajectory recovery - if(length(RecTraj) == 0){return(c(NA,NA))} - nn <- length(ObsTraj) - addi <- rep(NA, nn) - denom <- rep(NA,nn) - for(i in 1:nn){ - addi[i] <- sqrt(mean((ObsTraj[[i]]-RecTraj[[i]])^2)) - denom[i] <- sqrt(mean(ObsTraj[[i]]^2)) - } - return(c(mean(addi),mean(addi)/mean(denom))) -} - -APE_CV <- function(ObsResp, PredResp){ - # error criterion: MSE for regression case - if(length(PredResp)==0){return(c(NA,NA))} - return(c(sqrt(mean((ObsResp - PredResp)^2)), - sqrt(mean((ObsResp - PredResp)^2))/sqrt(mean(ObsResp^2)))) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/MakeBWtoZscore02y.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/MakeBWtoZscore02y.R deleted file mode 100644 index 619cca99..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/MakeBWtoZscore02y.R +++ /dev/null @@ -1,49 +0,0 @@ -#' Z-score body-weight for age 0 to 24 months based on WHO standards -#' -#' Make vector of age and body-weight to z-scores based on WHO standards using LMS -#' -#' @param sex A character 'M' or 'F' indicating the sex of the child. -#' @param age A vector of time points of size Q. -#' @param bw A vector of body-weight readings of size Q. -#' -#' @return A vector of Z-scores of size Q. -#' @export -MakeBWtoZscore02y <- function(sex, age, bw){ - time = 0:24 - if(length(age) != length(bw)){ - stop('Number of readings for age and body-weight are not the same.') - } - if(!all( (age <= time[24]) && (time[1] <= age))){ - stop('Age requested is outside the [0,24] months.') - } - - if(sex == 'F'){ - # http://www.who.int/childgrowth/standards/tab_wfa_girls_p_0_5.txt - sGbw = c( 0.14171, 0.13724, 0.13000, 0.12619, 0.12402, 0.12274, 0.12204, 0.12178, 0.12181, 0.12199, 0.12223, - 0.12247, 0.12268, 0.12283, 0.12294, 0.12299, 0.12303, 0.12306, 0.12309, 0.12315, 0.12323, 0.12335, - 0.12350, 0.12369, 0.12390) - mGbw = c( 3.2322, 4.1873, 5.1282, 5.8458, 6.4237, 6.8985, 7.2970, 7.6422, 7.9487, 8.2254, 8.4800, - 8.7192, 8.9481, 9.1699, 9.3870, 9.6008, 9.8124, 10.0226, 10.2315, 10.4393, 10.6464, 10.8534, - 11.0608, 11.2688, 11.4775 ) - lGbw = c( 0.3809, 0.1714, 0.0962, 0.0402, -0.0050, -0.0430, -0.0756, -0.1039, -0.1288, -0.1507, -0.1700, - -0.1872, -0.2024, -0.2158, -0.2278, -0.2384, -0.2478, -0.2562, -0.2637, -0.2703, -0.2762, -0.2815, - -0.2862, -0.2903, -0.2941) - return( ( ((bw/spline(x=time, y = mGbw, xout = age)$y)^(spline(x=time, y = lGbw, xout = age)$y)) -1 ) / - (spline(x=time, y = sGbw, xout = age)$y * spline(x=time, y = lGbw, xout = age)$y) ) - } else if(sex == 'M'){ - # http://www.who.int/childgrowth/standards/tab_wfa_boys_p_0_5.txt - sBbw = c(0.14602, 0.13395, 0.12385, 0.11727, 0.11316, 0.11080, 0.10958, 0.10902, 0.10882, 0.10881, 0.10891, - 0.10906, 0.10925, 0.10949, 0.10976, 0.11007, 0.11041, 0.11079, 0.11119, 0.11164, 0.11211, 0.11261, - 0.11314, 0.11369,0.11426) - mBbw = c(3.3464, 4.4709, 5.5675, 6.3762, 7.0023, 7.5105, 7.9340, 8.2970, 8.6151, 8.9014, 9.1649, - 9.4122, 9.6479, 9.8749, 10.0953, 10.3108, 10.5228, 10.7319, 10.9385, 11.1430, 11.3462, 11.5486, - 11.7504, 11.9514, 12.1515) - lBbw = c(0.3487, 0.2297, 0.1970, 0.1738, 0.1553, 0.1395, 0.1257, 0.1134, 0.1021, 0.0917, 0.0820, - 0.0730, 0.0644, 0.0563, 0.0487, 0.0413, 0.0343, 0.0275, 0.0211, 0.0148, 0.0087, 0.0029, - -0.0028, -0.0083,-0.0137) - return( ( ((bw/spline(x=time, y = mBbw, xout = age)$y)^(spline(x=time, y = lBbw, xout = age)$y)) -1 ) / - (spline(x=time, y = sBbw, xout = age)$y * spline(x=time, y = lBbw, xout = age)$y) ) - } else{ - stop("Sex type undefined.") - } -} \ No newline at end of file diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/MakeFPCAInputs.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/MakeFPCAInputs.R deleted file mode 100644 index c77a474b..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/MakeFPCAInputs.R +++ /dev/null @@ -1,52 +0,0 @@ -#' Format FPCA input -#' -#' Turn vector inputs to the list so they can be used in FPCA -#' -#' @param IDs n-by-1 vector of subject IDs (Default: NULL) -#' @param tVec Either an n-by-1 vector of measurement times, or a p-by-1 vector corresponding to the common time support -#' @param yVec n-by-1 vector of measurements from the variable of interest, or a n-by-p matrix with each row corresponding to the dense observations. -#' @param na.rm logical indicating if NA should be omitted (Default: FALSE) -#' @param sort logical indicating if the returned lists Lt and Ly should be ensured to be sorted (Default: FALSE) -#' @return L list containing 3 lists each of length 'm', 'm' being the number of unique subject IDs -#' @export - -MakeFPCAInputs <- function(IDs = NULL, tVec, yVec, na.rm=FALSE, sort = FALSE){ - - if ((!is.null(IDs) && any(is.na(IDs)) || any(is.na(tVec))) && - na.rm == FALSE) { - stop('NAs exist in the IDs or tVec. Use na.rm=TRUE') - } - - if( !is.null(IDs) ){ - if (na.rm) { - dat <- na.omit(data.frame(IDs, tVec, yVec)) - IDs <- dat[, 'IDs'] - tVec <- dat[, 'tVec'] - yVec <- dat[, 'yVec'] - } - uniqueIDs <- unique(IDs) - # Lt <- lapply( uniqueIDs, function(x) tVec[ which(IDs == x)]) - # Ly <- lapply( uniqueIDs, function(x) yVec[ which(IDs == x)]) - Lid <- as.list(uniqueIDs) - Lt <- split(tVec, IDs, drop=TRUE) - Lt <- Lt[match(as.character(uniqueIDs), names(Lt))] - Ly <- split(yVec, IDs, drop=TRUE) - Ly <- Ly[match(as.character(uniqueIDs), names(Ly))] - } else if ( is.matrix(yVec) && is.null(IDs) && is.vector(tVec) ){ - if (ncol(yVec) != length(tVec)) { - stop('columns of yVec does not correspond to tVec.') - } - Ly <- lapply( seq_len(nrow(yVec)), function(i) yVec[i,]) - Lt <- rep( list(tVec), dim(yVec)[1] ) - Lid <- as.list( 1:dim(yVec)[1]) - } - if(sort){ - Ly = mapply( FUN = function(u1,u2) { ifelse(is.unsorted(u1), return( u2[order(u1)]), return(u2) ) }, u1 = Lt, u2 = Ly, SIMPLIFY = FALSE) - Lt = lapply( Lt, function(u) { ifelse(is.unsorted(u), return( sort(u) ), return(u) ) } ) - } - - L <- list( Lid = Lid, Ly = Ly, Lt = Lt) - return(L) - -} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/MakeGPFunctionalData.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/MakeGPFunctionalData.R deleted file mode 100644 index 6589e422..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/MakeGPFunctionalData.R +++ /dev/null @@ -1,56 +0,0 @@ -#' Make Gaussian Process Dense Functional Data sample -#' -#' Make a Gaussian process dense functional data sample of size n over a [0,1] support. -#' -#' @param n number of samples to generate -#' @param M number of equidistant readings per sample (default: 100) -#' @param mu vector of size M specifying the mean (default: rep(0,M)) -#' @param K scalar specifying the number of basis to be used (default: 2) -#' @param lambda vector of size K specifying the variance of each components (default: rep(1,K)) -#' @param sigma The standard deviation of the Gaussian noise added to each observation points. -#' @param basisType string specifiying the basis type used; possible options are: 'sin', 'cos' and 'fourier' (default: 'cos') (See code of 'CreateBasis' for implementation details.) -#' -#' @return Y: X(t_{j}), Yn: noisy observations -#' @export - -MakeGPFunctionalData <-function(n, M = 100, mu=rep(0,M), K = 2, lambda = rep(1,K), sigma=0, basisType='cos'){ - - if(n <2){ - stop("Samples of size 1 are irrelevant.") - } - if(M <20){ - stop("Dense samples with less than 20 observations per subject are irrelevant.") - } - if (!is.numeric(sigma) || sigma < 0) { - stop("'sigma' needs to be a nonnegative number") - } - s <- seq(0,1,length.out = M) - - if(length(mu) != M){ - stop("Make sure that 'M' and the number of points over which 'mu' is evaluated is the same.") - } - # if(is.null(lambda)){ - # lambda = seq(K,1,-1) - # } - if(K != length(lambda)){ - stop("Make sure you provide 'lambda's for all 'K' modes of variation.") - } - # if( !(basisType %in% c('cos','sin','fourier'))){ - # stop("Make sure you provide a valid parametric basis.") - # } - - Ksi <- apply(matrix(rnorm(n*K), ncol=K), 2, scale) %*% diag(sqrt(lambda)) - Phi <- CreateBasis(pts= s, type= basisType, K = K) - - yTrue <- t(matrix(rep(mu,n), nrow=M)) + Ksi %*% t(Phi) - - res <- list(Y = yTrue, Phi = Phi, xi=Ksi, pts=s) - - if (sigma > 0) { - yNoisy <- yTrue + rnorm(n * M, sd=sigma) - res <- c(res, list(Yn = yNoisy)) - } - - return(res) - } - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/MakeHCtoZscore02y.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/MakeHCtoZscore02y.R deleted file mode 100644 index 06a37f9e..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/MakeHCtoZscore02y.R +++ /dev/null @@ -1,41 +0,0 @@ -#' Z-score head-circumference for age 0 to 24 months based on WHO standards -#' -#' Make vector of age and height measurement to z-scores based on WHO standards using mu and sigma (not LMS) -#' -#' @param sex A character 'M' or 'F' indicating the sex of the child. -#' @param age A vector of time points of size Q. -#' @param hc A vector of head circumference readings of size Q (in cm). -#' -#' @return A vector of Z-scores of size Q. -#' @export -MakeHCtoZscore02y <- function(sex, age, hc){ - time = 0:24 - - if(length(age) != length(hc)){ - stop('Number of readings for age and head circ. are not the same.') - } - if(!all( (age <= time[24]) && (time[1] <= age))){ - stop('Age requested is outside the [0,24] months.') - } - if(sex == 'F'){ - # http://www.who.int/childgrowth/standards/second_set/tab_hcfa_girls_p_0_5.txt - muGhc = c(33.8787, 36.5463, 38.2521, 39.5328, 40.5817, 41.4590, 42.1995, 42.8290, 43.3671, - 43.8300, 44.2319, 44.5844, 44.8965, 45.1752, 45.4265, 45.6551, 45.8650, 46.0598, - 46.2424, 46.4152, 46.5801, 46.7384, 46.8913, 47.0391, 47.1822) - sdGhc = c(1.18440, 1.17314, 1.21183, 1.24133, 1.26574, 1.28606, 1.30270, 1.31699, 1.32833, - 1.33813, 1.34642, 1.35314, 1.35902, 1.36384, 1.36825, 1.37239, 1.37549, 1.37857, - 1.38126, 1.38410, 1.38669, 1.38907, 1.39126, 1.39330, 1.39518); - return( (hc - spline(x=time, y = muGhc, xout = age)$y) / spline(x=time, y = sdGhc, xout = age)$y) - } else if(sex == 'M'){ - # http://www.who.int/childgrowth/standards/second_set/tab_hcfa_boys_p_0_5.txt - muBhc = c(34.4618, 37.2759, 39.1285, 40.5135, 41.6317, 42.5576, 43.3306, 43.9803, 44.5300, - 44.9998, 45.4051, 45.7573, 46.0661, 46.3395, 46.5844, 46.8060, 47.0088, 47.1962, - 47.3711, 47.5357, 47.6919, 47.8408, 47.9833, 48.1201, 48.2515) - sdBhc = c(1.27026, 1.16785, 1.17268, 1.18218, 1.19400, 1.20736, 1.22062, 1.23321, 1.24506, - 1.25639, 1.26680, 1.27617, 1.28478, 1.29241, 1.30017, 1.30682, 1.31390, 1.32008, - 1.32639, 1.33243, 1.33823, 1.34433, 1.34977, 1.35554, 1.36667) - return( (hc - spline(x=time, y = muBhc, xout = age)$y) / spline(x=time, y = sdBhc, xout = age)$y) - } else{ - stop("Sex type undefined.") - } -} \ No newline at end of file diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/MakeLNtoZscore02y.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/MakeLNtoZscore02y.R deleted file mode 100644 index 1bc70d65..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/MakeLNtoZscore02y.R +++ /dev/null @@ -1,45 +0,0 @@ -#' Z-score height for age 0 to 24 months based on WHO standards -#' -#' Make vector of age and height measurement to z-scores based on WHO standards using mu and sigma (not LMS) -#' -#' @param sex A character 'M' or 'F' indicating the sex of the child. -#' @param age A vector of time points of size Q. -#' @param ln A vector of body-length readings of size Q (in cm). -#' -#' @return A vector of Z-scores of size Q. -#' @export -MakeLNtoZscore02y <- function(sex, age, ln){ - time = 0:24 - - if(length(age) != length(ln)){ - stop('Number of readings for age and length are not the same.') - } - if(!all( (age <= time[24]) && (time[1] <= age))){ - stop('Age requested is outside the [0,24] months.') - } - if(sex == 'F'){ - #http://www.who.int/childgrowth/standards/tab_lhfa_girls_p_0_2.txt - muGln = c(49.1477, 53.6872, 57.0673, 59.8029, 62.0899, 64.0301, - 65.7311, 67.2873, 68.7498, 70.1435, 71.4818, 72.771, - 74.015, 75.2176, 76.3817, 77.5099, 78.6055, 79.671, - 80.7079, 81.7182, 82.7036, 83.6654, 84.604, 85.5202, 86.4153) - sdGln = c(1.8627, 1.9542, 2.0362, 2.1051, 2.1645, 2.2174, - 2.2664, 2.3154, 2.365, 2.4157, 2.4676, 2.5208, - 2.575, 2.6296, 2.6841, 2.7392, 2.7944, 2.849, - 2.9039, 2.9582, 3.0129, 3.0672, 3.1202, 3.1737, 3.2267); - return( (ln - spline(x=time, y = muGln, xout = age)$y) / spline(x=time, y = sdGln, xout = age)$y) - } else if(sex == 'M'){ - #http://www.who.int/childgrowth/standards/tab_lhfa_boys_p_0_2.txt - muBln = c(49.8842, 54.7244, 58.4249, 61.4292, 63.886, 65.9026, - 67.6236, 69.1645, 70.5994, 71.9687, 73.281, 74.5388, - 75.7488, 76.9186, 78.0497, 79.1458, 80.211, 81.2487, - 82.2587, 83.2418, 84.1996, 85.1348, 6.0477, 86.941, 87.8161) - sdBln = c(1.8931, 1.9465, 2.0005, 2.0444, 2.0808, 2.1115, - 2.1403, 2.1711, 2.2055, 2.2433, 2.2849, 2.3293, - 2.3762, 2.426, 2.4773, 2.5303, 2.5844, 2.6406, - 2.6973, 2.7553, 2.814, 2.8742, 2.9342, 2.9951, 3.0551) - return( (ln - spline(x=time, y = muBln, xout = age)$y) / spline(x=time, y = sdBln, xout = age)$y) - } else{ - stop("Sex type undefined.") - } -} \ No newline at end of file diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/MakeResultFPCA.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/MakeResultFPCA.R deleted file mode 100644 index 612fc529..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/MakeResultFPCA.R +++ /dev/null @@ -1,85 +0,0 @@ -# This function makes the output object for function FPCA - -###### -# Input: -###### -# optns: options for FPCA function -# smcObj: smooth mean curve object -# scsObj: smooth cov surface object -# eigObj: eigen analysis object -# scoresObj: FPC scores object -# obsGrid: observed time grid -# workGrid: time grid for smoothed covariance surface -# rho: regularization parameter for sigma2 -# fitLambda: eigenvalues by least squares fit method -# timestamps: time-stamps on how much time specific parts of FPCA needed -# inputData: input data to return (if lean: FALSE) -###### -# Output: -###### -# ret: FPCA output object -########################################################################## - -MakeResultFPCA <- function(optns, smcObj, mu, scsObj, eigObj, - scoresObj, obsGrid, workGrid, rho=NULL, fitLambda=NULL, inputData, timestamps = NULL){ - - if (optns$methodXi == 'CE') { - xiEst <- t(do.call(cbind, scoresObj[1, ])) - xiVar <- scoresObj[2, ] - } else if (optns$methodXi == 'IN') { - xiEst <- scoresObj$xiEst - xiVar <- scoresObj$xiVar - } - - ret <- list(sigma2 = scsObj$sigma2, - lambda = eigObj$lambda, - phi = eigObj$phi, - xiEst = xiEst, - xiVar = xiVar, - obsGrid = obsGrid, - workGrid = workGrid, - mu = spline(x= obsGrid, y= mu, xout= workGrid)$y, - smoothedCov = scsObj$smoothCov, - FVE = eigObj$cumFVE[eigObj$kChoosen], - cumFVE = eigObj$cumFVE, - fittedCov = eigObj$fittedCov, - optns = optns, - bwMu = smcObj$bw_mu, - bwCov = scsObj$bwCov) - - if (optns$methodXi == 'CE') { - ret$rho <- rho - } - - if (optns$fitEigenValues) { - ret$fitLambda <- fitLambda - } - - ret$inputData <- inputData; # This will be potentially be NULL if `lean` - class(ret) <- 'FPCA' - - # select number of components based on specified criterion # This should be move within MakeResultFPCA - selectedK <- SelectK(fpcaObj = ret, criterion = optns$methodSelectK, FVEthreshold = optns$FVEthreshold) - - if(!optns$lean){ - ret$inputData <- inputData; - } else { - ret$inputData <- NULL - } - - ret <- append(ret, list(selectK = selectedK$K, criterionValue = selectedK$criterion)) - class(ret) <- 'FPCA' - - ret <- SubsetFPCA(fpcaObj = ret, K = ret$selectK) - - if(is.null(timestamps)) { - timings = NULL; - } else { - timestamps = c(Sys.time(), timestamps) - timings = round(digits=3, timestamps[1:4]-timestamps[5:8]); - names(timings) <- c('total','mu','cov','pace') - } - ret$timings = timings; - - return(ret) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/MakeSparseGP.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/MakeSparseGP.R deleted file mode 100644 index 5e8d40a6..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/MakeSparseGP.R +++ /dev/null @@ -1,105 +0,0 @@ -#' Make Gaussian Process Sparse Functional Data sample -#' -#' Make a Gaussian process sparse functional data sample of size n -#' -#' @param n number of samples to generate. -#' @param rdist a sampler for generating the random design time points within [0, 1]. -#' @param sparsity A vector of integers. The number of observation per sample is chosen to be one of the elements in sparsity with equal chance. -#' @param muFun a function that takes a vector input and output a vector of the corresponding mean (default: zero function). -#' @param K scalar specifying the number of basis to be used (default: 2). -#' @param lambda vector of size K specifying the variance of each components (default: rep(1,K)). -#' @param sigma The standard deviation of the Gaussian noise added to each observation points. -#' @param basisType string specifiying the basis type used; possible options are: 'sin', 'cos' and 'fourier' (default: 'cos') (See code of 'CreateBasis' for implementation details.) -#' @param CovFun an alternative specification of the covariance structure. -#' -#' @return TODO -#' @export - -MakeSparseGP <- function(n, rdist=runif, sparsity=2:9, - muFun=function(x) rep(0, length(x)), - K = 2, lambda = rep(1, K), sigma=0, - basisType='cos', CovFun=NULL) { - - if(n < 2){ - stop("Samples of size 1 are irrelevant.") - } - if(!is.function(rdist)){ - stop("'rdist' needs to be a function.") - } - if(!is.function(muFun)){ - stop("'muFun' needs to be a function.") - } - if (!is.numeric(sigma) || sigma < 0) { - stop("'sigma' needs to be a nonnegative number") - } - if (!is.null(CovFun) && - (!missing(lambda) || !missing(basisType) || !missing(K))) { - stop('Specify the covariance structure either with CovFun or with K, lambda, and basisType') - } - if (missing(K) && !missing(lambda) && is.null(CovFun)) { - K <- length(lambda) - } - if(is.null(CovFun) && K != length(lambda)){ - stop("Make sure you provide 'lambda's for all 'K' modes of variation.") - } - # if( !(basisType %in% c('cos','sin','fourier'))) { - # stop("Make sure you provide a valid parametric basis.") - # } - if (length(sparsity) == 1) { - sparsity <- c(sparsity, sparsity) # avoid scalar case for sample() - } - - Ni <- sample(sparsity, n, replace=TRUE) - if (is.null(CovFun)) { - Ksi <- apply(matrix(rnorm(n*K), ncol=K), 2, scale) %*% - diag(sqrt(lambda), length(lambda)) - - samp <- lapply(seq_len(n), function(i) { - ni <- Ni[i] - ti <- sort(rdist(ni)) - Phii <- CreateBasis(K, ti, basisType) - yi <- muFun(ti) + as.numeric(tcrossprod(Ksi[i, ], Phii)) - - list(ti = ti, yi=yi) - }) - } else { # !is.null(CovFun) - - if (!requireNamespace('MASS', quietly=TRUE)) { - stop('{MASS} is needed if CovFun is specified') - } - - M <- 51 - pts <- seq(0, 1, length.out=M) # For generating the true curves - - samp <- lapply(seq_len(n), function(i) { - ni <- Ni[i] - ti <- sort(rdist(ni)) - ti <- c(ti, pts) - yi <- MASS::mvrnorm(1, muFun(ti), CovFun(ti)) - - list(ti = ti[seq_len(ni)], yi=yi[seq_len(ni)], yCurve=yi[-seq_len(ni)]) - }) - } - - Lt <- lapply(samp, `[[`, 'ti') - Ly <- lapply(samp, `[[`, 'yi') - - - if (sigma > 0) { - LyTrue <- Ly - Ly <- lapply(LyTrue, function(x) x + rnorm(length(x), sd=sigma)) - } - - if (is.null(CovFun)) { - res <- list(Ly=Ly, Lt=Lt, xi=Ksi, Ni=Ni) - } else { - res <- list(Ly=Ly, Lt=Lt, yCurve=lapply(samp, `[[`, 'yCurve'), Ni=Ni) - } - - if (sigma > 0) { - res <- append(res, list(LyTrue=LyTrue)) - } - - return(res) -} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/MapX1D.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/MapX1D.R deleted file mode 100644 index 932d0374..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/MapX1D.R +++ /dev/null @@ -1,35 +0,0 @@ -# Map (x,y) to (newx,newy) -# x : a vector of 1 * n -# y : a vector of 1 * n or a n * p matrix -# newx : vector of 1 * m -# newy : vector of 1 * m or a matrix of m * optns$ - - # if( is.vector(y) ){ - # return(y[is.element(x,newx)]) - # }else if(is.matrix(y)){ - # return(y[is.element(x,newx),]) - # }else{ - # warning('y cannot be empty!\n') - # return(NaN) - # } -# } - -MapX1D <- function(x, y, newx) { - # if (!all(newx %in% x)) - # warning('Interpolation occured: you might want to increase the obsGrid coverage') - - # if (min(newx) + 100 * .Machine$double.eps < min(x) || max(newx) > max(x) + 100 * .Machine$double.eps) - # warning('Extrapolation occured') - if (is.vector(y)){ - # newy <- approxExtrap(x, y, newx, method='linear')$y - newy <- approx(x, y, newx, method='linear')$y - } else { - # newy <- apply(y, 2, function(yy) approxExtrap(x, yy, newx, method='linear')$y) - newy <- apply(y, 2, function(yy) approx(x, yy, newx, method='linear')$y) - } - if (any(is.nan(newy))){ - stop('NA \'s during the mapping from(x,y) to (newx,newy)') - } - - return(newy) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/MgnJntDensity.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/MgnJntDensity.R deleted file mode 100644 index 5ae0407e..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/MgnJntDensity.R +++ /dev/null @@ -1,143 +0,0 @@ -##### -##### marginal and 2-dim. joint kernel densities estimators -##### - -##### input variables: -##### j: index of kernel estimation for marginal density (scalar) -##### kj: index of kernel estimation for 2-dim. joint density (2-dim. vector) -##### x: estimation grid (N*d matrix) -##### X: covariate observation grid (n*d matrix) -##### h: bandwidths (d-dim. vector) -##### K: kernel function (function object, default is the Epanechnikov kernel) -##### supp: supports of estimation interested (d*2 matrix) - -##### output: -##### margianl densities at estimation points near observation points (N*d matrix) -##### 2-dim. joint densities at estimation grid near observation grid (N*N*d*d array) - - -### propertion of non-truncated observation -P0 <- function(X, supp=NULL){ - - n <- nrow(X) - d <- ncol(X) - - if (is.null(supp)==TRUE) { - supp <- matrix(rep(c(0,1),d),ncol=2,byrow=TRUE) - } - - tmp <- rep(1,n) - for(j in 1:d){ - tmp <- tmp*dunif(X[,j],supp[j,1],supp[j,2])*(supp[j,2]-supp[j,1]) - } - - return(mean(tmp)) -} - -# marginal density estimation -Pj <- function(j, x, X, h=NULL, K='epan', supp=NULL){ - - N <- nrow(x) - d <- ncol(x) - n <- nrow(X) - - if (K!='epan') { - message('Epanechnikov kernel is only supported currently. It uses Epanechnikov kernel automatically') - K<-'epan' - } - if (is.null(supp)==TRUE) { - supp <- matrix(rep(c(0,1),d),ncol=2,byrow=TRUE) - } - if (is.null(h)==TRUE) { - h <- rep(0.25*n^(-1/5),d)*(supp[,2]-supp[,1]) - } - - tmpIndex <- rep(1,n) - for(l in 1:d){ - tmpIndex <- tmpIndex*dunif(X[,l],supp[l,1],supp[l,2])*(supp[l,2]-supp[l,1]) - } - index <- which(tmpIndex==1) - pHat <- apply(NormKernel(x[,j],X[,j],h[j],K,c(supp[j,1],supp[j,2]))[,index],1,'sum')/n - - pHat <- pHat/trapzRcpp(sort(x[,j]),pHat[order(x[,j])]) - - return(pHat/P0(X,supp)) -} - -# 2-dimensional joint density estimation -Pkj <- function(kj, x, X, h=NULL, K='epan', supp=NULL){ - - N <- nrow(x) - d <- ncol(x) - n <- nrow(X) - - if (K!='epan') { - message('Epanechnikov kernel is only supported currently. It uses Epanechnikov kernel automatically') - K<-'epan' - } - if (is.null(supp)==TRUE) { - supp <- matrix(rep(c(0,1),d),ncol=2,byrow=TRUE) - } - if (is.null(h)==TRUE) { - h <- rep(0.25*n^(-1/5),d)*(supp[,2]-supp[,1]) - } - - k <- kj[1] - pHatk <- NormKernel(x[,k],X[,k],h[k],K,c(supp[k,1],supp[k,2])) - - j <- kj[2] - pHatj <- NormKernel(x[,j],X[,j],h[j],K,c(supp[j,1],supp[j,2])) - - tmpIndex <- rep(1,n) - for(l in 1:d){ - tmpIndex <- tmpIndex*dunif(X[,l],supp[l,1],supp[l,2])*(supp[l,2]-supp[l,1]) - } - index <- which(tmpIndex==1) - pHat <- pHatk[,index]%*%t(pHatj[,index])/n - - pHat <- pHat/trapzRcpp(sort(x[,j]),Pj(j,x,X,h,K,supp)[order(x[,j])])/trapzRcpp(sort(x[,k]),Pj(k,x,X,h,K,supp)[order(x[,k])]) - - return(pHat/P0(X,supp)) -} - -# construction of evaluation matrices for marginal and joint densities estimators -MgnJntDensity <- function(x, X, h=NULL, K='epan', supp=NULL){ - - N <- nrow(x) - d <- ncol(x) - n <- nrow(X) - - if (K!='epan') { - message('Epanechnikov kernel is only supported currently. It uses Epanechnikov kernel automatically') - K<-'epan' - } - if (is.null(supp)==TRUE) { - supp <- matrix(rep(c(0,1),d),ncol=2,byrow=TRUE) - } - if (is.null(h)==TRUE) { - h <- rep(0.25*n^(-1/5),d)*(supp[,2]-supp[,1]) - } - - pMatMgn <- matrix(0,nrow=N,ncol=d) - pArrJnt <- array(0,dim=c(N,N,d,d)) - #cat(paste('Computing all pairs of 1-/2-dim.l marginal/joint density estimators...','\n',sep='')) - for (j in 1:d) { - #cat(paste(' ',round(j/d,3),'\n',sep='')) - #cat('\n') - pMatMgn[,j] <- Pj(j,x,X,h,K,supp) - - for (k in j:d) { - #print(k) - if (k==j) { - #pArrJnt[,,k,j] <- diag(Pj(j,x,X,h,K,supp)) - pArrJnt[,,k,j] <- diag(pMatMgn[,j]) - } else { - pArrJnt[,,k,j] <- Pkj(c(k,j),x,X,h,K,supp) - pArrJnt[,,j,k] <- t(pArrJnt[,,k,j]) - } - } - } - - return(list(pArrJnt=pArrJnt, pMatMgn=pMatMgn)) -} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/Minb.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/Minb.R deleted file mode 100644 index e9652d26..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/Minb.R +++ /dev/null @@ -1,30 +0,0 @@ -# This function is used to find the minimum bandwidth choice -# where local window contains at least "numPoints" points -# Input x : n x 1 vector -# Input numPoints: an integer specifying the number of points in a local window -# for local weighted constant, numPoints is at least 1 -# for local weighted linear, numPoints is at least 2 -# Output b: the minimum bandwidth choice for vector x - -Minb <- function(x, numPoints){ - - n = length(x); - if( (numPoints<1) || (numPoints > n) ){ - warning("Invalid number of minimum points specified\n") - return(NaN) - } - - if('legacyCode' == TRUE){ - x = sort(unique(x)); # Unique is added to ensure that we do not have a degenerate design - if(numPoints > 1){ - return( max(x[numPoints:n]-x[1:(n-numPoints+1)]) ) - }else{ - return( max( (x[2:n]-x[1:(n-1)])/2) ) - } - } - - gridPts <- sort(unique(x)) - distNN1 <- max(diff(gridPts, lag=numPoints)) - - return(distNN1) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/MultiFAM.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/MultiFAM.R deleted file mode 100644 index 04826741..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/MultiFAM.R +++ /dev/null @@ -1,249 +0,0 @@ -#' Functional Additive Models with Multiple Predictor Processes -#' -#' Smooth backfitting procedure for functional additive models with multiple predictor processes -#' -#' @param Y An \emph{n}-dimensional vector whose elements consist of scalar responses. -#' @param X A \emph{d}-dimensional list whose components consist of two lists of \emph{Ly} and \emph{Lt} containing obervation times and functional covariate values for each predictor component, respectively. For details of \emph{Ly} and \emph{Lt}, see \code{FPCA} for detail. -#' @param ker A \code{function} object representing the base kernel to be used in the smooth backfitting algorithm (default is 'epan' which is the only option supported currently). -#' @param nEval The number of evaluation grid points for kernel smoothing (default is 51. If it is specified as 0, then estimated FPC scores in the training set are used for evaluation grid instead of equal grid). -#' @param XTest A \emph{d}-dimensional list for test set of functional predictors (default is NULL). If \code{XTest} is specified, then estimated FPC scores in the test set are used for evalution grid. -#' @param bwMethod The method of initial bandwidth selection for kernel smoothing, a positive value for designating K-fold cross-validtaion and zero for GCV (default is 0) -#' @param alpha The shrinkage factor (positive number) for bandwidth selection. See Han et al. (2016) (default is 0.7). -#' @param supp The lower and upper limits of kernel smoothing domain for studentized FPC scores, which FPC scores are divided by the square roots of eigenvalues (default is [-2,2]). -#' @param optnsList A \emph{d}-dimensional list whose components consist of \code{optns} for each predictor component, respectively. (default is NULL which assigns the same default \code{optns} for all components as in \code{FPCA}). -#' -#' @details \code{MultiFAM} fits functional additive models for a scalar response and multiple predictor processes based on the smooth backfitting algorithm proposed by Han et al. (2016) that \deqn{E(Y | \mathbf{X}) = \sum_{j=1}^d \sum_{k=1}^{K_j} g_{jk}(\xi_{jk}),} where \eqn{\xi_{jk}} stand for the k-th FPC score of the j-th predictor process. \code{MultiFAM} only focuses on mutiple predictor processes case. In fact, the case of univariate predictor is the same with functional additive model proposed by Mueller and Yao (2008). Especially in this development, one can designate an estimation support of additive models when the additive modeling is only allowed over restricted intervals or one is interested in the modeling over the support (see Han et al., 2016). -#' -#' @return A list containing the following fields: -#' \item{mu}{A scalar of centered part of the regression model.} -#' \item{SBFit}{An \emph{N} by \eqn{(K_1 + ... + K_d)} matrix whose column vectors consist of the smooth backfitting component function estimators at the given \emph{N} estimation points.} -#' \item{xi}{An \emph{N} by \eqn{(K_1 + ... + K_d)} matrix whose column vectors consist of FPC score grid vectors that each additive component functional is evluated.} -#' \item{bw}{A \eqn{(K_1 + ... + K_d)}-dimensional bandwidth vector.} -#' \item{lambda}{A \eqn{(K_1 + ... + K_d)}-dimensional vector containing eigenvalues.} -#' \item{phi}{A \emph{d}-dimensional list whose components consist of an \emph{nWorkGrid} by \emph{K_j} matrix containing eigenfunctions, supported by \code{WorkGrid}. See \code{FPCA}.} -#' \item{workGrid}{A \emph{d}-dimensional list whose components consist of an \emph{nWorkGrid} by \emph{K_j} working grid, the internal regular grid on which the eigen analysis is carried on. See \code{FPCA}.} -#' @examples -#' set.seed(1000) -#' -#' library(MASS) -#' -#' f11 <- function(t) t -#' f12 <- function(t) 2*cos(2*pi*t/4) -#' f21 <- function(t) 1.5*sin(2*pi*t/4) -#' f22 <- function(t) 1.5*atan(2*pi*t/4) -#' -#' n<-100 -#' N<-200 -#' -#' sig <- matrix(c(2.0, 0.0, 0.5, -.2, -#' 0.0, 1.2, -.2, 0.3, -#' 0.5, -.2, 1.7, 0.0, -#' -.2, 0.3, 0.0, 1.0), -#' nrow=4,ncol=4) -#' -#' scoreX <- mvrnorm(n,mu=rep(0,4),Sigma=sig) -#' scoreXTest <- mvrnorm(N,mu=rep(0,4),Sigma=sig) -#' -#' Y <- f11(scoreX[,1]) + f12(scoreX[,2]) + f21(scoreX[,3]) + f22(scoreX[,4]) + rnorm(n,0,0.5) -#' YTest <- f11(scoreXTest[,1]) + f12(scoreXTest[,2]) + -#' f21(scoreXTest[,3]) + f22(scoreXTest[,4]) + rnorm(N,0,0.5) -#' -#' phi11 <- function(t) sqrt(2)*sin(2*pi*t) -#' phi12 <- function(t) sqrt(2)*sin(4*pi*t) -#' phi21 <- function(t) sqrt(2)*cos(2*pi*t) -#' phi22 <- function(t) sqrt(2)*cos(4*pi*t) -#' -#' grid <- seq(0,1,length.out=21) -#' Lt <- Lx1 <- Lx2 <- list() -#' for (i in 1:n) { -#' Lt[[i]] <- grid -#' Lx1[[i]] <- scoreX[i,1]*phi11(grid) + scoreX[i,2]*phi12(grid) + rnorm(1,0,0.01) -#' Lx2[[i]] <- scoreX[i,3]*phi21(grid) + scoreX[i,4]*phi22(grid) + rnorm(1,0,0.01) -#' } -#' -#' LtTest <- Lx1Test <- Lx2Test <- list() -#' for (i in 1:N) { -#' LtTest[[i]] <- grid -#' Lx1Test[[i]] <- scoreXTest[i,1]*phi11(grid) + scoreXTest[i,2]*phi12(grid) + rnorm(1,0,0.01) -#' Lx2Test[[i]] <- scoreXTest[i,3]*phi21(grid) + scoreXTest[i,4]*phi22(grid) + rnorm(1,0,0.01) -#' } -#' -#' X1 <- list(Ly=Lx1, Lt=Lt) -#' X2 <- list(Ly=Lx2, Lt=Lt) -#' -#' X1Test <- list(Ly=Lx1Test, Lt=LtTest) -#' X2Test <- list(Ly=Lx2Test, Lt=LtTest) -#' -#' X <- list(X1, X2) -#' XTest <- list(X1Test, X2Test) -#' -#' # estimation -#' sbf <- MultiFAM(Y=Y,X=X) -#' -#' xi <- sbf$xi -#' -#' par(mfrow=c(2,2)) -#' j <- 1 -#' p0 <- trapzRcpp(sort(xi[,j]),dnorm(sort(xi[,j]),0,sqrt(sig[j,j]))) -#' g11 <- f11(sort(xi[,j])) - -#' trapzRcpp(sort(xi[,j]),f11(sort(xi[,j]))*dnorm(sort(xi[,j]),0,sqrt(sig[j,j])))/p0 -#' tmpSgn <- sign(sum(g11*sbf$SBFit[,j])) -#' plot(sort(xi[,j]),g11,type='l',col=2,ylim=c(-2.5,2.5),xlab='xi11') -#' points(sort(xi[,j]),tmpSgn*sbf$SBFit[order(xi[,j]),j],type='l') -#' legend('top',c('true','SBF'),col=c(2,1),lwd=2,bty='n',horiz=TRUE) -#' -#' j <- 2 -#' p0 <- trapzRcpp(sort(xi[,j]),dnorm(sort(xi[,j]),0,sqrt(sig[j,j]))) -#' g12 <- f12(sort(xi[,j])) - -#' trapzRcpp(sort(xi[,j]),f12(sort(xi[,j]))*dnorm(sort(xi[,j]),0,sqrt(sig[j,j])))/p0 -#' tmpSgn <- sign(sum(g12*sbf$SBFit[,j])) -#' plot(sort(xi[,j]),g12,type='l',col=2,ylim=c(-2.5,2.5),xlab='xi12') -#' points(sort(xi[,j]),tmpSgn*sbf$SBFit[order(xi[,j]),j],type='l') -#' legend('top',c('true','SBF'),col=c(2,1),lwd=2,bty='n',horiz=TRUE) -#' -#' j <- 3 -#' p0 <- trapzRcpp(sort(xi[,j]),dnorm(sort(xi[,j]),0,sqrt(sig[j,j]))) -#' g21 <- f21(sort(xi[,j])) - -#' trapzRcpp(sort(xi[,j]),f21(sort(xi[,j]))*dnorm(sort(xi[,j]),0,sqrt(sig[j,j])))/p0 -#' tmpSgn <- sign(sum(g21*sbf$SBFit[,j])) -#' plot(sort(xi[,j]),g21,type='l',col=2,ylim=c(-2.5,2.5),xlab='xi21') -#' points(sort(xi[,j]),tmpSgn*sbf$SBFit[order(xi[,j]),j],type='l') -#' legend('top',c('true','SBF'),col=c(2,1),lwd=2,bty='n',horiz=TRUE) -#' -#' j <- 4 -#' p0 <- trapzRcpp(sort(xi[,j]),dnorm(sort(xi[,j]),0,sqrt(sig[j,j]))) -#' g22 <- f22(sort(xi[,j])) - -#' trapzRcpp(sort(xi[,j]),f22(sort(xi[,j]))*dnorm(sort(xi[,j]),0,sqrt(sig[j,j])))/p0 -#' tmpSgn <- sign(sum(g22*sbf$SBFit[,j])) -#' plot(sort(xi[,j]),g22,type='l',col=2,ylim=c(-2.5,2.5),xlab='xi22') -#' points(sort(xi[,j]),tmpSgn*sbf$SBFit[order(xi[,j]),j],type='l') -#' legend('top',c('true','SBF'),col=c(2,1),lwd=2,bty='n',horiz=TRUE) -#' -#' \dontrun{ -#' # fitting -#' sbf <- MultiFAM(Y=Y,X=X,nEval=0) -#' yHat <- sbf$mu+apply(sbf$SBFit,1,'sum') -#' par(mfrow=c(1,1)) -#' plot(yHat,Y) -#' abline(coef=c(0,1),col=2) -#' -#' -#' # R^2 -#' R2 <- 1-sum((Y-yHat)^2)/sum((Y-mean(Y))^2) -#' R2 -#' -#' -#' # prediction -#' sbf <- MultiFAM(Y=Y,X=X,XTest=XTest) -#' yHat <- sbf$mu+apply(sbf$SBFit,1,'sum') -#' par(mfrow=c(1,1)) -#' plot(yHat,YTest) -#' abline(coef=c(0,1),col=2) -#' } -#' @references -#' \cite{Mammen, E., Linton, O. and Nielsen, J. (1999), "The existence and asymptotic properties of a backfitting projection algorithm under weak conditions", Annals of Statistics, Vol.27, No.5, p.1443-1490.} -#' -#' \cite{Mammen, E. and Park, B. U. (2006), "A simple smooth backfitting method for additive models", Annals of Statistics, Vol.34, No.5, p.2252-2271.} -#' -#' \cite{Mueller, H.-G. and Yao, F. (2008), "Functional additive models", Journal of the Americal Statistical Association, Vol.103, No.484, p.1534-1544.} -#' -#' \cite{Han, K., Mueller, H.-G. and Park, B. U. (2016), "Smooth backfitting for additive modeling with small errors-in-variables, with an application to additive functional regression for multiple predictor functions", Bernoulli (accepted).} -#' @export - -MultiFAM <- function(Y,X,ker='epan',nEval=51,XTest=NULL,bwMethod=0,alpha=0.7,supp=c(-2,2),optnsList=NULL){ - - n <- length(Y) - d0 <- length(X) - - if (is.null(optnsList)==TRUE) { - for (j in 1:d0) { - optnsList[[j]] <- list() - } - } - - if (length(optnsList)==1) { - - for (j in 1:d0) { - optnsList <- rep(optnsList,d0) - } - } - - N <- c() - dj <- c() - XiStd <- xiStdGrid <- c() - estLambda <- c() - estEigen <- list() - workGrid <- list() - for (j in 1:d0) { - tmpLy <- X[[j]]$Ly - tmpLt <- X[[j]]$Lt - - tmpFPCA <- FPCA(tmpLy, tmpLt, optns = optnsList[j]) - - XijStd <- t(t(tmpFPCA$xiEst)/sqrt(tmpFPCA$lambda)) - dj[j] <- length(tmpFPCA$lambda) - - estLambda <- c(estLambda,tmpFPCA$lambda) - - estEigen[[j]] <- tmpFPCA$phi - workGrid[[j]] <- tmpFPCA$workGrid - - XiStd <- cbind(XiStd,XijStd) - - if (is.null(XTest)==TRUE) { - - if (nEval==0) { - N <- nrow(XiStd) - xiStdGrid <- XiStd - } else { - N <- nEval - xiStdGrid <- cbind(xiStdGrid,matrix(rep(seq(supp[1],supp[2],length.out=N),dj[j]),nrow=N,ncol=dj[j])) - } - - } else { - XijStdTest <- predict.FPCA(tmpFPCA,newLy=XTest[[j]]$Ly,newLt=XTest[[j]]$Lt,K=dj[j])%*%diag(1/sqrt(tmpFPCA$lambda)) - - N <- nrow(XijStdTest) - xiStdGrid <- cbind(xiStdGrid,XijStdTest) - } - - } - d <- sum(dj) - - if (d > n) { - stop('Too many FPC scores in the model. Try first two FPC scores by imposing optnsList=list(maxK=2)') - } - - if (ker!='epan') { - stop('Epanechnikov kernel is only supported currently. It uses Epanechnikov kernel automatically') - } - - h <- c() - for (j in 1:d) { - if (bwMethod>0) { - options(warn = -1) - h0 <- CVLwls1D(y=Y,t=XiStd[,j],kernel='epan',npoly=0,nder=0,dataType='Sparse',kFolds=bwMethod) - options(warn = 0) - } else { - options(warn = -1) - h0 <- GCVLwls1D1(yy=Y,tt=XiStd[,j],kernel='epan',npoly=0,nder=0,dataType='Sparse')$bOpt - options(warn = 0) - } - h[j] <- alpha*h0 - } - - supp <- matrix(rep(supp,c(d,d)),nrow=d,ncol=2) - - sbf <- SBFitting(Y,xiStdGrid,XiStd,h,K=ker,supp=supp) - - xiGrid <- xiStdGrid%*%diag(sqrt(estLambda)) - bw <- h*sqrt(estLambda) - phi <- estEigen - - sbf <- list(mu=sbf$mY,SBFit=sbf$SBFit,xi=xiGrid,bw=bw,lambda=estLambda,phi=phi,workGrid=workGrid) - - return(sbf) - -} - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/NWMgnReg.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/NWMgnReg.R deleted file mode 100644 index b7848dc1..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/NWMgnReg.R +++ /dev/null @@ -1,55 +0,0 @@ -##### -##### Nadaraya-Watson marginal regression estimation -##### - -##### input variables: -##### Y: response observation points (n-dim. vector) -##### kj: index of conditional projection for the k-th component function on the j-th component function space (2-dim. vector) -##### x: estimation grid (N*d matrix) -##### X: covariate observation grid (n*d matrix) -##### h: bandwidths (d-dim. vector) -##### K: kernel function (function object, default is the Epanechnikov kernel) -##### supp: supports of estimation interested (d*2 matrix) - -##### output: -##### NW marginal regression function kernel estimators at each estimation points (N*d matrix) - -NWMgnReg <- function(Y, x, X, h=NULL, K='epan', supp=NULL){ - - N <- nrow(x) - d <- ncol(x) - n <- nrow(X) - - if (K!='epan') { - message('Epanechnikov kernel is only supported currently. It uses Epanechnikov kernel automatically') - K<-'epan' - } - if (is.null(supp)==TRUE) { - supp <- matrix(rep(c(0,1),d),ncol=2,byrow=TRUE) - } - if (is.null(h)==TRUE) { - h <- rep(0.25*n^(-1/5),d)*(supp[,2]-supp[,1]) - } - - fNW <- matrix(0,nrow=N,ncol=d) - - tmpIndex <- rep(1,n) - for (j in 1:d) { - tmpIndex <- tmpIndex*dunif(X[,j],supp[j,1],supp[j,2])*(supp[j,2]-supp[j,1]) - } - tmpIndex <- which(tmpIndex==1) - - for (j in 1:d) { - pHatj <- NormKernel(x[,j],X[,j],h[j],K,c(supp[j,1],supp[j,2])) - rHatj <- c(pHatj[,tmpIndex]%*%Y[tmpIndex])/length(Y) - - pHatj <- apply(pHatj[,tmpIndex],1,'sum')/length(Y) - - tmpInd <- which(pHatj!=0) - - fNW[tmpInd,j] <- rHatj[tmpInd]/pHatj[tmpInd] - } - - return(fNW) -} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/NormCurveToArea.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/NormCurveToArea.R deleted file mode 100644 index b5fbc346..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/NormCurveToArea.R +++ /dev/null @@ -1,23 +0,0 @@ -#' Normalise a curve to a particular area. -#' -#' Normalise a curve such that \\int{yNew}dx = area (according to trapezoid integration) -#' -#' @param y values of curve at time-points x -#' @param x design time-points (default: seq(0,1, length.out=length(y))) -#' @param area value to normalise the curve onto (default: 1) -#' -#' @return yNew values of curve at times x such that [\\int{yNew}dx = area] -#' @export - -NormCurvToArea <- function(y, x = seq(0, 1, length.out = length(y)), area = 1){ - - if( length(x) != length(y)){ - stop("'x' and 'y' must have the same length.") - } - if( length(y) < 2 ){ - stop("No area is defined for a single measurement.") - } - yNew = area * y / trapzRcpp(X = x, Y = y); - return(yNew) -} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/NormKernel.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/NormKernel.R deleted file mode 100644 index cb4c9af0..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/NormKernel.R +++ /dev/null @@ -1,56 +0,0 @@ -##### -##### normalization of compactly supported kernel (Mammen et al., 1999) -##### - -##### input variables -##### x: estimation points (N-dim. vector) -##### X: covariate observation points (n-dim. vector) -##### h: bandwidth (scalar) -##### K: kernel function (function object, default is the Epanechnikov kernel) -##### supp: support of stimation interested (2-dim. vector, default is a closed interval [0,1]) - -##### output variable: -##### evaluated values of normalized kernel at estimation points near observation points (N by n matrix) - - - -### normalized kernel -NormKernel <- function(x, X, h=NULL, K='epan', supp=NULL){ - - N <- length(x) - n <- length(X) - - if (K!='epan') { - message('Epanechnikov kernel is only supported currently. It uses Epanechnikov kernel automatically') - K<-'epan' - } - if (is.null(supp)==TRUE) { - supp <- c(0,1) - } - if (is.null(h)==TRUE) { - h <- 0.25*n^(-1/5)*(supp[2]-supp[1]) - } - - numer <- ScaleKernel(x,X,h,K=K,supp=supp) - - ind1 <- which(dunif(X,supp[1],supp[2])==0) - numer[,ind1] <- 0 - - denom <- c() - for (i in 1:n) { - denom[i] <- trapzRcpp(sort(x),numer[order(x),i]) - } - #denom <- apply(numer[x_order,],2,FUN='trapzRcpp',X=sort(x)) - - ind2 <- which(denom==0) - - NormKernelTmp <- numer/matrix(rep(denom,N),nrow=N,byrow=TRUE) - NormKernelTmp[,ind2] <- 0 - - if (min(nrow(NormKernelTmp),ncol(NormKernelTmp))==1) { - return(c(NormKernelTmp)) - } else { - return(NormKernelTmp) - } -} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/PC_CovE.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/PC_CovE.R deleted file mode 100644 index 29e72631..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/PC_CovE.R +++ /dev/null @@ -1,83 +0,0 @@ -# This function outputs the smoothed covariance function -# along the diagonal with and without measurement error, -# together with the estimated variance of measurement error - -###### -# Input: -###### -# obsGrid: vector of all observed time/measurement points in increasing order -# regGrid: vector of output time-point-grid -# bw_userCov: 2-d vector, bandwidths along 2 directions for covariance surface smoothing -# rotationCut: 2-element vector in [0,1] indicating the percent of data truncated during -# sigma^2 estimation (default c(1/4,3/4)) -# kernel: kernel function used for 2d smoothing, default is 'epan' -# rcov: a struct/list from function GetRawCov - -###### -# Output: a list/struct of -###### -# sigma2: estimated variance of measurement error -# xvar: smoothed cov along diagonal without measurement error -# yvar: smoothed cov along diagonal with measurement error - -PC_CovE = function(obsGrid, regGrid, bw_userCov, rotationCut=c(0, 1), kernel = 'epan', rcov){ - buff <- .Machine$double.eps * max(abs(obsGrid)) * 10 - a0 = min(obsGrid) - b0 = max(obsGrid) - lint = b0 - a0 - - rcutprop = rotationCut[2] - rotationCut[1] - if(rcutprop <= 0 || rcutprop > 1){ - warning("Invalid option: rotationCut.") - } - rcutGrid = regGrid[regGrid > a0 + lint * rotationCut[1] - buff & - regGrid < a0 + lint * rotationCut[2] + buff] - - tPairs = rcov$tPairs # time points pairs for raw covariance - rcovdiag = rcov$diag # get raw covariance along diagonal direction - - # get smoothed covariance surface for x(t) using Lwls2D - - cxxn = rcov$cxxn # off-diagonal terms - - if(length(rcov$count) != 0 && class(rcov)[1] != 'BinnedRawCov'){ - # for dataType="RegularwithMV" case, the raw covariance - # matrix needs to be divided by the number of - # individual sums for each element in the matrix. - # for dataType="Dense" case, the divider is n for - # each subject. - cxxn = cxxn / rcov$count - } - - if (class(rcov)[1] == 'BinnedRawCov') - win1 <- rcov$count - else - win1 = rep(1, length(cxxn)) - - # get smoothed variance function for y(t) (observed) using Lwls1D - if (class(rcov)[1] == 'BinnedRawCov') { - rcovdiag <- cbind(rcov$tDiag, rcov$diagMeans) - win2 <- rcov$diagCount - cxxn <- rcov$meanVals - } else - win2 = rep(1, nrow(rcovdiag)) - - # yvar is the smoothed variance function along the diagonal line - # yvar = Lwls1D(bw = bw_userCov[1], kern = kernel, xin = rcovdiag[,1], - # yin = rcovdiag[,2], win = win2, xout = rcutGrid, returnFit = FALSE) - xorder = order(rcovdiag[,1]); - yvar = Lwls1D(bw = bw_userCov[1], kernel_type = kernel, xin = rcovdiag[xorder,1], - yin = rcovdiag[xorder,2], win = win2, xout = rcutGrid) - - - - - # Estimate variance of measurement error term - # use quadratic form on diagonal to estimate Var(x(t)) - # xvar = RotateLwls2DV2(bw = bw_userCov[1], kern = kernel, xin = tPairs, yin = cxxn, win = win1, xout = cbind(rcutGrid, out22)) - xvar = RotateLwls2DV2(bw = bw_userCov[1], kern = kernel, xin = tPairs, yin = cxxn, win = win1, xout = rcutGrid) - sigma2 = trapzRcpp(rcutGrid, (yvar - xvar)) / (lint * rcutprop) - - - return(list('sigma2' = sigma2, 'xvar' = xvar, 'yvar' = yvar)) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/RcppExports.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/RcppExports.R deleted file mode 100644 index f6310050..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/RcppExports.R +++ /dev/null @@ -1,83 +0,0 @@ -# Generated by using Rcpp::compileAttributes() -> do not edit by hand -# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 - -CPPlwls1d <- function(bw, kernel_type, win, xin, yin, xout, npoly = 1L, nder = 0L) { - .Call('_fdapace_CPPlwls1d', PACKAGE = 'fdapace', bw, kernel_type, win, xin, yin, xout, npoly, nder) -} - -GetIndCEScoresCPP <- function(yVec, muVec, lamVec, phiMat, SigmaYi) { - .Call('_fdapace_GetIndCEScoresCPP', PACKAGE = 'fdapace', yVec, muVec, lamVec, phiMat, SigmaYi) -} - -GetIndCEScoresCPPnewInd <- function(yVec, muVec, lamVec, phiMat, SigmaYi, newPhi, newMu) { - .Call('_fdapace_GetIndCEScoresCPPnewInd', PACKAGE = 'fdapace', yVec, muVec, lamVec, phiMat, SigmaYi, newPhi, newMu) -} - -RCPPmean <- function(X) { - .Call('_fdapace_RCPPmean', PACKAGE = 'fdapace', X) -} - -RCPPvar <- function(X) { - .Call('_fdapace_RCPPvar', PACKAGE = 'fdapace', X) -} - -RcppPseudoApprox <- function(X, Y, X_target) { - .Call('_fdapace_RcppPseudoApprox', PACKAGE = 'fdapace', X, Y, X_target) -} - -Rcppsort <- function(v) { - .Call('_fdapace_Rcppsort', PACKAGE = 'fdapace', v) -} - -Rmullwlsk <- function(bw, kernel_type, tPairs, cxxn, win, xgrid, ygrid, bwCheck, transp = TRUE) { - .Call('_fdapace_Rmullwlsk', PACKAGE = 'fdapace', bw, kernel_type, tPairs, cxxn, win, xgrid, ygrid, bwCheck, transp) -} - -RmullwlskCC <- function(bw, kernel_type, tPairs, cxxn, win, xgrid, ygrid, bwCheck) { - .Call('_fdapace_RmullwlskCC', PACKAGE = 'fdapace', bw, kernel_type, tPairs, cxxn, win, xgrid, ygrid, bwCheck) -} - -RmullwlskCCsort2 <- function(bw, kernel_type, tPairs, cxxn, win, xgrid, ygrid, bwCheck) { - .Call('_fdapace_RmullwlskCCsort2', PACKAGE = 'fdapace', bw, kernel_type, tPairs, cxxn, win, xgrid, ygrid, bwCheck) -} - -RmullwlskUniversal <- function(bw, kernel_type, tPairs, cxxn, win, xgrid, ygrid, bwCheck, autoCov) { - .Call('_fdapace_RmullwlskUniversal', PACKAGE = 'fdapace', bw, kernel_type, tPairs, cxxn, win, xgrid, ygrid, bwCheck, autoCov) -} - -RmullwlskUniversalDeriv <- function(bw, kernel_type, tPairs, cxxn, win, xgrid, ygrid, npoly, nder1, nder2, bwCheck, autoCov) { - .Call('_fdapace_RmullwlskUniversalDeriv', PACKAGE = 'fdapace', bw, kernel_type, tPairs, cxxn, win, xgrid, ygrid, npoly, nder1, nder2, bwCheck, autoCov) -} - -Rrotatedmullwlsk <- function(bw, kernel_type, tPairs, cxxn, win, xygrid, npoly, bwCheck) { - .Call('_fdapace_Rrotatedmullwlsk', PACKAGE = 'fdapace', bw, kernel_type, tPairs, cxxn, win, xygrid, npoly, bwCheck) -} - -#' Cumulative Trapezoid Rule Numerical Integration -#' -#' Cumulative Trapezoid Rule Numerical Integration using Rcpp -#' @param X Sorted vector of X values -#' @param Y Vector of Y values. -#' @export -cumtrapzRcpp <- function(X, Y) { - .Call('_fdapace_cumtrapzRcpp', PACKAGE = 'fdapace', X, Y) -} - -dropZeroElementsXYWin <- function(win, xin, yin) { - .Call('_fdapace_dropZeroElementsXYWin', PACKAGE = 'fdapace', win, xin, yin) -} - -interp2lin <- function(xin, yin, zin, xou, you) { - .Call('_fdapace_interp2lin', PACKAGE = 'fdapace', xin, yin, zin, xou, you) -} - -#' Trapezoid Rule Numerical Integration -#' -#' Trapezoid Rule Numerical Integration using Rcpp -#' @param X Sorted vector of X values -#' @param Y Vector of Y values. -#' @export -trapzRcpp <- function(X, Y) { - .Call('_fdapace_trapzRcpp', PACKAGE = 'fdapace', X, Y) -} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/RotateLwls2DV2.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/RotateLwls2DV2.R deleted file mode 100644 index 352b76ed..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/RotateLwls2DV2.R +++ /dev/null @@ -1,24 +0,0 @@ -# Rotate the data and then smooth the diagonal elements. We use quadratic terms on either direction, rather than only orthogonal to the diagonal. -# xout: a matrix of two columns containing the diagonal elements. - -RotateLwls2DV2 <- function(bw, kern='epan', xin, yin, win=NULL, xout) { - - if (length(bw) == 1){ - bw <- c(bw, bw) - } - - if (missing(win) || is.null(win)){ - win <- rep(1, length(xin)) - } - - if ( is.vector(xout)){ - xout = matrix(c(xout,xout),ncol= 2) - } - - fit <- Rrotatedmullwlsk(bw, kern, t(xin), yin, win, t(xout), npoly=1, bwCheck=FALSE) - - if (any(is.nan(fit))) - stop('Something wrong with the rotate smoothed results') - - return(fit) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/SBFCompUpdate.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/SBFCompUpdate.R deleted file mode 100644 index 3a3bc7b6..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/SBFCompUpdate.R +++ /dev/null @@ -1,78 +0,0 @@ -##### -##### smooth backfitting for a component function -##### - -##### input variables: -##### f: current SBF estimator of component functions at each estimation points (N*d matrix) -##### ind: index of updating component during SBF algorithm (scalar) -##### fNW: marginal regression function kernel estimators at each estimation points (N*d matrix) -##### Y: response observation points (n-dim. vector) -##### x: estimation grid (N*d matrix) -##### X: covariate observation grid (n*d matrix) -##### h: bandwidths (d-dim. vector) -##### K: kernel function (function object, default is the Epanechnikov kernel) -##### supp: supports of estimation interested (d*2 matrix) -##### MgnJntDensity: evaluated values of marginal and 2-dim. joint densities (2-dim. list, referred to the output of 'MgnJntDensity') - -##### output: -##### updated smooth backfitting component functions for a designated component (N*d matrix) - -SBFCompUpdate<-function(f,ind,fNW,Y,X,x,h=NULL,K='epan',supp=NULL,MgnJntDens){ - - N<-nrow(x) - d<-ncol(x) - n<-nrow(X) - - if (K!='epan') { - message('Epanechnikov kernel is only supported currently. It uses Epanechnikov kernel automatically') - K<-'epan' - } - if (is.null(supp)==TRUE) { - supp <- matrix(rep(c(0,1),d),ncol=2,byrow=TRUE) - } - if (is.null(h)==TRUE) { - h <- rep(0.25*n^(-1/5),d)*(supp[,2]-supp[,1]) - } - - #f_nw<-NWMgnReg(Y,x,X,h,Kh,supp) - - #tmp <- X >= matrix(supp[, 1], nrow=n, byrow=TRUE) & X <= matrix(supp[, 2], nrow=n, byrow=TRUE) - # tmp_ind <- apply(tmp, 1, all) - - tmpIndex <- rep(1,n) - for (l in 1:d) { - tmpIndex <- tmpIndex*dunif(X[,l],supp[l,1],supp[l,2])*(supp[l,2]-supp[l,1]) - } - tmpIndex <- which(tmpIndex==1) - - yMean <- sum(Y[tmpIndex])/length(Y)/P0(X,supp) - - j <- ind - - tmp1<-tmp2<-0 - if (j==1) { - for (k in (j+1):d) { - tmp2 <- tmp2+CondProjection(f,c(k,j),x,X,MgnJntDens) - } - - f[,j]<-fNW[,j]-yMean-tmp2 - } else if (j>1 && jcritEps) { - - epsTmp <- eps - f0 <- f - - for (j in 1:d) { - f[,j] <- SBFCompUpdate(f,j,fNW,Y,X,x,h,K,supp,MgnJntDens)[,j] - - if (sum(is.nan(f[,j])==TRUE)>0) { - f[which(is.nan(f[,j])==TRUE),j] <- 0 - } - - - if (sum(f[,j]*f0[,j])<0) { - f[,j] <- -f[,j] - } - } - - #eps <- max(abs(f-f0)) - eps <- max(sqrt(apply(abs(f-f0)^2,2,'mean'))) - - if (abs(epsTmp-eps)critIter) { - message('The algorithm may not converge (SBF iteration > stopping criterion). Try another choice of bandwidths.') - return(list( - SBFit=f, - mY=yMean, - NW=fNW, - mgnDens=MgnJntDens$pMatMgn, - jntDens=MgnJntDens$pArrJnt, - iterNum=iter, - iterErr=eps, - iterErrDiff=abs(epsTmp-eps), - critNum=critIter, - critErr=critEps, - critErrDiff=critEpsDiff - ) - ) - } - - iter <- iter+1 - } - - return(list( - SBFit=f, - mY=yMean, - NW=fNW, - mgnDens=MgnJntDens$pMatMgn, - jntDens=MgnJntDens$pArrJnt, - iterNum=iter, - iterErr=eps, - iterErrDiff=abs(epsTmp-eps), - critNum=critIter, - critErr=critEps, - critErrDiff=critEpsDiff - ) - ) - -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/ScaleKernel.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/ScaleKernel.R deleted file mode 100644 index 35ac84a0..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/ScaleKernel.R +++ /dev/null @@ -1,40 +0,0 @@ -##### -##### scaling of compactly supported kernel -##### - -##### input variables -##### x: estimation points (N-dim. vector) -##### X: covariate observation points (n-dim. vector) -##### h: bandwidth (scalar) -##### K: kernel function (function object, default is the Epanechnikov kernel) -##### supp: support of stimation interested (2-dim. vector, default is a closed interval [0,1]) - -##### output variable: -##### evaluated values of scaled kernel at estimation points near observation points (N by n matrix) - - -### scaled kernel -ScaleKernel <- function(x, X, h=NULL, K='epan',supp=NULL){ - - N <- length(x) - n <- length(X) - - if (K!='epan') { - message('Epanechnikov kernel is only supported currently. It uses Epanechnikov kernel automatically') - } - if (is.null(supp)==TRUE) { - supp <- c(0,1) - } - if (is.null(h)==TRUE) { - h <- 0.25*n^(-1/5)*(supp[2]-supp[1]) - } - - xTmp <- matrix(rep(x,n),nrow=N) - XTmp <- matrix(rep(X,N),ncol=n,byrow=TRUE) - - Tmp <- xTmp-XTmp - - KhTmp <- (3/4)*(1-(Tmp/h)^2)*dunif(Tmp/h,-1,1)*2/h - - return(KhTmp) -} \ No newline at end of file diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/SelectK.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/SelectK.R deleted file mode 100644 index db1eb1e9..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/SelectK.R +++ /dev/null @@ -1,87 +0,0 @@ -#' Selects number of functional principal components for -#' given FPCA output and selection criteria -#' -#' @param fpcaObj A list containing FPCA related subjects returned by MakeFPCAResults(). -#' @param criterion A string or positive integer specifying selection criterion for number of functional principal components, available options: 'FVE', 'AIC', 'BIC', or the specified number of components - default: 'FVE' -#' @param FVEthreshold A threshold percentage specified by user when using "FVE" as selection criterion: (0,1] - default: NULL -#' @param Ly A list of \emph{n} vectors containing the observed values for each individual - default: NULL -#' @param Lt A list of \emph{n} vectors containing the observation time points for each individual corresponding to Ly - default: NULL -#' -#' @return A list including the following two fields: -#' \item{K}{An integer indicating the selected number of components based on given criterion.} -#' \item{criterion}{The calculated criterion value for the selected number of components, i.e. FVE, AIC or BIC value, NULL for fixedK criterion.} -#' -#' @export - -SelectK = function(fpcaObj, criterion = 'FVE', FVEthreshold = 0.95, Ly = NULL, Lt = NULL){ - if(!'FPCA' %in% class(fpcaObj)) { - stop('Invalid Input: not a FPCA object!') - } - if(is.null(criterion)){ - stop('Invalid selection criterion. Selection criterion must not be NULL!') - } - if (length(criterion) != 1) { - stop('The length of criterion needs to be 1') - } - if(!(criterion %in% c('FVE', 'AIC', 'BIC'))){ - if(is.numeric(criterion)){ - if(as.integer(criterion) != criterion || criterion <= 0){ - stop('Invalid selection criterion. To select fixed number of component, criterion needs to be a positive integer.') - } - } else { - stop('Invalid selection criterion. Need to be one of "FVE", "AIC", "BIC" or a positive integer!') - } - } - - if(criterion %in% c('AIC','BIC')) { - if(fpcaObj$optns$lean == TRUE && (is.null(Ly) || is.null(Lt))){ - stop("Option lean is TRUE, need input data Ly and measurement time list Lt to calculate log-likelihood.") - } - if(fpcaObj$optns$lean == FALSE){ - Ly <- fpcaObj$inputData$Ly - Lt <- fpcaObj$inputData$Lt - } - C = ifelse( criterion == 'AIC' , 2 , log(length(Ly)) ) - # FVE is not the selection criterion - IC = rep(Inf, length(fpcaObj$lambda)) - for(i in 1:length(fpcaObj$lambda)){ - logliktemp = GetLogLik(fpcaObj, i, Ly = Ly, Lt = Lt) - if(is.null(logliktemp)){ - stop('The covariance matrix of the estimated function is nearly singular! AIC or BIC is not applicable.') - } - IC[i] = logliktemp + C * i - if(i > 1 && IC[i] > IC[i-1]){ - # cease whenever AIC/BIC stops decreasing - K <- i-1; - criterion <- IC[i-1]; - break; - } else if(i == length(fpcaObj$lambda)){ - K <- i - criterion <- IC[i] - } - } - #if(criterion != 'FVE'){ - # return(K = length(fpcaObj$lambda)) - #} - } else if(criterion == 'FVE'){ - # select FVE based on cumFVE in fpcaObj and specified FVEthreshold - if(is.null(FVEthreshold)){stop('Need to specify FVEthreshold to choose number of components via FVE.')} - cumFVE = fpcaObj$cumFVE - buff <- .Machine[['double.eps']] * 100 - K <- min( which(cumFVE > FVEthreshold * 100 - buff) ) - criterion <- cumFVE[min(which(cumFVE > FVEthreshold * 100 - buff))] - } else if (is.numeric(criterion) && criterion > 0) { # fixed K is specified. - if(criterion > length(fpcaObj$lambda)){ - stop("Specified number of components is more than available components.") - } - K <- criterion - criterion <- NULL - } else { - stop('Unknown criterion!') - } - - # For compatibility reason, k is also returned. - # return(list(K=K, criterion=criterion, k=K)) - return(list(K=K, criterion=criterion)) - -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/SetDerOptions.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/SetDerOptions.R deleted file mode 100644 index 8e9362ae..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/SetDerOptions.R +++ /dev/null @@ -1,31 +0,0 @@ -SetDerOptions <- function(fpcaObject = NULL, derOptns = list()) { - if (is.null(derOptns)) { - derOptns <- list() - } - # These are relevant for fitted.FPCA - derOptns$method <- ifelse (is.null(derOptns$method), 'FPC', - derOptns$method) - #derOptns$k <- ifelse (is.null(derOptns$k), length(fpcaObject$lambda), derOptns$k) - # derOptns$GCV <- ifelse (is.null(derOptns$GCV), FALSE, TRUE) - - derOptns$p <- ifelse (is.null(derOptns$p), 1, derOptns$p) - derOptns$kernelType <- ifelse(is.null(derOptns$kernelType), 'gauss', - derOptns$kernelType) - if (is.null(derOptns$bwMu) && is.null(derOptns$bwCov)) { - if (is.null(derOptns$bw)) { - derOptns$bw <- - if (!is.null(fpcaObject[['sigma2']]) && (fpcaObject$sigma2 / sum(fpcaObject$lambda)) >= 0.01) { - derOptns$p * 0.10 * diff(range(fpcaObject$workGrid)) - } else { - derOptns$p * 0.05 * diff(range(fpcaObject$workGrid)) - } - } - derOptns$bwCov <- derOptns$bwMu <- derOptns$bw - } else if (!is.null(derOptns$bwMu) && !is.null(derOptns$bwCov)) { - # OK - } else { - stop('need to specify neither or both bwMu and bwCov') - } - - return(derOptns) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/SetOptions.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/SetOptions.R deleted file mode 100644 index 354d62a8..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/SetOptions.R +++ /dev/null @@ -1,262 +0,0 @@ -#' Set the PCA option list -#' -#' @param y A list of \emph{n} vectors containing the observed values for each individual. -#' @param t A list of \emph{n} vectors containing the observation time points for each individual corresponding to y. -#' @param optns A list of options control parameters specified by \code{list(name=value)}. See `Details'. -#' -#' See '?FPCAfor more details. Usually users are not supposed to use this function directly. -#' @export - - -SetOptions = function(y, t, optns){ - - methodMuCovEst = optns[['methodMuCovEst']] - userBwMu =optns[['userBwMu']]; - methodBwMu =optns[['methodBwMu']]; - userBwCov =optns[['userBwCov']]; - methodBwCov =optns[['methodBwCov']]; - kFoldMuCov = optns[['kFoldMuCov']] - methodSelectK =optns[['methodSelectK']]; - FVEthreshold =optns[['FVEthreshold']]; - fitEigenValues <- optns[['fitEigenValues']]; - maxK =optns[['maxK']]; - dataType =optns[['dataType']]; - error =optns[['error']]; - nRegGrid =optns[['nRegGrid']]; - methodXi =optns[['methodXi']]; - shrink =optns[['shrink']] - kernel =optns[['kernel']]; - numBins =optns[['numBins']]; - yname =optns[['yname']]; - rho =optns[['rho']]; - userRho = optns[['userRho']]; - diagnosticsPlot =optns[['diagnosticsPlot']]; - plot =optns[['plot']] - if (!is.null(diagnosticsPlot)) { - warning("The option 'diagnosticsPlot' is deprecated. Use 'plot' instead") - plot = diagnosticsPlot - } - verbose =optns[['verbose']]; - userMu =optns[['userMu']]; - #methodMu =optns[['methodMu']]; - outPercent =optns[['outPercent']]; - userCov =optns[['userCov']]; - userSigma2 = optns[['userSigma2']] - rotationCut =optns[['rotationCut']]; - useBinnedData =optns[['useBinnedData']]; - useBinnedCov = optns[['useBinnedCov']] - lean = optns[['lean']] - useBW1SE =optns[['useBW1SE']]; - - if(is.null(methodBwMu)){ # bandwidth choice for mean function is GCV if userBwMu = 0 - #methodBwMu = 'GMeanAndGCV'; - methodBwMu = 'Default' - } - if(is.null(userBwMu) && methodBwMu == 'Default'){ # bandwidth choice for mean function is using CV or GCV - userBwMu = 0.05 * diff(range(unlist(t))); - } - if(is.null(userBwMu) && methodBwMu != 'Default'){ - userBwMu = 0.0; - } - if(is.null(methodBwCov)){ # bandwidth choice for covariance function is GCV if userBwCov = c(0,0) - #methodBwCov = 'GMeanAndGCV'; - methodBwCov = 'Default'; - } - if(is.null(userBwCov) && methodBwCov == 'Default'){ # bandwidth choice for covariance function is CV or GCV - userBwCov = 0.10 * diff(range(unlist(t))); - } - if(is.null(userBwCov) && methodBwCov != 'Default'){ - userBwCov = 0.0; - } - #if(is.null(ngrid1)){ # number of support points for the covariance surface - # ngrid1 = 30; - #} - if (is.null(kFoldMuCov)) { # CV fold for covariance smoothing - kFoldMuCov <- 10L - } else { - kFoldMuCov <- as.integer(kFoldMuCov) - } - if(is.null(methodSelectK)){ # the method of choosing the number of principal components K - # TODO : Possibly have user-defined selection methods for the # of FPCs and we keep - # an internal FVE-based method for us - methodSelectK = "FVE"; - } - if(is.null(FVEthreshold)){ # Default Value for the Fraction-of-Variance-Explained - FVEthreshold = 0.9999; - } - if(is.null(dataType)){ #do we have dataType or sparse functional data - dataType = IsRegular(t); - } - if (is.null(fitEigenValues)) { - fitEigenValues <- FALSE - } - if(is.null(methodMuCovEst)){ - if (dataType == 'Sparse'){ - methodMuCovEst = 'smooth'; #In the odd case that somehow we use this... - } else { - methodMuCovEst = 'cross-sectional'; - } - } - if (fitEigenValues && dataType == 'Dense') { - stop('Fit method only apply to sparse data') - } - if(is.null(error)){ # error assumption with measurement error - error = TRUE; - } - if(is.null(nRegGrid)){ # number of support points in each direction of covariance surface - if(dataType == 'Dense' || dataType == 'DenseWithMV'){ - tt = unlist(t) - nRegGrid = length(unique(signif(tt[!is.na(tt)],6))); - } else { # for Sparse and p>>n - nRegGrid = 51; - } - } - if(is.null(maxK)){ # maximum number of principal components to consider - maxK = min( nRegGrid-2, length(y)-2 ); - if(methodMuCovEst == 'smooth'){ - maxK = min( maxK, 20) - } - if(maxK < 1){ - message("Automatically defined maxK cannot be less than 1. Reset to maxK = 1 now!\n") - maxK = 1 - } - if( length(y) <= 3 ){ - message("The sample size is less or equal to 3 curves. Be cautious!\n") - } - } - methodNames = c("IN", "CE"); - if(!is.null(methodXi) && !(methodXi %in% methodNames)){ - message(paste('methodXi', methodXi, 'is unrecognizable! Reset to automatic selection now!\n')); - methodXi = NULL; - } - if(is.null(methodXi)){ # method to estimate the PC scores - if(dataType == 'Dense'){ - methodXi = "IN"; - } else if(dataType == 'Sparse'){ - methodXi = "CE"; - } else if(dataType == 'DenseWithMV'){ - methodXi = "CE"; # We will see how IN can work here - } else { # for dataType = p>>n - methodXi = "IN"; - } - } - if(is.null(shrink)){ - # apply shrinkage to estimates of random coefficients (dataType data - # only) - shrink = FALSE; - } - if(shrink == TRUE && (error != TRUE || methodXi != "IN")){ - # Check for valid shrinkage choice - message('shrinkage method only has effects when methodXi = "IN" and error = TRUE! Reset to shrink = FALSE now!\n'); - shrink = FALSE - } - if(is.null(kernel)){ # smoothing kernel choice - if(dataType == "Dense"){ - kernel = "epan"; # kernel: Epanechnikov - }else{ - kernel = "gauss"; # kernel: Gaussian - } - } - kernNames = c("rect", "gauss", "epan", "gausvar", "quar"); - if(!(kernel %in% kernNames)){ # Check suitability of kernel - message(paste('kernel', kernel, 'is unrecognizable! Reset to automatic selection now!\n')); - kernel = NULL; - } - if(is.null(kernel)){ # smoothing kernel choice - if(dataType %in% c( "Dense", "DenseWithMV")){ - kernel = "epan"; # kernel: Epanechnikov - }else{ - kernel = "gauss"; # kernel: Gaussian - } - } - if(is.null(yname)){ # name of the variable analysed - yname = as.character(substitute(y)) - } - if(maxK > (nRegGrid-2)){ # check if a reasonable number of eigenfunctions is requested - message(paste("maxK can only be less than or equal to", nRegGrid-2,"! Reset to be", nRegGrid-2, "now!\n")); - maxK = nRegGrid -2; - } - if(is.numeric(methodSelectK)){ - FVEthreshold <- 1 # disable FVE selection. - if(methodSelectK > (nRegGrid-2)){ # check if a reasonable number of eigenfunctions is requested - message(paste("maxK can only be less than or equal to", nRegGrid-2,"! Reset to be", nRegGrid-2, "now!\n")); - maxK = nRegGrid -2; - }else if(methodSelectK <= 0){ # check if a positive number of eigenfunctions is requested - message("methodSelectK must be a positive integer! Reset to BIC now!\n"); - methodSelectK = "BIC" - FVEthreshold = 0.95; - } - } - if(is.null(plot)){ # make corrplot - plot = FALSE; - } - if(is.null(rho)){ # truncation threshold for the iterative residual that is used - # no regularization if sigma2 is specified or assume no measurement error. - if (!is.null(userSigma2) || error == FALSE) { - rho <- 'no' - } else { - rho <- 'cv' - } - } - if(is.null(userRho)){ - userRho = NULL - } - if(is.null(verbose)){ # display diagnostic messages - verbose = FALSE; - } - if(is.null(userMu)){ # user-defined mean functions valued at distinct input time points - userMu <- NULL - } - if(is.null(userCov)){ - userCov <- NULL - } - if(is.null(outPercent)){ - outPercent <- c(0,1) - } - if(is.null(rotationCut)){ - rotationCut <- c(0.25,.75) - } - # if(error == FALSE && (methodSelectK == "AIC" || methodSelectK == "BIC")){ # Check suitability of information criterion - # message(paste0('When assume no measurement error, cannot use "AIC" or "BIC". Reset to "BIC" now!\n')) - # methodSelectK = "BIC" - #} - if(!is.null(numBins)){ - if(numBins < 10){ # Check suitability of number of bins - message("Number of bins must be at least +10!!\n"); - numBins = NULL; - } - } - if(is.null(useBinnedData)){ - useBinnedData = 'AUTO'; - } - if (is.null(useBinnedCov)) { - useBinnedCov <- TRUE - if ( ( 128 > length(y) ) && ( 3 > mean ( unlist( lapply( y, length) ) ) )){ - useBinnedCov <- FALSE - } - } - if(is.null(lean)){ - lean = FALSE; - } - if(is.null(useBW1SE)){ - useBW1SE = FALSE; - } - # if (!all.equal(outPercent, c(0, 1)) && methodMuCovEst == 'cross-sectional') { - # stop('outPercent not supported for cross-sectional covariance estimate') - # } - - retOptns <- list(userBwMu = userBwMu, methodBwMu = methodBwMu, userBwCov = userBwCov, methodBwCov = methodBwCov, - kFoldMuCov = kFoldMuCov, methodSelectK = methodSelectK, FVEthreshold = FVEthreshold, - fitEigenValues = fitEigenValues, maxK = maxK, dataType = dataType, error = error, shrink = shrink, - nRegGrid = nRegGrid, rotationCut = rotationCut, methodXi = methodXi, kernel = kernel, - lean = lean, diagnosticsPlot = diagnosticsPlot, plot=plot, numBins = numBins, useBinnedCov = useBinnedCov, - yname = yname, rho = rho, verbose = verbose, userMu = userMu, userCov = userCov, methodMuCovEst = methodMuCovEst, - userRho = userRho, userSigma2 = userSigma2, outPercent = outPercent, useBinnedData = useBinnedData, useBW1SE = useBW1SE) - - invalidNames <- !names(optns) %in% names(retOptns) - if (any(invalidNames)) { - stop(sprintf('Invalid option names: %s', - paste0(names(optns)[invalidNames], collapse=', '))) - } - return( retOptns ) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/SetSVDOptions.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/SetSVDOptions.R deleted file mode 100644 index af91a750..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/SetSVDOptions.R +++ /dev/null @@ -1,98 +0,0 @@ -### SetSVDOptions - -SetSVDOptions <- function(Ly1, Lt1, Ly2, Lt2, SVDoptns){ - dataType1 = SVDoptns[['dataType1']] - dataType2 = SVDoptns[['dataType2']] - bw1 = SVDoptns[['bw1']] - bw2 = SVDoptns[['bw2']] - userMu1 = SVDoptns[['userMu1']] - userMu2 = SVDoptns[['userMu2']] - useGAM = SVDoptns[['useGAM']] - methodSelectK = SVDoptns[['methodSelectK']] - FVEthreshold = SVDoptns[['FVEthreshold']] - maxK = SVDoptns[['maxK']] - kernel = SVDoptns[['kernel']] - nRegGrid1 = SVDoptns[['nRegGrid1']] - nRegGrid2 = SVDoptns[['nRegGrid2']] - bwRoutine = SVDoptns[['bwRoutine']] - rmDiag = SVDoptns[['rmDiag']] - noScores = SVDoptns[['noScores']] - regulRS = SVDoptns[['regulRS']] - flip = SVDoptns[['flip']] - - if(is.null(dataType1)){# do we have dataType or sparse functional data for the first sample - dataType1 = IsRegular(Lt1); - } - if(is.null(dataType2)){# do we have dataType or sparse functional data for the first sample - dataType2 = IsRegular(Lt2); - } - if(is.null(maxK)){ # maximum number of singular components to consider - maxK = min(20, length(Ly1)-2) - } - if(is.null(kernel)){ # only gauss is avaiable for CrCov smoothing now - kernel = "gauss" - } - if(is.null(nRegGrid1)){ - nRegGrid1 = 51 # currently only 51, since it is the case for GetCrCovXY() - } - if(is.null(nRegGrid2)){ - nRegGrid2 = 51 # currently only 51, since it is the case for GetCrCovXY() - } - if(is.null(userMu1)){ - userMu1 = NULL - } - if(is.null(userMu2)){ - userMu2 = NULL - } - if(is.null(bwRoutine)){ - bwRoutine = 'l-bfgs-b' - } - if(is.null(useGAM)){ - useGAM = FALSE - } - if(is.null(rmDiag)){ # whether to remove diagonal raw cov for cross cov estimation - rmDiag = FALSE - } - if(is.null(FVEthreshold)){ # Default Value for the Fraction-of-Variance-Explained - FVEthreshold = 0.9999; - } - if(is.null(methodSelectK)){ # the method of choosing the number of singular components K - methodSelectK = "FVE"; - } - if(is.numeric(methodSelectK)){ - FVEthreshold <- 1 # disable FVE selection. - if(methodSelectK > maxK){ # check if a reasonable number of singular functions is requested - message(paste("maxK can only be less than or equal to", maxK,"! Reset to be", maxK, "now!\n")); - }else if(methodSelectK <= 0 || as.integer(methodSelectK)!=methodSelectK){ # check if a positive number of eigenfunctions is requested - message("methodSelectK must be a positive integer! Reset to FVE now!\n"); - methodSelectK = "FVE" - FVEthreshold = 0.95; - } - } - - if(is.null(noScores)){ # the method of choosing the number of singular components K - noScores = FALSE; - } - if(is.null(regulRS)){ # the method of choosing the number of singular components K - regulRS = 'sigma2'; - } - if(is.null(flip)){ # the method of choosing the number of singular components K - flip = FALSE; - } - - - retSVDOptns <- list(dataType1 = dataType1, dataType2 = dataType2, - bw1 = bw1, bw2 = bw2, userMu1 = userMu1, userMu2 = userMu2, - useGAM = useGAM, methodSelectK = methodSelectK, - FVEthreshold = FVEthreshold, maxK = maxK, flip = flip, - kernel = kernel, nRegGrid1 = nRegGrid1, nRegGrid2 = nRegGrid2, - bwRoutine = bwRoutine, rmDiag = rmDiag, noScores = noScores, regulRS = regulRS) - - invalidNames <- !names(SVDoptns) %in% names(retSVDOptns) - if (any(invalidNames)) { - stop(sprintf('Invalid option names: %s', - paste0(names(SVDoptns)[invalidNames], collapse=', '))) - } - return(retSVDOptns) -} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/Sparsify.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/Sparsify.R deleted file mode 100644 index 45b49d45..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/Sparsify.R +++ /dev/null @@ -1,71 +0,0 @@ -#' Sparsify densely observed functional data -#' -#' Given a matrix of densely observed functional data, make a sparsified sample. -#' -#' @param samp A matrix of densely observed functional data, with each row containing one sample. -#' @param pts A vector of grid points corresponding to the columns of \code{samp}. -#' @param sparsity A vector of integers. The number of observation per sample is chosen to be one of the elements in sparsity with equal chance. -#' @param aggressive Sparsify in an "aggressive" manner making sure that near-by readings are excluded. -#' @param fragment Sparsify the observations into fragments, which are (almost) uniformly distributed in the time domain. Default to FALSE as not fragmenting. Otherwise a positive number specifying the approximate length of each fragment. -#' -#' @return A list of length 2, containing the following fields: -#' \item{Lt}{A list of observation time points for each sample.} -#' \item{Ly}{A list of values for each sample, corresponding to the time points.} -#' @export -Sparsify <- function(samp, pts, sparsity, aggressive = FALSE, fragment=FALSE) { - - if (!is.matrix(samp)) { - stop('samp needs to be a matrix') - } - if (ncol(samp) != length(pts)) { - stop('The number of columns in samp needs to be equal to the length of pts') - } - if (length(sparsity) == 1) { - sparsity <- c(sparsity, sparsity) # avoid scalar case - } - - if (aggressive && fragment) { - stop('Specify one of `aggressive` or `fragment` only') - } - - if (aggressive) { - indEach <- lapply(1:nrow(samp), function(x) - remotesampling(ncol(samp), sparsity) ) - } else if (fragment != FALSE) { - nptsEach <- fragment / mean(diff(pts)) - indEach <- lapply(1:nrow(samp), function(x) { - ranPts <- range(pts) - mid <- runif(1, ranPts[1], ranPts[2]) - usePts <- which(pts >= mid - 1/2 * diff(ranPts) * fragment & - pts <= mid + 1/2 * diff(ranPts) * fragment) - nSampPts <- sample(sparsity, 1) - if (nSampPts >= length(usePts)) usePts else sort(sample(usePts, nSampPts)) - }) - } else { - indEach <- lapply(1:nrow(samp), function(x) - sort(sample(ncol(samp), sample(sparsity, 1)))) - } - - Lt <- lapply(indEach, function(x) pts[x]) - Ly <- lapply(1:length(indEach), function(x) { - ind <- indEach[[x]] - y <- samp[x, ind] - return(y) - }) - - return(list(Lt=Lt, Ly=Ly)) -} - - - -remotesampling <- function(N,s){ - onesamp = sort( sample( N, sample( s, 1))) - threshold = (1/length(onesamp))^(1.5) * N - while( min(diff(onesamp)) < threshold ){ - onesamp = sort( sample( N, length(onesamp))) - } - return(onesamp) -} - - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/Stringing.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/Stringing.R deleted file mode 100644 index cc541128..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/Stringing.R +++ /dev/null @@ -1,129 +0,0 @@ -#' Stringing for High-Dimensional data -#' -#' @param X A matrix (n by p) of data, where X[i,] is the row vector of measurements for the ith subject. -#' @param Y A vector (n by 1), where Y[i] is the reponse associated with X[i,] -#' @param standardize A logical variable indicating whether standardization of the input data matrix is required, with default: FALSE. -#' @param disOptns A distance metric to be used, one of the following: "euclidean" (default), "maximum", "manhattan", "canberra", "binary", "minkowski", "correlation", "spearman", "hamming", "xycor", or "user". If specified as "xycor", the absolute difference of correlation between predictor and response is used. If specified as "user", a dissimilarity matrix for the argument "disMat" must be provided. -#' @param disMat A user-specified dissimilarity matrix, only necessary when "disOptns" is "user". -#' -#' @return A list containing the following fields: -#' \item{Ly}{A list of n vectors, which are the random trajectories for all subjects identified by the Stringing method.} -#' \item{Lt}{A list of n time points vectors, at which corresponding measurements Ly are taken.} -#' \item{StringingOrder}{A vector representing the order of the stringing, s.t. using as column index on \code{X} yields recovery of the underlying process.} -#' \item{Xin}{A matrix, corresponding to the input data matrix.} -#' \item{Xstd}{A matrix, corresponding to the standardized input data matrix. It is NULL if standardize is FALSE.} -#' @examples -#' set.seed(1) -#' n <- 50 -#' wiener = Wiener(n = n)[,-1] -#' p = ncol(wiener) -#' rdmorder = sample(size = p, x=1:p, replace = FALSE) -#' stringingfit = Stringing(X = wiener[,rdmorder], disOptns = "correlation") -#' diff_norev = sum(abs(rdmorder[stringingfit$StringingOrder] - 1:p)) -#' diff_rev = sum(abs(rdmorder[stringingfit$StringedOrder] - p:1)) -#' if(diff_rev <= diff_norev){ -#' stringingfit$StringingOrder = rev(stringingfit$StringingOrder) -#' stringingfit$Ly = lapply(stringingfit$Ly, rev) -#' } -#' plot(1:p, rdmorder[stringingfit$StringingOrder], pch=18); abline(a=0,b=1) -#' -#' @references -#' \cite{Chen, K., Chen, K., Mueller, H. G., and Wang, J. L. (2011). "Stringing high-dimensional data for functional analysis." Journal of the American Statistical Association, 106(493), 275-284.} -#' @export - -Stringing = function(X, Y = NULL, standardize = FALSE, disOptns = "euclidean", disMat = NA){ - # input check - if(!(is.numeric(X) && is.matrix(X))){ - stop('Incorrect format for input data matrix X! Check if it is a matrix.') - } - if(!(disOptns %in% c("euclidean", "maximum", "manhattan", "canberra", "binary", "minkowski", - "correlation", "spearman", "hamming", "xycor", "user"))){ - stop('Invalid distance option specified! Need to be one of "euclidean", "correlation", "spearman", "hamming" and "user".') - } - if(disOptns == "user" && is.na(disMat)){ - stop('User specified dissimilarity matrix is missing, which is required for distance option "User".') - } - if(disOptns == "xycor"){ - if(is.null(Y)){ - stop('Missing response vector Y, required when disMat is "xycor".') - } - if(!(is.numeric(Y) && is.vector(Y))){ - stop('Incorrect format for input response vector Y! Check if it is a vector.') - } - if(length(Y) != nrow(X)){ - stop('Incosistent sample size based on input design matrix X and response vector Y.') - } - } - # Standardization of the input data X - Xin = X - if(standardize){ - Xstd = t(t(X) - colMeans(X)) %*% diag((1/sqrt(diag(cov(X)))), nrow = ncol(X)) - X = Xstd - } else { - Xstd = NULL - X = Xin - } - - # Calculate dissimilarity matrix - n = nrow(X); p = ncol(X); - if(disOptns != "user"){ - disMat = GetDisMatrix(X, disOptns, Y) - } else { # check if the user-specified dissimilarity matrix is a well-defined - if(!(isSymmetric(disMat) && sum(disMat > 0) == p*(p-1) && sum(abs(diag(disMat))) == 0)){ - stop("User-specified dissimilarity matrix is not valid!") - } - } - - # UDS - uds = MASS::isoMDS(d = disMat, k = 1, trace = FALSE) - pts = uds$points - StringingOrder = order( (pts - min(pts))/diff(range(pts)) ) - - # obtain stringed data - stringedX = X[,StringingOrder] - stringedTime = 1:p - fpcainput = MakeFPCAInputs(IDs = rep(seq_len(n),times=p), tVec = rep(stringedTime, each=n), - yVec = c(stringedX)) - Ly = fpcainput$Ly - Lt = fpcainput$Lt - stringingObj <- list(Ly = Ly, Lt = Lt, StringingOrder = StringingOrder, Xin = Xin, Xstd = Xstd) - class(stringingObj) <- "Stringing" - return(stringingObj) -} - - -# function to get dissimilarity matrix for given data matrix -GetDisMatrix = function(X, disOptns = "euclidean", Y){ - p = ncol(X); n = nrow(X); - if(disOptns %in% c("euclidean","maximum","manhattan","canberra","binary","minkowski")){ - disMat = dist(x = t(X), method = disOptns) - } else if(disOptns == "correlation"){ - disMat = sqrt(2*(1 - cor(X))) - } else if(disOptns == "spearman"){ - rankX = X - for(i in 1:p){ - rankX[,i] = rank(X[,i]) - } - disMat = 1 - cor(rankX) - } else if(disOptns == "hamming"){ - disMat = matrix(NA, nrow = p, ncol = p) - for(i in 1:p){ - for(j in i:p){ - disMat[i,j] = sum(X[,i] != X[,j])/n - if(j > i){ - disMat[j,i] = disMat[i,j] - } - } - } - } else { # xy correlation - disMat = matrix(NA, nrow = p, ncol = p) - XYcor = cor(cbind(Y,X))[-1,1] # the correlation vector of Xj's and Y, j=1,...,p - for(i in 1:p){ - for(j in i:p){ - disMat[i,j] = abs(XYcor[i] - XYcor[j]); - disMat[j,i] = disMat[i,j]; - } - } - } - return(disMat) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/SubsetFPCA.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/SubsetFPCA.R deleted file mode 100644 index b8564c38..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/SubsetFPCA.R +++ /dev/null @@ -1,11 +0,0 @@ -### subset the FPCA object with specified number of components K -### and return the subsetted fpcaObj - -SubsetFPCA <- function(fpcaObj, K){ - fpcaObj$lambda <- fpcaObj$lambda[1:K] - fpcaObj$phi <- fpcaObj$phi[,1:K, drop=FALSE] - fpcaObj$xiEst <- fpcaObj$xiEst[,1:K, drop=FALSE] - fpcaObj$FVE <- fpcaObj$cumFVE[K] - fpcaObj$cumFVE <- fpcaObj$cumFVE[1:K] - return(fpcaObj) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/TVAM.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/TVAM.R deleted file mode 100644 index a316972f..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/TVAM.R +++ /dev/null @@ -1,178 +0,0 @@ -#' Iterative Smooth Backfitting Algorithm -#' -#' Smooth backfitting procedure for time-varying additive models -#' -#' @param Lt An \emph{n}-dimensional list of \emph{N_i}-dimensional vector whose elements consist of longitudial time points for each \emph{i}-th subject. -#' @param Ly An \emph{n}-dimensional list of \emph{N_i}-dimensional vector whose elements consist of longitudial response observations of each \emph{i}-subject corresponding to \emph{Lt}. -#' @param LLx A tuple of \emph{d}-lists, where each list respresents longitudinal covariate observations of the \emph{j}-th component corresponding to \emph{Lt} and \emph{Ly}. -#' @param gridT An \emph{M}-dimensional sequence of evaluation time points for additive surface estimators. (Must be sorted in increasing orders.) -#' @param x An \emph{N} by \emph{d} matrix whose column vectors consist of \emph{N} vectors of evaluation points for additive surface component estimators at each covariate value. -#' @param ht A bandwidth for kernel smoothing in time component. -#' @param hx A \emph{d} vector of bandwidths for kernel smoothing covariate components, respectively. -#' @param K A \code{function} object representing the kernel to be used in the smooth backfitting (default is 'epan', the the Epanechnikov kernel.). -#' @param suppT A 2-dimensional vector consists of the lower and upper limits of estimation intervals for time component (default is \emph{[0,1]}). -#' @param suppX A \emph{d} by 2 matrix whose row vectors consist of the lower and upper limits of estimation intervals for each component function (default is the \emph{d}-dimensional unit rectangle of \emph{[0,1]}). -#' -#' @details \code{TVAM} estimates component surfaces of time-varying additive models for londitudinal observations based on the smooth backfitting algorithm proposed by Zhang et al. (2013). \code{TVAM} only focuses on the local constant smooth backfitting in contrast to the original development as in Zhang et al. (2013). However, the local polynomial version can be extended similarly, so that those are omitted in the development. Especially in this development, one can designate an estimation support of additive surfaces when the additive modeling is only allowed over restricted intervals or one is interested in the modeling over the support (see Han et al., 2016). -#' -#' @return A list containing the following fields: -#' \item{tvamComp}{A tuple of \emph{d}-lists, where each list is given by \emph{M} by \emph{N} matrix whose elements represents the smooth backfitting surface estimator of the \emph{j}-component evaluated at \code{gridT} and the \emph{j}-th column of \code{x}.} -#' \item{tvamMean}{An \emph{M}-dimensional vector whose elelments consist of the marginal time regression function estimated at \code{gridT}.} -#' @examples -#' -#' set.seed(1000) -#' -#' n <- 100 -#' Lt <- list() -#' Ly <- list() -#' Lx1 <- list() -#' Lx2 <- list() -#' -#' for (i in 1:n) { -#' Ni <- sample(10:15,1) -#' -#' Lt[[i]] <- sort(runif(Ni,0,1)) -#' Lx1[[i]] <- runif(Ni,0,1) -#' Lx2[[i]] <- runif(Ni,0,1) -#' Ly[[i]] <- Lt[[i]]*(cos(2*pi*Lx1[[i]]) + sin(2*pi*Lx2[[i]])) + rnorm(Ni,0,0.1) -#' -#' } -#' -#' LLx <- list(Lx1,Lx2) -#' -#' gridT <- seq(0,1,length.out=41) -#' x0 <- seq(0,1,length.out=51) -#' x <- cbind(x0,x0) -#' -#' ht <- 0.1 -#' hx <- c(0.1,0.1) -#' -#' tvam <- TVAM(Lt,Ly,LLx,gridT=gridT,x=x,ht=ht,hx=hx,K='epan') -#' -#' g0Sbf <- tvam$tvamMean -#' gjSbf <- tvam$tvamComp -#' -#' par(mfrow=c(1,2)) -#' par(mar=c(1,1,1,1)+0.1) -#' persp(gridT,x0,gjSbf[[1]],theta=60,phi=30, -#' xlab='time',ylab='x1',zlab='g1(t, x1)') -#' persp(gridT,x0,gjSbf[[2]],theta=60,phi=30, -#' xlab='time',ylab='x2',zlab='g1(t, x2)') -#' -#' @references -#' \cite{Zhang, X., Park, B. U. and Wang, J.-L. (2013), "Time-varying additive models for longitudinal data", Journal of the American Statistical Association, Vol.108, No.503, p.983-998.} -#' -#' \cite{Han, K., Mueller, H.-G. and Park, B. U. (2018), "Smooth backfitting for additive modeling with small errors-in-variables, with an application to additive functional regression for multiple predictor functions", Bernoulli, Vol.24, No.2, p.1233-1265.} -#' -#' @export - -TVAM <- function(Lt,Ly,LLx,gridT=NULL,x=NULL,ht=NULL,hx=NULL,K='epan',suppT=NULL,suppX=NULL){ - - supp0 <- suppT - supp <- suppX - - if (is.null(ncol(x))==TRUE) { - return(message('Evaluation grid must be multi-dimensional.')) - } - - M <- length(gridT) - N <- nrow(x) - n <- length(Lt) - d <- ncol(x) - - h0 <- ht - h <- hx - - if (K!='epan') { - message('Epanechnikov kernel is only supported currently. It uses Epanechnikov kernel automatically') - K<-'epan' - } - if (is.null(supp0)==TRUE) { - supp0 <-c(0,1) - } - if (is.null(supp)==TRUE) { - supp <- matrix(rep(c(0,1),d),ncol=2,byrow=TRUE) - } - if (is.null(h0)==TRUE) { - h <- rep(0.25*n^(-1/5),d)*(supp[,2]-supp[,1]) - } - if (is.null(h)==TRUE) { - h <- rep(0.25*n^(-1/5),d)*(supp[,2]-supp[,1]) - } - if (length(h0)>1) { - return(message('Bandwidth for time component must be univariate.')) - } - if (length(h)<2) { - return(message('Bandwidths for covariate components must be multi-dimensional.')) - } - - Ni <- c() - for (i in 1:n) { - Ni[i] <- length(Lt[[i]]) - } - - sumNi <- sum(Ni) - - obsT <- c() - Y <- c() - X <- c() - for (i in 1:n) { - obsT <- c(obsT,Lt[[i]]) - Y <- c(Y,Ly[[i]]) - - tmpX <- matrix(nrow=Ni[i],ncol=d) - for (j in 1:d) { - tmpX[,j] <- (LLx[[j]])[[i]] - } - X <- rbind(X,tmpX) - } - - g0Sbf <- c() - gjSbf <- list() - for (j in 1:d) { - gjSbf[[j]] <- matrix(nrow=M,ncol=N) - } - for (m in 1:M) { - # print(m) - - tmpInd <- which(abs(obsT - gridT[m])= min(obsGrid) - buff & tVec <= max(obsGrid) + buff) - return(ind) - }, Ly, Lt, SIMPLIFY=FALSE) - Ly <- mapply(function(yVec, ind) yVec[ind], Ly, tmpInd, SIMPLIFY = FALSE) - Lt <- mapply(function(tVec, ind) tVec[ind], Lt, tmpInd, SIMPLIFY = FALSE) - - return(list(Ly=Ly, Lt=Lt)) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/VCAM.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/VCAM.R deleted file mode 100644 index 586159b0..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/VCAM.R +++ /dev/null @@ -1,346 +0,0 @@ -#' Sieve estimation -#' -#' B-spline based estimation procedure for time-varying additive models. -#' -#' @param Lt An \emph{n}-dimensional list of \emph{N_i}-dimensional vectors whose elements consist of longitudial time points for each \emph{i}-th subject. -#' @param Ly An \emph{n}-dimensional list of \emph{N_i}-dimensional vectors whose elements consist of longitudial response observations of each \emph{i}-subject corresponding to \emph{Lt}. -#' @param X An \emph{n} by \emph{d} matrix whose row vectors consist of covariate vector of additive components for each subject. -#' @param optnAdd A list of options controls B-spline parameters for additive components, specified by list(name=value). See 'Details'. -#' @param optnVc A list of options controls B-spline parameters for varying-coefficient components, specified by list(name=value). See 'Details'. -#' -#' @details \code{VCAM} provides a simple algorithm based on B-spline basis to estimate its nonparametric additive and varying-coefficient components. -#' -#' Available control options for \emph{optnAdd} are -#' \describe{ -#' \item{nKnot}{A \emph{d}-dimensional vector which designates the number of knots for each additive component function estimation (default=10).} -#' \item{order}{A \emph{d}-dimensional vector which designates the order of B-spline basis for each additive component function estimation (default=3).} -#' \item{grid}{A \emph{N} by \emph{d} matrix whose column vector consist of evaluation grid points for each component function estimation.} -#' } -#' and control options for \emph{optnVc} are -#' \describe{ -#' \item{nKnot}{A \emph{(d+1)}-dimensional vector which designates the number of knots for overall mean function and each varying-coefficient component function estimation (default=10).} -#' \item{order}{A \emph{(d+1)}-dimensional vector which designates the order of B-spline basis for overall mean function and each varying-coefficient component function estimation (default=3).} -#' \item{grid}{A \emph{M} by \emph{(d+1)} matrix whose column vectors consist of evaluation grid points for overall mean function and each varying-coefficient component function estimation.} -#' } -#' -#' @return A list containing the following fields: -#' \item{Lt}{The same with input given by \emph{Lt}} -#' \item{LyHat}{Fitted values corresponding to \emph{Ly}} -#' \item{phiEst}{An \emph{N} by \emph{d} matrix whose column vectors consist of esimates for each additive component function evaluated at \emph{gridX}.} -#' \item{beta0Est}{An \emph{M}-dimensional vector for overall mean function estimates evalueated at \emph{gridT}.} -#' \item{betaEst}{An \emph{M} by \emph{d} matrix whose column vectors consist of esimates for each varying-coefficient components evalueated at \emph{gridT}.} -#' \item{gridX}{The same with input given by \emph{optnAdd$grid}} -#' \item{gridT}{The same with input given by \emph{optnVc$grid}} -#' @examples -#' -#' library(MASS) -#' -#' set.seed(100) -#' -#' n <- 100 -#' d <- 2 -#' -#' Lt <- list() -#' Ly <- list() -#' -#' m <- rep(0,2) -#' S <- matrix(c(1,0.5,0.5,1),nrow=2,ncol=2) -#' X <- pnorm(mvrnorm(n,m,S)) -#' -#' beta0 <- function(t) 1.5*sin(3*pi*(t+0.5)) -#' beta1 <- function(t) 3*(1-t)^2 -#' beta2 <- function(t) 4*t^3 -#' -#' phi1 <- function(x) sin(2*pi*x) -#' phi2 <- function(x) 4*x^3-1 -#' -#' for (i in 1:n) { -#' Ni <- sample(10:20,1) -#' -#' Lt[[i]] <- sort(runif(Ni,0,1)) -#' Ly[[i]] <- beta0(Lt[[i]]) + beta1(Lt[[i]])*phi1(X[i,1]) + beta2(Lt[[i]])*phi2(X[i,2]) + rnorm(Ni,0,0.1) -#' -#' } -#' -#' -#' vcam <- VCAM(Lt,Ly,X) -#' -#' par(mfrow=c(1,1)) -#' plot(unlist(vcam$LyHat),unlist(Ly),xlab='observed Y',ylab='fitted Y') -#' abline(coef=c(0,1),col=8) -#' -#' par(mfrow=c(1,2)) -#' plot(vcam$gridX[,1],vcam$phiEst[,1],type='l',ylim=c(-1,1),xlab='x1',ylab='phi1') -#' points(vcam$gridX[,1],phi1(vcam$gridX[,1]),col=2,type='l',lty=2,lwd=2) -#' legend('topright',c('true','est'),lwd=2,lty=c(1,2),col=c(1,2)) -#' -#' plot(vcam$gridX[,2],vcam$phiEst[,2],type='l',ylim=c(-1,3),xlab='x2',ylab='phi2') -#' points(vcam$gridX[,2],phi2(vcam$gridX[,2]),col=2,type='l',lty=2,lwd=2) -#' legend('topleft',c('true','est'),lwd=2,lty=c(1,2),col=c(1,2)) -#' -#' par(mfrow=c(1,3)) -#' plot(vcam$gridT,vcam$beta0Est,type='l',xlab='t',ylab='beta0') -#' points(vcam$gridT,beta0(vcam$gridT),col=2,type='l',lty=2,lwd=2) -#' legend('topright',c('true','est'),lwd=2,lty=c(1,2),col=c(1,2)) -#' -#' plot(vcam$gridT,vcam$betaEst[,1],type='l',xlab='t',ylab='beta1') -#' points(vcam$gridT,beta1(vcam$gridT),col=2,type='l',lty=2,lwd=2) -#' legend('topright',c('true','est'),lwd=2,lty=c(1,2),col=c(1,2)) -#' -#' plot(vcam$gridT,vcam$betaEst[,2],type='l',xlab='t',ylab='beta2') -#' points(vcam$gridT,beta2(vcam$gridT),col=2,type='l',lty=2,lwd=2) -#' legend('topright',c('true','est'),lwd=2,lty=c(1,2),col=c(1,2)) -#' -#' @references -#' \cite{Zhang, X. and Wang, J.-L. (2015), "Varying-coefficient additive models for functional data", Biometrika, Vol.102, No.1, p.15-32.} -#' -#' @export - -VCAM <- function(Lt,Ly,X,optnAdd=list(),optnVc=list()) { - - n <- length(Lt) - d <- ncol(X) - - if (is.null(optnAdd$order)==TRUE) { - optnAdd$order <- 3 - } - if (is.null(optnAdd$nKnot)==TRUE) { - optnAdd$nKnot <- min(10,ceiling(n/d-optnAdd$order-1)) - } - - if (length(optnAdd$order)==1) { - optnAdd$order <- rep(optnAdd$order,d) - } - if (length(optnAdd$nKnot)==1) { - optnAdd$nKnot <- rep(optnAdd$nKnot,d) - } - - if (is.null(optnVc$order)==TRUE) { - optnVc$order <- 3 - } - if (is.null(optnVc$nKnot)==TRUE) { - optnVc$nKnot <- min(10,ceiling(n/(d+1)-optnVc$order-1)) - } - - if (length(optnVc$order)==1) { - optnVc$order <- rep(optnVc$order,d+1) - } - if (length(optnVc$nKnot)==1) { - optnVc$nKnot <- rep(optnVc$nKnot,d+1) - } - - if (is.null(d)==TRUE) { - X <- matrix(X,nrow=n,ncol=d) - } - - Ni <- c() - for (i in 1:n) { - Ni[i] <- length(Lt[[i]]) - } - - maxT <- max(unlist(Lt)) - minT <- min(unlist(Lt)) - - - if (is.null(optnAdd$grid)==TRUE) { - tmp <- matrix(nrow=51,ncol=d) - for (j in 1:d) { - tmp[,j] <- seq(min(X[,j]),max(X[,j]),length.out=51) - } - optnAdd$grid <- tmp - } - - if (is.null(optnVc$grid)==TRUE) { - optnVc$grid <- seq(minT,maxT,length.out=51) - } - - - # B-spline estimation for additive function - intY <- c() - for (i in 1:n) { - ind <- order(Lt[[i]]) - Ti <- (Lt[[i]][ind]-minT)/(maxT-minT) - Yi <- Ly[[i]][ind] - - intY[i] <- trapzRcpp(Ti,Yi) - } - - BSplineX <- c() - nBasisX <- c() - for (j in 1:d) { - stdXj <- (X[,j]-min(X[,j]))/(max(X[,j])-min(X[,j])) - - nIntKnot <- optnAdd$nKnot[j] - optnAdd$order[j] - 1 - - tmp <- GenBSpline(stdXj,nIntKnot,optnAdd$order[j]) - nBasisX[j] <- ncol(tmp) - - BSplineX <- cbind(BSplineX,tmp) - - } - - if (n <= ncol(BSplineX)) { - stop('Try smaller number of knots or lower order of B-spline basis.') - } - - fitAdd <- lm(intY~BSplineX) - - fHat <- fitAdd$coefficients[-1] - indNa <- is.na(fHat) - fHat[which(indNa==TRUE)] <- 0 - - phiHat <- matrix(nrow=n,ncol=d) - phiHat[,1] <- BSplineX[,1:nBasisX[1]]%*%fHat[1:nBasisX[1]] - if (d > 1) { - for (j in 2:d) { - phiHat[,j] <- BSplineX[,(sum(nBasisX[1:(j-1)])+1):sum(nBasisX[1:j])]%*%fHat[(sum(nBasisX[1:(j-1)])+1):sum(nBasisX[1:j])] - } - } - - for (j in 1:d) { - phiHat[,j] <- phiHat[,j] - mean(phiHat[,j]) - } - - - # B-spline estimation for varying-coefficient function - Y <- unlist(Ly) - stdT <- (unlist(Lt)-minT)/(maxT-minT) - - BSplineT <- c() - nBasisT <- c() - for (j in 1:(d+1)) { - nIntKnot <- optnVc$nKnot[j] - optnVc$order[j] - 1 - - tmp <- GenBSpline(stdT,nIntKnot,optnVc$order[j]) - nBasisT[j] <- ncol(tmp) - - BSplineT <- cbind(BSplineT,tmp) - } - - phiHatRe <- c() - for (j in 1:d) { - phiHatRe <- cbind(phiHatRe,rep(phiHat[,j],Ni)) - } - - BSplineTX <- BSplineT[,1:nBasisT[1]] - for (j in 1:d) { - BSplineTX <- cbind(BSplineTX,BSplineT[,(sum(nBasisT[1:j])+1):sum(nBasisT[1:(j+1)])]*phiHatRe[,j]) - } - - fitVc <- lm(Y~0+BSplineTX) - - gHat <- fitVc$coefficients - indNa <- is.na(gHat) - gHat[which(indNa==TRUE)] <- 0 - - betaHat <- matrix(nrow=sum(Ni),ncol=(d+1)) - betaHat[,1] <- BSplineT[,1:nBasisT[1]]%*%gHat[1:nBasisT[1]] - if (d > 1) { - for (j in 1:d) { - betaHat[,j+1] <- BSplineT[,(sum(nBasisT[1:j])+1):sum(nBasisT[1:(j+1)])]%*%gHat[(sum(nBasisT[1:j])+1):sum(nBasisT[1:(j+1)])] - } - } - - for (j in 2:(d+1)) { - betaHat[,j] <- betaHat[,j]/trapzRcpp(sort(stdT),betaHat[order(stdT),j]) - } - - - # fitted values for responses - yHat <- fitVc$fitted.values - - LyHat <- list() - LyHat[[1]] <- yHat[1:Ni[1]] - for (i in 2:n) { - LyHat[[i]] <- yHat[(sum(Ni[1:(i-1)])+1):sum(Ni[1:i])] - } - - - # additive function estimation - X0 <- optnAdd$grid - - BSplineX0 <- c() - nBasisX0 <- c() - for (j in 1:d) { - - nIntKnot <- optnAdd$nKnot[j] - optnAdd$order[j] - 1 - - tmp <- GenBSpline(X0[,j],nIntKnot,optnAdd$order[j]) - nBasisX0[j] <- ncol(tmp) - - BSplineX0 <- cbind(BSplineX0,tmp) - - } - - phiEst <- matrix(nrow=nrow(X0),ncol=d) - phiEst[,1] <- BSplineX0[,1:nBasisX0[1]]%*%fHat[1:nBasisX0[1]] - if (d > 1) { - for (j in 2:d) { - phiEst[,j] <- BSplineX0[,(sum(nBasisX0[1:(j-1)])+1):sum(nBasisX0[1:j])]%*%fHat[(sum(nBasisX0[1:(j-1)])+1):sum(nBasisX0[1:j])] - } - } - - for (j in 1:d) { - phiEst[,j] <- phiEst[,j] - mean(phiEst[,j]) - } - - par(mfrow=c(1,2)) - plot(sort(X0[,1]),phiEst[order(X0[,1]),1],type='l',ylim=c(-1,1)) - points(sort(X[,1]),phi1(sort(X[,1])),col=2,type='l',lty=2,lwd=2) - plot(sort(X0[,2]),phiEst[order(X0[,2]),2],type='l',ylim=c(-1,3)) - points(sort(X[,2]),phi2(sort(X[,2])),col=2,type='l',lty=2,lwd=2) - - - # varying-coefficient function esimation - T0 <- optnVc$grid - - BSplineT0 <- c() - nBasisT0 <- c() - for (j in 1:(d+1)) { - nIntKnot <- optnVc$nKnot[j] - optnVc$order[j] - 1 - - tmp <- GenBSpline(T0,nIntKnot,optnVc$order[j]) - nBasisT0[j] <- ncol(tmp) - - BSplineT0 <- cbind(BSplineT0,tmp) - } - - betaEst <- matrix(nrow=length(T0),ncol=(d+1)) - betaEst[,1] <- BSplineT0[,1:nBasisT0[1]]%*%gHat[1:nBasisT0[1]] - if (d > 1) { - for (j in 1:d) { - betaEst[,j+1] <- BSplineT0[,(sum(nBasisT0[1:j])+1):sum(nBasisT0[1:(j+1)])]%*%gHat[(sum(nBasisT0[1:j])+1):sum(nBasisT0[1:(j+1)])] - } - } - - for (j in 2:(d+1)) { - betaEst[,j] <- betaEst[,j]/trapzRcpp(T0,betaEst[,j]) - } - - par(mfrow=c(1,3)) - plot(T0,betaEst[,1],type='l') - points(sort(stdT),beta0(sort(stdT)),col=2,type='l',lty=2,lwd=2) - plot(T0,betaEst[,2],type='l') - points(sort(stdT),beta1(sort(stdT)),col=2,type='l',lty=2,lwd=2) - plot(T0,betaEst[,3],type='l') - points(sort(stdT),beta2(sort(stdT)),col=2,type='l',lty=2,lwd=2) - - return(list(Lt=Lt, LyHat=LyHat, phiEst=phiEst, beta0Est=betaEst[,1], betaEst=betaEst[,-1], gridT=T0, gridX=X0)) - -} - - - - - - - - - - - - - - - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/WFDA.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/WFDA.R deleted file mode 100644 index 2648afc8..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/WFDA.R +++ /dev/null @@ -1,242 +0,0 @@ -#' Warped Functional Data Analysis -#' -#' Pairwise curve synchronization for functional data -#' -#' @param Ly A list of \emph{n} vectors containing the observed values for each individual. -#' @param Lt A list of \emph{n} vectors containing the observation time points for each individual corresponding to y. Each vector should be sorted in ascending order. -#' @param optns A list of options control parameters specified by \code{list(name=value)}. See 'Details'. -#' -#' @details WFDA uses a pairwise warping method to obtain the desired alignment (registration) of the random trajectories. -#' The data has to be regular. The routine returns the aligned curves and the associated warping function. -#' -#' Available control options are -#' \describe{ -#' \item{choice}{Choice of estimating the warping functions ('weighted' or 'truncated'). If 'weighted' then weighted averages of pairwise warping functions are computed; the weighting is based on the inverse pairwise distances. If 'truncated' the pairs with the top 10\% largest distances are truncated and the simple average of the remaining pairwise distances are used - default: 'truncated'} -#' \item{subsetProp}{Pairwise warping functions are determined by using a subset of the whole sample; numeric (0,1] - default: 0.50} -#' \item{lambda}{Penalty parameter used for estimating pairwise warping functions; numeric - default : V*10^-4, where V is the average L2 norm of y-mean(y).} -#' \item{nknots}{Number of knots used for estimating the piece-wise linear pairwise warping functions; numeric - default: 2} -#' \item{isPWL}{Indicator if the resulting warping functions should piece-wise linear, if FALSE 'nknots' is ignored and the resulting warping functions are simply monotonic; logical - default: TRUE (significantly larger computation time.)} -#' \item{seed}{Random seed for the selection of the subset of warping functions; numeric - default: 666} -#' \item{verbose}{Indicator if the progress of the pairwise warping procedure should be displayed; logical - default: FALSE} -#' } -#' @return A list containing the following fields: -#' \item{optns}{Control options used.} -#' \item{lambda}{Penalty parameter used.} -#' \item{aligned}{Aligned curves evaluated at time 't'} -#' \item{h}{Warping functions for 't'} -#' \item{hInv}{Inverse warping functions evaluated at 't'} -#' \item{costs}{The mean cost associated with each curve} -#' \item{timing}{The time required by time-warping.} -#' @examples -#' N = 44; -#' eps = 0.123; -#' M = 41; -#' set.seed(123) -#' Tfinal = 3 -#' me <- function(t) exp(-Tfinal*(((t/Tfinal^2)-0.5))^2); -#' T = seq(0,Tfinal,length.out = M) -#' recondingTimesMat = matrix(nrow = N, ncol = M) -#' yMat = matrix(nrow = N, ncol = M) -#' -#' for (i in 1:N){ -#' peak = runif(min = 0.2,max = 0.8,1) * Tfinal -#' recondingTimesMat[i,] = sort( unique(c( seq(0.0 , peak, length.out = round((M+1)/2)), -#' seq( peak, Tfinal, length.out = round((M+1)/2))))) * Tfinal -#' yMat[i,] = me(recondingTimesMat[i,]) * rnorm(1, mean=4.0, sd= eps) -#' + rnorm(M, mean=0.0, sd= eps) -#' } -#' -#' Y = as.list(as.data.frame(t(yMat))) -#' X = rep(list(T),N) -#' -#' sss = WFDA(Ly = Y, Lt = X, list( choice = 'weighted' )) -#' par(mfrow=c(1,2)) -#' matplot(x= T, t(yMat), t='l', main = 'Raw', ylab = 'Y'); grid() -#' matplot(x= T, t(sss$aligned), t='l', main = 'Aligned', ylab='Y'); grid() -#' @references -#' \cite{Tang, R. and Mueller, H.G. (2008). "Pairwise curve synchronization for functional data." Biometrika 95, 875-889} -#' -#' \cite{Tang, R. and Mueller, H.G. (2009) "Time-synchronized clustering of gene expression trajectories." Biostatistics 10, 32-45} -#' @export - -WFDA = function(Ly, Lt, optns = list()){ - - if(is.null(optns$isPWL)){ - optns$isPWL = TRUE - } - - if(is.null(optns$verbose)){ - optns$verbose = FALSE - } - - if(optns$isPWL){ - # Knot related checks - if(is.null(optns$nknots)){ - optns$nknots = 2; - } - if( !(optns$nknots %in% 1:7) ){ - stop("Number of knots should be between 1 and 7.") - } - } - - # Subsettig related checks - if(is.null(optns$subsetProp)){ - optns$subsetProp = 0.50; - } - if(findInterval(optns$subsetProp - .Machine$double.eps, c(0,1)) != 1){ - stop("Number of proportion used should be above 0 and at most 1.") - } - - # Averaging related checks - if(is.null(optns$choice)){ - optns$choice = 'truncated'; - } - if( !(optns$choice %in% c('truncated','weighted') )){ - stop("The estimation of warping functions can only be done by 'truncated' or 'weighted' average.") - } - - theCurrentRandomSeed <- .Random.seed #Store the current random seed to restore in the end of the function. - #Restore the current random seed to the state it had in the beginning of the function. - on.exit( .Random.seed <- theCurrentRandomSeed ) - - # Seed related checks - if(is.null(optns$seed)){ - optns$seed = 666; - } - if(!(is.numeric(optns$seed))) { - stop("The seed has to be numeric.") - } - - # Check the data validity for further analysis - CheckData(Ly,Lt) - inputData <- HandleNumericsAndNAN(Ly,Lt); - Ly <- inputData$Ly; - Lt <- inputData$Lt; - - # Set the options structure members that are still NULL - optnsFPCA = SetOptions(Ly, Lt, list()); - - if(optnsFPCA$dataType != 'Dense'){ - stop(paste0("The data has to be 'Dense' for WFDA to be relevant; the current dataType is : '", optnsFPCA$dataType,"'!") ) - } - - # Check the options validity for the PCA function. - numOfCurves = length(Ly); - CheckOptions(Lt, optnsFPCA,numOfCurves) - - ymat <- List2Mat(Ly, Lt) - N = nrow(ymat) - - obsGrid = sort(unique( c(unlist(Lt)))); - workGrid = (obsGrid - min(obsGrid))/ max(obsGrid - min(obsGrid)) # Same grid on [0,1] - M = length(workGrid) - - ## Super-norm normalization - maxAtTimeT = apply(ymat,1, function(u) max(abs(u))); - - ymatNormalised <- ymat / rep(maxAtTimeT, times = M) - - ## Mean function - smcObj = GetMeanDense(ymatNormalised, obsGrid, optnsFPCA) - - # mu: the smoothed mean curve evaluated at times 'obsGrid' - mu <- smcObj$mu - - if (is.null(optns$lambda)){ - Vy = sqrt(sum( apply(ymatNormalised,1, function(u) trapzRcpp(obsGrid, (u - mu)^2 ) ) )/(N-1)) - lambda = Vy*10^-4 - } else { - lambda <- optns$lambda - } - - numOfKcurves = min(round(optns$subsetProp * (N-1))) - hikMat <- array(dim = c(numOfKcurves,M,N) ) - distMat <- matrix( nrow = N, ncol = numOfKcurves) - hMat <- array(dim = c(N,M) ) - hInvMat <- array(dim = c(N,M) ) - alignedMat <- array(dim = c(N,M) ) - - getcurveJ <- function(tj, curvej){ - # approx(x = obsGrid, y = curvej, xout = tj)$y - RcppPseudoApprox(X = workGrid, Y = curvej, X_target = tj) - } - - theCost <- function(curvei, curvek,lambda,ti,tk){ - sum((getcurveJ(tk, curvek)-curvei)^2) + lambda * sum((tk-ti)^2) - } - - getHikRS <- function(curvei, curvek, lambda){ - myCosts <- sapply(1:numOfKcurves^2, function(u){ set.seed(u); - theCost(curvei, curvek, lambda, workGrid, c(0,Rcppsort(runif(M-2)) ,1)) }) - set.seed( which.min( myCosts ) ) - minCost <- min(myCosts) - return( c(0,Rcppsort(runif(M-2)),1) ) - } - - getSol <- function(x){ - #approx(x = seq(0,1, length.out = (2+ optns$nknots)), y = c(0, Rcppsort(x),1) ,n = M)$y - RcppPseudoApprox(X = seq(0,1, length.out = (2+ optns$nknots)), Y = c(0, Rcppsort(x),1), X_target = seq(0,1, length.out = M)) - } - - theCostOptim <- function(x , curvei, curvek,lambda,ti){ - tk = getSol(x); - sum((getcurveJ(tk, curvek)-curvei)^2) + lambda * sum((tk-ti)^2) - } - - getHikOptim <- function(curvei, curvek, lambda, minqaAvail ){ - s0 <- seq(0,1,length.out = (2+ optns$nknots))[2:(1+optns$nknots)] - if( !minqaAvail ) { - optimRes <- optim( par = s0, fn = theCostOptim, method = 'L-BFGS-B', - lower = rep(1e-6, optns$nknots), upper = rep(1 - 1e-6, optns$nknots), - curvei = curvei, curvek = curvek, lambda = lambda, ti =workGrid) - } else { - optimRes <- minqa::bobyqa( par = s0, fn = theCostOptim, - lower = rep(1e-6, optns$nknots), upper = rep(1 - 1e-6, optns$nknots), - curvei = curvei, curvek = curvek, lambda = lambda, ti =workGrid) - } - bestSol <- getSol(optimRes$par) - return( bestSol ) - } - - start <- Sys.time () - if( !is.element('minqa', installed.packages()[,1]) && optns$isPWL){ - warning("Cannot use 'minqa::bobyqa' to find the optimal knot locations as 'minqa' is not installed. We will do an 'L-BFGS-B' search.") - minqaAvail = FALSE - } else { - minqaAvail = TRUE - } - - for(i in seq_len(N)){ # For each curve - if(optns$verbose){ - cat('Computing pairwise warping for curve #:', i, ' out of', N, 'curves.\n') - } - set.seed( i + optns$seed ); - curvei = ymatNormalised[i,]; - candidateKcurves = sample(seq_len(N)[-i], numOfKcurves) - - for(k in seq_len(numOfKcurves)){ # For each of the candidate curves - if(!optns$isPWL){ - hikMat[k, ,i] = getHikRS(curvei, ymatNormalised[candidateKcurves[k],], lambda) - } else { - hikMat[k, ,i] = getHikOptim(curvei, ymatNormalised[candidateKcurves[k],], lambda, minqaAvail) - } - distMat[i,k] = mean( ( getcurveJ(tj =hikMat[k, ,i], curvei) - ymatNormalised[candidateKcurves[k]])^2 ) - } - - if(optns$choice == 'weighted'){ - hInvMat[i,] = apply(hikMat[, ,i] , 2, weighted.mean, 1/distMat[i,]) - } else { - hInvMat[i,] = apply(hikMat[ (distMat[i,] <= quantile( distMat[i,], p=0.90) ), ,i] , 2, mean) - } - - hMat[i,] = approx(y = workGrid, x = hInvMat[i,], xout = workGrid)$y - alignedMat[i,] = approx(x = workGrid, y = ymat[i,], xout = hMat[i,])$y - - } - - timing = Sys.time () - start - ret <- list(optns = optns, lambda = lambda, h = hMat, hInv = hInvMat, aligned = alignedMat, costs = rowMeans(distMat), timing = timing) - class(ret) <- 'WFDA' - - return(ret); -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/Wiener.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/Wiener.R deleted file mode 100644 index 6683cd26..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/Wiener.R +++ /dev/null @@ -1,53 +0,0 @@ -#' Simulate standard Wiener processes (Brownian motions) -#' -#' Simulate \code{n} standard Wiener processes on [0, 1], possibly -#' sparsifying the results. -#' -#' The algorithm is based on Karhunen-Loeve expansion. -#' -#' @param n Sample size. -#' @param pts A vector of points in [0, 1] specifying the support of the processes. -#' @param sparsify A vector of integers. The number of observations per curve will be uniform distribution on sparsify. -#' @param K The number of components. -#' -#' @return If \code{sparsify} is not specified, a matrix with \code{n} rows corresponding to the samples are returned. Otherwise the sparsified sample is returned. -#' -#' @seealso Sparsify -#' @export - -Wiener <- function(n=1, pts=seq(0, 1, length=50), sparsify=NULL, K=50) { - pts <- as.matrix(pts) - if (dim(pts)[1] < dim(pts)[2]) - pts <- t(pts) - - basis <- sqrt(2) * sin( pts %*% matrix(1:K - 1/2, 1, K) * pi ) - samp <- t(basis %*% diag(1 / (1:K - 1/2) / pi, K) %*% matrix(rnorm(K * n), K, n)) - - if (!is.null(sparsify)) { - samp <- Sparsify(samp, pts, sparsify) - } - - return(samp) - -} - -## sparsify samp -## samp: a matrix of samples, with rows containing the samples -## pts: a vector of grid points, should be from 0 to 1 -## sparsity: a vector of integers. The number of observation will be uniform distribution on sparsify. -#Sparsify <- function(samp, pts, sparsity) { -# if (length(sparsity) == 1) -# sparsity <- c(sparsity, sparsity) # avoid scalar case -# -# indEach <- lapply(1:nrow(samp), function(x) -# sort(sample(ncol(samp), sample(sparsity, 1)))) -# Lt <- lapply(indEach, function(x) pts[x]) -# Ly <- lapply(1:length(indEach), function(x) { -# ind <- indEach[[x]] -# y <- samp[x, ind] -# return(y) -# }) -# -# return(list(Lt=Lt, Ly=Ly)) -#} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/fitted.FPCA.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/fitted.FPCA.R deleted file mode 100644 index f3d43005..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/fitted.FPCA.R +++ /dev/null @@ -1,250 +0,0 @@ -#' Fitted functional sample from FPCA object -#' -#' Combine the zero-meaned fitted values and the interpolated mean to get the fitted values for the trajectories or the derivatives of these trajectories. -#' Estimates are given on the work-grid, not on the observation grid. Use ConvertSupport to map the estimates to your desired domain. \code{100*(1-alpha)}-percentage coverage intervals, or bands, for trajectory estimates (not derivatives) are provided. See details in example. -#' -#' @param object A object of class FPCA returned by the function FPCA(). -#' @param K The integer number of the first K components used for the representation. (default: length(fpcaObj$lambda )) -#' @param derOptns A list of options to control the derivation parameters specified by \code{list(name=value)}. See `Details'. (default = NULL) -#' @param ciOptns A list of options to control the confidence interval/band specified by \code{list(name=value)}. See `Details'. (default = NULL) -#' -#' @return If \code{alpha} is \code{NULL}, \code{p>1} or functional observations are dense, an \code{n} by \code{length(workGrid)} matrix, each row of which contains a sample. Otherwise, it returns a list which consists of the following items: -#' \item{workGrid}{An evaluation grid for fitted values.} -#' \item{fitted}{An n by length(workGrid) matrix, each row of which contains a sample.} -#' \item{cvgUpper}{An n by length(workGrid) matrix, each row of which contains the upper \code{alpha}-coverage limit} -#' \item{cvgLower}{An n by length(workGrid) matrix, each row of which contains the lower \code{alpha}-coverage limit} -#' @details Available derivation control options are -#' \describe{ -#' \item{p}{The order of the derivatives returned (default: 0, max: 2)} -#' \item{method}{The method used to produce the sample of derivatives ('FPC' (default) or 'QUO'). See Liu and Mueller (2009) for more details} -#' \item{bw}{Bandwidth for smoothing the derivatives (default: p * 0.10 * S)} -#' \item{kernelType}{Smoothing kernel choice; same available types are FPCA(). default('epan')} -#' } -#' @details Available confidence interval/band control options are -#' \describe{ -#' \item{alpha}{Significant level for confidence interval/band for trajectory coverage. default=0.05 (currently only work when p=0)} -#' \item{cvgMethod}{Option for trajectory coverage method beween 'interval' and 'band'. default='band'} -#' } -#' @param ... Additional arguments -#' -#' @examples -#' set.seed(1) -#' n <- 100 -#' pts <- seq(0, 1, by=0.05) -#' sampWiener <- Wiener(n, pts) -#' sampWiener <- Sparsify(sampWiener, pts, 5:10) -#' res <- FPCA(sampWiener$Ly, sampWiener$Lt, -#' list(dataType='Sparse', error=FALSE, kernel='epan', verbose=TRUE)) -#' fittedY <- fitted(res, ciOptns = list(alpha=0.05)) -#' -#' workGrid <- res$workGrid -#' cvgUpper <- fittedY$cvgUpper -#' cvgLower <- fittedY$cvgLower -#' -#' par(mfrow=c(2,3)) -#' ind <- sample(1:n,6) -#' for (i in 1:6) { -#' j <- ind[i] -#' plot(workGrid,cvgUpper[j,],type='l',ylim=c(min(cvgLower[j,]),max(cvgUpper[j,])),col=4,lty=2, -#' xlab='t', ylab='X(t)', main=paste(j,'-th subject',sep='')) -#' points(workGrid,cvgLower[j,],type='l',col=4,lty=2) -#' points(res$inputData$Lt[[j]],res$inputData$Ly[[j]]) -#' } -#' -#' @references -#' \cite{Yao, F., Mueller, H.-G. and Wang, J.-L. "Functional data analysis for sparse longitudinal data", Journal of the American Statistical Association, vol.100, No. 470 (2005): 577-590.} -#' -#' \cite{Liu, Bitao, and Hans-Georg Mueller. "Estimating derivatives for samples of sparsely observed functions, with application to online auction dynamics." Journal of the American Statistical Association 104, no. 486 (2009): 704-717. (Sparse data FPCA)} -#' @export - -fitted.FPCA <-function (object, K = NULL, derOptns = list(p=0), ciOptns = list(alpha=NULL, cvgMethod=NULL), ...) { - ddd <- list(...) - if (!is.null(ddd[['k']])) { - K <- ddd[['k']] - warning("specifying 'k' is deprecated. Use 'K' instead!") - } - - derOptns <- SetDerOptions(fpcaObject = object, derOptns) - p <- derOptns[['p']] - method <- derOptns[['method']] - bw <- derOptns[['bw']] # - kernelType <- derOptns[['kernelType']] - - alpha <- ciOptns[['alpha']] - if (is.null(alpha)==FALSE) { - if (alpha <= 0 || alpha >= 1) { - stop("'fitted.FPCA()' is requested to use a significant level between 0 and 1.") - } - } - - cvgMethod <- ciOptns[['cvgMethod']] - if (is.null(cvgMethod)==TRUE) { - cvgMethod <- 'band' - } - - fpcaObj <- object - # if (class(fpcaObj) != 'FPCA'){ - # stop("fitted.FPCA() requires an FPCA class object as basic input") - # } - - if( is.null(K) ){ - K = length( fpcaObj$lambda ) - } else { - if( ( round(K)>=0) && ( round(K) <= length( fpcaObj$lambda ) ) ){ - K = round(K); - } else { - stop("'fitted.FPCA()' is requested to use more components than it currently has available. (or 'K' is smaller than 0)") - } - } - - if( ! (p %in% c(0,1,2))){ - stop("'fitted.FPCA()' is requested to use a derivative order other than p = {0,1,2}!") - } - - if( p < 1 ){ - - ZMFV = fpcaObj$xiEst[, seq_len(K), drop = FALSE] %*% t(fpcaObj$phi[, seq_len(K), drop = FALSE]); - IM = fpcaObj$mu - - if (is.null(alpha)==TRUE || fpcaObj$optns$dataType=='Dense') { - return( t(apply( ZMFV, 1, function(x) x + IM))) - } else { - - bwMu <- fpcaObj$bwMu - mu = fpcaObj$mu - phi = fpcaObj$phi - obsGrid = fpcaObj$obsGrid - workGrid = fpcaObj$workGrid - lambda = fpcaObj$lambda - # covSmooth <- fpcaObj$smoothedCov - - cvgUpper <- cvgLower <- matrix(nrow=nrow(fpcaObj$xiEst), ncol=length(workGrid)) - for (i in 1:nrow(fpcaObj$xiEst)) { - xHat <- mu + ZMFV[i,] - - muObs <- Lwls1D(bw = bwMu, kernelType, win = rep(1,length(workGrid)), - xin = workGrid, yin = mu, xout = (fpcaObj$inputData)$Lt[[i]]) - - phiObs <- apply(phi, 2, function(phiI) Lwls1D(bw = bwMu, kernelType, win = rep(1, length(workGrid)), - xin = workGrid, yin = phiI, xout = (fpcaObj$inputData)$Lt[[i]])) - # HI <- diag(lambda)%*%t(phiObs) - # - # indI <- match(fpcaObj$inputData$Lt[[i]],obsGrid) - # covObsI <- covSmooth[indI,indI] - # - # if (is.null(fpcaObj$sigma2)==TRUE || fpcaObj$sigma2==0) { - # tmpSigma2 <- max(c(0.01,abs(min(diag(covObsI))))) - # covObsI <- covObsI + tmpSigma2*diag(1,nrow=nrow(covObsI),ncol=ncol(covObsI)) - # } else { - # covObsI <- covObsI + fpcaObj$sigma2*diag(1,nrow=nrow(covObsI),ncol=ncol(covObsI)) - # } - # - # omegaI <- diag(lambda) - HI%*%solve(covObsI)%*%t(HI) - - omegaI <- fpcaObj$xiVar[[i]] - - tmp <- eigen(omegaI) - tmpA <- Re(tmp$vectors) - tmpB <- Re(tmp$values) - tmpB[which(tmpB<0)] <- 0 - - if (length(tmpB)==1) { - omegaI <- tmpA*tmpB*t(tmpA) - } else { - omegaI <- tmpA%*%diag(tmpB)%*%t(tmpA) - } - - - if (cvgMethod=='interval') { - cvgUpper[i,] <- xHat + stats::qnorm(1-alpha/2)*sqrt(diag(phi%*%omegaI%*%t(phi))) - cvgLower[i,] <- xHat + stats::qnorm(alpha/2)*sqrt(diag(phi%*%omegaI%*%t(phi))) - } else { - cvgUpper[i,] <- xHat + sqrt(stats::qchisq(1-alpha,K)*diag(phi%*%omegaI%*%t(phi))) - cvgLower[i,] <- xHat - sqrt(stats::qchisq(1-alpha,K)*diag(phi%*%omegaI%*%t(phi))) - } - } - - return(list( - workGrid = workGrid, - fitted = t(apply( ZMFV, 1, function(x) x + IM)), - cvgUpper = cvgUpper, - cvgLower = cvgLower - ) - ) - - } - } else { #Derivative is not zero - - if( K > SelectK( fpcaObj, FVEthreshold=0.95, criterion='FVE')$K ){ - warning("Potentially you use too many components to estimate derivatives. \n Consider using SelectK() to find a more informed estimate for 'K'."); - } - - if( is.null(method) ){ - method = 'FPC' - } - - mu = fpcaObj$mu - phi = fpcaObj$phi - obsGrid = fpcaObj$obsGrid - workGrid = fpcaObj$workGrid - - if ( method == 'FPC'){ - phi = apply(phi, 2, function(phiI) Lwls1D(bw = bw, kernelType, win = rep(1, length(workGrid)), - xin = workGrid, yin = phiI, xout = workGrid, npoly = p, nder = p)) - mu = Lwls1D(bw = bw, kernelType, win = rep(1, length(workGrid)), xin = workGrid, yin = mu, xout = workGrid, npoly = p, nder = p) - ZMFV = fpcaObj$xiEst[, seq_len(K), drop = FALSE] %*% t(phi[, seq_len(K), drop = FALSE]); - IM = mu - return( t(apply( ZMFV, 1, function(x) x + IM) )) - } - - if( method == 'QUO'){ - impSample <- fitted(fpcaObj, K = K); # Look ma! I do recursion! - return( t(apply(impSample, 1, function(curve) Lwls1D(bw = bw, kernelType, win = rep(1, length(workGrid)), - xin = workGrid, yin = curve, xout = workGrid, npoly = p, nder = p)))) - } else if (method == 'DPC') { - if (K > ncol(fpcaObj[['xiDer']])) { - stop('fpcaObj does not contain K columns!') - } - return(tcrossprod(fpcaObj[['xiDer']][, seq_len(K), drop=FALSE], - fpcaObj[['phiDer']][, seq_len(K), drop=FALSE])) - }else { - stop('You asked for a derivation scheme that is not implemented.') - } - } - -} - -getEnlargedGrid <- function(x){ - N <- length(x) - return ( c( x[1] - 0.1 * diff(x[1:2]), x, x[N] + 0.1 * diff(x[(N-1):N])) ) -} - -getDerivative <- function(y, t, ord=1){ # Consider using the smoother to get the derivatives - if( length(y) != length(t) ){ - stop("getDerivative y/t lengths are unequal.") - } - newt = getEnlargedGrid(t) # This is a trick to get first derivatives everywhere - newy = Hmisc::approxExtrap(x=t, y=y, xout= newt)$y - - if (ord == 1) { - der <- numDeriv::grad( stats::splinefun(newt, newy) , x = t ) - } else if (ord == 2) { - der <- sapply(t, function(t0) - numDeriv::hessian( stats::splinefun(newt, newy) , x = t0 ) - ) - } - - return(der) -} - -getSmoothCurve <- function(t, ft, GCV = FALSE, kernelType = 'epan', mult = 1){ - myBw = ifelse( GCV, GCVLwls1D1( yy= ft, tt =t, npoly=1, nder=0, dataType='Sparse', kernel=kernelType)[['bOpt']] , - CVLwls1D( y= ft, t = t, npoly=1, nder=0, dataType='Sparse', kernel=kernelType, kFolds = 10)) - myBw <- myBw * mult - smoothCurve = Lwls1D(bw = myBw, kernel_type= kernelType, win = rep(1, length(t)), yin = ft, xout = t, xin= t) - return(smoothCurve) -} - - - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/fitted.FPCAder.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/fitted.FPCAder.R deleted file mode 100644 index 723e624c..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/fitted.FPCAder.R +++ /dev/null @@ -1,63 +0,0 @@ -#' Fitted functional sample from FPCAder object -#' -#' Combine the zero-meaned fitted values and the mean derivative to get the fitted values for the derivatives trajectories -#' Estimates are given on the work-grid, not on the observation grid. Use ConvertSupport to map the estimates to your desired domain. -#' -#' @param object A object of class FPCA returned by the function FPCA(). -#' @param K The integer number of the first K components used for the representation. (default: length(derObj$lambda )) -#' @param ... Additional arguments -#' -#' @return An \code{n} by \code{length(workGrid)} matrix, each row of which contains a sample. -#' -#' @examples -#' set.seed(1) -#' n <- 20 -#' pts <- seq(0, 1, by=0.05) -#' sampWiener <- Wiener(n, pts) -#' sampWiener <- Sparsify(sampWiener, pts, 10) -# #' res <- FPCA(sampWiener$Ly, sampWiener$Lt, -# #' list(dataType='Sparse', error=FALSE, kernel='epan', verbose=TRUE)) -# #' fittedY <- fitted(res) -#' @references -#' \cite{Liu, Bitao, and Hans-Georg Mueller. "Estimating derivatives for samples of sparsely observed functions, with application to online auction dynamics." Journal of the American Statistical Association 104, no. 486 (2009): 704-717. (Sparse data FPCA)} -#' @export - - -fitted.FPCAder <- function (object, K = NULL, ...) { - ddd <- list(...) - if (!is.null(ddd[['k']])) { - K <- ddd[['k']] - warning("specifying 'k' is deprecated. Use 'K' instead!") - } - - derObj <- object - # if (class(derObj) != 'FPCA'){ - # stop("fitted.FPCA() requires an FPCA class object as basic input") - # } - method <- derObj[['derOptns']][['method']] - - if (substr(method, 1, 3) == 'DPC') { - maxK <- length(derObj[['lambdaDer']]) - } else { - maxK <- length(derObj[['lambda']]) - } - - if( is.null(K)) { - K <- maxK - } else if (abs(K - round(K)) > 1e-5 || K <= 0) { - stop("'K' needs to be a positive integer") - } else if (K > maxK) { - stop("'fitted.FPCAder()' is requested to use more components than it currently has available.") - } - - if (substr(method, 1, 3) == 'DPC') { - fit <- tcrossprod(derObj[['xiDer']][, seq_len(K), drop=FALSE], - derObj[['phiDer']][, seq_len(K), drop=FALSE]) - } else if (substr(method, 1, 3) == 'FPC') { - fit <- tcrossprod(derObj[['xiEst']][, seq_len(K), drop=FALSE], - derObj[['phiDer']][, seq_len(K), drop=FALSE]) - } - fit <- fit + matrix(derObj[['muDer']], nrow(fit), ncol(fit), byrow=TRUE) - - return(fit) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/kCFC.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/kCFC.R deleted file mode 100644 index 5bdd2b79..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/kCFC.R +++ /dev/null @@ -1,113 +0,0 @@ -#' Functional clustering and identifying substructures of longitudinal data using kCFC. -#' -#' @param y A list of \emph{n} vectors containing the observed values for each individual. Missing values specified by \code{NA}s are supported for dense case (\code{dataType='dense'}). -#' @param t A list of \emph{n} vectors containing the observation time points for each individual corresponding to y. -#' @param k A scalar defining the number of clusters to define; default 3. Values that define very small clusters (eg.cluster size <=3) will potentiall err. -#' @param kSeed A scalar valid seed number to ensure replication; default: 123 -#' @param maxIter A scalar defining the maximum number of iterations allowed; default 20, common for both the simple kmeans initially and the subsequent k-centres -#' @param optnsSW A list of options control parameters specified by \code{list(name=value)} to be used for sample-wide FPCA; by default: "list( methodMuCovEst ='smooth', FVEthreshold= 0.90, methodBwCov = 'GCV', methodBwMu = 'GCV' )". See `Details in ?FPCA'. -#' @param optnsCS A list of options control parameters specified by \code{list(name=value)} to be used for cluster-specific FPCA; by default: "list( methodMuCovEst ='smooth', FVEthreshold= 0.70, methodBwCov = 'GCV', methodBwMu = 'GCV' )". See `Details in ?FPCA'. -#' -#' @return A list containing the following fields: -#' \item{cluster}{A vector of levels 1:k, indicating the cluster to which each curve is allocated.} -#' \item{fpcaList}{A list with the fpcaObj for each separate cluster.} -#' \item{iterToConv}{A number indicating how many iterations where required until convergence.} -#' -#' @examples -#' data(medfly25) -#' Flies <- MakeFPCAInputs(medfly25$ID, medfly25$Days, medfly25$nEggs) -#' kcfcObj <- kCFC(Flies$Ly[1:250], Flies$Lt[1:250], # using only 250 for speed consideration -#' optnsSW = list(methodMuCovEst = 'smooth', userBwCov = 2, FVEthreshold = 0.90), -#' optnsCS = list(methodMuCovEst = 'smooth', userBwCov = 2, FVEthreshold = 0.70)) -#' @references -#' \cite{Jeng-Min Chiou, Pai-Ling Li, "Functional clustering and identifying substructures of longitudinal data." Journal of the Royal Statistical Society 69 (2007): 679-699} -#' @export - -kCFC = function(y, t, k = 3, kSeed = 123, maxIter = 125, - optnsSW = list( methodMuCovEst = 'smooth', FVEthreshold = 0.90, methodBwCov = 'GCV', methodBwMu = 'GCV'), - optnsCS = list( methodMuCovEst = 'smooth', FVEthreshold = 0.70, methodBwCov = 'GCV', methodBwMu = 'GCV')){ - - if( (k <2) || (floor(length(y)*0.5) < k) ){ - warning("The value of 'k' is outside [2, 0.5*N]; reseting to 3.") - } - if(maxIter <1){ - stop("Please allow at least 1 iteration.") - } - - ## First FPCA - fpcaObjY <- FPCA(y, t, optnsSW) - N <- length(y) - if( fpcaObjY$optns$dataType == 'Sparse' ){ - stop(paste0("The data has to be 'Dense' for kCFC to be relevant; the current dataType is : '", fpcaObjY$optns$dataType,"'!") ) - } - - ## Initial clustering and cluster-associated FPCAs - if(!is.null(kSeed)){ - set.seed(kSeed) - } - initialClustering <- kmeans( fpcaObjY$xiEst, centers = k, algorithm = "MacQueen", iter.max = maxIter) - clustConf0 <- as.factor(initialClustering$cluster) - indClustIds <- lapply(levels(clustConf0), function(u) which(clustConf0 == u) ) - if( any( min( sapply( indClustIds, length)) <= c(3)) ){ - stop(paste0("kCFC stopped during the initial k-means step. The smallest cluster has three (or less) curves. " , - "Consider using a smaller number of clusters (k) or a different random seed (kSeed).")) - } - listOfFPCAobjs <- lapply(indClustIds, function(u) FPCA(y[u], t[u], optnsCS) ) - - ## Iterative clustering - ymat <- List2Mat(y,t); - convInfo <- "None" - clustConf <- list() - - for(j in seq_len(maxIter)){ - - # Get new costs and relevant cluster configuration - iseCosts <- sapply(listOfFPCAobjs, function(u) GetISEfromFPCA(u, ymat)) - clustConf[[j]] <- as.factor(apply(iseCosts, 1, which.min)) - - # Check that clustering progressed reasonably - #ie. Still having k clster AND the minimum cluster size is reasonable - if( (length(unique(clustConf[[j]])) < k) || any( min(summary(clustConf[[j]])) <= c(0.01 * N,3))){ - convInfo <- ifelse( length(unique(clustConf[[j]])) < k , "LostCluster", "TinyCluster") - break; - } - # Check if algorithm converged - if( (j>1) && any(sapply(clustConf[1:(j-1)], function(u) all(u == clustConf[[j]]))) ){ - convInfo <- "WeMadeIt!" - break; - } - - indClustIds <- lapply(levels(clustConf[[j]]), function(u) which(clustConf[[j]] == u) ) - listOfFPCAobjs <- lapply(indClustIds, function(u) FPCA(y[u], t[u], optnsCS) ) - curvesThatChanged <- ifelse(j > 1, sum(!( as.numeric(clustConf[[j]]) == as.numeric(clustConf[[j-1]] ))), - sum(!( as.numeric(clustConf[[j]]) == as.numeric(clustConf0)))) - } - - if(convInfo == 'None'){ - warning(paste0( 'FkC did not converge after maxIter = ', maxIter, ' iterations. ', curvesThatChanged, ' curve(s) are undecided.')) - } - if(convInfo == 'TinyCluster'){ - warning(paste0("kCFC did not fully converge. It stopped because the smallest cluster has ", - "less than 1% of the samples' curves. Consider using a smaller number of clusters.")) - } - if(convInfo == 'LostCluster'){ - warning(paste0("kCFC did not fully converge. It stopped because it 'lost a cluster'. Consider using a smaller number of clusters.")) - } - - kCFCobj <- list(cluster = clustConf[[j]], fpcaList = listOfFPCAobjs, iterToConv = j-1, prevConf = clustConf, clustConf0 = clustConf0) - class(kCFCobj) <- 'kCFCobj' - return( kCFCobj ) -} - -GetISEfromFPCA = function(fpcaObj,ymat){ - # First get the fitted curves for all the sample based on the mu/phi/lambda/sigma2 - # of 'fpcaObj' and then calculate their associated ISE; 'iseCost' is a n-dim vector. - phiObs <- ConvertSupport(fpcaObj$workGrid, fpcaObj$obsGrid, phi=fpcaObj$phi) - muObs <- ConvertSupport(fpcaObj$workGrid, fpcaObj$obsGrid, mu=fpcaObj$mu) - - numIntResults <- GetINScores(ymat = ymat, t = fpcaObj$obsGrid, optns = fpcaObj$optns, mu = muObs, - lambda = fpcaObj$lambda, phi = phiObs, sigma2 = fpcaObj$sigma2) - - iseCost <- apply((numIntResults[['fittedY']] - ymat)^2, 1, function(y) {notNA <- !is.na(y); trapzRcpp(X = fpcaObj$obsGrid[notNA], Y = y[notNA])}) - return( iseCost ) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/medfly25.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/medfly25.R deleted file mode 100644 index a01decc7..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/medfly25.R +++ /dev/null @@ -1,20 +0,0 @@ -#' Number of eggs laid daily from medflies -#' -#' A dataset containing the eggs laid from 789 medflies (Mediterranean fruit flies, -#' Ceratitis capitata) during the first 25 days of their lives. This is a subset of -#' the dataset used by Carey at al. (1998); only flies having lived at least 25 days -#' are shown. At the end of the recording period all flies were still alive. -#' -#' @name medfly25 -#' @docType data -#' @format A data frame with 19725 rows and 3 variables: -#' \describe{ -#' \item{ID}{: Medfly ID according to the orignal dataset} -#' \item{Days}{: Day of measurement} -#' \item{nEggs}{: Number of eggs laid at that particular day} -#' \item{nEggsRemain}{: Remaining total number of eggs laid} -#' } -#' @source \url{http://anson.ucdavis.edu/~mueller/data/medfly1000.html} -#' @references -#' {Carey, J.R., Liedo, P., Mueller, H.G., Wang, J.L., Chiou, J.M. (1998). Relationship of age patterns of fecundity to mortality, longevity, and lifetime reproduction in a large cohort of Mediterranean fruit fly females. J. of Gerontology --Biological Sciences 53, 245-251. } -NULL diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/pkgname.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/pkgname.R deleted file mode 100644 index 0118d05d..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/pkgname.R +++ /dev/null @@ -1,42 +0,0 @@ -#' PACE: Principal Analysis by Conditional Expectation -#' -#' PACE package for Functional Data Analysis and Empirical Dynamics. -#' -#' PACE is a versatile package that provides implementation of various methods -#' of Functional Data Analysis (FDA) and Empirical Dynamics. The core of this -#' package is Functional Principal Component Analysis (FPCA), a key technique -#' for functional data analysis, for sparsely or densely sampled random -#' trajectories and time courses, via the Principal Analysis by Conditional -#' Estimation (PACE) algorithm. PACE is useful for the analysis of data that -#' have been generated by a sample of underlying (but usually not fully -#' observed) random trajectories. It does not rely on pre-smoothing of -#' trajectories, which is problematic if functional data are sparsely sampled. -#' PACE provides options for functional regression and correlation, for -#' Longitudinal Data Analysis, the analysis of stochastic processes from -#' samples of realized trajectories, and for the analysis of underlying -#' dynamics. -#' -#' -#' @author -#' Xiongtao Dai \email{dai@@ucdavis.edu}, -#' Pantelis Z. Hadjipantelis \email{pantelis@@ucdavis.edu}, -#' Hao Ji \email{haoji@@ucdavis.edu} -#' Hans-Georg Mueller \email{hgmueller@@ucdavis.edu} -#' Jane-Ling Wang \email{janelwang@@ucdavis.edu} -#' -#' Maintainer: Pantelis Z. Hadjipantelis \email{pantelis@@ucdavis.edu} -#' -#' @docType package -#' @name fdapace -#' @useDynLib fdapace -#' @import Rcpp -#' @importFrom Matrix Matrix -#' @importFrom Hmisc approxExtrap -#' @importFrom pracma meshgrid midpoint mod ones uniq -#' @importFrom numDeriv grad hessian -#' @importFrom grDevices colorRampPalette dev.new palette -#' @importFrom graphics abline barplot boxplot grid legend lines matlines matplot par plot points polygon -#' @importFrom stats aggregate approx approxfun cov dist fitted kmeans lm median na.omit optim predict quantile rnorm runif spline var sd poly weighted.mean cor dunif -#' @importFrom utils installed.packages -#' @importFrom MASS isoMDS mvrnorm -NULL diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/plot.FPCA.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/plot.FPCA.R deleted file mode 100644 index 2ae892bf..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/plot.FPCA.R +++ /dev/null @@ -1,121 +0,0 @@ -#' Plot an FPCA object. -#' -#' This function plot the results for an FPCA. It prints the design plot, mean function, scree-plot -#' and the first three eigenfunctions of a sample. If provided with a derivative options object (?FPCAder) it will return the -#' differentiated mean and first two principal modes of variations for 50\%, 75\%, 100\%, 125\% and 150\% of the defined bandwidth choice. -#' -#' @param x An FPCA class object returned by FPCA(). -#' @param openNewDev A logical specifying if a new device should be opened - default: FALSE -#' @param addLegend A logical specifying whether to add legend. -#' -#' @details The black, red, and green curves stand for the first, second, and third eigenfunctions, respectively. -#' \code{plot.FPCA} is currently implemented only for the original function, but not a derivative FPCA object. - -#' -#' @examples -#' set.seed(1) -#' n <- 20 -#' pts <- seq(0, 1, by=0.05) -#' sampWiener <- Wiener(n, pts) -#' sampWiener <- Sparsify(sampWiener, pts, 10) -#' res1 <- FPCA(sampWiener$Ly, sampWiener$Lt, -#' list(dataType='Sparse', error=FALSE, kernel='epan', verbose=FALSE)) -#' plot(res1) -#' @export -plot.FPCA <- function(x, openNewDev = FALSE, addLegend=TRUE, ...){ - - fpcaObj <- x - - oldPar <- par(no.readonly=TRUE) - if (any(oldPar[['pin']] < 0)) { - stop('Figure margin too large') - } else { - on.exit(par(oldPar)) - } - - if(!'FPCA' %in% class(fpcaObj)) { - stop("Input class is incorrect; plot.FPCA() is only usable for FPCA objects.") - } else { - - #if(is.null(derOptns) || !is.list(derOptns)){ - t = fpcaObj$inputData$Lt - if(openNewDev){ - dev.new(width=6.2, height=6.2, noRStudioGD=TRUE) ; - } - fves = fpcaObj$cumFVE - mu = fpcaObj$mu - obsGrid = fpcaObj$obsGrid - workGrid = fpcaObj$workGrid - - par(mfrow=c(2,2)) - - ## Make Design plot - CreateDesignPlot(t, addLegend=addLegend, noDiagonal=fpcaObj$optns$error) - - ## Make Mean trajectory plot - plot( workGrid, mu, type='l', xlab='s',ylab='', main='Mean Function', panel.first = grid(), axes = TRUE) - - ## Make Scree plot - CreateScreePlot(fpcaObj); - - ## Make Phi plot - K = ncol(fpcaObj$phi); - k =1; - if(K>3){ - k = 3; - } else { - k = K; - } # paste(c("First ", as.character(3), " eigenfunctions"),collapse= '') - if (addLegend) { - ## pin does not work for Rstudio - # newpin <- par()[['pin']] - # newpin[1] <- newpin[1] * 0.8 - # par(pin = newpin) - newplt <- par()[['plt']] - newplt[2] <- newplt[1] + 0.85 * (newplt[2] - newplt[1]) - par(plt=newplt) - } - matplot(workGrid, fpcaObj$phi[,1:k], type='n', - main=paste(collapse='', c("First ", as.character(k), " Eigenfunctions")) , xlab='s', ylab='') - abline(h=0, col='gray9') - grid() - matlines(workGrid, fpcaObj$phi[,1:k] ) - pars <- par() - if (addLegend) { - legend("right", col=1:k, lty=1:k, legend = do.call(expression, sapply(1:k, function(u) return(bquote(phi[ .(u) ])))), border = FALSE, xpd=TRUE, inset=-pars[['mai']][4] / pars[['pin']][1] * 1.8, seg.len=1.2) - } - # } else { - # - # derOptns <- SetDerOptions(fpcaObj,derOptns = derOptns) - # p <- derOptns[['p']] - # method <- derOptns[['method']] - # bw <- derOptns[['bw']] - # kernelType <- derOptns[['kernelType']] - # k <- derOptns[['k']] - # if(p==0){ - # stop("Derivative diagnostics are inapplicable when p = 0") - # } - # - # bwMultipliers = seq(0.50,1.5,by=0.25) - # yy = lapply( bwMultipliers * bw, function(x) FPCAder(fpcaObj, list(p=p, method = method, kernelType = kernelType, k = k, bw = x))) - # - # par(mfrow=c(1,3)) - # - # Z = rbind(sapply(1:5, function(x) yy[[x]]$muDer)); - # matplot(x = fpcaObj$workGrid, lty= 1, type='l', Z, ylab= expression(paste(collapse = '', 'd', mu, "/ds")), - # main= substitute(paste("Derivatives of order ", p, " of ", mu)), xlab = 's') - # grid(); legend('topright', lty = 1, col=1:5, legend = apply( rbind( rep('bw: ',5), bwMultipliers * bw), 2, paste, collapse = '')) - # - # Z = rbind(sapply(1:5, function(x) yy[[x]]$phiDer[,1])); - # matplot(x = fpcaObj$workGrid, lty= 1, type='l', Z, ylab= expression(paste(collapse = '', 'd', phi[1], "/ds")), - # main= substitute(paste("Derivatives of order ", p, " of ", phi[1])), xlab = 's') - # grid(); legend('topright', lty = 1, col=1:5, legend = apply( rbind( rep('bw: ',5), bwMultipliers * bw), 2, paste, collapse = '')) - # - # Z = rbind(sapply(1:5, function(x) yy[[x]]$phiDer[,2])); - # matplot(x = fpcaObj$workGrid, lty= 1, type='l', Z, ylab= expression(paste(collapse = '', 'd', phi[2], "/ds")), - # main= substitute(paste("Derivatives of order ", p, " of ", phi[2])), xlab = 's') - # grid(); legend('topleft', lty = 1, col=1:5, legend = apply( rbind( rep('bw: ',5), bwMultipliers * bw), 2, paste, collapse = '')) - - } -} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/predict.FPCA.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/predict.FPCA.R deleted file mode 100644 index 7b91a51a..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/predict.FPCA.R +++ /dev/null @@ -1,96 +0,0 @@ -#' Predict FPC scores for a new sample given an FPCA object -#' -#' Return a matrix with the first K FPC scores according to conditional expectation or numerical integration. -#' -#' @param object An FPCA object. -#' @param newLy A list of \emph{n} vectors containing the observed values for each individual. -#' @param newLt A list of \emph{n} vectors containing the observation time points for each individual corresponding to y. -#' @param sigma2 The user-defined measurement error variance. A positive scalar. (default: rho if applicable, otherwise sigma2 if applicable, otherwise 0 if no error. ) -#' @param K The scalar defining the number of clusters to define; (default: 1). -#' @param xiMethod The integration method used to calculate the functional principal component scores ( standard numerical integration 'IN' or conditional expectation 'CE'); default: 'CE'. -#' @param ... Not used. -#' -#' @return A matrix of size n-by-K -#' -#' @examples -#' set.seed(1) -#' n <- 50 -#' pts <- seq(0, 1, by=0.05) -#' # The first n samples are for training and the rest testing -#' sampWiener <- Wiener(2 * n, pts) -#' sparsity <- 2:5 -#' train <- Sparsify(sampWiener[seq_len(n), , drop=FALSE], pts, sparsity) -#' test <- Sparsify(sampWiener[seq(n + 1, 2 * n), , drop=FALSE], pts, sparsity) -#' res <- FPCA(train$Ly, train$Lt) -#' pred <- predict(res, test$Ly, test$Lt, K=5) -#' plot(pred[, 1], pred[, 2]) -#' -#' @method predict FPCA -#' @export - -predict.FPCA <- function(object, newLy, newLt, sigma2 = NULL, K = 1, xiMethod = 'CE', ...){ - fpcaObj = object; - - if(class(fpcaObj) != "FPCA"){ - stop('Please provide a valid FPCA object.') - } - - if(! all.equal( sapply(newLt, length), sapply(newLy, length) ) ){ - stop('The size of the vectors in newLt and newLy differ. They must be equal.') - } - - # Standard data checks/massasing as in FPCA() - CheckData(newLy, newLt) - inputData <- HandleNumericsAndNAN(Lt = newLt, Ly = newLy); - newLy <- inputData$Ly; - newLt <- inputData$Lt; - - if(is.null(sigma2)){ - sigma2 <- ifelse( !is.null(fpcaObj$rho), fpcaObj$rho, - ifelse( !is.null(fpcaObj$sigma2), fpcaObj$sigma2, - ifelse( !fpcaObj$optns$error, 0, stop('sigma2 cannot be determined.')))) - } else { - if(!is.numeric(sigma2) ){ - stop('sigma2 is not numeric, we sure about this? :D') - } - } - - if(K > fpcaObj$selectK){ - stop( paste0( collapse = '', 'You cannot get FPC scores for more components than what is already available. (', fpcaObj$selectK ,').' )) - } - - if( !(xiMethod %in% c('CE','IN')) ){ - stop( paste0( collapse = '', 'Unrecognised method to calculate the FPC scores.')) - } - if( (fpcaObj$optns$dataType == 'Sparse') && (xiMethod == 'IN')){ - stop( 'Trapezoid Numerical intergration (IN) is invalid for sparse data.') - } - - rangeOfOrigData <- range(unlist(fpcaObj$workGrid)) - rangeOfNewData <- range(unlist(newLt)) - - if(rangeOfNewData[1] < rangeOfOrigData[1]){ - stop("The new data's lower range is below the original data's lower range.") - } else{ - if(rangeOfNewData[2] > rangeOfOrigData[2]){ - stop("The new data's upper range is above the original data's upper range.") - } - } - - MuObs = ConvertSupport(fromGrid = fpcaObj$workGrid, toGrid = fpcaObj$obsGrid, mu = fpcaObj$mu) - CovObs = ConvertSupport(fromGrid = fpcaObj$workGrid, toGrid = fpcaObj$obsGrid, Cov = fpcaObj$fittedCov) - PhiObs = ConvertSupport(fromGrid = fpcaObj$workGrid, toGrid = fpcaObj$obsGrid, phi = fpcaObj$phi) - - # Get scores - if ( xiMethod == 'CE') { - scoresObj <- GetCEScores(y = newLy, t = newLt, optns = fpcaObj$optns, mu = MuObs, obsGrid = fpcaObj$obsGrid, sigma2 = sigma2, - fittedCov = CovObs, lambda = fpcaObj$lambda, phi = PhiObs) - finalXiEst <- t(do.call(cbind, scoresObj['xiEst', ]))[, seq_len(K), drop=FALSE] - } else if (xiMethod == 'IN') { - ymat = List2Mat(newLy,newLt) - scoresObj <- GetINScores(ymat = ymat, t = newLt,optns = fpcaObj$optns,mu = MuObs,lambda =fpcaObj$lambda ,phi = PhiObs,sigma2 = sigma2) - finalXiEst <- scoresObj$xiEst[, seq_len(K), drop=FALSE] - } - - return(finalXiEst) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/print.FPCA.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/print.FPCA.R deleted file mode 100644 index 29e0487b..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/print.FPCA.R +++ /dev/null @@ -1,31 +0,0 @@ -#' Print an FPCA object -#' -#' Print a simple description of an FPCA object -#' -#' @param x An FPCA object. -#' @param ... Not used. -#' -#' @examples -#' set.seed(1) -#' n <- 20 -#' pts <- seq(0, 1, by=0.05) -#' sampWiener <- Wiener(n, pts) -#' sampWiener <- Sparsify(sampWiener, pts, 10) -#' res <- FPCA(sampWiener$Ly, sampWiener$Lt) -#' res -#' -#' @method print FPCA -#' @export -print.FPCA <- function(x, ...){ - obj = x; - cat(paste0("Functional Principal Components Object for ", tolower(obj$optns$dataType), " data.\n\n")) - cat(paste0("The optimal number of components selected is: ", length(obj$lambda), ", and \nthe first K (<=3) eigenvalues are: ")) - if ( length(obj$lambda) < 4) { - cat(paste0( round(obj$lambda,3) ,"\n")) - } else { - cat(paste0( round(obj$lambda[1:3],3) ,"\n")) - } -} - - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/print.FSVD.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/print.FSVD.R deleted file mode 100644 index b01de9a4..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/print.FSVD.R +++ /dev/null @@ -1,32 +0,0 @@ -#' Print an FSVD object -#' -#' Print a simple description of an FSVD object -#' -#' @param x An FSVD object. -#' @param ... Not used. -#' -#' @method print FSVD -#' @export -print.FSVD <- function(x, ...){ - obj = x; - thisDataType <- NULL - if(obj$optns$SVDopts$dataType1 == 'Dense' && obj$optns$SVDopts$dataType2 == 'Dense'){ - thisDataType <- 'Dense' - } else { - thisDataType <- 'Sparse' - } - if(obj$optns$SVDopts$dataType1 == 'DenseWithMV' && obj$optns$SVDopts$dataType2 == 'DenseWithMV'){ - thisDataType <- 'DenseWithMV' - } - - cat(paste0("Functional Singular Value Decomposition object for ", tolower(thisDataType), " data.\n\n")) - cat(paste0("The optimal number of components selected is: ", length(obj$sValues)," and \nthe first K (<=3) singular values are: ")) - if ( length(obj$sValues) < 4) { - cat(paste0( round(obj$sValues,3) ,"\n")) - } else { - cat(paste0(round(obj$sValues[1:3],3) ,"\n")) - } -} - - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/print.WFDA.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/print.WFDA.R deleted file mode 100644 index d4d9c461..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/print.WFDA.R +++ /dev/null @@ -1,18 +0,0 @@ -#' Print a WFDA object -#' -#' Print a simple description of a WFDA object -#' -#' @param x A WFDA object. -#' @param ... Not used. -#' -#' @method print WFDA -#' @export -print.WFDA <- function(x, ...){ - obj = x; - - cat(paste0("Warped Functional Data Analysis object for ", length(obj$costs), " curves.\n\n")) - cat(paste0("The penalty parameter used was: ", signif(obj$lambda,6), ", the warping functions ", - ifelse(obj$optns$isPWL,"are ", "are not"), "piece-wise linear \n", - "and the pairwise warping was done using the ", obj$optns$choice, " averages of the warped curves.\n" )) -} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/R/str.FPCA.R b/fdapace.Rcheck/00_pkg_src/fdapace/R/str.FPCA.R deleted file mode 100644 index 339b0e6f..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/R/str.FPCA.R +++ /dev/null @@ -1,10 +0,0 @@ -#' Compactly display the structure of an FPCA object -#' -#' @param object An FPCA object -#' @param ... Not used -#' -#' @export -str.FPCA <- function(object, ...) { - fpcaObj <- object - NextMethod(max.level=1) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/README.md b/fdapace.Rcheck/00_pkg_src/fdapace/README.md deleted file mode 100644 index aca1c48d..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/README.md +++ /dev/null @@ -1,26 +0,0 @@ - -PACE package for Functional Data Analysis and Empirical Dynamics -==== - -[![Build Status](https://travis-ci.org/functionaldata/tPACE.svg?branch=master)](https://travis-ci.org/functionaldata/tPACE) -[![cran version](http://www.r-pkg.org/badges/version/fdapace)](https://cran.r-project.org/web/packages/fdapace) -[![downloads](http://cranlogs.r-pkg.org/badges/fdapace)](http://cranlogs.r-pkg.org/badges/fdapace) -[![total downloads](http://cranlogs.r-pkg.org/badges/grand-total/fdapace)](http://cranlogs.r-pkg.org/badges/grand-total/fdapace) - -## Installation of the current development version -You can install the development version of the package in R using: -``` -devtools::install_github("functionaldata/tPACE") -``` - -## Installation of the latest CRAN release -You can install the package in R using: -``` -install.packages("fdapace") -``` - -## Load Package and Data -Once installed you can load the package with: -``` -library(fdapace) -``` diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/build/vignette.rds b/fdapace.Rcheck/00_pkg_src/fdapace/build/vignette.rds deleted file mode 100644 index 63da3e5a..00000000 Binary files a/fdapace.Rcheck/00_pkg_src/fdapace/build/vignette.rds and /dev/null differ diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/data/medfly25.RData b/fdapace.Rcheck/00_pkg_src/fdapace/data/medfly25.RData deleted file mode 100644 index c0c1f8c8..00000000 Binary files a/fdapace.Rcheck/00_pkg_src/fdapace/data/medfly25.RData and /dev/null differ diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/deleted_files b/fdapace.Rcheck/00_pkg_src/fdapace/deleted_files deleted file mode 100644 index 5e04bf78..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/deleted_files +++ /dev/null @@ -1,15 +0,0 @@ -M DESCRIPTION -M R/CreateDesignPlot.R -A R/DynCorr.R -A R/Dyn_test.R -D R/TVAM.R -M R/WFDA.R -M man/CreateDesignPlot.Rd -A man/DynCorr.Rd -A man/Dyn_test.Rd -D man/TVAM.Rd -M man/WFDA.Rd -A tests/testthat/test_DynCorr.R -A tests/testthat/test_Dyn_test.R -D tests/testthat/test_TVAM.R -M tests/testthat/test_WFDA.R diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/file_history b/fdapace.Rcheck/00_pkg_src/fdapace/file_history deleted file mode 100644 index 39a2cf17..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/file_history +++ /dev/null @@ -1,11961 +0,0 @@ -commit 96ec47d15e807d745ea0553ee3d423123d45f114 -Merge: 84cdaac c941c4e -Author: yqgchen -Date: Wed Mar 20 23:36:03 2019 -0700 - - Merge pull request #43 from functionaldata/tv-additive - - merge TVAM - -commit 84cdaac531df4823cb67470c485a0ee18e106be7 -Merge: fefad3f 838a363 -Author: yqgchen -Date: Wed Mar 20 22:30:07 2019 -0700 - - Merge pull request #44 from functionaldata/revert-tvam - - revert tvam on the master - -commit 838a36358de4aa07c152d7735f3cad9bee222115 -Author: yqgchen -Date: Wed Mar 20 21:55:06 2019 -0700 - - revert tvam on the master - -M NAMESPACE -M man/FPCquantile.Rd -D tests/testthat/test_TVAM.R - -commit c941c4e7c73fa310c349864d176f8587d692f714 -Author: yqgchen -Date: Wed Mar 20 18:27:10 2019 -0700 - - add back TVAM R and Rd files - -A R/TVAM.R -A man/TVAM.Rd - -commit 9619813b3f923ee9e379808b122ec97d44b42d20 -Author: yqgchen -Date: Wed Mar 20 18:25:38 2019 -0700 - - rm TVAM R and Rd files - -D R/TVAM.R -D man/TVAM.Rd - -commit fefad3f4ff64996f72ba7f4a61f795e267e64aa1 -Merge: 0d984c6 0bf4f2f -Author: yqgchen -Date: Wed Mar 20 18:16:10 2019 -0700 - - solve conflicts on TVAM merging - -commit 0bf4f2f556feafd3f7b54124895cfd643fe76972 -Author: hadjipantelis -Date: Wed Mar 20 08:47:32 2019 +0000 - - Minor changes and ver bump - -M DESCRIPTION -M NAMESPACE -M R/CreateBWPlot.R -M R/FPCA.R -M R/TVAM.R -M man/CreateBWPlot.Rd -M man/TVAM.Rd - -commit 610ff066b4c59959f6c51e86e08420ffa0aa7e28 -Author: Cody Carroll -Date: Tue Mar 5 17:01:00 2019 -0800 - - tvam unit test fix - -M tests/testthat/test_TVAM.R - -commit 8bb30b5e9b66a4a705d296bff4737e2bbf079849 -Merge: b95fa5e bf6ef49 -Author: Cody Carroll -Date: Tue Mar 5 16:18:40 2019 -0800 - - Merge branch 'tv-additive' of https://github.com/functionaldata/tPACE into tv-additive - e - -commit b95fa5e1fbe3eb25ecc640d6881c19a882acb708 -Author: Cody Carroll -Date: Tue Mar 5 16:18:11 2019 -0800 - - checking issues with unit test - -M tests/testthat/test_TVAM.R - -commit bf6ef4929e6adf2963d673be9869a68d8dca90b1 -Author: yqgchen -Date: Tue Mar 5 16:14:35 2019 -0800 - - add two lines as suggested in travis checks - - importFrom("stats", "binomial", "glm") - importFrom("utils", "head", "tail") - -M NAMESPACE - -commit 1293648df1ae4e9bb58fa301188dba0a63864c3a -Author: yqgchen -Date: Tue Mar 5 11:24:00 2019 -0800 - - ran document() - -M DESCRIPTION -M man/FAM.Rd -M man/FOptDes.Rd -M man/GetCrCovYX.Rd -M man/GetNormalisedSample.Rd -M man/MakeGPFunctionalData.Rd -M man/MakeSparseGP.Rd -M man/MultiFAM.Rd -M man/Wiener.Rd -M man/kCFC.Rd - -commit 227d12143581e370d1ad3ae6e1cb83b113715b77 -Author: Cody Carroll -Date: Mon Mar 4 23:01:20 2019 -0800 - - TVAM unit test fix - -M tests/testthat/test_TVAM.R - -commit 03c2327894690fca25cfaa9d1e52f803145744f8 -Author: Cody Carroll -Date: Mon Mar 4 19:51:02 2019 -0800 - - TVAM unit tests - -M R/RcppExports.R -M src/RcppExports.cpp -A tests/testthat/test_TVAM.R - -commit 0d984c6d2975c0f18aa33efcab71aca8d542b20c -Merge: 596bf33 f9c23c1 -Author: yqgchen -Date: Fri Mar 1 21:27:05 2019 -0800 - - Merge pull request #41 from functionaldata/trajectCvg - - add prediction band for individual prediction - -commit 596bf33634b26bca22b7073c7a132cda58891637 -Merge: ad03d13 ecdbd2f -Author: yqgchen -Date: Fri Mar 1 20:11:44 2019 -0800 - - Merge pull request #40 from functionaldata/quantileregression - - merge Quantile Regression to the master - -commit ecdbd2f57bc5ab5a646532daf6c68a05be58ff53 -Merge: d692a6d ad03d13 -Author: yqgchen -Date: Fri Mar 1 19:23:58 2019 -0800 - - Merge branch 'master' into quantileregression - -commit d692a6df7b1cd5c10f63f4a8d899f49816601372 -Author: yqgchen -Date: Fri Mar 1 19:18:11 2019 -0800 - - update namespace - -M NAMESPACE - -commit dd8f7f7e929da225024e43c3b39131e409f70c2c -Author: yqgchen -Date: Fri Mar 1 17:47:58 2019 -0800 - - update equantion in the documentation - -M man/FPCquantile.Rd - -commit 649ee5c056064d7312294fe91f097f5a50929db8 -Author: yqgchen -Date: Fri Mar 1 17:46:11 2019 -0800 - - update equations in the documentation - -M R/FPCquantile.R - -commit 1bd8b150068840c5610fffabb93dcd6fce810c49 -Author: yqgchen -Date: Fri Mar 1 17:27:50 2019 -0800 - - update FPCquantile.Rd - -A man/FPCquantile.Rd - -commit ec7d1421139189bb7e817d9535c0d99876039fe7 -Author: yqgchen -Date: Fri Mar 1 17:27:14 2019 -0800 - - Delete FPCquantile.Rd - -D man/FPCquantile.Rd - -commit 42ac3cb23fb2f00f57c756fb977169b5c9b0ec18 -Author: yqgchen -Date: Fri Mar 1 17:26:31 2019 -0800 - - bug fix in the example - -M R/FPCquantile.R - -commit ad03d138d58d43b99691ca57ade9b2535dff22d9 -Merge: 899ad7d f1ccad2 -Author: yqgchen -Date: Fri Mar 1 10:00:17 2019 -0800 - - Merge pull request #31 from schoonees/patch-1 - - Typo fdapaceVig.Rmd - -commit 899ad7ddb86be60ff031454cef391dd7501739cb -Merge: 2aec1c3 b209d0f -Author: yqgchen -Date: Fri Mar 1 09:59:27 2019 -0800 - - Merge pull request #39 from functionaldata/descFix - - fix DESCRIPTION - -commit b209d0fe3e101983493f9422735ac0e627dff67b -Author: yqgchen -Date: Thu Feb 28 23:56:11 2019 -0800 - - other fix - -D man/FPCRegS.Rd -M man/WFDA.Rd - -commit cc18590ca43ac25b37f2553b8e679e4a5592cb74 -Author: yqgchen -Date: Thu Feb 28 22:40:45 2019 -0800 - - fix DESCRIPTION - -M DESCRIPTION - -commit 2aec1c38debaa474c9ec57dc901e34f2d9962f98 -Merge: a81eb19 5559860 -Author: yqgchen -Date: Thu Feb 28 21:43:47 2019 -0800 - - Merge pull request #38 from functionaldata/revert-35-tv-additive - - Revert "New implementation for TVAM" - -commit 5559860df1e49d700543b2f31296bc2888421cc6 -Author: yqgchen -Date: Thu Feb 28 21:43:28 2019 -0800 - - Revert "New implementation for TVAM" - -M NAMESPACE -D R/TVAM.R -D man/TVAM.Rd - -commit a81eb19b35f228f2f729d70b94c3ee81a88d716d -Merge: d34ac47 5b26551 -Author: yqgchen -Date: Thu Feb 28 21:43:10 2019 -0800 - - Merge pull request #37 from functionaldata/revert-36-vc-additive - - Revert "Varying-coefficient additive models" - -commit 5b26551112b0388cc631cbdf89ec4df4d04f1e19 -Author: yqgchen -Date: Thu Feb 28 21:25:02 2019 -0800 - - Revert "Varying-coefficient additive models" - -M NAMESPACE -D R/GenBSpline.R -D R/VCAM.R -D man/VCAM.Rd - -commit d34ac47f6f05dcc6e61b2d28a893a68460b2fae3 -Merge: 2a60006 9552ec9 -Author: yqgchen -Date: Thu Feb 28 21:21:14 2019 -0800 - - Merge pull request #36 from functionaldata/vc-additive - - Varying-coefficient additive models - -commit 9552ec9d6f77c04576502cd4abc1df4a559ed299 -Merge: a561b1a 2a60006 -Author: yqgchen -Date: Thu Feb 28 19:51:56 2019 -0800 - - Merge branch 'master' into vc-additive - -commit 2a6000677b88a684c68dcfcae6e02cc23e3b339e -Merge: b7f5c7c 55327b5 -Author: yqgchen -Date: Thu Feb 28 19:39:56 2019 -0800 - - Merge pull request #35 from functionaldata/tv-additive - - New implementation for TVAM - -commit b7f5c7cf140198ecea4e770e9f9b85af16c51dbf -Merge: b57accb f8914ee -Author: yqgchen -Date: Thu Feb 28 19:37:48 2019 -0800 - - Merge pull request #34 from functionaldata/WFDAfix2 - - pair warp fix2 - -commit b57accb77594aa573bd391e46edee3dc5a4defec -Merge: 2760030 35b0aec -Author: yqgchen -Date: Tue Feb 26 21:42:09 2019 -0800 - - resolve conflicts - -commit 35b0aec2ddea9e8de2f03f20e0f0cfb1c89a2465 -Author: yqgchen -Date: Tue Feb 26 21:24:06 2019 -0800 - - namespace update - -M DESCRIPTION -M NAMESPACE -M R/RcppExports.R -M man/DynCorr.Rd -M man/Dyn_test.Rd -M man/FAM.Rd -M man/FOptDes.Rd -M man/FPCRegS.Rd -M man/GetCrCovYX.Rd -M man/GetNormalisedSample.Rd -M man/MakeGPFunctionalData.Rd -M man/MakeSparseGP.Rd -M man/MultiFAM.Rd -M man/Wiener.Rd -M man/kCFC.Rd -M src/RcppExports.cpp - -commit 55eddcd5a48d295a005a38c60d751fad4dc90c41 -Author: yqgchen -Date: Tue Feb 12 15:23:57 2019 -0800 - - add spaces - -M R/Dyn_test.R - -commit 454a7b4721ebe63038aec0f4648d3ea56962276e -Author: yqgchen -Date: Tue Feb 12 15:00:59 2019 -0800 - - add spaces - -M R/DynCorr.R - -commit 1b5246672c84f373f991294f8c0db670c5bd4ff2 -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Tue Feb 12 11:11:10 2019 -0800 - - Add files via upload - -A man/DynCorr.Rd - -commit a9f9cbb0cbeddbfddc01dc2670daf5810d4ab533 -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Tue Feb 12 11:10:29 2019 -0800 - - Delete DynCorr.Rd - -D man/DynCorr.Rd - -commit 8ee3b7beff615ad014d4d5e6a6495b4e60376b02 -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Tue Feb 12 11:09:53 2019 -0800 - - update the example - -A R/DynCorr.R - -commit bbeb76ffc0faf99784fdf3ac7ded3b1468dca2a4 -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Tue Feb 12 11:09:12 2019 -0800 - - Delete DynCorr.R - -D R/DynCorr.R - -commit 4c1a58692073b5dd9a90e9e8870e7f4c3b3125b6 -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Mon Feb 11 22:14:08 2019 -0800 - - Add files via upload - -A tests/testthat/test_DynCorr.R - -commit 5901ee47ab4395b97bee001a15920081a888fcae -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Mon Feb 11 22:13:46 2019 -0800 - - Delete test_Dyncorr.R - -D tests/testthat/test_Dyncorr.R - -commit c3a847b26606ca73f9ff3175fc7ecc70f30c510a -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Mon Feb 11 17:57:45 2019 -0800 - - Add files via upload - -A man/Dyn_test.Rd - -commit fcfaa19d2c8fc66c6355136afb538bfad6d963f3 -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Mon Feb 11 17:57:03 2019 -0800 - - Delete Dyn_test.Rd - -D man/Dyn_test.Rd - -commit 48f5f26a84f1733fa3ae238c3fd9655787e4f541 -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Mon Feb 11 17:56:49 2019 -0800 - - update the example - -A R/Dyn_test.R - -commit b86e3c4e3179d550c02d5492d214a44970051897 -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Mon Feb 11 17:56:20 2019 -0800 - - Delete Dyn_test.R - -D R/Dyn_test.R - -commit c0750bf8a95f17bb69a17645d3d1a9305562e9c5 -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Mon Feb 11 17:52:23 2019 -0800 - - update example - -A R/DynCorr.R - -commit 8213995fdb62b5173a1df8073981df8e1a96afb9 -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Mon Feb 11 17:51:52 2019 -0800 - - Delete DynCorr.R - -D R/DynCorr.R - -commit f3fa62c6c91eb2b50bad46db0cae324adba5f2d0 -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Mon Feb 11 17:51:36 2019 -0800 - - Add files via upload - -A man/DynCorr.Rd - -commit e730a2eee0bdc8eb553fe56742c22253533d65b4 -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Mon Feb 11 17:51:06 2019 -0800 - - Delete DynCorr.Rd - -D man/DynCorr.Rd - -commit 62caf8a8db411832eb810dbbe0857db2cbda45ef -Merge: bb69ba7 ea7458d -Author: yqgchen -Date: Sat Feb 2 14:28:43 2019 -0800 - - Merge pull request #33 from functionaldata/hadjipantelis-patch-1 - - Hadjipantelis patch 1 - -commit ea7458d2150e0cbc92b87355afc88000c3de2e39 -Author: hadjipantelis -Date: Thu Jan 31 22:38:07 2019 +0000 - - Update .travis.yml - -M .travis.yml - -commit b2277ee086d7be560ba58b252d055253b9cd97bd -Author: hadjipantelis -Date: Thu Jan 31 22:11:27 2019 +0000 - - Update .travis.yml - -M .travis.yml - -commit bb69ba7d12e53af80cd0d33c11e38699431e9bcb -Author: yqgchen -Date: Tue Jan 29 16:35:58 2019 -0800 - - Update DynCorr.R - - add set.seed(1) - -M R/DynCorr.R - -commit ddcf6db88a5daea31cd66912b6810f9ed3f50d14 -Author: yqgchen -Date: Mon Jan 28 13:43:46 2019 -0800 - - Update test_FPCquantile.R - - use expect_error() for negative tests - -M tests/testthat/test_FPCquantile.R - -commit 7d5f0b12f052c385a5a960099b7e49f2317af9e6 -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Sat Dec 22 22:26:41 2018 -0800 - - unit test of dyncorr and dyn_test - -A tests/testthat/test_Dyn_test.R -A tests/testthat/test_Dyncorr.R - -commit e22ee34e0f5245a4d29bd3fa5f13c8b2a1c828fb -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Sat Dec 22 22:26:03 2018 -0800 - - Add files via upload - -A man/DynCorr.Rd -A man/Dyn_test.Rd - -commit 13c4644a5496c3aab162ce482706856321991c71 -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Sat Dec 22 22:25:38 2018 -0800 - - add a reference - -A R/DynCorr.R - -commit 30b9a9dcb52864bfbd16702c27640464822864ab -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Sat Dec 22 22:25:18 2018 -0800 - - Delete DynCorr.R - -D DynCorr.R - -commit 0d48610d8d721422fe295ddd69368243ec71b0e7 -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Sat Dec 22 22:25:03 2018 -0800 - - add a reference - -A DynCorr.R - -commit 3fe67a7bc41027e95b6789a5abbe93f1a3e742bd -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Sat Dec 22 22:24:41 2018 -0800 - - fix a bug and add a reference - -A R/Dyn_test.R - -commit 69e19e2d0e505eaae01237d3d1a0a79ceccb5833 -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Sat Dec 22 22:24:15 2018 -0800 - - Delete Dyn_test.R - -D R/Dyn_test.R - -commit a975c1c2980ad47b456c3ddd3a35bda80b05dbcc -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Sat Dec 22 22:24:07 2018 -0800 - - Delete DynCorr.R - -D R/DynCorr.R - -commit d3d629fed8313494276432e5b6976dc05978c800 -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Sat Dec 22 16:43:46 2018 -0800 - - add example and reference - -A R/Dyn_test.R - -commit 6b6a0a39dc98a5b37f1002583c55f6031f1930a4 -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Sat Dec 22 16:43:22 2018 -0800 - - Delete Dyn_test.R - -D Dyn_test.R - -commit 79fe10a974cbcf6abe9e900b794c097b6f7cd15e -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Sat Dec 22 16:42:42 2018 -0800 - - add example and reference - -A Dyn_test.R - -commit 329ecb7f55110f69aec5e582a39773d93feaf600 -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Sat Dec 22 16:42:20 2018 -0800 - - add example and reference - -A R/DynCorr.R - -commit 2045e6d029b73b8a1dc39eca2a715e7d2edf1827 -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Sat Dec 22 16:41:34 2018 -0800 - - Delete Dyn_test.R - -D R/Dyn_test.R - -commit 2d7f98bbfc3a0ba6adb238914cd86245a9f09625 -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Sat Dec 22 16:41:19 2018 -0800 - - Delete DynCorr.R - -D R/DynCorr.R - -commit b0b63f6f55b3445a9a87305e3de20011162cc1dd -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Tue Dec 4 13:03:41 2018 -0800 - - Add files via upload - -A tests/testthat/test_FPCquantile.R - -commit 0698d0633378dcf291d7a4725e08facb085292bc -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Tue Dec 4 13:02:53 2018 -0800 - - Add files via upload - -A man/FPCquantile.Rd - -commit 8687912aa93945309bad02fd66e7068edfb89f26 -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Tue Dec 4 12:58:46 2018 -0800 - - Add files via upload - -A R/FPCquantile.R - -commit 2bc0bbc2aed02a451beb18250bdee7d46642375d -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Tue Dec 4 12:58:23 2018 -0800 - - Delete FPCquantile.R - -D R/FPCquantile.R - -commit 17a43194d84c5ee553f0118bcfdf1e8f89ff1d2d -Author: Jianing Fan <31675015+fjn919@users.noreply.github.com> -Date: Tue Dec 4 12:58:09 2018 -0800 - - Delete FPCAPred.R - -D R/FPCAPred.R - -commit f1ccad2b61a9f0f5efdd8d68b0d7e7b0c4a866a1 -Author: Pieter Schoonees -Date: Thu Nov 29 17:19:07 2018 +0100 - - Update fdapaceVig.Rmd - - typo - -M vignettes/fdapaceVig.Rmd - -commit 27600303d397cf5f9bf6c102f3bb240c2450cc5c -Merge: 227dd46 4ff42b9 -Author: Xiongtao Dai -Date: Sat Nov 10 19:54:26 2018 -0600 - - Merge pull request #30 from functionaldata/fixHelperFuncs - - add doc for CreateDesignPlot; fix example for predict - -commit 4ff42b9acf2f1c5cf4bea70799c7019283f37fa6 -Author: Dai -Date: Wed Oct 31 23:56:31 2018 -0500 - - add doc for CreateDesignPlot; fix example for predict - -M R/CreateDesignPlot.R -M R/predict.FPCA.R -M man/CreateDesignPlot.Rd -M man/predict.FPCA.Rd - -commit 227dd46610871dc4bc360e2d25f9c45554d11c43 -Merge: 4768cd2 3719851 -Author: hadjipantelis -Date: Thu Oct 18 23:09:36 2018 +0100 - - Merge pull request #29 from functionaldata/ModVarAddition - - Mod var addition - -commit 37198517819ea3ad12d8727a1c9941d56b5ad2cc -Author: hadjipantelis -Date: Thu Oct 18 22:36:32 2018 +0100 - - Necessary rm - -D man/FPCRegS.Rd - -commit 229c26ee7378035144ff536bae5766b1b2d8f273 -Author: hadjipantelis -Date: Thu Oct 18 22:27:30 2018 +0100 - - ModeOfVarPlot update - -M DESCRIPTION -M R/CreateModeOfVarPlot.R -M man/CreateModeOfVarPlot.Rd -M man/FAM.Rd -M man/FOptDes.Rd -M man/FPCRegS.Rd -M man/GetCrCovYX.Rd -M man/GetNormalisedSample.Rd -M man/MakeGPFunctionalData.Rd -M man/MakeSparseGP.Rd -M man/MultiFAM.Rd -M man/Wiener.Rd -M man/kCFC.Rd - -commit 4768cd279713fffd2d817f9434c77f70040a4903 -Author: Pantelis Hadjipantelis -Date: Thu Oct 18 14:32:44 2018 +0100 - - Reverting - -M NAMESPACE -D R/FPCRegS.R -D R/MultiNorm.R -D R/demeanFuc.R -D R/supportfunctions.R -D man/FPCRegS.Rd -D tests/testthat/test_FPCRegS.R - -commit a65ba00e3f652d2828746197ef47ab52a5ca4dc5 -Author: fjn919 <31675015+fjn919@users.noreply.github.com> -Date: Tue Oct 2 15:20:38 2018 -0700 - - Update FPCquantile.R - -M R/FPCquantile.R - -commit a2e1a602d335c50d1044f0a337c6d564df7ca66a -Author: fjn919 <31675015+fjn919@users.noreply.github.com> -Date: Tue Oct 2 15:18:41 2018 -0700 - - Update FPCAPred.R - -M R/FPCAPred.R - -commit f96b73c5c2d6477f3bd3791b903d3f8a2f183c70 -Author: fjn919 <31675015+fjn919@users.noreply.github.com> -Date: Tue Oct 2 15:16:23 2018 -0700 - - Update FPCquantile.R - -M R/FPCquantile.R - -commit 408ad66854d5aed77f34ec9f18603e91b0e6d74a -Author: fjn919 <31675015+fjn919@users.noreply.github.com> -Date: Tue Oct 2 13:27:59 2018 -0700 - - Perform one or two samples bootstrap test of dynamic correlation - -A R/Dyn_test.R - -commit 040baa8a7dca219e9b5bf3ba8d355af2612b6fba -Author: fjn919 <31675015+fjn919@users.noreply.github.com> -Date: Tue Oct 2 13:26:49 2018 -0700 - - Calculate individual dynamic correlations - -A R/DynCorr.R - -commit 250216b4bc4ecb5e7688fc2b4b0c2f2e8c2fcfab -Author: fjn919 <31675015+fjn919@users.noreply.github.com> -Date: Tue Oct 2 13:26:05 2018 -0700 - - Delete Dyn_test.R - -D R/Dyn_test.R - -commit de3d0bc5b7ef21c51fc71c7371309cc84dc85a1e -Author: fjn919 <31675015+fjn919@users.noreply.github.com> -Date: Tue Oct 2 13:25:48 2018 -0700 - - Delete DynCorr.R - -D R/DynCorr.R - -commit 814b1c98d65b501c13e56aa4f306734f24070d71 -Author: fjn919 <31675015+fjn919@users.noreply.github.com> -Date: Tue Oct 2 13:25:14 2018 -0700 - - Predict functional principal scores of new observations - -A R/FPCAPred.R - -commit 2d4534611938d4e75e4a0a91e6c8f71f999c680c -Author: fjn919 <31675015+fjn919@users.noreply.github.com> -Date: Tue Oct 2 13:24:00 2018 -0700 - - Quantile regression with functional predictor and scalar response - -A R/FPCquantile.R - -commit 189a561618eeef2618ced9d4930fa5c3e7988a9d -Author: fjn919 <31675015+fjn919@users.noreply.github.com> -Date: Tue Oct 2 13:20:15 2018 -0700 - - Add files via upload - -A R/DynCorr.R -A R/Dyn_test.R - -commit 2f9313e6ab2f199d892c9ebe56f68febe12a85aa -Author: hadjipantelis -Date: Sun Jul 22 23:51:36 2018 +0100 - - Changes to the auto-title of CreateModeOfVarPlot - -M R/CreateModeOfVarPlot.R - -commit f8914ee7d94be5ee667defd5437361e2460a551e -Author: yqgchen -Date: Mon May 28 20:01:27 2018 -0700 - - Exchange the names of hMat and hInvMat - - Exchange the names of hMat and hInvMat to be consistent with the reference - -M R/WFDA.R - -commit f9946aae09178d519fbfacb51ed95f36003b5db8 -Author: yqgchen -Date: Thu May 24 10:39:20 2018 -0700 - - fix the weight - - fix the weight used when calculating the inverse of the global warping function by averaging the pairwise warping functions - -M R/WFDA.R - -commit a561b1ac5972f07c27e09a743504563f32bf06c4 -Author: Kyunghee Han -Date: Thu May 24 02:18:30 2018 -0700 - - Varying-coefficient additive models - - The initial implementation - -M NAMESPACE -A R/GenBSpline.R -A R/VCAM.R -A man/VCAM.Rd - -commit 55898b1eb42f177863d7b7ccf18dc7f29b8d4e9c -Merge: 56d1ec8 80e7684 -Author: kevinhaofree -Date: Fri May 18 19:11:48 2018 -0700 - - Merge pull request #24 from functionaldata/FRegSDense - - FRegSDense - -commit 80e7684143bad0c36c2f67ddb9fdfdd3ea3617ef -Author: haost -Date: Fri May 18 16:36:22 2018 -0700 - - updating description - -M R/FPCRegS.R -M man/FPCRegS.Rd - -commit c4b423a9e34e20358e80030d289778ef69a2888f -Author: haost -Date: Thu May 17 10:57:23 2018 -0700 - - adding one boundary case - -M tests/testthat/test_FPCRegS.R - -commit 8724e741ab496add62ed788450c483a4f96a5f8b -Author: haost -Date: Thu May 17 10:07:08 2018 -0700 - - bug fix 1.1 - -M R/supportfunctions.R - -commit 22d06ebc54d3eac89a43d4bc5cc6f3f4c3e91f00 -Author: haost -Date: Thu May 17 09:15:58 2018 -0700 - - bug fix - - fix some variable that not use correctly - -M R/FPCRegS.R -M R/supportfunctions.R -M tests/testthat/test_FPCRegS.R - -commit c0e05d22b8a635023b638d021e0a9ae7a924281a -Author: haost -Date: Tue May 8 15:17:46 2018 -0700 - - update 2.5 - - unclear definition cleared - -M R/supportfunctions.R - -commit 6084e027540b90748aad81d3a1dabd7f3e083d2f -Author: haost -Date: Tue May 8 14:09:23 2018 -0700 - - update 2.4 - - bug fixed - -M tests/testthat/test_FPCRegS.R - -commit a830733ad3046775eb514fa964bccc0362a84c70 -Author: haost -Date: Tue May 8 13:35:58 2018 -0700 - - update2.3 - - bug fixes - -M tests/testthat/test_FPCRegS.R - -commit 423c1fdf106de44ca4fc40d2ac6ffc7149005e64 -Author: haost -Date: Tue May 8 11:16:02 2018 -0700 - - fix2.2 - - fix minor bugs here - -M tests/testthat/test_FPCRegS.R - -commit 44f8f9d05ebaa59d24c0326bbe0d4b93808f1d41 -Author: haost -Date: Tue May 8 09:52:58 2018 -0700 - - updateV2.1 - - omit one seed open - -M tests/testthat/test_FPCRegS.R - -commit c65d975ad9c0971c2a1f3819f125f7f2e2962ff2 -Author: haost -Date: Tue May 8 04:03:56 2018 -0700 - - updateV2 - - change the document description and add the test that - -M R/FPCRegS.R -M man/FPCRegS.Rd -A tests/testthat/test_FPCRegS.R - -commit fd44ee2c01590f6861e262adbd67fa9a925980a7 -Author: haost -Date: Mon Apr 30 23:20:35 2018 -0700 - - updating examples 2.0 - -M R/FPCRegS.R -M man/FPCRegS.Rd - -commit b35d979747455618cbe3927e51d60ca8ce62b42e -Author: haost -Date: Mon Apr 30 23:16:32 2018 -0700 - - updating the examples - -M R/FPCRegS.R -M man/FPCRegS.Rd - -commit 56d1ec8900faddd2b08ac849f83dbe7c4d81a782 -Merge: adc8aac 03966a7 -Author: hadjipantelis -Date: Mon Apr 30 12:34:29 2018 +0100 - - Merge pull request #23 from functionaldata/FClustPatch - - F clust patch - -commit 03966a76b9ebd1bbab1ea32f8b854885dccef664 -Author: hadjipantelis -Date: Sat Apr 21 00:29:23 2018 +0100 - - FClust patch 2 - -M R/SetOptions.R -M R/kCFC.R - -commit 2df44ea84acab9f372877a4e3f0f96127f249483 -Author: hadjipantelis -Date: Fri Apr 20 23:31:45 2018 +0100 - - FClust patch - -M R/FClust.R -M R/kCFC.R -M man/FClust.Rd -M man/kCFC.Rd -M tests/testthat/test_FClust.R - -commit f9c23c11c87fdf52e8d30073e7f04b4036b4539f -Author: Kyunghee Han -Date: Tue Apr 17 15:22:24 2018 -0700 - - Debugging, support of constant trajectory cases - -M R/fitted.FPCA.R -M man/fitted.FPCA.Rd - -commit 86177e500f3442e8687a6fe2674eb1fc029e4001 -Author: haost -Date: Tue Apr 10 22:18:51 2018 -0700 - - default setting change - -M R/FPCRegS.R - -commit fc35d0f259f70440c802ce8eae7e23223ba43371 -Author: haost -Date: Tue Apr 10 15:07:21 2018 -0700 - - Fix bugs - -M NAMESPACE -A R/FPCRegS.R -A R/MultiNorm.R -A R/demeanFuc.R -A R/supportfunctions.R -A man/FPCRegS.Rd - -commit 55327b50254a1d10140f2e812c9fd658c51cdfa2 -Author: Kyunghee Han -Date: Mon Apr 9 17:00:57 2018 -0700 - - New implementation for TVAM - - Alpha version - -M NAMESPACE -A R/TVAM.R -A man/TVAM.Rd - -commit c2c344049091f36eaff073b631e33f066d27fe82 -Author: Kyunghee Han -Date: Tue Apr 3 17:32:13 2018 -0700 - - Fixed warning messages from Travis - -M R/fitted.FPCA.R -M man/fitted.FPCA.Rd - -commit 7b5221a512db0c6cd01714296492408612285a6d -Author: Kyunghee Han -Date: Tue Apr 3 17:01:17 2018 -0700 - - Minor update - -M R/fitted.FPCA.R - -commit b3be6962abc3cd75327b1aced8b33f95c8ea3eec -Author: Kyunghee Han -Date: Tue Apr 3 16:26:08 2018 -0700 - - Fixing vignettes problem. - -M R/fitted.FPCA.R -M man/fitted.FPCA.Rd - -commit adc8aac70e857e33411dcf1d2fdb8913bf35ff3e -Author: hadjipantelis -Date: Sat Feb 24 22:09:07 2018 +0000 - - Deleting PDF vignette. - -D vignettes/Sweavel.sty -D vignettes/fdapaceVignetteKnitr.Rnw -D vignettes/framed.sty - -commit 981ac4af99d792c8091f28e494d89c869a74f0f6 -Author: hadjipantelis -Date: Sat Feb 24 21:24:30 2018 +0000 - - FCReg example timing. - -M R/FCReg.R -M man/FCReg.Rd - -commit 19470e067650676547401d6f7c9273c5b925e574 -Author: Pantelis -Date: Fri Feb 23 11:16:56 2018 +0000 - - Example timings - -M R/CreateOutliersPlot.R -M R/FClust.R -M R/FPCReg.R -M R/MultiFAM.R -M man/CreateOutliersPlot.Rd -M man/FClust.Rd -M man/FPCReg.Rd -M man/MultiFAM.Rd - -commit 6c8f6a608e18bea3c24921abd51ade415ddfd420 -Author: hadjipantelis -Date: Thu Feb 22 16:01:08 2018 -0800 - - Vign. fix for R-dev - -M vignettes/fdapaceVig.Rmd - -commit ae4c1acf99e0518f73900a75a89537807e390e46 -Author: Pantelis Hadjipantelis -Date: Thu Feb 22 14:51:43 2018 -0800 - - Rcpp Exports fix. - -M R/RcppExports.R -M src/RcppExports.cpp - -commit 802ba5b0ca1b12ecb3d94777d0ee919355735577 -Author: hadjipantelis -Date: Thu Feb 22 21:35:57 2018 +0000 - - Typo. - -M R/FPCReg.R -M man/FPCReg.Rd - -commit d78107f2ccbef609b1f9231de1de291d6a219637 -Author: hadjipantelis -Date: Thu Feb 22 21:17:59 2018 +0000 - - Fixing line-widths - -M R/FPCReg.R -M R/RcppExports.R -M man/FPCReg.Rd -M src/RcppExports.cpp - -commit 1bd55ac73757a1c6b67b2c6b34f732d912a4925b -Author: Pantelis -Date: Thu Feb 22 15:07:08 2018 +0000 - - str.FPCA fix. - -M R/str.FPCA.R -M man/str.FPCA.Rd -M vignettes/fdapaceVig.Rmd - -commit e793de3b8829469a1d079f34dd0d9f9a61bf94c7 -Author: Pantelis -Date: Thu Feb 22 11:41:29 2018 +0000 - - SelectK fix. - -M R/SelectK.R - -commit 75690ba70f49b6f066278154c933327da9313a1e -Merge: 4e1b3ed b8db3c6 -Author: hadjipantelis -Date: Tue Feb 20 19:13:16 2018 +0000 - - Merge pull request #21 from functionaldata/exportStr - - Export str.FPCA - -commit b8db3c647b95166bef6e3ce9bc7d99baeb8ca6b4 -Author: Xiongtao Dai -Date: Tue Feb 20 00:17:23 2018 -0800 - - export str.FPCA - -M NAMESPACE -M R/Lwls1D.R -M R/str.FPCA.R -A man/str.FPCA.Rd - -commit 4e1b3edf90add713c979fcd1aa1a589b4e4dc72d -Author: hadjipantelis -Date: Mon Feb 19 23:11:34 2018 +0000 - - Update LICENSE - -M LICENSE - -commit 5bb61c1b63c48df6cd709ccc3e9c90d02855b251 -Merge: 4ff1405 2c222f5 -Author: hadjipantelis -Date: Mon Feb 19 23:07:17 2018 +0000 - - Merge pull request #20 from functionaldata/Exporter - - Merging Exporter branch. - -commit 2c222f5398207a8cc8cd02c5444709f693eacc7d -Author: hadjipantelis -Date: Fri Feb 16 23:21:18 2018 +0000 - - Update NEWS - -M NEWS - -commit 3f2b740cd5a3e8f869070f706bf1a175b105de63 -Author: hadjipantelis -Date: Fri Feb 16 22:46:06 2018 +0000 - - Fixing test_FClust - -M tests/testthat/test_FClust.R - -commit 61f03f028e8f217cf06286c9c89f44ae9f49ead0 -Author: hadjipantelis -Date: Fri Feb 16 22:09:38 2018 +0000 - - Exporters - -M NAMESPACE -M R/FAM.R -M R/MultiFAM.R -M R/RcppExports.R -M src/cumtrapzRcpp.cpp -M src/trapzRcpp.cpp -D vignettes/Sweave.sty - -commit d0f5e887d989e4159ecac2a6ab840215cd5dda96 -Author: hadjipantelis -Date: Fri Feb 16 21:35:50 2018 +0000 - - Update NEWS - - Added FPReg in NEWS. - -M NEWS - -commit ff2bf54b0258dd4051f339ab578b2f713105baf8 -Author: hadjipantelis -Date: Fri Feb 16 21:29:38 2018 +0000 - - Minor - -M R/FAM.R -M R/FClust.R -M R/MultiFAM.R -M man/FClust.Rd - -commit dfe7fc43c856312355fd03065580e700e44d2dcc -Author: hadjipantelis -Date: Fri Feb 16 21:06:38 2018 +0000 - - removing ':::' - -M R/FAM.R -M R/MultiFAM.R -M man/MultiFAM.Rd - -commit 97aa68bb16a970528d7fe7e8096f42ee6ff62ae4 -Author: hadjipantelis -Date: Fri Feb 16 20:53:16 2018 +0000 - - Fixing FClust. - -M R/FClust.R -M man/FClust.Rd - -commit 50c63d6fa6e842aedcb282fe9e13c87a25422210 -Author: hadjipantelis -Date: Thu Feb 15 22:51:24 2018 +0000 - - FClust first fix. - -M DESCRIPTION -M R/FClust.R -M man/FClust.Rd -M tests/testthat/test_FClust.R - -commit ee80261c9e4335e9aa578ac97a10e84de8f6d7b0 -Author: hadjipantelis -Date: Thu Feb 15 19:38:05 2018 +0000 - - Authors, vers. and date - -M DESCRIPTION - -commit 4ff14054ea5d4a3bb70263ad732961940631446c -Merge: a152729 e6a0b71 -Author: hadjipantelis -Date: Wed Feb 14 21:58:45 2018 +0000 - - Merge pull request #19 from functionaldata/fResReg - - F res reg - -commit e6a0b71e51e71d944d0b64bd2ecfff4f215fb628 -Author: mathchin -Date: Wed Feb 14 11:37:27 2018 +0800 - - remove rm(). - -M tests/testthat/test_FPCReg.R - -commit f1906c02009571b39e164192eb1eea831fae63b5 -Author: mathchin -Date: Tue Feb 13 12:29:56 2018 +0800 - - Add unit tests for sparse and multipredicts - -M tests/testthat/test_FPCReg.R - -commit 2d7a0c47ce3d74a7e3c00bacf00598a008f5941d -Author: mathchin -Date: Tue Feb 13 09:06:32 2018 +0800 - - further google r style and avoid diag() - -M R/FPCReg.R - -commit 19ba8f20e2d0fd1c4525a97fe55d55688747cf15 -Author: hadjipantelis -Date: Wed Feb 7 21:02:15 2018 +0000 - - First take on exporting rcpp helpers - -M R/RcppExports.R -A man/cumtrapzRcpp.Rd -A man/trapzRcpp.Rd -M src/cumtrapzRcpp.cpp -M src/trapzRcpp.cpp - -commit a152729399d5c7dbe9481602331a9fe81fa0f7e9 -Merge: aefdf6b 8696b4d -Author: hadjipantelis -Date: Mon Jan 29 23:49:30 2018 +0000 - - Merge pull request #18 from functionaldata/plotFix - - Plot fix - -commit 8696b4dd711111814b61d34d4e36daedb1fc2635 -Merge: 23c7ddd 9231f7b -Author: hadjipantelis -Date: Sun Jan 21 00:35:07 2018 +0000 - - Merge pull request #17 from linulysses/plotFix - - Change to GetEigenAnalysisResults and plot.FPCA - -commit 9231f7bd4e7252d0376c071c8670adeac689b246 -Author: linulysses <33917103+linulysses@users.noreply.github.com> -Date: Sat Jan 20 15:19:19 2018 -0800 - - change data generation seed - -M tests/testthat/test_plotFPCA.R - -commit 8fb9aeaa38402627009f467382a9bac4b2acc60c -Author: linulysses <33917103+linulysses@users.noreply.github.com> -Date: Sat Jan 20 09:37:22 2018 -0800 - - Change to GetEigenAnalysisResults and plot.FPCA - - 1. highlighted x-axis on plots in plot.FPCA - 2. switched sign of eigenfunctions if their inner product with the mean is negative in GetEigenAnalysisResults - -A tests/testthat/test_plotFPCA.R - -commit 23c7ddd548b5368df2cda6e8492bb818a536d0f2 -Author: Cody Carroll -Date: Wed Dec 6 15:11:09 2017 -0800 - - fix circular dependency and axes issue - -M R/GetEigenAnalysisResults.R -M R/plot.FPCA.R - -commit 218e015f6f480aedd6330d806cf66ba83c45111b -Author: Cody Carroll -Date: Tue Dec 5 11:23:19 2017 -0800 - - add x axis to plots and change eigenfunction's sign if inner product with mean is negative (instead of covariance as before) - -M R/GetEigenAnalysisResults.R -M R/plot.FPCA.R - -commit aefdf6bac6084ff617041231eb20a99baaa81646 -Author: hadjipantelis -Date: Sat Dec 2 14:00:08 2017 +0000 - - Update NEWS, RccpExports, SelectK - -M NEWS -M R/RcppExports.R -M R/SelectK.R -M man/SelectK.Rd -M src/RcppExports.cpp -M vignettes/fdapaceVig.html - -commit c5e469920d8cee43ed5d0b7503f74bd0bdc097eb -Author: Pantelis -Date: Fri Dec 1 15:36:35 2017 +0000 - - Rmd Vignette HTML - -A vignettes/fdapaceVig.html - -commit 2e30cba63eb54b5006e43cec3fb437a817d52d4f -Author: Pantelis -Date: Fri Dec 1 15:33:59 2017 +0000 - - Rmd Vignette - -A vignettes/fdapaceVig.Rmd - -commit c54be3d5a3d165693a08ec44b3adbd2803105dca -Merge: 855017d efb2513 -Author: Kyunghee Han -Date: Mon Nov 20 21:13:15 2017 -0800 - - Merge pull request #16 from functionaldata/additive - - Additive - -commit efb25135afeaab60622652cda40dc6cbe3219dea -Author: Kyunghee Han <> -Date: Mon Nov 20 18:54:14 2017 -0800 - - final modification after Gary's beta testing - -M R/MultiFAM.R - -commit 855017d2c380ec4d8828160d6c247325eb6dc7c3 -Author: dmchris -Date: Mon Oct 30 23:07:53 2017 -0500 - - Modify FOptDes.R for grid conversion issues - -M R/FOptDes.R - -commit 1362b94e9b81112a17175492324cfdb09e88cfaa -Author: Xiongtao Dai -Date: Sun Oct 29 01:23:39 2017 +0100 - - plot.FPCA use optns$error for the design plot - -M R/plot.FPCA.R - -commit 5a52883ecfb55e753ef9522aa793bbf737db7958 -Author: Xiongtao Dai -Date: Fri Oct 27 20:15:20 2017 +0100 - - fix FSVD - -M R/FSVD.R - -commit 0facf922a3c738da30aab6f55b2a9552356ecb8c -Author: Cody Carroll -Date: Wed Oct 25 15:10:38 2017 -0700 - - remove unnecessary lines - -M tests/testthat/test_WFDA.R - -commit 4cd1a444ced1e3f236baea8c81b0421d3cfe5196 -Author: Kyunghee Han <> -Date: Wed Oct 25 14:35:24 2017 -0700 - - minor change in Rdocument of FAM - -M R/FAM.R -M man/FAM.Rd - -commit d278e86a27f74d4acb288e3d6af9d323311baa22 -Author: Kyunghee Han <> -Date: Wed Oct 25 12:46:13 2017 -0700 - - merging travispass into additive branch - -M tests/AAAtestthat.R -M tests/testthat_slow.R - -commit dbe74c8a710e9d314e86ffab3cddbc76520c50ef -Merge: e56b08f 0b9f2cd -Author: Kyunghee Han -Date: Wed Oct 25 12:07:22 2017 -0700 - - Merge remote-tracking branch 'origin/travispass' into additive - -commit e56b08fdc2c0ab1e94777e6f3f242b5062c2747c -Author: Kyunghee Han <> -Date: Wed Oct 25 04:49:01 2017 -0700 - - removing TVAMSBFitting temporarily (reducing testthat) - -M NAMESPACE -M R/FAM.R -M R/MultiFAM.R -D R/TVAMCompFntCent.R -D R/TVAMCondProjection.R -D R/TVAMLLMgnReg.R -D R/TVAMMgnJntDensity.R -D R/TVAMSBFCompUpdate.R -D R/TVAMSBFitting.R -M man/FAM.Rd -M man/MultiFAM.Rd -D man/TVAMSBFitting.Rd - -commit 51fa8b9fec2797f0c61d65b911e0bfb31ffa23b6 -Author: Cody Carroll -Date: Tue Oct 24 23:02:51 2017 -0700 - - Minor unit test fix - -M tests/testthat/test_WFDA.R - -commit 67805f9a9f765d3431b3a546aad704200a158706 -Author: Kyunghee Han <> -Date: Tue Oct 24 22:34:33 2017 -0700 - - minor debugging 3 - -M R/FAM.R -M R/MultiFAM.R -M man/FAM.Rd -M man/MultiFAM.Rd - -commit 94189fa5651abd1cd5d547f6cf45ff4976f4bc88 -Author: Kyunghee Han <> -Date: Tue Oct 24 21:46:44 2017 -0700 - - minor debugging 2 - -M R/FAM.R -M man/FAM.Rd - -commit 4f07519dfe8671700c38121aaae6b9884999b77d -Author: Kyunghee Han <> -Date: Tue Oct 24 21:20:17 2017 -0700 - - minor debugging - -M R/FAM.R - -commit 6c282e5c5f897f750acbbffd7336d2c9a2ed498d -Author: Kyunghee Han <> -Date: Tue Oct 24 20:12:46 2017 -0700 - - 2nd debugging - -M R/FAM.R -M R/MultiFAM.R -M R/RcppExports.R -M man/FAM.Rd -M man/MultiFAM.Rd -M src/RcppExports.cpp - -commit 16d3f1e1a91d441762bdf7882bd4b2543372016a -Author: Cody Carroll -Date: Tue Oct 24 17:08:14 2017 -0700 - - add more unit tests - -M tests/testthat/test_WFDA.R - -commit 0b9f2cdfab2a4c882d52f479af6a361f51793a09 -Author: hadjipantelis -Date: Tue Oct 24 21:22:20 2017 +0100 - - Update .travis.yml - - Checking if we are OK with no Rcpp specs. - -M .travis.yml - -commit 86cf881a0bc8252882c8d177757b18f156633d73 -Merge: abf2e34 c1c6ef8 -Author: hadjipantelis -Date: Tue Oct 24 21:15:13 2017 +0100 - - Merge pull request #15 from functionaldata/travispass - - Travis pass - -commit 08bc5a5d9b3f7eedda296a179f99b8aca3584338 -Merge: 007033a abf2e34 -Author: Kyunghee Han -Date: Tue Oct 24 13:13:07 2017 -0700 - - Merge branch 'master' into additive - -commit c1c6ef88155e68b86eb49a0eada28b1b948ac94d -Author: hadjipantelis -Date: Tue Oct 24 20:29:07 2017 +0100 - - Making test_FPCA a bit lighter - -M tests/testthat/test_FPCA.R - -commit b09ad1cadcb59b2294af416a294d86915ad8cb56 -Author: hadjipantelis -Date: Tue Oct 24 20:20:03 2017 +0100 - - Near void. - -M tests/testthat_slow.R - -commit 007033a0c011bdc2aa945ae535a162d4c49cb1ac -Author: Kyunghee Han <> -Date: Tue Oct 24 09:33:23 2017 -0700 - - trapzRcpp -> fdapace:::trapzRcpp - -M R/FAM.R -M man/FAM.Rd -M man/MultiFAM.Rd - -commit 3730cc78aa2903d2afaaf990f76312d3c0f1c7ac -Author: Kyunghee Han <> -Date: Tue Oct 24 04:48:00 2017 -0700 - - Rdocument modification - -M R/FAM.R -M R/MultiFAM.R -M man/FAM.Rd -M man/MultiFAM.Rd - -commit 8e899e83256e9d713e5e37d5b7603714738fd441 -Author: Kyunghee Han <> -Date: Tue Oct 24 04:23:10 2017 -0700 - - debugging after 1st beta test - -M R/FAM.R -M R/MultiFAM.R -M man/FAM.Rd -M man/MultiFAM.Rd - -commit abf2e34ca78352352c9e63fdec2c0e4c675ae1eb -Author: hadjipantelis -Date: Mon Oct 23 23:50:27 2017 +0100 - - Breaking slow tests for Travis - -M tests/testthat_slow.R - -commit 2154eaeaa0b17ed89c65aabed60d3fe7c791ce32 -Author: hadjipantelis -Date: Mon Oct 23 22:35:45 2017 +0100 - - Minor MakeResultFPCA fix. - -M R/FPCA.R -M R/MakeResultFPCA.R -M R/RcppExports.R -M src/RcppExports.cpp - -commit 82cd9fc1d964f4aaac1486fc6817d0bdb522f2c4 -Merge: 22925e5 4adb1bc -Author: hadjipantelis -Date: Mon Oct 23 21:18:22 2017 +0100 - - Merge pull request #14 from functionaldata/WFDAfix - - Fixing optns$lambda on WFDA - -commit 4adb1bce0b4a347aca342d5e8712bdba55a4e3b2 -Author: Xiongtao Dai -Date: Sun Oct 22 12:05:23 2017 -0600 - - strange WFDA behavior - -M R/WFDA.R -M src/RcppExports.cpp -M tests/testthat/test_WFDA.R - -commit f6e47148efb4d6e036526db159571879937957bc -Author: Kyunghee Han <> -Date: Fri Oct 20 01:34:25 2017 -0700 - - 2nd maintenance for MultiFAM and FAM - -M R/FAM.R -M R/MultiFAM.R -M man/FAM.Rd -M man/MultiFAM.Rd - -commit 3147781ca779134b306cab7a361fd388eca8fc59 -Author: Kyunghee Han <> -Date: Fri Oct 20 00:58:13 2017 -0700 - - maintenance for MultiFAM and FAM - -M NAMESPACE -A R/FAM.R -M R/MultiFAM.R -M R/SBFitting.R -M R/TVAMSBFitting.R -A man/FAM.Rd -M man/MultiFAM.Rd -M man/TVAMSBFitting.Rd - -commit 22925e5d2a6666ea69253d353e21dd5d87fdf3ff -Author: hadjipantelis -Date: Thu Sep 28 22:40:01 2017 +0100 - - Minor CreateModeOfVarPlot patch. - -M R/CreateModeOfVarPlot.R - -commit dcee098ff17b712c19c490a19cad51ec6f770422 -Author: hadjipantelis -Date: Mon Aug 21 21:17:48 2017 +0100 - - Minor fix - -M tests/testthat/test_useBin.R - -commit 7d3a95f0823fecbd9fb0d0f3bbda27021fce067b -Author: hadjipantelis -Date: Mon Aug 21 20:52:13 2017 +0100 - - Bringing back the roxygen to 6.0.1. - -M DESCRIPTION -M man/BwNN.Rd -M man/CheckData.Rd -M man/CheckOptions.Rd -M man/ConvertSupport.Rd -M man/CreateBWPlot.Rd -M man/CreateBasis.Rd -M man/CreateCovPlot.Rd -M man/CreateDesignPlot.Rd -M man/CreateFuncBoxPlot.Rd -M man/CreateModeOfVarPlot.Rd -M man/CreateOutliersPlot.Rd -M man/CreatePathPlot.Rd -M man/CreateScreePlot.Rd -M man/CreateStringingPlot.Rd -M man/FCCor.Rd -M man/FCReg.Rd -M man/FClust.Rd -M man/FOptDes.Rd -M man/FPCA.Rd -M man/FPCAder.Rd -M man/FSVD.Rd -M man/FVPA.Rd -M man/GetCrCorYX.Rd -M man/GetCrCorYZ.Rd -M man/GetCrCovYX.Rd -M man/GetCrCovYZ.Rd -M man/GetNormalisedSample.Rd -M man/Lwls1D.Rd -M man/Lwls2D.Rd -M man/Lwls2DDeriv.Rd -M man/MakeBWtoZscore02y.Rd -M man/MakeFPCAInputs.Rd -M man/MakeGPFunctionalData.Rd -M man/MakeHCtoZscore02y.Rd -M man/MakeLNtoZscore02y.Rd -M man/MakeSparseGP.Rd -M man/NormCurvToArea.Rd -M man/SBFitting.Rd -M man/SelectK.Rd -M man/SetOptions.Rd -M man/Sparsify.Rd -M man/Stringing.Rd -M man/WFDA.Rd -M man/Wiener.Rd -M man/fdapace.Rd -M man/fitted.FPCA.Rd -M man/fitted.FPCAder.Rd -M man/kCFC.Rd -M man/medfly25.Rd -M man/plot.FPCA.Rd -M man/predict.FPCA.Rd -M man/print.FPCA.Rd -M man/print.FSVD.Rd -M man/print.WFDA.Rd - -commit 97fed54a7152d287baf65ff52241cdaa3c63ecf5 -Merge: 8b2d461 0ead6c3 -Author: hadjipantelis -Date: Mon Aug 21 20:50:26 2017 +0100 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit 8b2d461cccd606b898d2f5bf679d044bb046e546 -Author: hadjipantelis -Date: Mon Aug 21 20:49:47 2017 +0100 - - Timings - -M R/FPCA.R -M R/MakeResultFPCA.R -M man/FPCA.Rd - -commit 0ead6c3ad0b50b216ec778611934a53090a35466 -Merge: 2a3fe79 e7716d1 -Author: hadjipantelis -Date: Sun Aug 20 22:44:01 2017 +0100 - - Merge pull request #13 from functionaldata/Stringing - - add metrics for stringing and modify documentations - -commit 2a3fe795f3c062836e23101cf4abf91f40ede2dc -Author: hadjipantelis -Date: Sun Aug 20 21:44:29 2017 +0100 - - Minor unit-test fix. - -M R/CVLwls1D.R -M tests/testthat/test_gcvlwls2dV2.R - -commit 5c017fe68ddb758a47862b7c0e4de21c121cd2ae -Author: hadjipantelis -Date: Sun Aug 20 20:24:43 2017 +0100 - - useBW1SE option for BW selection - -M DESCRIPTION -M R/CVLwls1D.R -M R/CheckOptions.R -M R/FPCA.R -M R/GCVLwls2DV2.R -M R/GetSmoothedCovarSurface.R -M R/GetSmoothedMeanCurve.R -M R/SetOptions.R -M man/FPCA.Rd -M tests/testthat/test_FPCA.R - -commit 83e68afdb021feffa3e94e8a9a34fbbb9ae73e4a -Author: Kyunghee Han -Date: Tue Jul 25 12:04:21 2017 -0700 - - minor modification for SBF iteration - -M R/SBFitting.R -M R/TVAMSBFitting.R - -commit 20b8438e08c7aeeb8f0bdba6efd3ddbd92a755f9 -Author: hadjipantelis -Date: Tue Jul 11 00:12:55 2017 +0100 - - Long line corrections. 100+ char. - -M R/FPCAder.R -M man/FPCAder.Rd - -commit ef93c274c2843e28917540e08cbdb390d323b7cb -Author: Xiongtao Dai -Date: Mon Jul 10 11:53:32 2017 -0700 - - restore our modified Sweavel.sty - -M vignettes/Sweavel.sty - -commit 7562b0895e202e0d0e644840402a579b1a8ede49 -Author: Xiongtao Dai -Date: Mon Jul 10 11:24:16 2017 -0700 - - sty files - -M .gitignore -A vignettes/Sweave.sty -M vignettes/Sweavel.sty -A vignettes/framed.sty - -commit b798fcad3fa30726f586f9a8c5e7c5736134935c -Author: mathchin -Date: Wed Jul 5 15:48:25 2017 +0800 - - MASS::mvrnorm. - -M R/FPCReg.R -M man/FPCReg.Rd - -commit abb616173144f68ae2db6ac49323499d147c0c61 -Author: mathchin -Date: Wed Jul 5 10:43:25 2017 +0800 - - Add FPCReg.RD - -M man/FPCReg.Rd - -commit 4c09ebd9d142322fa25545fe3cfadc9e7f28a3db -Author: mathchin -Date: Wed Jul 5 09:27:48 2017 +0800 - - Revised NAMESPACE and DESCRIPTION. - f PleasR enter the commit message for your changes. Lines starting - -M DESCRIPTION -M NAMESPACE - -commit 9723a1458bea43a30e22efc908c6c58523b65af2 -Author: mathchin -Date: Tue Jul 4 18:24:56 2017 +0800 - - Fix R^2 bug and mapply(, SIMPLIFY=FALSE). No outside function. - -M DESCRIPTION -M R/FPCReg.R -M R/pkgname.R - -commit fadc2481e0f12cb18fad37f549653146a8e5d50f -Author: Kyunghee Han -Date: Tue Jun 13 00:02:51 2017 -0700 - - New implementation of Multiple FAM and minor modifications in preivous functions - -M NAMESPACE -M R/MgnJntDensity.R -A R/MultiFAM.R -M R/SBFCompUpdate.R -M R/SBFitting.R -M R/TVAMSBFitting.R -A man/MultiFAM.Rd -M man/SBFitting.Rd -M man/TVAMSBFitting.Rd - -commit e7716d13a4a5856b556654d4bbf1c49e7f250f28 -Author: dmchris -Date: Mon Jun 5 13:10:02 2017 -0700 - - add metrics for stringing and modify documentations - -M DESCRIPTION -M R/CreateStringingPlot.R -M R/Stringing.R -M man/BwNN.Rd -M man/CheckData.Rd -M man/CheckOptions.Rd -M man/ConvertSupport.Rd -M man/CreateBWPlot.Rd -M man/CreateBasis.Rd -M man/CreateCovPlot.Rd -M man/CreateDesignPlot.Rd -M man/CreateFuncBoxPlot.Rd -M man/CreateModeOfVarPlot.Rd -M man/CreateOutliersPlot.Rd -M man/CreatePathPlot.Rd -M man/CreateScreePlot.Rd -M man/CreateStringingPlot.Rd -M man/FCCor.Rd -M man/FCReg.Rd -M man/FClust.Rd -M man/FOptDes.Rd -M man/FPCA.Rd -M man/FPCAder.Rd -M man/FSVD.Rd -M man/FVPA.Rd -M man/GetCrCorYX.Rd -M man/GetCrCorYZ.Rd -M man/GetCrCovYX.Rd -M man/GetCrCovYZ.Rd -M man/GetNormalisedSample.Rd -M man/Lwls1D.Rd -M man/Lwls2D.Rd -M man/Lwls2DDeriv.Rd -M man/MakeBWtoZscore02y.Rd -M man/MakeFPCAInputs.Rd -M man/MakeGPFunctionalData.Rd -M man/MakeHCtoZscore02y.Rd -M man/MakeLNtoZscore02y.Rd -M man/MakeSparseGP.Rd -M man/NormCurvToArea.Rd -M man/SBFitting.Rd -M man/SelectK.Rd -M man/SetOptions.Rd -M man/Sparsify.Rd -M man/Stringing.Rd -M man/WFDA.Rd -M man/Wiener.Rd -M man/fdapace.Rd -M man/fitted.FPCA.Rd -M man/fitted.FPCAder.Rd -M man/kCFC.Rd -M man/medfly25.Rd -M man/plot.FPCA.Rd -M man/predict.FPCA.Rd -M man/print.FPCA.Rd -M man/print.FSVD.Rd -M man/print.WFDA.Rd -M tests/testthat/test_CreateStringingPlot.R -M tests/testthat/test_Stringing.R - -commit 872104cbcaec64c218fde4193fc1b2333a1f1698 -Author: Kyunghee Han -Date: Tue May 30 19:03:12 2017 -0700 - - minor modification of R document - -M R/TVAMSBFitting.R -M man/TVAMSBFitting.Rd - -commit d21a1bc624b52da7ac86765dbc325a22c8df60ef -Author: Kyunghee Han -Date: Tue May 30 18:25:04 2017 -0700 - - minor modification for SBF and new commit for time-varying additive models - -M NAMESPACE -M R/MgnJntDensity.R -M R/NWMgnReg.R -M R/NormKernel.R -M R/SBFCompUpdate.R -M R/SBFitting.R -M R/ScaleKernel.R -A R/TVAMCompFntCent.R -A R/TVAMCondProjection.R -A R/TVAMLLMgnReg.R -A R/TVAMMgnJntDensity.R -A R/TVAMSBFCompUpdate.R -A R/TVAMSBFitting.R -M man/SBFitting.Rd -A man/TVAMSBFitting.Rd - -commit 420c70c2ed7988ba0eb880267b91a5af8a746db4 -Merge: e105bfc 222ab6b -Author: Xiongtao Dai -Date: Sun May 28 00:26:16 2017 +0100 - - Merge branch 'fixDenseNA' - -commit e105bfc226f241d7c46ea722ec383d3c8864f797 -Merge: e19118e db8838f -Author: Xiongtao Dai -Date: Sun May 28 00:24:10 2017 +0100 - - Merge branch 'FPCAderDoc' - -commit e19118e7ab7ab7d279f7fa03f5fa50ebb0bf970e -Author: Xiongtao Dai -Date: Sat May 27 23:52:41 2017 +0100 - - fix an erronous test for FOptDes - -M tests/testthat/test_FOptDes.R - -commit 226bd746de0466d1dc3e1a89fdc8922d8d753a42 -Author: Xiongtao Dai -Date: Fri May 26 21:40:46 2017 +0100 - - speed up MakeFPCAInputs - - Now is much faster if the number of subjects is large. - -M R/MakeFPCAInputs.R -M tests/testthat/test_MakeFPCAInputs.R - -commit db8838f62698043e786e3e67ec46aabe0febe0dd -Author: Xiongtao Dai -Date: Fri May 12 02:26:56 2017 -0700 - - export CreateBasis; modified FPCAder eg - -M NAMESPACE -M R/CreateBasis.R -M R/FPCAder.R -A man/CreateBasis.Rd -M man/FPCAder.Rd - -commit d2ea78abb1ebc8dd270177afea386e0fa82dd1f6 -Author: Xiongtao Dai -Date: Thu May 11 22:31:20 2017 -0700 - - add example for FPCAder - -M R/FPCAder.R -M man/FPCAder.Rd -M tests/testthat/test_FPCAder.R -M tests/testthat/test_Lwls2DDeriv.R - -commit 222ab6b06cc5500143589ae1b47b9db5ec9b0b70 -Author: Xiongtao Dai -Date: Thu May 11 16:55:15 2017 -0700 - - fix DenseWithNA - - Under the DenseWithNA scheme this scenario will now throw an error - message: At time point t_1 the observations are too sparse to estimate - the covariance cov(X(t_1), X(t_2)) for some t_2 by cross-sectional - method. - -M R/GetCovDense.R -M tests/testthat/test_GetCovDense.R - -commit e68539848414e7dd013349ced66dab635c13273a -Author: mathchin -Date: Wed Apr 19 06:25:00 2017 +0800 - - Add package 'fields' into DESCRIPTION and pkgname.R - -M DESCRIPTION -M R/pkgname.R - -commit 8aab00a48dd2ef5203dc78cbf991108ffe7acfb7 -Merge: 927a5d3 f2e6aa5 -Author: mathchin -Date: Wed Apr 19 06:02:22 2017 +0800 - - Merge branch 'master' into fResReg - -commit 927a5d37ff6c362171d7f1b9050ab11c2f0aba22 -Author: mathchin -Date: Tue Apr 18 14:58:55 2017 +0800 - - Revise trailingcing whitespace. - -M R/FPCReg.R - -commit 53d1a814c8b71d974065c366792affbd30f4896b -Author: mathchin -Date: Tue Apr 18 02:17:09 2017 +0800 - - Add document (NAMESPACE; FPCReg). Revise replicated fun name in FPCReg. - -M NAMESPACE -M R/FPCReg.R -A man/FPCReg.Rd - -commit f2e6aa5c9396ede4cdfa23236198c7db4410ae1c -Author: hadjipantelis -Date: Wed Apr 12 22:01:29 2017 +0100 - - Minor (Bug fix (#9) and renaming recently added arg.) - -M R/CheckData.R -M R/MakeFPCAInputs.R -M man/MakeFPCAInputs.Rd -M tests/testthat/test_CheckData.R -M tests/testthat/test_MakeFPCAInputs.R - -commit c8574e376c200f7945272f767fe926e7b5e781c8 -Author: hadjipantelis -Date: Wed Apr 12 01:44:42 2017 +0100 - - Finalising unit-test - -M tests/testthat/test_MakeFPCAInputs.R - -commit 858705057573084a7de2705edcc7cb896b962bdc -Author: hadjipantelis -Date: Wed Apr 12 01:39:45 2017 +0100 - - Removing duplicate - -D tests/testthat/test_makeFPCAinputs.R - -commit 65782278640df25f3e0d9dc3a83913d469b0a594 -Author: hadjipantelis -Date: Wed Apr 12 01:16:17 2017 +0100 - - Minor enc. to MakeFPCAInput, unit-test, and some typos. - -M R/CheckData.R -M R/MakeFPCAInputs.R -M man/MakeFPCAInputs.Rd -M tests/testthat/test_CheckData.R -A tests/testthat/test_MakeFPCAInputs.R - -commit 1cd2797e6792e25a1a7a08951c78385e731bb025 -Author: mathchin -Date: Tue Apr 11 06:23:35 2017 +0800 - - Rename FPCReg.r to FPCReg.R - -R100 R/FPCReg.r R/FPCReg.R - -commit 7d8f40cfa06949b36ad3b727d8a107bbc263520b -Author: mathchin -Date: Tue Apr 11 06:19:25 2017 +0800 - - Add instruction and unit test. - -M R/FPCReg.r -A tests/testthat/test_FPCReg.R - -commit 92bbcdf8241a90104008dbfef34b4ffad3fc7df5 -Author: Xiongtao Dai -Date: Wed Mar 22 00:12:25 2017 -0700 - - Changed FPCAder documentation and test cases - -M R/FPCAder.R -M man/FPCAder.Rd -M tests/testthat/test_FPCAder.R - -commit 56d2310f11a15836ef23607e5b74549da4ff17a3 -Author: hadjipantelis -Date: Thu Mar 16 12:25:04 2017 +0000 - - Changes to predict() arguments - -M R/predict.FPCA.R -M man/predict.FPCA.Rd -M tests/testthat/test_predictFPCA.R - -commit 4a797793aac7dc5ad7a9aa1cd5242c2b61346242 -Author: Xiongtao Dai -Date: Wed Mar 15 23:05:38 2017 -0700 - - minor legendre basis fix - -M R/CreateBasis.R - -commit 859f364b76b3bfec9cf5ae3f7d76bb373a437e03 -Author: hadjipantelis -Date: Sat Mar 11 19:50:30 2017 +0000 - - Correcting typos in DESCRIPTION - -M DESCRIPTION - -commit 15c8bb78523dd13dd9acd2f61594fb1e7a10f6bd -Author: hadjipantelis -Date: Sat Mar 11 19:45:15 2017 +0000 - - Correcting typos in SBFitting doc and in S3 method - -M R/SBFitting.R -M R/predict.FPCA.R -M man/SBFitting.Rd -M man/predict.FPCA.Rd - -commit dcac1dc6bc84000a3a1b4d855b6c6a164c547a2d -Author: hadjipantelis -Date: Sat Mar 11 19:27:52 2017 +0000 - - predict function - -M NAMESPACE -A R/predict.FPCA.R -M man/SBFitting.Rd -A man/predict.FPCA.Rd -A tests/testthat/test_predictFPCA.R - -commit 8bb99026cffa3f1cace51eb00d5a025608ff43a7 -Author: Kyunghee Han -Date: Fri Mar 10 16:25:38 2017 -0800 - - Modification removing non-ascii characters in document. - -M R/SBFitting.R -M man/SBFitting.Rd - -commit 9ff102943de30f5fc6169b23ddf16610b16d6588 -Author: Xiongtao Dai -Date: Fri Mar 10 15:22:19 2017 -0800 - - rm FPCReg.r - -D R/FPCReg.r - -commit e95acfb6f282ca93234295abef2ed7ccf2fe879d -Author: Xiongtao Dai -Date: Fri Mar 10 15:19:20 2017 -0800 - - Revert "Delete FPCReg.r" - - This reverts commit bdcfb2e36b810ca794ed5b822d6482d24eb956a6. - -A R/FPCReg.r - -commit 3ac8502da1c9d4be7a2e7987bf0c5e25c0eefa9b -Author: Xiongtao Dai -Date: Fri Mar 10 15:19:19 2017 -0800 - - Revert "FPCReg" - - This reverts commit ad1d5eeaba7263de291a0e38e700e3f17644409b. - -D R/FPCReg.r - -commit 362cc6c1db98f4e8f569f5753a55af57fbece0a1 -Author: Xiongtao Dai -Date: Fri Mar 10 15:19:18 2017 -0800 - - Revert "FPCReg" - - This reverts commit 15d255fcea414181a6dbebcb9f11ae43e213c18b. - -M DESCRIPTION -M NAMESPACE -M R/FPCReg.r - -commit e796a2ad3f7acacdef175e6585c0d27bc7006435 -Author: Xiongtao Dai -Date: Fri Mar 10 15:19:17 2017 -0800 - - Revert "FPCReg" - - This reverts commit 9eafa71fa1db3acb6cd1d39326f11b635d31d012. - -M DESCRIPTION -M NAMESPACE - -commit 23a424217ebdf884e4b4a95a19be82c20a91c253 -Author: Xiongtao Dai -Date: Fri Mar 10 15:19:16 2017 -0800 - - Revert "FPCReg" - - This reverts commit 42cffe50970cc73c92396a6122d00a632c69f83c. - -M DESCRIPTION - -commit 936fad17eaeba38cd368900eaa82f3e86c3e8e94 -Author: Xiongtao Dai -Date: Fri Mar 10 15:19:13 2017 -0800 - - Revert "FPCReg" - - This reverts commit a44edd3464f26c74e43c62f011f38005c9156e84. - -M R/pkgname.R - -commit c7986c49b2d5dc6f174d37f124165b8e8a975bf4 -Author: Xiongtao Dai -Date: Fri Mar 10 15:19:04 2017 -0800 - - Revert "FPCReg" - - This reverts commit 91ec89588952f37c164c61d76082d864778cddab. - -M R/FPCReg.r - -commit ac7dd25a3d5f0504d534cf81e0a23b537312c7d5 -Author: Kyunghee Han -Date: Fri Mar 10 14:54:07 2017 -0800 - - fix stopping criterion; update test casefix stopping criterion - -M R/SBFitting.R -M tests/testthat/test_SBFitting.R - -commit 759d03bf32f863510da6a012725a96133db3a87b -Author: mathchin -Date: Sat Mar 11 06:33:14 2017 +0800 - - Revert "Modification of the stopping criterion of iteration of the algorithm." - - Changes of the functional regression function is in the - fResReg branch - - This reverts commit c61cf727a07e1cd833ea985882561f6dbd31c6a8. - -M R/SBFitting.R -M man/SBFitting.Rd - -commit 91ec89588952f37c164c61d76082d864778cddab -Author: mathchin -Date: Fri Mar 10 18:01:41 2017 +0800 - - FPCReg - -M R/FPCReg.r - -commit a44edd3464f26c74e43c62f011f38005c9156e84 -Author: mathchin -Date: Fri Mar 10 17:29:59 2017 +0800 - - FPCReg - -M R/pkgname.R - -commit 42cffe50970cc73c92396a6122d00a632c69f83c -Author: mathchin -Date: Fri Mar 10 17:24:50 2017 +0800 - - FPCReg - -M DESCRIPTION - -commit 9eafa71fa1db3acb6cd1d39326f11b635d31d012 -Author: mathchin -Date: Fri Mar 10 17:20:04 2017 +0800 - - FPCReg - -M DESCRIPTION -M NAMESPACE - -commit 15d255fcea414181a6dbebcb9f11ae43e213c18b -Author: mathchin -Date: Fri Mar 10 16:54:43 2017 +0800 - - FPCReg - -M DESCRIPTION -M NAMESPACE -M R/FPCReg.r - -commit ad1d5eeaba7263de291a0e38e700e3f17644409b -Author: mathchin -Date: Fri Mar 10 15:58:18 2017 +0800 - - FPCReg - -A R/FPCReg.r - -commit bdcfb2e36b810ca794ed5b822d6482d24eb956a6 -Author: mathchin -Date: Fri Mar 10 15:29:19 2017 +0800 - - Delete FPCReg.r - -D R/FPCReg.r - -commit eb2c0b5848244b859f549c9913e82e742f7a54f9 -Author: mathchin -Date: Fri Mar 10 15:21:41 2017 +0800 - - Add files via upload - -A R/FPCReg.r - -commit c61cf727a07e1cd833ea985882561f6dbd31c6a8 -Author: Kyunghee Han -Date: Tue Feb 28 17:10:35 2017 -0800 - - Modification of the stopping criterion of iteration of the algorithm. - -M R/SBFitting.R -M man/SBFitting.Rd - -commit ba992e894bc3c02d6e6a6d190a00181745a366fc -Merge: 6239576 bb49218 -Author: Kyunghee Han -Date: Mon Feb 27 16:47:09 2017 -0800 - - Merge pull request #8 from functionaldata/additive - - Additive - -commit bb49218cbe6b1838e687a10a53a66390a8f4524e -Merge: cb03d3f 6239576 -Author: Kyunghee Han -Date: Mon Feb 27 16:26:20 2017 -0800 - - Merge branch 'master' into additive - -commit cb03d3fd5752bf2094ea40b2538ca05a0422e3b8 -Author: Kyunghee Han -Date: Mon Feb 27 16:04:00 2017 -0800 - - SBFitting with following Google's R style - -M R/CompFntCent.R -M R/CondProjection.R -M R/MgnJntDensity.R -M R/NWMgnReg.R -M R/NormKernel.R -M R/SBFCompUpdate.R -M R/SBFitting.R -A R/ScaleKernel.R -M man/SBFitting.Rd -M tests/testthat/test_SBFitting.R - -commit 182a5cfbd0670aa69524ece3b5f946e90f89a545 -Author: Kyunghee Han -Date: Mon Feb 27 12:06:12 2017 -0800 - - first commit in the new branch - -M DESCRIPTION -M NAMESPACE -M R/NormKernel.R -M R/pkgname.R -M man/BwNN.Rd -M man/CheckData.Rd -M man/CheckOptions.Rd -M man/ConvertSupport.Rd -M man/CreateBWPlot.Rd -M man/CreateCovPlot.Rd -M man/CreateDesignPlot.Rd -M man/CreateFuncBoxPlot.Rd -M man/CreateModeOfVarPlot.Rd -M man/CreateOutliersPlot.Rd -M man/CreatePathPlot.Rd -M man/CreateScreePlot.Rd -M man/CreateStringingPlot.Rd -M man/FCCor.Rd -M man/FCReg.Rd -M man/FClust.Rd -M man/FOptDes.Rd -M man/FPCA.Rd -M man/FPCAder.Rd -M man/FSVD.Rd -M man/FVPA.Rd -M man/GetCrCorYX.Rd -M man/GetCrCorYZ.Rd -M man/GetCrCovYX.Rd -D man/GetCrCovYX_old.Rd -M man/GetCrCovYZ.Rd -M man/GetNormalisedSample.Rd -D man/HandleNumericsAndNAN.Rd -M man/Lwls1D.Rd -M man/Lwls2D.Rd -M man/Lwls2DDeriv.Rd -M man/MakeBWtoZscore02y.Rd -M man/MakeFPCAInputs.Rd -M man/MakeGPFunctionalData.Rd -M man/MakeHCtoZscore02y.Rd -M man/MakeLNtoZscore02y.Rd -M man/MakeSparseGP.Rd -M man/NormCurvToArea.Rd -A man/SBFitting.Rd -M man/SelectK.Rd -M man/SetOptions.Rd -M man/Sparsify.Rd -M man/Stringing.Rd -M man/WFDA.Rd -M man/Wiener.Rd -M man/fdapace.Rd -M man/fitted.FPCA.Rd -M man/fitted.FPCAder.Rd -M man/kCFC.Rd -M man/medfly25.Rd -M man/plot.FPCA.Rd -M man/print.FPCA.Rd -M man/print.FSVD.Rd -M man/print.WFDA.Rd - -commit 6239576f2a3d3aaf69ae85a62bcba4f747536a9b -Author: hadjipantelis -Date: Mon Feb 27 01:03:05 2017 +0000 - - Minor:Fixing run-away int macro - -M DESCRIPTION -M NAMESPACE -M R/NormCurveToArea.R -M man/BwNN.Rd -M man/CheckData.Rd -M man/CheckOptions.Rd -M man/ConvertSupport.Rd -M man/CreateBWPlot.Rd -M man/CreateCovPlot.Rd -M man/CreateDesignPlot.Rd -M man/CreateFuncBoxPlot.Rd -M man/CreateModeOfVarPlot.Rd -M man/CreateOutliersPlot.Rd -M man/CreatePathPlot.Rd -M man/CreateScreePlot.Rd -M man/CreateStringingPlot.Rd -M man/FCCor.Rd -M man/FCReg.Rd -M man/FClust.Rd -M man/FOptDes.Rd -M man/FPCA.Rd -M man/FPCAder.Rd -M man/FSVD.Rd -M man/FVPA.Rd -M man/GetCrCorYX.Rd -M man/GetCrCorYZ.Rd -M man/GetCrCovYX.Rd -D man/GetCrCovYX_old.Rd -M man/GetCrCovYZ.Rd -M man/GetNormalisedSample.Rd -D man/HandleNumericsAndNAN.Rd -M man/Lwls1D.Rd -M man/Lwls2D.Rd -M man/Lwls2DDeriv.Rd -M man/MakeBWtoZscore02y.Rd -M man/MakeFPCAInputs.Rd -M man/MakeGPFunctionalData.Rd -M man/MakeHCtoZscore02y.Rd -M man/MakeLNtoZscore02y.Rd -M man/MakeSparseGP.Rd -M man/NormCurvToArea.Rd -A man/SBFitting.Rd -M man/SelectK.Rd -M man/SetOptions.Rd -M man/Sparsify.Rd -M man/Stringing.Rd -M man/WFDA.Rd -M man/Wiener.Rd -M man/fdapace.Rd -M man/fitted.FPCA.Rd -M man/fitted.FPCAder.Rd -M man/kCFC.Rd -M man/medfly25.Rd -M man/plot.FPCA.Rd -M man/print.FPCA.Rd -M man/print.FSVD.Rd -M man/print.WFDA.Rd - -commit c8cbff80ea7f994b390fb4f5775120ba8c61a91c -Author: Kyunghee Han -Date: Sat Feb 25 12:51:02 2017 -0800 - - Modification of SBFitting.R (3rd) - - Minor modification in description. - -M R/SBFitting.R - -commit de67cd72330cbf75ebb976e451a29aab0a7dc83d -Author: Kyunghee Han -Date: Sat Feb 25 04:35:48 2017 -0800 - - Modification of SBFitting.R (2nd) - - There were mistakes in syntax for description. - -M R/SBFitting.R - -commit 14d7a9c0ce7e5e1c2a1afafb79d912ea2e221195 -Author: Kyunghee Han -Date: Sat Feb 25 04:26:45 2017 -0800 - - Modification of SBFitting.R - - It was my mistake to use #’ instead of #’ on description part. - -M R/SBFitting.R - -commit 49c2160cc3c9e1d3c3d2987f1116ba94b8981cd4 -Author: Kyunghee Han -Date: Sat Feb 25 03:59:34 2017 -0800 - - Modification of test_SBFitting.R - - I just added ‘#’ in the preamble to ignore my own sourcing commend. - -M tests/testthat/test_SBFitting.R - -commit 3df33a0ff1652b1bc69aade9cb24bdfa31aa6467 -Author: Kyunghee Han -Date: Sat Feb 25 03:54:21 2017 -0800 - - A tentative code of smooth backfitting for nonparametric additive models - - I’m committing my tentative R code of SBF which can be applied to - various additive models. It’s supposed to be modified in several times - for synchronizing the tPACE environment. Please refer to the code and - give me comments anytime! - -A R/CompFntCent.R -A R/CondProjection.R -A R/MgnJntDensity.R -A R/NWMgnReg.R -A R/NormKernel.R -A R/SBFCompUpdate.R -A R/SBFitting.R -A tests/testthat/test_SBFitting.R - -commit 7399911a56e17b4a3ff0ae92cf4be3d75d787c2f -Author: dmchris -Date: Tue Feb 21 17:09:57 2017 -0800 - - importing MASS - -M DESCRIPTION - -commit 31f73c9aa31b61e81b0a0d751266a39d93628229 -Author: dmchris -Date: Tue Feb 21 16:35:17 2017 -0800 - - Modified documentation for CreateStringingPlot - -M R/CreateStringingPlot.R -M man/CreateStringingPlot.Rd - -commit 5ab8faaced3d09345e7654251ff5604f2f7a1d38 -Author: dmchris -Date: Tue Feb 21 16:24:20 2017 -0800 - - Updated Documentations - -M NAMESPACE -M man/BwNN.Rd -M man/CheckData.Rd -M man/CheckOptions.Rd -M man/ConvertSupport.Rd -M man/CreateBWPlot.Rd -M man/CreateCovPlot.Rd -M man/CreateDesignPlot.Rd -M man/CreateFuncBoxPlot.Rd -M man/CreateModeOfVarPlot.Rd -M man/CreateOutliersPlot.Rd -M man/CreatePathPlot.Rd -M man/CreateScreePlot.Rd -A man/CreateStringingPlot.Rd -M man/FCCor.Rd -M man/FCReg.Rd -M man/FClust.Rd -M man/FOptDes.Rd -M man/FPCA.Rd -M man/FPCAder.Rd -M man/FSVD.Rd -M man/FVPA.Rd -M man/GetCrCorYX.Rd -M man/GetCrCorYZ.Rd -M man/GetCrCovYX.Rd -A man/GetCrCovYX_old.Rd -M man/GetCrCovYZ.Rd -M man/GetNormalisedSample.Rd -A man/HandleNumericsAndNAN.Rd -M man/Lwls1D.Rd -M man/Lwls2D.Rd -M man/Lwls2DDeriv.Rd -M man/MakeBWtoZscore02y.Rd -M man/MakeFPCAInputs.Rd -M man/MakeGPFunctionalData.Rd -M man/MakeHCtoZscore02y.Rd -M man/MakeLNtoZscore02y.Rd -M man/MakeSparseGP.Rd -M man/NormCurvToArea.Rd -M man/SelectK.Rd -M man/SetOptions.Rd -M man/Sparsify.Rd -A man/Stringing.Rd -M man/WFDA.Rd -M man/Wiener.Rd -M man/fdapace.Rd -M man/fitted.FPCA.Rd -M man/fitted.FPCAder.Rd -M man/kCFC.Rd -M man/medfly25.Rd -M man/plot.FPCA.Rd -M man/print.FPCA.Rd -M man/print.FSVD.Rd -M man/print.WFDA.Rd - -commit 77f1d2f694b1aed24d63b8af7587a57b20f7bf54 -Author: dmchris -Date: Tue Feb 21 16:18:35 2017 -0800 - - modifications for stringing - - 1. isStandardize -> standardize in Stringing() - 2. Added descriptions and corrected a typo on the x-label for stringed - order. - 3. modified test cases using up-to-date testthat package. - -M R/CreateStringingPlot.R -M R/Stringing.R -M tests/testthat/test_CreateStringingPlot.R -M tests/testthat/test_Stringing.R - -commit 2af5ac17acb9bb088a2a6abe60268f24aa9ec397 -Author: dmchris -Date: Thu Feb 16 20:31:04 2017 -0800 - - modified stringing, adding an independent plotting function - - modified correlation metric; - import mvrnorm and isoMDS from MASS; - add plotting function for observed & stringed predictors, and stringing - function. - -A R/CreateStringingPlot.R -M R/Stringing.R -M R/pkgname.R -A tests/testthat/test_CreateStringingPlot.R -M tests/testthat/test_Stringing.R - -commit 1a93b0c6a788d802c6252c3af392e84539575582 -Author: dmchris -Date: Tue Feb 14 22:35:24 2017 -0800 - - adding checks for user-specified metric matrix - -M R/Stringing.R - -commit f5a03ebcc8151fa2ccf79ad428f74aca50bab6ad -Author: dmchris -Date: Tue Feb 14 22:20:05 2017 -0800 - - tentative codes for stringing - - Feature various kinds of dissimilarity metrics. Uses UDS via function - MASS::isoMDS. Performance is better than Matlab. Standardization of - input data not yet implemented (could add an option, but Matlab version - doesn’t have this part.) - -A R/Stringing.R -A tests/testthat/test_Stringing.R - -commit cfe71296c149ae7aa5cd38b19f809eb7e4ad4de2 -Author: hadjipantelis -Date: Mon Feb 6 19:13:12 2017 +0000 - - Update DESCRIPTION - -M DESCRIPTION - -commit 9ce741d9c1afd4da6c933120ddcd85dfb59d329b -Author: hadjipantelis -Date: Sat Feb 4 15:18:10 2017 +0000 - - Minor updates and 'userRho' functionality. - -M DESCRIPTION -M R/CheckOptions.R -M R/FPCA.R -M R/NormCurveToArea.R -M R/SetOptions.R -M man/BwNN.Rd -M man/CheckData.Rd -M man/CheckOptions.Rd -M man/ConvertSupport.Rd -M man/CreateBWPlot.Rd -M man/CreateCovPlot.Rd -M man/CreateDesignPlot.Rd -M man/CreateFuncBoxPlot.Rd -M man/CreateModeOfVarPlot.Rd -M man/CreateOutliersPlot.Rd -M man/CreatePathPlot.Rd -M man/CreateScreePlot.Rd -M man/FCCor.Rd -M man/FCReg.Rd -M man/FClust.Rd -M man/FOptDes.Rd -M man/FPCA.Rd -M man/FPCAder.Rd -M man/FSVD.Rd -M man/FVPA.Rd -M man/GetCrCorYX.Rd -M man/GetCrCorYZ.Rd -M man/GetCrCovYX.Rd -M man/GetCrCovYZ.Rd -M man/GetNormalisedSample.Rd -M man/Lwls1D.Rd -M man/Lwls2D.Rd -M man/Lwls2DDeriv.Rd -M man/MakeBWtoZscore02y.Rd -M man/MakeFPCAInputs.Rd -M man/MakeGPFunctionalData.Rd -M man/MakeHCtoZscore02y.Rd -M man/MakeLNtoZscore02y.Rd -M man/MakeSparseGP.Rd -M man/NormCurvToArea.Rd -M man/SelectK.Rd -M man/SetOptions.Rd -M man/Sparsify.Rd -M man/WFDA.Rd -M man/Wiener.Rd -M man/fdapace.Rd -M man/fitted.FPCA.Rd -M man/fitted.FPCAder.Rd -M man/kCFC.Rd -M man/medfly25.Rd -M man/plot.FPCA.Rd -M man/print.FPCA.Rd -M man/print.FSVD.Rd -M man/print.WFDA.Rd -M tests/testthat/test_CheckData.R - -commit 15fc3097153d342db0f6ef3a56dd0de6e10301df -Author: hadjipantelis -Date: Sat Feb 4 14:48:05 2017 +0000 - - Update README.md - -M README.md - -commit dd7cad6145909fb13c76b3c43b6474a5fd027379 -Author: hadjipantelis -Date: Fri Feb 3 23:35:32 2017 +0000 - - Update README.md - -M README.md - -commit b123b8393adce58f74ee13ec37236f6381c32207 -Author: hadjipantelis -Date: Fri Feb 3 23:28:26 2017 +0000 - - Area normalisation convenience func. - -M NAMESPACE -A R/NormCurveToArea.R -A man/NormCurvToArea.Rd - -commit e2266a5cc5ef4a3abc95f123cd92f3eab7586e87 -Author: hadjipantelis -Date: Mon Jan 30 23:24:36 2017 +0000 - - Print function for WFDA - -M NAMESPACE -M R/WFDA.R -A R/print.WFDA.R -M man/WFDA.Rd -A man/print.WFDA.Rd - -commit 815d8453b9689ef50aabccbf3a78cad999aeb460 -Author: hadjipantelis -Date: Sat Jan 28 16:48:42 2017 +0000 - - Update ISSUE_TEMPLATE.md - -M ISSUE_TEMPLATE.md - -commit be293326a1d339d775b6df25d990bdc6ba405a23 -Author: hadjipantelis -Date: Sat Jan 28 16:47:53 2017 +0000 - - Update ISSUE_TEMPLATE.md - -M ISSUE_TEMPLATE.md - -commit b972849ec811dedd6ac09ffe3e1193b9352bb43a -Author: hadjipantelis -Date: Sat Jan 28 16:45:22 2017 +0000 - - Created ISSUE_TEMPLATE - -A ISSUE_TEMPLATE.md - -commit ab9090be5bfc90cf103c6640214fd4f97ab274c5 -Author: hadjipantelis -Date: Tue Jan 24 20:04:27 2017 +0000 - - Updating dates. - -M DESCRIPTION -M LICENSE - -commit 451f1ef508909920a6b0fadeb53212d78d0ee085 -Author: hadjipantelis -Date: Tue Jan 24 19:45:15 2017 +0000 - - Minor changes - -M R/medfly25.R -M data/medfly25.RData -M man/FOptDes.Rd -M man/medfly25.Rd -M tests/testthat/test_FOptDes.R - -commit 6d2de5e8667585f5b2fd5005dba3ac7c0789e8b7 -Author: dmchris -Date: Mon Jan 23 23:19:31 2017 -0800 - - update medfly25.RData, modify test cases correspondingly - -M data/medfly25.RData -D data/medfly25_res.RData -M tests/testthat/test_FOptDes.R - -commit be7a84dcf4d3329634fec8d2eb914fabd9ffa70f -Author: dmchris -Date: Mon Jan 23 22:07:34 2017 -0800 - - Adding medfly25_res.RData, update test cases for FOptDes.R - -M R/FOptDes.R -A data/medfly25_res.RData -M tests/testthat/test_FOptDes.R - -commit 9277f019a26e729a638a329bba0b193b9dd857a8 -Author: hadjipantelis -Date: Mon Jan 23 21:36:49 2017 +0000 - - Adding the Jacques & Preda reference - -M R/FClust.R -M man/FClust.Rd -M man/FOptDes.Rd - -commit 58b4bfde61f7d4f5ed086b8f1b97eb5da8b09eef -Author: hadjipantelis -Date: Sun Jan 22 19:36:45 2017 +0000 - - MATLAB compatibiity WFDA test - -A inst/testdata/YmatFromWFPCAexample_rng123.RData -M tests/testthat/test_WFDA.R - -commit 8d6acffe385ca9045a79e5866e22d61cee416f62 -Merge: e725af9 75f7090 -Author: hadjipantelis -Date: Fri Jan 20 22:14:10 2017 +0000 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit e725af9a6c03392f6b70794873b8d64d968cdbfd -Author: hadjipantelis -Date: Fri Jan 20 22:13:03 2017 +0000 - - Minor update to 'CreateFuncBoxPlot' - -M R/CreateFuncBoxPlot.R - -commit 75f7090ddd9e6d3175f3ca82682ec664c2cd0435 -Author: dmchris -Date: Fri Jan 20 00:08:48 2017 -0800 - - added input checks - -M R/FOptDes.R -M tests/testthat/test_FOptDes.R - -commit 7cdc746984323172667eafe8974ac83bccc06192 -Author: dmchris -Date: Thu Jan 19 23:30:34 2017 -0800 - - small bug fix for FOptDes.R - -M R/FOptDes.R - -commit bb4912c0b8c5c5d90243f36a3385ffd882b65d9b -Author: dmchris -Date: Thu Jan 19 23:28:43 2017 -0800 - - modified documentation and input checks for FOptDes - - Passed the current test. Coming up with example with medfly25 data for - regression. - -M R/FOptDes.R -M tests/testthat/test_FOptDes.R - -commit 53cbfcbd6354e80061d37da1f361e5e34ce6ded8 -Author: hadjipantelis -Date: Sun Jan 15 23:43:14 2017 +0000 - - Making examples faster. - -M R/FOptDes.R -M R/kCFC.R -M man/FOptDes.Rd -M man/kCFC.Rd - -commit c7f6f9c62b421325af477fab78a6c4b56192f210 -Author: dmchris -Date: Fri Jan 13 14:18:11 2017 -0800 - - FOptDes test case bug fix & news update - -M NEWS -M tests/testthat/test_FOptDes.R - -commit a25ecc6380317fcb5e796942bb9db66d0fe6b32a -Author: hadjipantelis -Date: Fri Jan 13 21:41:11 2017 +0000 - - Basic clean-up. - -M NAMESPACE -M R/BestDes_SR.R -M R/BestDes_TR.R -M R/MCVOptRidge.R -A man/FOptDes.Rd - -commit 3f7c8e5ed4cbd36d457d660c72c3ae89786a6421 -Author: dmchris -Date: Fri Jan 13 03:01:00 2017 -0800 - - FOptDes test case - -A tests/testthat/test_FOptDes.R - -commit 7d59bcdb47d427b5dc3950b795d040377bd3546b -Author: dmchris -Date: Fri Jan 13 01:40:24 2017 -0800 - - Modifies FOptDes - -M R/FOptDes.R -M R/MCVOptRidge.R - -commit f926decc0872f2a9f9d2a3e9d130a1f4347d6e3f -Author: dmchris -Date: Fri Jan 13 00:18:31 2017 -0800 - - documentation example change - -M R/FOptDes.R - -commit 1fa62bdd4ecde787052b912a4ef94f40071dd00e -Author: dmchris -Date: Fri Jan 13 00:14:34 2017 -0800 - - Rename Foptdes.R to FOptDes.R - -R100 R/Foptdes.R R/FOptDes.R - -commit 59ab9055ead1075cb5bb061732767a661dfee077 -Author: dmchris -Date: Thu Jan 12 23:52:57 2017 -0800 - - FOptDes revised version - -A R/BestDes_SR.R -A R/BestDes_TR.R -M R/Foptdes.R -A R/MCVOptRidge.R - -commit dec2a13704a516c257197441d389dd945fd96580 -Author: dmchris -Date: Tue Jan 10 21:54:59 2017 -0800 - - optimal designs (tentative) - - Works for trajectory recovery and scalar response prediction for dense - and sparse data. Works for dense data now. - -A R/Foptdes.R - -commit 4818f738ef6dc597f859c32ab12fae79f7b23429 -Author: hadjipantelis -Date: Sat Jan 7 04:25:18 2017 +0200 - - Long line change. - -M R/WFDA.R -M man/WFDA.Rd - -commit f87db151a7e0416d58ff9c8009e5058ef8674955 -Author: hadjipantelis -Date: Fri Jan 6 18:44:25 2017 +0200 - - New version on DESC - -M DESCRIPTION - -commit f99dbe4c885ceb2359319c40fbfc8a5cc79f798d -Author: hadjipantelis -Date: Fri Jan 6 18:34:49 2017 +0200 - - WFDA Unit Test & Example - -M R/WFDA.R -M man/WFDA.Rd -A tests/testthat/test_WFDA.R - -commit 33336f2ac63342b00fda5d0aa6e342fb90ac3f2e -Author: hadjipantelis -Date: Fri Jan 6 03:36:06 2017 +0200 - - Update NEWS - -M NEWS - -commit 1676e49da7c5f39d3a45a2554a86574d762ed9ff -Author: hadjipantelis -Date: Thu Jan 5 16:51:07 2017 +0200 - - Additonal WFDA fixes. - -M R/WFDA.R -M man/WFDA.Rd - -commit 0d8b131f2edc72f6e80da573e4e1a3dc4775bb08 -Author: Xiongtao Dai -Date: Sun Dec 18 23:29:09 2016 +0800 - - rename FuncCorrCent -> FCCor - -M NAMESPACE -M NEWS -R089 R/FuncCorrCent.R R/FCCor.R -R081 man/FuncCorrCent.Rd man/FCCor.Rd -R070 tests/testthat/test_FuncCorrCent.R tests/testthat/test_FCCor.R - -commit 435a388193cbc908040bb71478ff12f95e6509b7 -Author: hadjipantelis -Date: Wed Dec 7 23:35:25 2016 +0000 - - Correcting test. - -M tests/testthat/test_RcppPseudoApprox.R - -commit effd439986138248a50eb812de2abf75f4102b24 -Author: hadjipantelis -Date: Wed Dec 7 23:30:58 2016 +0000 - - Omission! - -M R/WFDA.R - -commit 80f376356e7cce2b135631abbaf177400fe38572 -Author: hadjipantelis -Date: Wed Dec 7 22:48:01 2016 +0000 - - Tests and grid modifications. - -M R/WFDA.R -M src/RcppPseudoApprox.cpp -A tests/testthat/test_RcppPseudoApprox.R - -commit 694131494f0ed2ca3f836c522cc817f304f99aa1 -Author: hadjipantelis -Date: Tue Dec 6 22:28:36 2016 +0000 - - Cleaning up Rcpp file. - -D RcppInterp.cpp - -commit ba17d376af951614d8990e4b8dbcc3fa8bb6b3d9 -Author: hadjipantelis -Date: Tue Dec 6 22:27:39 2016 +0000 - - Further speed-ups. - -M R/WFDA.R - -commit 9c9b6a75b4a844492ebe16ebc6d3d4b625fed704 -Author: hadjipantelis -Date: Mon Dec 5 22:46:37 2016 +0000 - - Faster approx - -M R/RcppExports.R -M R/WFDA.R -M src/RcppExports.cpp -A src/RcppPseudoApprox.cpp - -commit f1c6a1edc3d798d8774ed533882386518f2e94ef -Author: hadjipantelis -Date: Mon Dec 5 22:24:46 2016 +0000 - - Speeding-up WFDA - -M R/RcppExports.R -M R/WFDA.R -M src/RcppExports.cpp -A src/Rcppsort.cpp - -commit c62be51e3bf7bbea81de33f3f40f17f4c69eda70 -Merge: 7b429b8 cb15dad -Author: hadjipantelis -Date: Mon Dec 5 21:13:59 2016 +0000 - - Merge pull request #5 from functionaldata/Rmixmod - - Rmixmod - -commit cb15dad1aba5ad75648d1ea52ae9f811851ab254 -Author: hadjipantelis -Date: Mon Dec 5 21:12:39 2016 +0000 - - Sorting out FClust - -M R/FClust.R -M man/FClust.Rd -M tests/testthat/test_FClust.R - -commit 7b429b8dd58450b76129bc398254413970cdb1e9 -Author: Xiongtao Dai -Date: Sun Dec 4 18:46:39 2016 -0800 - - travis - -M .travis.yml - -commit 808514b81c8b2f6f2353d59cb60e4e1d17b6cec3 -Author: Xiongtao Dai -Date: Sun Dec 4 18:16:10 2016 -0800 - - Rcpp 0.12.8 has a problem; dont use it on travis - -M .travis.yml -M DESCRIPTION - -commit 519413b40ffd10287ba0b2cacbea298019441521 -Author: Xiongtao Dai -Date: Sun Dec 4 18:05:23 2016 -0800 - - use new Rcpp - -M DESCRIPTION - -commit 1c38b78f2dadaccb71dee771af77a9b8374f3789 -Author: Xiongtao Dai -Date: Sun Dec 4 17:08:36 2016 -0800 - - fix WARNINGs and NOTEs - -M NAMESPACE -M R/CreateBasis.R -M R/GetNormalisedSample.R -M R/Lwls2DDeriv.R -M R/RcppExports.R -M R/fitted.FPCA.R -M R/pkgname.R -M R/plot.FPCA.R -M man/GetNormalisedSample.Rd -M man/Lwls2DDeriv.Rd -M man/plot.FPCA.Rd -M src/RcppExports.cpp -M tests/testthat/test_Rrotatemullwlsk.R - -commit 69a7b96a579c80d2525899624d24db1ce8c808eb -Author: hadjipantelis -Date: Mon Dec 5 00:39:03 2016 +0000 - - Dropping 'SEM' - -M R/FClust.R -M tests/testthat/test_FClust.R - -commit 709ccdcf0e6ac3d5b24d0659834c80bcf57114c9 -Author: Xiongtao Dai -Date: Sun Dec 4 16:35:28 2016 -0800 - - travis cache packages - -M .travis.yml - -commit dfe7fc95f108cd6ddb68146f3805683f9b60d50e -Author: Xiongtao Dai -Date: Sun Dec 4 16:23:25 2016 -0800 - - travis - -M .travis.yml - -commit e5e9e7969bc473cb64415a144628564835157f68 -Author: Xiongtao Dai -Date: Sun Dec 4 16:07:52 2016 -0800 - - travis - -M .travis.yml - -commit 9c228ce5dd8bdcaa6be01cd042edea4c1eef3731 -Author: Xiongtao Dai -Date: Sun Dec 4 15:45:20 2016 -0800 - - travis update R package cache - -M .travis.yml - -commit c1ba5b2fc0d1718f7f6c768d81e6a61178e5b562 -Author: Xiongtao Dai -Date: Sun Dec 4 12:58:22 2016 -0800 - - isolated degeneration problem in Rmixmod - -M R/FClust.R -M tests/testthat/test_FClust.R - -commit e595bb9925984fbfc1684b540b40718d81ed33c8 -Author: Xiongtao Dai -Date: Sun Dec 4 12:25:50 2016 -0800 - - Fix GetBinnedCurve.R - - Previously GetBinnedCurve produce binned data that does not cover the - output domain (range(obsGrid) would change), which is highly unexpected. - Now range(obsGrid) of the binned and the original dataset agree. - -M R/GetBinnedCurve.R -M tests/testthat/test_FClust.R -M tests/testthat/test_FPCA.R -M tests/testthat/test_GetBinnedCurve.R -M tests/testthat/test_GetBinnedDataset.R - -commit 5ae78ba5d64355a58d808c130c133c965e073fa1 -Author: hadjipantelis -Date: Sun Nov 27 23:16:27 2016 +0000 - - Typo! - -M R/WFDA.R - -commit 1b184ad35e1e254c1839c92da8b02d052fd6a770 -Author: hadjipantelis -Date: Sun Nov 27 23:10:35 2016 +0000 - - Release candidate. WFDA correct. - -M R/WFDA.R -M man/WFDA.Rd - -commit f9253bb70375decab3de0846034109f1bbf58622 -Author: hadjipantelis -Date: Sat Nov 26 17:40:35 2016 +0000 - - Requesting newer survival package to make sure Hmisc works. - -M DESCRIPTION - -commit 6050cb63cf0283e3a8691d474b3c7d8fbc477225 -Author: hadjipantelis -Date: Sat Nov 26 17:20:08 2016 +0000 - - First working WFDA.R - -M NAMESPACE -M R/RcppExports.R -A R/WFDA.R -A RcppInterp.cpp -A man/WFDA.Rd -M src/RcppExports.cpp - -commit 237b5fe546f96254615b3f81af679f21d45d2027 -Merge: a1c3da1 4b12598 -Author: Xiongtao Dai -Date: Mon Oct 24 06:39:47 2016 +0100 - - Merge branch 'master' of github.com:functionaldata/tPACE - -commit a1c3da1f20fef43c27ae074e65a25cbf79fa0964 -Author: Xiongtao Dai -Date: Mon Oct 24 06:39:29 2016 +0100 - - update docs - -M NEWS -M man/FPCA.Rd -M man/FPCAder.Rd -M man/MakeSparseGP.Rd - -commit b49dda992eba98e02d8d66ba91fd6077420c75bb -Author: Xiongtao Dai -Date: Mon Oct 24 06:26:22 2016 +0100 - - minor fitted.FPCA - -M R/fitted.FPCA.R - -commit 4b12598c58295aeaabcce29f46d0e31e11bde482 -Author: Pantelis -Date: Wed Sep 14 17:04:05 2016 +0100 - - Commenting out unused variables in CPP. - -M R/RcppExports.R -M src/GetIndCEScoresCPP.cpp -M src/GetIndCEScoresCPPnewInd.cpp -M src/RcppExports.cpp - -commit dcc9ce0246ed6f5ca3616762a6c9df175e6b568f -Author: Xiongtao Dai -Date: Sun Sep 11 02:00:57 2016 -0700 - - minor fix in FPCA and MakeFPCAInputs - -M R/FPCA.R -M R/MakeFPCAInputs.R - -commit 004c0a22849d268d87c112edb057bed9ac797c01 -Author: Xiongtao Dai -Date: Tue Sep 6 14:24:22 2016 -0700 - - minor na fix for MakeFPCAInputs - -M R/MakeFPCAInputs.R - -commit 00a31d55d44d08314db362a1faef18b633ca9964 -Author: Xiongtao Dai -Date: Fri Sep 2 00:53:42 2016 -0700 - - minor change to CreatePathPlot FPCAder - -M R/CreatePathPlot.R -M R/FPCAder.R - -commit 72924a1d5c096696dbdd7662ef3e09f97f6e80df -Author: Xiongtao Dai -Date: Wed Aug 31 22:40:14 2016 -0700 - - fix FPC case - -M R/FPCAder.R - -commit 9b49b0576cd00ebacb11d01217bcd4828031a64b -Author: Xiongtao Dai -Date: Wed Aug 31 21:06:38 2016 -0700 - - add user Cov to MakeSparseGP - -M R/MakeSparseGP.R -M tests/testthat/test_MakeSparseGP.R - -commit 24f1302f9c127353f66fa18811f6da4cc1b1abcd -Author: Xiongtao Dai -Date: Wed Aug 31 12:10:33 2016 -0700 - - FPCAder add DPCCE - -M R/FPCAder.R -M R/Sparsify.R - -commit b77522355020ad844170c24b7ba452f22c0f69f4 -Author: Xiongtao Dai -Date: Sun Aug 21 13:37:00 2016 -0700 - - fix basis test - -M tests/testthat/test_CreateBasis.R - -commit bae8204725f9dfe8071fa168263f9abfc6278f6c -Author: Xiongtao Dai -Date: Sun Aug 21 11:17:39 2016 -0700 - - add basis (again) - -A tests/testthat/test_CreateBasis.R - -commit ce4b76fe30f48a276770cb8489095cde242ef89f -Author: Xiongtao Dai -Date: Sun Aug 21 11:11:32 2016 -0700 - - numerical tolerance modified for WSL - -M tests/testthat/test_Rmullwlsk.R - -commit 360451b117fa39cffac7ec5f43860afc380a35e4 -Author: Xiongtao Dai -Date: Sat Aug 20 16:59:03 2016 -0700 - - change back - -M R/FPCAder.R - -commit da012947b19a6cbcd52fc8d11a34fb7ab7321a29 -Author: Xiongtao Dai -Date: Sat Aug 20 15:44:03 2016 -0700 - - minor - -M R/FPCAder.R - -commit a1a41cf9300cf8640e50072bf0fc30c6d1d1bc32 -Author: Xiongtao Dai -Date: Sat Aug 20 15:40:30 2016 -0700 - - minor - -M R/FPCAder.R - -commit 98626e521ab06e34db62a8fac3842d35e24a3819 -Author: Xiongtao Dai -Date: Sat Aug 20 01:20:08 2016 -0700 - - FPCAder add bwMu bwCov; add poly legendre basis - -M R/CreateBasis.R -M R/FPCAder.R -M R/MakeGPFunctionalData.R -M R/MakeSparseGP.R -M R/SetDerOptions.R - -commit 5078a21f750f08a28fcd20c6a693b09651d19230 -Author: Xiongtao Dai -Date: Fri Aug 19 12:33:37 2016 -0700 - - FPCAder: clean up DPC; xiVarDer no smooth and trunc - -M R/FPCAder.R - -commit 0b1600eeb6e08fee5974846cbda267e04c03e76c -Author: Xiongtao Dai -Date: Tue Aug 16 18:29:37 2016 -0700 - - fix fitted.FPCAder.R - -M R/FPCAder.R -M R/fitted.FPCAder.R - -commit 27265ec9791ef0b108ece0aad99704520bc2664b -Author: Xiongtao Dai -Date: Tue Aug 16 02:24:56 2016 -0700 - - add DPC1 FPC1 - -M R/FPCAder.R -M R/MakeGPFunctionalData.R -M R/fitted.FPCAder.R -M man/MakeGPFunctionalData.Rd - -commit b568a3ebdb21175fdd0ae5830ca91c8fac9ad6eb -Author: Xiongtao Dai -Date: Sun Aug 14 18:50:41 2016 -0700 - - make cov11 symmetric - -M R/FPCAder.R - -commit 796080d7556986856721bf6c6f525584950e9c3b -Author: Xiongtao Dai -Date: Sun Aug 14 16:26:05 2016 -0700 - - fix test - -M NAMESPACE -M man/CreatePathPlot.Rd -A man/fitted.FPCAder.Rd -M tests/testthat/test_FPCAder.R -M tests/testthat/test_Lwls2DDeriv.R - -commit 06379cc31f493a652c4bd4ba7ca42c57b9b6c743 -Author: Xiongtao Dai -Date: Sun Aug 14 16:01:49 2016 -0700 - - update deriv; add util functions for der - -M R/CreatePathPlot.R -M R/FPCAder.R -M R/SetDerOptions.R -M R/fitted.FPCA.R -A R/fitted.FPCAder.R -M man/FPCAder.Rd -M man/fitted.FPCA.Rd -M tests/testthat/test_CreatePathPlot.R -M tests/testthat/test_FPCAder.R - -commit a79dae92123e8eb9e9c104f956bda8aa5c654de7 -Author: Xiongtao Dai -Date: Sun Jul 31 17:28:04 2016 -0700 - - 2D GCV criterion modified to prevent undersmoothing - -M NAMESPACE -M R/CreateBasis.R -M R/GCVLwls2DV2.R -A R/MakeSparseGP.R -M R/SetDerOptions.R -M R/fitted.FPCA.R -M man/ConvertSupport.Rd -M man/FPCAder.Rd -M man/Lwls1D.Rd -M man/Lwls2D.Rd -A man/Lwls2DDeriv.Rd -A man/MakeSparseGP.Rd -M man/fitted.FPCA.Rd -A tests/testthat/test_MakeSparseGP.R -M tests/testthat/test_fitted.R - -commit 5353dcac8fb17e4a06cb1ba1dba96336bd95f3ec -Author: Xiongtao Dai -Date: Fri Jul 29 14:41:35 2016 -0700 - - minor fix ConvertSupport - -M R/ConvertSupport.R - -commit 2130675bf88092520561165599c8c69241b5d0ec -Merge: e6f60dd 09a8ebc -Author: Xiongtao Dai -Date: Fri Jul 29 14:37:42 2016 -0700 - - merge master - -commit 09a8ebc8140039ea658d9ab156068cb7c3441244 -Author: Xiongtao Dai -Date: Thu Jul 28 00:02:06 2016 -0700 - - minor fix - -M R/CreatePathPlot.R - -commit 765a6ace3853b835493c68f0430bf77aa8fe6133 -Author: Xiongtao Dai -Date: Wed Jul 27 23:28:16 2016 -0700 - - Modified CreatePathPlot and GetNormalisedSample - -M NAMESPACE -M NEWS -M R/CreatePathPlot.R -M R/GetNormalisedSample.R -M R/MakeGPFunctionalData.R -M man/CreatePathPlot.Rd -M man/GetNormalisedSample.Rd -M tests/testthat/test_CreatePathPlot.R -A tests/testthat/test_GetNormalisedSample.R - -commit c55d525b791323c7413d37ae49184fa53f4d6ec0 -Author: Xiongtao Dai -Date: Tue Jul 19 22:17:06 2016 -0700 - - fix FVPA for very dense data - -M R/FVPA.R -M tests/testthat/test_FVPA.R - -commit 6106383733fb0b4735a3bdd7a92d744afd84fc6d -Author: Xiongtao Dai -Date: Mon Jul 18 18:38:49 2016 -0700 - - forgot to export - -M NAMESPACE -M R/FuncCorrCent.R - -commit 33f495ec3b2578d47437e54ccd1e1559f22ce31c -Merge: b6b6f76 53ead11 -Author: Xiongtao Dai -Date: Mon Jul 18 18:17:47 2016 -0700 - - Merge branch 'master' of github.com:functionaldata/tPACE - -commit b6b6f76a746005133943dcb418334fa05e2ad116 -Author: Xiongtao Dai -Date: Mon Jul 18 18:17:43 2016 -0700 - - add FuncCorrCent - -M R/FCReg.R -M R/FPCA.R -A R/FuncCorrCent.R -M R/GetCrCovYZ.R -M R/Sparsify.R -M R/Wiener.R -M man/FCReg.Rd -M man/FPCA.Rd -A man/FuncCorrCent.Rd -M man/GetCrCovYZ.Rd -D man/Lwls2Dv1.Rd -D man/oldFCReg.Rd -M man/plot.FPCA.Rd -A tests/testthat/test_FuncCorrCent.R - -commit a12ddbb45cfccb92a43a6205b05a11329ac0ebfc -Author: Xiongtao Dai -Date: Mon Jul 18 11:18:14 2016 -0700 - - rm old functions - -D R/Lwls2Dv1.R -D R/oldFCReg.R - -commit 53ead110993420e8784627861de72178cfa311b9 -Author: hadjipantelis -Date: Sat Jul 16 03:07:59 2016 +0300 - - Fixed NEWS - -M NEWS - -commit 156fda792b46767d741f5a8371c425a0609fa9a7 -Author: Xiongtao Dai -Date: Sat Jul 16 00:54:53 2016 +0100 - - add obsOnly to CreatePathPlot; diagnostic plot renaming - -M NEWS -M R/CheckOptions.R -M R/CreateDesignPlot.R -M R/CreateDiagnosticsPlot.R -M R/CreatePathPlot.R -M R/FPCA.R -M R/RcppExports.R -M R/SetOptions.R -M R/plot.FPCA.R -M R/print.FPCA.R -M R/print.FSVD.R -M man/CreateDesignPlot.Rd -M man/CreatePathPlot.Rd -M man/FPCA.Rd -R060 man/CreateDiagnosticsPlot.Rd man/plot.FPCA.Rd -M src/RcppExports.cpp -M tests/testthat/test_CreateDiagnosticPlot.R -M tests/testthat/test_CreatePathPlot.R -M vignettes/fdapaceVignetteKnitr.Rnw - -commit fb3bfffb84c7fbfbe71b50e0c6fe528afdb45e71 -Author: hadjipantelis -Date: Thu Jul 14 22:19:57 2016 +0100 - - Necessary change to avoid non-reproducible error... - -M vignettes/fdapaceVignetteKnitr.Rnw - -commit cea6cb116ee0f964a66af99f2efb93ce43f670d4 -Merge: 0ad3464 42a0d42 -Author: Xiongtao Dai -Date: Wed Jul 13 17:45:28 2016 -0700 - - Merge branch 'master' of github.com:functionaldata/tPACE - -commit 0ad3464c4ba116604795fa5f46e89c621e542de9 -Author: Xiongtao Dai -Date: Wed Jul 13 17:45:23 2016 -0700 - - update NEWS - -M NEWS - -commit 42a0d42da7b5efe33795b1ed5de93e642c68b58d -Author: hadjipantelis -Date: Thu Jul 14 01:38:03 2016 +0100 - - Class-label reversal due to new Rmixmod. - -M tests/testthat/test_FClust.R - -commit 26fbe04e43cb275fd233db795e8d4f8dba47a938 -Author: hadjipantelis -Date: Thu Jul 14 01:00:12 2016 +0100 - - Only DESC changes. - -M DESCRIPTION -M R/RcppExports.R -M src/RcppExports.cpp - -commit c7d5b742b24d64f58532e2ca0f0ebeb868aff4bc -Author: Xiongtao Dai -Date: Fri Jul 8 18:14:53 2016 +0100 - - slightly update MakeGP - -M DESCRIPTION -M NAMESPACE -M R/MakeGPFunctionalData.R -M man/MakeGPFunctionalData.Rd - -commit 3a6f3818bba3c05798f17360f124cd8dd3094b18 -Author: Xiongtao Dai -Date: Wed Jul 6 23:11:58 2016 +0100 - - bug fix in GetCrCovYX; slightly modified SelectK; more tests - -M NEWS -M R/CreateDiagnosticsPlot.R -M R/CreatePathPlot.R -M R/FCReg.R -M R/GetCrCovYX.R -M R/Lwls2D.R -M R/MakeFPCAInputs.R -M R/RcppExports.R -M R/SelectK.R -M R/fitted.FPCA.R -M R/plot.FPCA.R -M README.md -M man/CreateDiagnosticsPlot.Rd -M man/CreateFuncBoxPlot.Rd -M man/CreatePathPlot.Rd -M man/FCReg.Rd -M man/SelectK.Rd -M man/fitted.FPCA.Rd -D man/plot.FPCA.Rd -M src/RcppExports.cpp -M tests/testthat/test_FCReg.R - -commit ad6cb41b48ff6c6a59d31e21bdebc737f6a47e4d -Author: Xiongtao Dai -Date: Mon Jul 4 19:18:12 2016 +0100 - - rm test coverage - -M .travis.yml - -commit e7116dd78046b5a2bed5ba3411629fa5ed404ffc -Author: Xiongtao Dai -Date: Mon Jul 4 01:46:15 2016 -0700 - - try code coverage - -M .gitignore -M .travis.yml -M R/RcppExports.R -M README.md -M src/RcppExports.cpp -M tests/testthat/test_GetCrCovYX.R - -commit 769f01fcb691f48c49f8524272602bea0cfb32eb -Author: Xiongtao Dai -Date: Sun Jul 3 18:56:31 2016 -0700 - - clean up vignette; k->K in CreateFuncBoxPlot - -M .gitignore -M R/CreateFuncBoxPlot.R -D vignettes/DerivativesFlies.pdf -D vignettes/DerivativesFliesInspect.pdf -D vignettes/DiagPlotSparse.pdf -D vignettes/DiagnoFlies.pdf -D vignettes/DiagnoSimu.pdf -D vignettes/DifferentBandwidths.pdf -D vignettes/OutliersFlies.pdf -D vignettes/PathFlies.pdf -D vignettes/fdapaceVignetteKnitr-concordance.tex -D vignettes/fdapaceVignetteKnitr.R -M vignettes/fdapaceVignetteKnitr.Rnw -D vignettes/fdapaceVignetteKnitr.bbl -D vignettes/fdapaceVignetteKnitr.pdf -D vignettes/fdapaceVignetteKnitr.tex - -commit 0666d1b950f374437c115f8bbb4fd47f6bb4a2ea -Merge: c4ccac7 e3593d7 -Author: Xiongtao Dai -Date: Sun Jul 3 18:11:42 2016 -0700 - - speed up crosscov smoothing by binning - -commit e3593d7abd911321c27366703f8ae8d74d4268d7 -Author: Xiongtao Dai -Date: Sun Jul 3 17:54:22 2016 -0700 - - make useGAM work for GetCrCovYX - -M R/GetCrCovYX.R -M R/GetCrCovYX_old.R -R100 tests/testthat/test_funcReg.R tests/testthat/test_FCReg.R -M tests/testthat/test_getCrCovYX.R - -commit c4ccac77740826b158337d66a63df123e7c46498 -Author: Xiongtao Dai -Date: Sun Jul 3 15:18:15 2016 -0700 - - selectK default to FVE; cat -> message; document - -M R/GCVLwls2DV2.R -M R/GetBinNum.R -M R/GetEigenAnalysisResults.R -M R/SelectK.R -M R/SetOptions.R -M R/SetSVDOptions.R -M R/print.FPCA.R -M R/print.FSVD.R -M man/CreatePathPlot.Rd -M man/FPCA.Rd -M man/MakeGPFunctionalData.Rd -M man/SelectK.Rd -M man/fitted.FPCA.Rd - -commit 14d23840e4283eedee311ef17e88e2a47a36aaa8 -Author: Xiongtao Dai -Date: Sun Jul 3 14:56:05 2016 -0700 - - use K as the number of components, instead of k - -M NEWS -M R/CreatePathPlot.R -M R/FPCA.R -M R/GetLogLik.R -M R/MakeGPFunctionalData.R -M R/SelectK.R -M R/SubsetFPCA.R -M R/fitted.FPCA.R -M R/print.FPCA.R -M R/print.FSVD.R -M tests/testthat/test_CreatePathPlot.R -M tests/testthat/test_GetCEScores.R -M tests/testthat/test_fitted.R -M tests/testthat/test_selectK.R - -commit 81c38bc507b3b0b4908501d32ea072453259e336 -Author: Xiongtao Dai -Date: Sun Jul 3 13:56:40 2016 -0700 - - fix plot: legend aside - -M R/CreateBWPlot.R -M R/CreateDesignPlot.R -M R/CreateDiagnosticsPlot.R -M R/CreateModeOfVarPlot.R -M R/RcppExports.R -M man/CreateDesignPlot.Rd -M man/CreateDiagnosticsPlot.Rd -M man/CreateModeOfVarPlot.Rd -M src/RcppExports.cpp -A tests/testthat/test_CreateDiagnosticPlot.R - -commit 97cb18fcb7be5da46aeb0f4fb08618b87054fd26 -Author: hadjipantelis -Date: Thu Jun 30 02:17:48 2016 -0700 - - Bug-fix in CheckAndCreateCOPoptions.R - -M R/CheckAndCreateCOPoptions.R - -commit 057ec8264813d54ebce7444e65a3a91994c86aed -Author: hadjipantelis -Date: Wed Jun 29 19:40:44 2016 -0700 - - Plots cross-covariances with 'CreateCovPlot' and some minor stuff. - -M R/CreateCovPlot.R -M R/CreateModeOfVarPlot.R -M R/RcppExports.R -M src/RcppExports.cpp - -commit c8f2e28fabf53ca268f942c2b1fad38e7bd169f3 -Author: Xiongtao Dai -Date: Mon Jun 27 18:04:18 2016 -0700 - - remove old file ignored by .gitignore - -M .gitignore -M R/RcppExports.R -M src/RcppExports.cpp - -commit 0062c6d8461ea9fc9325c768cec7b20394e0de2d -Merge: 7eb6c50 a834c77 -Author: Xiongtao Dai -Date: Mon Jun 27 17:21:25 2016 -0700 - - Merge branch 'master' of github.com:functionaldata/tPACE - -commit 7eb6c50e91e1dc820563e191f1bdf2edd860a234 -Author: Xiongtao Dai -Date: Mon Jun 27 17:21:05 2016 -0700 - - documentation change for GetCrCovY* - -M R/GetCrCovYX.R -M R/GetCrCovYZ.R -M R/RcppExports.R -M man/GetCrCovYX.Rd -M man/GetCrCovYZ.Rd -M src/RcppExports.cpp - -commit a834c77e1f56a18ef22cb436155d456bb204c54d -Author: hadjipantelis -Date: Sat Jun 25 22:07:35 2016 -0700 - - Bug/typo in CreateOutliers plot fixed. - -M R/CreateOutliersPlot.R - -commit 47ad9cfd91aa1909a5650ee99d0349e2ac5ac8e3 -Author: hadjipantelis -Date: Thu Jun 23 23:44:47 2016 -0700 - - Update README.md - -M README.md - -commit 75f5f043cf2d51b9780611e9ef6ce4e6dc8f22ff -Author: Xiongtao Dai -Date: Thu Jun 23 23:21:22 2016 -0700 - - Update README.md - -M README.md - -commit fb8d64f2b5ae31d4d62513ff975bfb02338d8e59 -Author: Xiongtao Dai -Date: Fri Jun 24 07:11:23 2016 +0100 - - revert changes - -M NEWS -M README.md - -commit 230014ecde63dc4caa088f0acc703bfdaf9256ae -Author: Xiongtao Dai -Date: Fri Jun 24 07:05:00 2016 +0100 - - Revert "Minor" - - This reverts commit a5724a0263da6e21b7e7953ddcee3b20dc93f4ac. - -M NEWS - -commit 53397c70edcc280edd917d42ea1083d7d5a816c6 -Author: Xiongtao Dai -Date: Thu Jun 23 23:01:17 2016 -0700 - - Update README.md - -M README.md - -commit a5724a0263da6e21b7e7953ddcee3b20dc93f4ac -Author: hadjipantelis -Date: Fri Jun 17 21:44:49 2016 -0700 - - Minor - -M NEWS - -commit 994df965c81156f11448e632bc215cdb8015cd30 -Author: hadjipantelis -Date: Fri Jun 17 21:40:34 2016 -0700 - - NEWS file. - -A NEWS -M man/CreateOutliersPlot.Rd - -commit 2fe1569a035e1febf2b1708acdf2fb2a45c67a48 -Author: hadjipantelis -Date: Fri Jun 17 20:46:16 2016 -0700 - - Commenting out legacy reference code. - -M R/GetCrCovYX.R - -commit 71eac69ecfb047d63ad3a4d0208b6514261a6640 -Author: hadjipantelis -Date: Fri Jun 17 20:31:50 2016 -0700 - - Sorting out expensive unit-tests. - -M R/GetCrCovYX.R -M tests/AAAtestthat.R -M tests/testthat/test_FSVD.R -M tests/testthat/test_funcReg.R -M tests/testthat/test_getCrCovYX.R - -commit 516d20e72c7f07a98ca4e8d7d7eabec8a1b976e3 -Merge: 3d48ea5 0f3c3e8 -Author: hadjipantelis -Date: Fri Jun 17 18:44:32 2016 -0700 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit 3d48ea5942b65cff617df1e79e5ab1b1ec8f1707 -Author: hadjipantelis -Date: Fri Jun 17 18:44:08 2016 -0700 - - Updating the bandwidth selection for CrCov. - -M R/GetCrCovYX.R - -commit 258f2ded3b4f433c0caa2d9b24ad5388df77ccf1 -Author: Xiongtao Dai -Date: Fri Jun 17 16:07:12 2016 -0700 - - speed up crosscov smoothing by binning - -M R/BinRawCov.R -M R/GetCrCovYX.R -A R/GetCrCovYX_old.R -M R/GetRawCrCovFuncFunc.R -M R/RcppExports.R -M man/CreateOutliersPlot.Rd -M src/RcppExports.cpp -M tests/AAAtestthat.R -M tests/testthat/test_GetRawCrCovFuncFunc.R -M tests/testthat/test_getCrCovYX.R -M tests/testthat_slow.R - -commit 0f3c3e856d3611b9af94b6ffb180ea4eac6233a8 -Author: Xiongtao Dai -Date: Fri Jun 17 00:22:41 2016 -0700 - - travis test - -M tests/AAAtestthat.R - -commit e8dbd1fbaf47a550116f9eb6ef41252c6ea8c093 -Author: Xiongtao Dai -Date: Thu Jun 16 23:33:09 2016 -0700 - - fix test - -R100 tests/test_FClust.R tests/testthat/test_FClust.R -R100 tests/test_FPCA.R tests/testthat/test_FPCA.R -R100 tests/test_FSVD.R tests/testthat/test_FSVD.R -R100 tests/test_FVPA.R tests/testthat/test_FVPA.R -R100 tests/test_funcReg.R tests/testthat/test_funcReg.R -M tests/testthat_slow.R - -commit 82148e98cd72c43110847b8096f3c698210653cb -Author: Xiongtao Dai -Date: Thu Jun 16 23:01:51 2016 -0700 - - run on travis - -R100 tests/testthat.R tests/AAAtestthat.R -M tests/test_FClust.R -M tests/test_FSVD.R -M tests/test_FVPA.R - -commit aa2b3ebb2709aac97184bc5f7f19d1882556b76d -Author: Xiongtao Dai -Date: Thu Jun 16 22:48:24 2016 -0700 - - Do not run test_FSVD which is too slow - -M tests/test_FSVD.R - -commit 51370bc2d45be486eefeebdbadb9f75efb57fbda -Author: Xiongtao Dai -Date: Thu Jun 16 22:46:03 2016 -0700 - - split tests - -R100 tests/testthat/test_FClust.R tests/test_FClust.R -R100 tests/testthat/test_FPCA.R tests/test_FPCA.R -R100 tests/testthat/test_FSVD.R tests/test_FSVD.R -R100 tests/testthat/test_FVPA.R tests/test_FVPA.R -R100 tests/testthat/test_funcReg.R tests/test_funcReg.R -M tests/testthat.R -A tests/testthat_slow.R - -commit 9392f53e73a4f9a39cc496a1ebf529fd73bd370d -Author: Xiongtao Dai -Date: Thu Jun 16 19:12:39 2016 -0700 - - upload RData - -A inst/testdata/200curvesByExampleSeed123.RData -A inst/testdata/InputForRotatedMllwlskInCpp.RData -A inst/testdata/InputFormMllwlskInCpp.RData -A inst/testdata/dataForGcvLwls.RData -A inst/testdata/dataForGcvLwlsTest.RData -A inst/testdata/dataForGetRawCov.RData -A inst/testdata/dataGeneratedByExampleSeed123.RData -A inst/testdata/datasetToTestRrotatedSmoother.RData -A inst/testdata/xcovForGetEigens1.csv - -commit 6b80a8379a79737c5ae8ebd317715e17141fdf1e -Author: Xiongtao Dai -Date: Thu Jun 16 18:38:07 2016 -0700 - - minor - -M tests/testthat/test_funcReg.R - -commit 6bf20c28a49a56e42ca2c231741eac037edb4885 -Author: Xiongtao Dai -Date: Thu Jun 16 18:27:35 2016 -0700 - - load file - -A inst/testdata/gene.dat -A inst/testdata/growth.dat -M tests/testthat/test_FClust.R -M tests/testthat/test_GetRawCov.R -M tests/testthat/test_GetRho.R -M tests/testthat/test_GetSmoothedMeanCurve.R -M tests/testthat/test_Lwls2D.R -M tests/testthat/test_Rmullwlsk.R -M tests/testthat/test_RmullwlskUniversal.R -M tests/testthat/test_Rrotatemullwlsk.R -M tests/testthat/test_cvlwls1d.R -M tests/testthat/test_gcvlwls1d1.R -M tests/testthat/test_gcvlwls2dV2.R -M tests/testthat/test_getMinb.R - -commit c45ed206698d0216e08953d5a6131ec30ca5edeb -Author: Xiongtao Dai -Date: Thu Jun 16 16:55:51 2016 -0700 - - move test dataset - -D data/200curvesByExampleSeed123.RData -D data/InputForRotatedMllwlskInCpp.RData -D data/InputFormMllwlskInCpp.RData -D data/dataForGcvLwls.RData -D data/dataForGcvLwlsTest.RData -D data/dataForGetRawCov.RData -D data/dataGeneratedByExampleSeed123.RData -D data/datasetToTestRrotatedSmoother.RData -D data/gene.dat -D data/growth.dat -D data/xcovForGetEigens1.csv -M tests/testthat/test_GetRho.R -M tests/testthat/test_Lwls2D.R -M tests/testthat/test_Rmullwlsk.R -M tests/testthat/test_Rrotatemullwlsk.R -M tests/testthat/test_cvlwls1d.R -M tests/testthat/test_gcvlwls1d1.R -M tests/testthat/test_gcvlwls2dV2.R - -commit abf89ae17a8b3a55baa474be1d500b11fc6f9f60 -Author: Xiongtao Dai -Date: Thu Jun 16 02:06:46 2016 +0100 - - fix test cases - -M tests/testthat/test_CreateFolds.R -M tests/testthat/test_funcReg.R -M tests/testthat/test_gcvlwls2dV2.R - -commit 0fcfdc413c80239fe1944364a3a3c74d9beb8aeb -Author: Xiongtao Dai -Date: Thu Jun 16 00:45:18 2016 +0100 - - remove devtools from tests - -M tests/testthat/test_BinRawCov.R -M tests/testthat/test_BwNN.R -M tests/testthat/test_ConvertSupport.R -M tests/testthat/test_CreatePathPlot.R -M tests/testthat/test_FClust.R -M tests/testthat/test_FPCA.R -M tests/testthat/test_FPCAder.R -M tests/testthat/test_FSVD.R -M tests/testthat/test_FVEdataset.R -M tests/testthat/test_FVPA.R -M tests/testthat/test_FitEigenValues.R -M tests/testthat/test_GetBinnedCurve.R -M tests/testthat/test_GetBinnedDataset.R -M tests/testthat/test_GetCEScores.R -M tests/testthat/test_GetCovDense.R -M tests/testthat/test_GetEigenAnalysisResults.R -M tests/testthat/test_GetRho.R -M tests/testthat/test_GetSmoothedCovarSurface.R -M tests/testthat/test_Lwls2D.R -M tests/testthat/test_createDesignPlot.R -M tests/testthat/test_cumtrapzRcpp.R -M tests/testthat/test_funcReg.R -M tests/testthat/test_gcvlwls2dV2.R -M tests/testthat/test_getCrCovYX.R -M tests/testthat/test_getCrCovYZ.R -M tests/testthat/test_getMinb.R -M tests/testthat/test_pc_covE.R -M tests/testthat/test_rotateLwls2dV2.R -M tests/testthat/test_selectK.R -M tests/testthat/test_trapzRcpp.R -M tests/testthat/test_useBin.R - -commit 5c6bb452f72c0b2b674a2badb7ee329731d0ce30 -Author: hadjipantelis -Date: Tue Jun 14 23:57:01 2016 -0700 - - Addtions to CreateOutliersPlot - -M DESCRIPTION -M R/CheckAndCreateCOPoptions.R -M R/CreateOutliersPlot.R - -commit 3d128bd5068249e62e47fdad656863a2c1a1c4ca -Merge: cb6cacc 6ac2b05 -Author: hadjipantelis -Date: Tue Jun 14 19:47:46 2016 -0700 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit cb6cacc0687bbd5defb3846b3b9a867fafed5ee2 -Author: hadjipantelis -Date: Tue Jun 14 19:47:21 2016 -0700 - - Weed out non-ASCII character - -M R/FClust.R -M man/FClust.Rd - -commit 6ac2b05536c195900b35798a19be8df3316e0343 -Author: hadjipantelis -Date: Tue Jun 14 14:02:05 2016 -0700 - - Minor (Suggests: testthat) - -M DESCRIPTION - -commit 78b08d6dc1f35e6a6e51cfe3f31864a41426b43e -Author: hadjipantelis -Date: Tue Jun 14 13:47:10 2016 -0700 - - Trying to run all the unitests on Travis.. - -M tests/testthat.R - -commit 85a05736836ed68f2a0df15b782363f6ad4ce0f0 -Merge: 2d48374 1f6b8e2 -Author: hadjipantelis -Date: Tue Jun 14 13:32:46 2016 -0700 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit 2d48374738c872f3fd6e9fc764c788d69e44f1ba -Author: hadjipantelis -Date: Tue Jun 14 13:32:30 2016 -0700 - - Elementary RmullwlskUniversal Rmullwlsk Equivalence test. - -A tests/testthat/test_RmullwlskUniversal.R - -commit 1f6b8e2557cc2f4bb92dfd7f33eb2611c6f8fbab -Author: hadjipantelis -Date: Tue Jun 14 08:57:07 2016 -0700 - - Update .travis.yml - -M .travis.yml - -commit 05525972664a5cb89435c0769ce63cfd95b8d94a -Author: hadjipantelis -Date: Tue Jun 14 02:45:53 2016 -0700 - - Deleted print.FSVD example. - -M R/print.FSVD.R -M man/print.FSVD.Rd - -commit 207b80c38781c3327f51c106863039f7dd7c1e44 -Author: hadjipantelis -Date: Tue Jun 14 02:20:40 2016 -0700 - - Unit-tests and simplifying slices code. - -M R/CreateOutliersPlot.R -M tests/testthat/test_FSVD.R - -commit fa7696ed47fc73341c551d5ca114864a7108bc26 -Merge: a6cf75d 26144e6 -Author: hadjipantelis -Date: Tue Jun 14 00:28:45 2016 -0700 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit a6cf75d08396d21f87c4fbc707e8f8c8bf068456 -Author: hadjipantelis -Date: Tue Jun 14 00:28:41 2016 -0700 - - Fixing flip - -M R/FSVD.R - -commit 26144e6ee019351281d569c906338833259d76cd -Author: Xiongtao Dai -Date: Mon Jun 13 23:32:40 2016 -0700 - - travis - -M NAMESPACE -M man/CreateOutliersPlot.Rd -M man/FPCA.Rd -M man/FSVD.Rd - -commit 40370a2a0815cdc8f6983a282cc6222a1e863e8d -Author: Xiongtao Dai -Date: Mon Jun 13 23:14:10 2016 -0700 - - fix minor bugs for packaging - -M R/FSVD.R -M R/pkgname.R - -commit e13c8af99936acf5662a21521e9d7af8915d95a2 -Author: Xiongtao Dai -Date: Mon Jun 13 22:02:38 2016 -0700 - - travis - -D vignettes/fdapaceVignette.Rnw - -commit 5a5f9eda35905bab18c150c47c38e567fc10c97c -Author: Xiongtao Dai -Date: Mon Jun 13 21:41:13 2016 -0700 - - minor bug fix - -M R/SetSVDOptions.R - -commit a99deefcd0c5fff6b05cb0213100343cb0eb7fdf -Merge: d5ca605 7ddd9ab -Author: Xiongtao Dai -Date: Mon Jun 13 17:11:17 2016 -0700 - - Merge branch 'master' of github.com:hadjipantelis/tPACE - -commit d5ca605cb679462a6db227c617114c4281c2812f -Author: Xiongtao Dai -Date: Mon Jun 13 17:11:07 2016 -0700 - - travis - -M vignettes/fdapaceVignetteKnitr.Rnw -M vignettes/fdapaceVignetteKnitr.pdf -M vignettes/fdapaceVignetteKnitr.tex - -commit 7ddd9ab5b72c24cbdc2a9b298ebafd86bcf48997 -Merge: 52e79ee 753aef1 -Author: hadjipantelis -Date: Mon Jun 13 16:50:43 2016 -0700 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit 52e79ee3dd60a9ac11341e7e491bd50af90fbb06 -Author: hadjipantelis -Date: Mon Jun 13 16:50:22 2016 -0700 - - Changes to FSVD, CreateOutlierPlot, FPCA docs, CheckAndCreateCOPoptions - -A R/CheckAndCreateCOPoptions.R -M R/CreateOutliersPlot.R -M R/FPCA.R -M R/FSVD.R -M R/SetSVDOptions.R - -commit 753aef1a22a1c5f0c49e56c217047142fe3bccc4 -Author: Xiongtao Dai -Date: Mon Jun 13 15:01:22 2016 -0700 - - travis - -M .travis.yml - -commit 8ed71d2de3ba7327e06a4f6b47dd9fc72c2f310e -Author: Xiongtao Dai -Date: Mon Jun 13 14:54:55 2016 -0700 - - travis - -M .travis.yml - -commit 3594ab081148a068e062abd4daad65712435efd9 -Author: Xiongtao Dai -Date: Mon Jun 13 14:35:51 2016 -0700 - - latex package -tikz - -M vignettes/fdapaceVignetteKnitr-concordance.tex -M vignettes/fdapaceVignetteKnitr.Rnw -M vignettes/fdapaceVignetteKnitr.bbl -M vignettes/fdapaceVignetteKnitr.pdf -M vignettes/fdapaceVignetteKnitr.tex - -commit f975ad3210a0d4c9d46dc2fa1088bad229fbc80b -Author: Xiongtao Dai -Date: Mon Jun 13 13:25:51 2016 -0700 - - travis - -M .travis.yml - -commit 3b0ca2d93abb3d76e91ee55a0307cf79e209a348 -Author: Xiongtao Dai -Date: Mon Jun 13 12:57:57 2016 -0700 - - travis - -M .travis.yml - -commit 86c0acbbe7b72bbdaa15d95381161098413a7255 -Author: Xiongtao Dai -Date: Mon Jun 13 12:45:52 2016 -0700 - - travis - -M .travis.yml - -commit aa0a361f9495f7fdb174762a9dc1a33bf3127329 -Author: hadjipantelis -Date: Fri Jun 10 19:42:07 2016 -0700 - - Regularisation options - -M R/CheckSVDOptions.R -M R/FSVD.R -M R/SetSVDOptions.R - -commit fc4dd6e8e1e844061ea410ef320e3c36187942bb -Author: hadjipantelis -Date: Fri Jun 10 16:00:00 2016 -0700 - - Basic .Rd and further exports - -M NAMESPACE -A man/FSVD.Rd -M man/GetCrCovYX.Rd -A man/print.FSVD.Rd -M tests/testthat/test_getCrCovYX.R - -commit ebf87f74fae8c82578dc1f4e2dedee8b32a67a8b -Author: hadjipantelis -Date: Fri Jun 10 15:32:00 2016 -0700 - - Adding correct unit-tests, speed-ups to FSVD and minor fixes. - -M R/FSVD.R -M R/GetCrCovYX.R -M R/SetSVDOptions.R -M R/print.FSVD.R -M tests/testthat/test_FClust.R -M tests/testthat/test_FSVD.R -M tests/testthat/test_FVPA.R -M tests/testthat/test_GetCEScores.R -M tests/testthat/test_funcReg.R - -commit 715feba9e7fae12984b9a4d7ce0d683e79965247 -Author: hadjipantelis -Date: Fri Jun 10 13:47:33 2016 -0700 - - Update test_FSVD.R - -M tests/testthat/test_FSVD.R - -commit c32d290c5c08f30ac579ef788ca8b33aac40c3e9 -Author: dmchris -Date: Fri Jun 10 08:44:16 2016 -0700 - - modified unit test - - Added bw for sparse case: bw1=bw2=1.2. - Modified comparison only on singular correlation (rho1). - -M tests/testthat/test_FSVD.R - -commit b422acbc3d2a4c2be1f09ae5b81a459f8e4c89a1 -Author: hadjipantelis -Date: Wed Jun 8 22:08:12 2016 -0700 - - Update fdapaceVignetteKnitr.Rnw - -M vignettes/fdapaceVignetteKnitr.Rnw - -commit 388aeaecdaee4946e654cf68db7320e880fe13cb -Author: hadjipantelis -Date: Wed Jun 8 21:57:42 2016 -0700 - - Update .travis.yml - -M .travis.yml - -commit 2fcff7cb180b2ceba3c721d3ef749f8106886997 -Author: hadjipantelis -Date: Wed Jun 8 17:55:25 2016 -0700 - - Update .travis.yml - -M .travis.yml - -commit f72bc4eb2673bb79f2286b8b6ebe3a02f02da95d -Author: hadjipantelis -Date: Wed Jun 8 17:41:11 2016 -0700 - - Update README.md - -M README.md - -commit 6796430157d7fa4d9b6a1b4776a579ff8f35ca6d -Author: hadjipantelis -Date: Wed Jun 8 17:40:37 2016 -0700 - - Update README.md - -M README.md - -commit 054c1423f472e5d800de73c626be26db4b066180 -Author: hadjipantelis -Date: Wed Jun 8 17:38:20 2016 -0700 - - .org to .md - -R100 README.org README.md - -commit ad08e900631c2acba1dfc96daff02d8244c8e869 -Author: hadjipantelis -Date: Wed Jun 8 17:35:00 2016 -0700 - - Minor tags changes. - -M README.org - -commit 5e16750e5870b00d6d8dd3f3249404104c1dba6f -Author: hadjipantelis -Date: Wed Jun 8 17:28:56 2016 -0700 - - Minor. - -M R/FSVD.R -M README.org - -commit e7f9766e1f8bac261d7e383e3dc1d31b82f0a388 -Author: hadjipantelis -Date: Tue Jun 7 18:41:50 2016 -0700 - - Update .travis.yml - -M .travis.yml - -commit 4b59a8b0ed704050149905ec9a5a85e532806e3e -Author: dmchris -Date: Tue Jun 7 16:54:41 2016 -0700 - - FSVD output rho -> canCorr, add unit test - -M R/FSVD.R -A tests/testthat/test_FSVD.R - -commit ffca5073e355d7899cf791d00e050f4038370b8d -Author: hadjipantelis -Date: Tue Jun 7 15:04:11 2016 -0700 - - Fixing output name. - -M R/FSVD.R -M R/SetSVDOptions.R - -commit b9624ec65c9467015e060c6e4d609f45964fa132 -Author: hadjipantelis -Date: Tue Jun 7 14:02:28 2016 -0700 - - Create .travis.yml - -A .travis.yml - -commit 795414378ab3e9143050248a13a941d964112db5 -Author: hadjipantelis -Date: Tue Jun 7 01:02:23 2016 -0700 - - Starting ROxygen2 on FSVD. - -M R/FSVD.R - -commit b371f7149f54ec0c0909933fc4b7e477de6197c4 -Author: hadjipantelis -Date: Mon Jun 6 20:13:04 2016 -0700 - - Cosmetic change to FSVD (print.FSVD function)/Dropping AdjustBW1.R - -D R/AdjustBW1.R -M R/FSVD.R -M R/GetSmoothedMeanCurve.R -A R/print.FSVD.R - -commit e7ab6a71942ee4a097d6e27d5188aa23174c8adc -Merge: 1fa7744 ba1ead8 -Author: Xiongtao Dai -Date: Sun Jun 5 23:45:35 2016 -0700 - - Merge branch 'inputData' - -commit 1fa7744c42d7e275d33279fac148aff2758221be -Author: dmchris -Date: Sun Jun 5 17:53:34 2016 -0700 - - tentative FSVD codes - - works for simulation setting in the paper for both dense and sparse - case. Featuring estimation of canonical correlations as well as the - singular scores. - -A R/CheckSVDOptions.R -A R/FSVD.R -A R/SetSVDOptions.R - -commit 152c9346d3b7a18cacaa05150b542a72c096ed30 -Author: hadjipantelis -Date: Fri Jun 3 14:30:36 2016 -0700 - - Example & doc fixes, new minor CreateModeOfVarPlot update. - -M R/CreateModeOfVarPlot.R -M R/FClust.R -M R/kCFC.R -M R/print.FPCA.R -M man/FClust.Rd -M man/FVPA.Rd -M man/kCFC.Rd -M man/medfly25.Rd -M man/print.FPCA.Rd -D run_tests.R -D vignettes/Rplots.pdf - -commit 7275bae41d195553160f86c0ec3dc09922517877 -Author: hadjipantelis -Date: Thu Jun 2 20:01:22 2016 -0700 - - Fixed FVPA example. - -M R/FVPA.R - -commit ce03a8a80e6fb6b4cf66919e8f4c2da96bc0bc2d -Author: hadjipantelis -Date: Thu Jun 2 19:51:08 2016 -0700 - - New FClust example that doesn't use Berk. growth data. - -M R/FClust.R -M R/medfly25.R - -commit c6ccce47354338a1858b8b91a821b9a705c6f7b8 -Author: hadjipantelis -Date: Thu Jun 2 08:16:12 2016 -0700 - - Fixing NAMESPACE2 - -M NAMESPACE -M R/pkgname.R - -commit 1da60fbba4013eedd7dc82ae22daabc2bfecd24a -Author: hadjipantelis -Date: Thu Jun 2 01:33:11 2016 -0700 - - Fixing a bit of NAMESPACE - -M NAMESPACE -M R/GetCrCovYZ.R -M R/pkgname.R -M man/GetCrCovYZ.Rd - -commit 5be2382f431e53a13737f5b5ccc42c58c41097a1 -Author: hadjipantelis -Date: Thu Jun 2 00:39:10 2016 -0700 - - Minor2. - -M R/CreateOutliersPlot.R -M R/pkgname.R - -commit 7aeb7976a0a99745d94a277c672cc6d611067477 -Author: hadjipantelis -Date: Thu Jun 2 00:02:34 2016 -0700 - - Minor - -M R/medfly25.R -M man/CreateModeOfVarPlot.Rd -M man/FClust.Rd -M man/medfly25.Rd - -commit ba1ead841205237c0eec69f3073b804d183aac48 -Author: Xiongtao Dai -Date: Wed Jun 1 17:02:44 2016 -0700 - - return binned data as inputData - -M R/FPCA.R -M tests/testthat/test_FPCA.R - -commit 12a21372dedef889f3331b74e6313400d4786184 -Merge: 1159c1a 65f49d4 -Author: Xiongtao Dai -Date: Wed Jun 1 16:56:35 2016 -0700 - - Merge branch 'master' of github.com:hadjipantelis/tPACE - -commit 1159c1ac66e98ecf3d7f5c0d70fb2dd9343cfcee -Author: Xiongtao Dai -Date: Wed Jun 1 16:56:27 2016 -0700 - - suggests plot3D - -M DESCRIPTION -M R/CreateCovPlot.R - -commit 65f49d4f6894655fde4bba5c7cdec9dcf982c830 -Merge: 688ef5a d06f164 -Author: hadjipantelis -Date: Wed Jun 1 16:46:05 2016 -0700 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit 688ef5a61ac8ab07c71aceb9c7cc1e50a952a587 -Author: hadjipantelis -Date: Wed Jun 1 16:45:46 2016 -0700 - - test for cumtrapzRcpp and checks for Rmixmod/minqa. - -M DESCRIPTION -M R/FClust.R -M R/GetCrCovYX.R -A tests/testthat/test_cumtrapzRcpp.R - -commit d06f1641e0fec8a38f5b4f4683cc45890ac7be1e -Author: hadjipantelis -Date: Tue May 31 18:51:14 2016 -0700 - - Minor (fig height) - -M vignettes/fdapaceVignetteKnitr.Rnw - -commit 951557c736d45b6fb977eb25f8e36920cc5dc76d -Author: hadjipantelis -Date: Tue May 31 18:38:19 2016 -0700 - - FCluster in the vignette. - -M vignettes/fdapaceVignetteKnitr.Rnw -M vignettes/roxygen.bib - -commit 7ee932076d943a4271cffefd8a474d1de40e8414 -Author: hadjipantelis -Date: Tue May 31 17:36:03 2016 -0700 - - Rainbow plot and fast cumtrapz - -M R/CreateModeOfVarPlot.R -M R/RcppExports.R -M src/RcppExports.cpp -A src/cumtrapzRcpp.cpp - -commit 24cd37351e5be9d06a24a266cf1c86bfe61bf031 -Author: hadjipantelis -Date: Sat May 28 16:46:09 2016 -0700 - - Change argument names 'y/t' to 'Ly/Lt' - -M R/FClust.R - -commit 1fa9a79aa422196acd982cc128a6272be29f4361 -Author: hadjipantelis -Date: Fri May 27 16:12:24 2016 -0700 - - Legend in DiagnosticsPlot for Phi - -M R/CreateDiagnosticsPlot.R - -commit e6f60dd61d3af9095ecf278be1d907c4c9d726f1 -Author: Xiongtao Dai -Date: Fri May 27 01:35:46 2016 -0700 - - dense DPC OK; diag() bug fix - -M R/ConvertSupport.R -M R/CreatePathPlot.R -M R/FPCAder.R -M R/GenerateFunctionalData.R -M R/GetLogLik.R -M R/Lwls1D.R -M R/MakeGPFunctionalData.R -M R/SelectK.R -R100 R/SetDerOption.R R/SetDerOptions.R -M R/Wiener.R -M R/fitted.FPCA.R -A R/str.FPCA.R -M tests/testthat/test_FPCAder.R - -commit a5e98a13323fe9b186cdc24db2196befe05f3288 -Author: hadjipantelis -Date: Thu May 26 23:29:12 2016 -0700 - - Adding Rmixmod to the Suggested - -M DESCRIPTION - -commit 8cf285cdc477fe12d81d563af5ec13857f981463 -Author: hadjipantelis -Date: Thu May 26 23:25:08 2016 -0700 - - FClust unit-test commit - -A tests/testthat/test_FClust.R -M tests/testthat/test_FVPA.R - -commit d2a9c9dffe3b94462b6cc094b3dcc98007d79f49 -Author: hadjipantelis -Date: Thu May 26 23:13:40 2016 -0700 - - FClust commit - -M NAMESPACE -A R/FClust.R -M R/GetSmoothedCovarSurface.R -M R/kCFC.R -A man/FClust.Rd -M man/kCFC.Rd - -commit 7616f4b2a5fcf17468b9651306acf1e1661ae5b4 -Author: Xiongtao Dai -Date: Thu May 26 17:06:09 2016 -0700 - - fix DenseWithMV methodXi=\'IN\' - -M R/CheckOptions.R -M tests/testthat/test_FPCA.R - -commit b382709f77ff4c6001e62ba34eea4707d9c390da -Author: hadjipantelis -Date: Thu May 26 12:36:36 2016 -0700 - - Minor stuff on kCFC and change for DenseWithMV - -M R/CheckOptions.R -M R/GetRawCov.R -M R/IsRegular.R -M R/RcppExports.R -M R/kCFC.R -M src/RcppExports.cpp - -commit 2ab31c3e7697b5b83db5a7d17c6fa76d074408ba -Author: Xiongtao Dai -Date: Wed May 25 15:34:01 2016 -0700 - - mu regGrid documentation - -M R/FPCA.R -M R/RcppExports.R -M man/FPCA.Rd -M src/RcppExports.cpp - -commit 6798ed937f38252623bc8552edc809e915580125 -Author: Xiongtao Dai -Date: Mon May 23 21:30:43 2016 -0700 - - fix minor bugs - -M R/GCVLwls2DV2.R -M R/GetCovDense.R -M R/GetEigenAnalysisResults.R -M tests/testthat/test_GetCovDense.R -M tests/testthat/test_gcvlwls2dV2.R - -commit a1698e3ea8470f0d89379283423d0ad11735878b -Author: Xiongtao Dai -Date: Mon May 23 16:07:28 2016 -0700 - - 2D smoother derivatives - -M R/Lwls2D.R -A R/Lwls2DDeriv.R -M R/RcppExports.R -M src/RcppExports.cpp -A src/RmullwlskUniversalDeriv.cpp -A tests/testthat/test_Lwls2DDeriv.R - -commit 271603dd3b51350d4a01983c6cc840418cf13833 -Author: hadjipantelis -Date: Mon May 23 15:52:02 2016 -0700 - - Minor unit-test fix. - -M R/GetCovDense.R -M tests/testthat/test_GetCovDense.R - -commit 0558c55d0227c6177a4c68abba09a9c173b98ffa -Author: hadjipantelis -Date: Mon May 23 15:22:07 2016 -0700 - - Minor patches to getGCVscoresV2. - -M R/GCVLwls2DV2.R -M tests/testthat/test_gcvlwls2dV2.R - -commit 83731fa1f428b482d3c97fcdac23c7b7d9a5272b -Author: hadjipantelis -Date: Mon May 23 14:31:44 2016 -0700 - - Convert support export. - -M NAMESPACE -M R/ConvertSupport.R -M R/fitted.FPCA.R -A man/ConvertSupport.Rd -M man/fitted.FPCA.Rd - -commit 237648a314a3d34bdcfa89dffd9caf94071f918c -Author: Xiongtao Dai -Date: Mon May 23 00:58:51 2016 +0100 - - minor - -M .gitignore -M R/CheckOptions.R - -commit c92aafd7ba58649afc8cb5c383de81736f716efc -Author: hadjipantelis -Date: Sat May 21 13:00:00 2016 -0700 - - Minor fixes to kCFC - -M R/fitted.FPCA.R -M R/kCFC.R -M man/fitted.FPCA.Rd -M man/kCFC.Rd - -commit d8219c925e0b50ea387c61058ffbce8b8dc649be -Author: Xiongtao Dai -Date: Sat May 21 08:50:33 2016 +0100 - - bug fix; improve plotting functions - -M R/CreateBWPlot.R -M R/CreateDesignPlot.R -M R/CreatePathPlot.R -M R/GetCovDense.R - -commit e21e7e33e3f2ce17687bf69952452ee86c1e479e -Author: Xiongtao Dai -Date: Wed May 18 22:01:38 2016 -0700 - - for R CMD BUILD - -M DESCRIPTION -A vignettes/fdapaceVignetteKnitr.R -M vignettes/fdapaceVignetteKnitr.Rnw -M vignettes/fdapaceVignetteKnitr.pdf -M vignettes/fdapaceVignetteKnitr.tex - -commit 244c505b7beff16bd778ac39af98f8964b02e1ca -Author: Xiongtao Dai -Date: Wed May 18 21:14:14 2016 -0700 - - format knitr vignette - -M .gitignore -M vignettes/Sweavel.sty -M vignettes/fdapaceVignetteKnitr-concordance.tex -M vignettes/fdapaceVignetteKnitr.Rnw -M vignettes/fdapaceVignetteKnitr.pdf -M vignettes/fdapaceVignetteKnitr.tex - -commit 05ee40391857fddc4e830a07199286059e204c98 -Author: Xiongtao Dai -Date: Sun May 15 22:12:37 2016 -0700 - - add FCReg example - -M R/FCReg.R -M man/FCReg.Rd - -commit 2d706fb2b24a407d78062e15d7568faa3fbc1e31 -Author: hadjipantelis -Date: Sun May 15 03:00:38 2016 -0700 - - Fixing error in the vignette. - -A vignettes/Rplots.pdf -A vignettes/fdapaceVignetteKnitr-concordance.tex -M vignettes/fdapaceVignetteKnitr.Rnw -A vignettes/fdapaceVignetteKnitr.bbl -A vignettes/fdapaceVignetteKnitr.pdf -A vignettes/fdapaceVignetteKnitr.tex - -commit ba8c6266dc0eff6dfb43267d523d52fda82e71ff -Author: Xiongtao Dai -Date: Sun May 15 01:02:39 2016 -0700 - - knitr vignette - -A vignettes/Sweavel.sty -A vignettes/fdapaceVignetteKnitr.Rnw - -commit abfe5433a39fb1e284dd1b7d8cf6b1d90e8f38e2 -Author: Xiongtao Dai -Date: Sat May 14 23:17:27 2016 -0700 - - speed up dense case; fix CreatePathPlot bug - -M R/CheckData.R -M R/CreatePathPlot.R -M R/FPCA.R -M R/GetBinnedDataset.R -M R/GetCovDense.R -M R/GetMeanDense.R -M R/GetSmoothedCovarSurface.R -M R/GetSmoothedMeanCurve.R -M tests/testthat/test_FPCA.R - -commit ea1555a57f3dcec431d3d614e2a60ca5905d2ab8 -Author: Xiongtao Dai -Date: Sat May 14 14:17:06 2016 -0700 - - fix bug in FCReg - -M R/FCReg.R -D R/funcReg.R -D R/oldfuncReg.R - -commit 84e682d4406667d85d6ba1024a89a2d2a14ee69a -Author: hadjipantelis -Date: Tue May 10 19:30:22 2016 -0700 - - kCFC additions. - -M R/kCFC.R -A data/gene.dat -A data/growth.dat - -commit 3cfa8279822af122400630c7e15bafc020322454 -Author: hadjipantelis -Date: Tue May 10 13:37:56 2016 -0700 - - Minor bug fix. - -M R/kCFC.R - -commit d2d46c591ebe49531c337f9c5c52d36e668eb389 -Author: hadjipantelis -Date: Tue May 10 13:24:12 2016 -0700 - - Fixing doc. - -M NAMESPACE -R083 man/FkC.Rd man/kCFC.Rd - -commit a7570d2c362da8fd02f2fd65fa5f89a7b0b0545c -Merge: f3d9862 300d5da -Author: hadjipantelis -Date: Tue May 10 13:21:47 2016 -0700 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit f3d9862ea6cfc383154fd2bf3bd83507c54e634e -Author: hadjipantelis -Date: Tue May 10 13:21:10 2016 -0700 - - Updated kCFC - -M NAMESPACE -M R/CheckData.R -M R/FPCA.R -D R/FkC.R -M R/RcppExports.R -A R/kCFC.R -M man/FPCA.Rd -M man/FkC.Rd -M src/RcppExports.cpp - -commit 300d5dabf987826378c3d1b1ccb7d603eb165fe4 -Author: Xiongtao Dai -Date: Tue May 10 20:14:46 2016 +0100 - - minor - -M NAMESPACE -M R/CheckData.R -M R/FPCA.R -M man/FPCA.Rd -M man/FkC.Rd - -commit c5b982620181e9286c6692bd91c6a9f82df64b9f -Author: hadjipantelis -Date: Mon May 9 23:21:14 2016 -0700 - - JMC Func Clustering - -A R/FkC.R -A man/FkC.Rd -A man/Lwls2Dv1.Rd - -commit 88abf5b71825eb98cb4a22e91da9b03fb1a5bb0a -Author: Xiongtao Dai -Date: Mon May 9 18:12:14 2016 +0100 - - fix sigma2 estimate (2nd diff) for dense case - -M R/GetCovDense.R -M R/RcppExports.R -M man/CreateCovPlot.Rd -M man/CreateDesignPlot.Rd -M man/CreateOutliersPlot.Rd -M man/CreatePathPlot.Rd -M man/Lwls2D.Rd -M src/RcppExports.cpp -M src/RmullwlskUniversal.cpp - -commit bf53d6d0b228fdbd7082ce9365fe0974f4074185 -Author: hadjipantelis -Date: Sat May 7 17:27:09 2016 -0700 - - Partial fix - -M R/CreateOutliersPlot.R - -commit 1424aaeb086f2e946136631b86e634b39f900d4f -Merge: b572ade 329fe36 -Author: hadjipantelis -Date: Sat May 7 13:55:20 2016 -0700 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit b572ade7505812d537108a15830aa6b6a7c4b40b -Author: hadjipantelis -Date: Sat May 7 13:54:57 2016 -0700 - - Minor. - -M R/CreateOutliersPlot.R - -commit 329fe3612ac812ada2e6eca158e03e85c5e57acd -Author: Xiongtao Dai -Date: Fri May 6 16:56:46 2016 -0700 - - add test for CreatePathPlot; minor - -M R/GCVLwls2DV2.R -A tests/testthat/test_CreatePathPlot.R -D tests/testthat/test_createPathPlot.R - -commit cf97b1d9975d2add55bda83a3207f42fb320800c -Author: hadjipantelis -Date: Fri May 6 11:57:50 2016 -0700 - - Changes based on feedback. - -M R/CreateCovPlot.R -M R/CreateDesignPlot.R -M R/CreateOutliersPlot.R -M R/CreateScreePlot.R - -commit 847123685932f864863e66568900c5bd7af18590 -Author: Xiongtao Dai -Date: Wed May 4 23:28:18 2016 -0700 - - revert change. The user should set showObs - -M R/CreatePathPlot.R - -commit afc513e2b0241f87211205ea04a46970738e6f87 -Author: Xiongtao Dai -Date: Wed May 4 23:19:27 2016 -0700 - - Update CreatePathPlot.R - -M R/CreatePathPlot.R - -commit 93f9dd4b0bea068916b9e89693389d14e922fee7 -Author: hadjipantelis -Date: Wed May 4 20:23:16 2016 -0700 - - Minor fixes on SetOptions and Lwls2D - -M R/Lwls2D.R -M R/SetOptions.R - -commit db749cabd250bbfe30981937340943d451d1daf0 -Author: dmchris -Date: Tue May 3 12:14:08 2016 -0700 - - Modify GetLogLik - - To speedup calculation for dense case. - -M R/GetLogLik.R - -commit 1f53d6d3855a8178018f38d7530076ae2d3740da -Author: hadjipantelis -Date: Sat Apr 30 23:30:02 2016 -0700 - - Making 'plain' smoother the default for Gaussian kernels - -M R/Lwls2D.R - -commit 44e5720b77b5cc7f4a2630bbd572412b4c7098c0 -Author: hadjipantelis -Date: Sat Apr 30 00:34:27 2016 -0700 - - Universal smoother - -M R/Lwls2D.R -M R/RcppExports.R -M src/RcppExports.cpp -M src/Rmullwlsk.cpp -M src/RmullwlskCCsort2.cpp -A src/RmullwlskUniversal.cpp -M tests/testthat/test_GetSmoothedCovarSurface.R -M tests/testthat/test_Lwls2D.R - -commit 00c3bf5a605db072909d6e5ae9df97af5c1ca464 -Author: hadjipantelis -Date: Fri Apr 29 18:48:20 2016 -0700 - - Removing test dataset - -D ProblematicLwls2D.RData - -commit 6cfe339f60e8dd9843049d95524217034a32cadb -Author: hadjipantelis -Date: Fri Apr 29 18:46:06 2016 -0700 - - Ironing out the new smoother - -A ProblematicLwls2D.RData -M R/GetCrCovYX.R -M R/Lwls2D.R -R058 R/Lwls2D2.R R/Lwls2Dv1.R -M R/RcppExports.R -M man/Lwls2D.Rd -M src/RcppExports.cpp -M src/RmullwlskCC.cpp -M src/RmullwlskCCsort2.cpp - -commit adc98b85d7c71b2f672f664095b489844ed0bcba -Author: hadjipantelis -Date: Fri Apr 29 16:01:35 2016 -0700 - - Clearing up the new smoother. - -M R/Lwls2D2.R - -commit 2e4ec003bac26e9151174e058be99dcaae0619ad -Author: hadjipantelis -Date: Fri Apr 29 15:55:13 2016 -0700 - - Merging Lwls2D2.R into master - -A R/Lwls2D2.R - -commit 6b2d8eb3d3430e6917a070d62bc4050a05eaedd7 -Author: hadjipantelis -Date: Fri Apr 29 15:51:10 2016 -0700 - - Merging RmullwlskCCsort2.cpp into master - -A src/RmullwlskCCsort2.cpp - -commit c88eb27ca752a9b9c2d793d2386c477b4cefbb48 -Author: hadjipantelis -Date: Fri Apr 29 13:44:59 2016 -0700 - - Minor renaming. - -M R/GetNormalisedSample.R - -commit ff9e288485ae1ed504f6baaec8db9210d4a22090 -Author: hadjipantelis -Date: Thu Apr 28 21:59:11 2016 -0700 - - Updating/upgrading CreateOutliersPlot - -M R/CreateOutliersPlot.R -M man/CreateOutliersPlot.Rd - -commit 46e5765f33f38574a8c9a3cab7a853ee5042983b -Author: Xiongtao Dai -Date: Tue Apr 26 05:24:51 2016 +0100 - - modified default rho - -M R/FPCA.R -M R/SetOptions.R -M man/FPCA.Rd -M tests/testthat/test_FPCA.R - -commit 2808d1a93eb887489a51e2e9f2c067a308c56702 -Author: hadjipantelis -Date: Mon Apr 25 20:27:13 2016 -0700 - - Fixing degenerate cov.matrix case. - -M R/GetCEScores.R -M src/GetIndCEScoresCPP.cpp -M tests/testthat/test_GetCEScores.R - -commit f85d0a3dba08acae4bba8eda1d95216e15fd6b4d -Merge: 380c5b8 9f20444 -Author: hadjipantelis -Date: Mon Apr 25 15:29:56 2016 -0700 - - Merge pull request #3 from hadjipantelis/fixYT - - Merging fixes on default argument names and unit-tests. - -commit 9f20444bae9584adb8754156640bcee597e37a69 -Author: hadjipantelis -Date: Mon Apr 25 15:25:55 2016 -0700 - - Checks to pass all unit tests. - -M R/BwNN.R -M R/GetCrCovYX.R -M R/GetCrCovYZ.R -M R/GetMinb.R -M R/Minb.R -M R/RcppExports.R -M src/RcppExports.cpp -M tests/testthat/test_BwNN.R -M tests/testthat/test_FPCAder.R -M tests/testthat/test_FVPA.R -M tests/testthat/test_GetCEScores.R -M tests/testthat/test_GetRho.R -M tests/testthat/test_GetSmoothedCovarSurface.R -M tests/testthat/test_GetSmoothedMeanCurve.R -M tests/testthat/test_SetOptions.R -M tests/testthat/test_createPathPlot.R -M tests/testthat/test_cvlwls1d.R -M tests/testthat/test_funSim.R -M tests/testthat/test_gcvlwls1d1.R -M tests/testthat/test_gcvlwls2dV2.R -M tests/testthat/test_getCrCovYX.R -M tests/testthat/test_getCrCovYZ.R -M tests/testthat/test_getMinb.R -M tests/testthat/test_minb.R - -commit 251c71dbad9269a2500e68d97ade65c6c4ad0b62 -Author: Xiongtao Dai -Date: Sun Apr 24 18:30:12 2016 -0700 - - update documentation also - -M man/CreateBWPlot.Rd -M man/CreateCovPlot.Rd -M man/CreateDesignPlot.Rd -M man/CreateDiagnosticsPlot.Rd -M man/CreateFuncBoxPlot.Rd -M man/CreateModeOfVarPlot.Rd -M man/CreateOutliersPlot.Rd -M man/CreatePathPlot.Rd -M man/CreateScreePlot.Rd -M man/FCReg.Rd -M man/FPCA.Rd -M man/FPCAder.Rd -M man/FVPA.Rd -M man/GetCrCovYZ.Rd -M man/SelectK.Rd -M man/Sparsify.Rd -M man/fitted.FPCA.Rd -M man/print.FPCA.Rd - -commit 9e5bd2d8dfdf2ecb131f87dd2e924e539ba51143 -Author: Xiongtao Dai -Date: Sun Apr 24 18:24:39 2016 -0700 - - y t yList tList to Ly Lt - -M R/CreateBWPlot.R -M R/CreateCovPlot.R -M R/CreateDesignPlot.R -M R/CreateDiagnosticsPlot.R -M R/CreateFuncBoxPlot.R -M R/CreateModeOfVarPlot.R -M R/CreateOutliersPlot.R -M R/CreatePathPlot.R -M R/CreateScreePlot.R -M R/FCReg.R -M R/FPCA.R -M R/FPCAder.R -M R/FVPA.R -M R/GetCrCovYZ.R -M R/GetLogLik.R -M R/GetNormalisedSample.R -M R/HandleNumericsAndNAN.R -M R/RcppExports.R -M R/SelectK.R -M R/Sparsify.R -M R/TruncateObs.R -M R/Wiener.R -M R/fitted.FPCA.R -M R/funcReg.R -M R/oldFCReg.R -M R/oldfuncReg.R -M R/print.FPCA.R -M src/RcppExports.cpp -M tests/testthat/test_BinRawCov.R -M tests/testthat/test_BwNN.R -M tests/testthat/test_FPCA.R -M tests/testthat/test_FPCAder.R -M tests/testthat/test_FitEigenValues.R -M tests/testthat/test_GetCEScores.R -M tests/testthat/test_GetEigenAnalysisResults.R -M tests/testthat/test_GetRho.R -M tests/testthat/test_GetSmoothedCovarSurface.R -M tests/testthat/test_Lwls2D.R -M tests/testthat/test_createDesignPlot.R -M tests/testthat/test_createPathPlot.R -M tests/testthat/test_fitted.R -M tests/testthat/test_funSim.R -M tests/testthat/test_funcReg.R -M tests/testthat/test_gcvlwls2dV2.R -M tests/testthat/test_getCrCovYX.R -M tests/testthat/test_getCrCovYZ.R -M tests/testthat/test_getMinb.R -M tests/testthat/test_pc_covE.R -M tests/testthat/test_rotateLwls2dV2.R -M tests/testthat/test_selectK.R -M tests/testthat/test_useBin.R -M tests/testthat/test_wiener.R - -commit 380c5b8cc6f26b1843619c9e30dc0d0053640154 -Author: Xiongtao Dai -Date: Sun Apr 24 15:25:05 2016 -0700 - - modified MakeGPFunctionalData, export/unexport funcs - -M NAMESPACE -M R/CheckData.R -M R/CheckOptions.R -M R/FCReg.R -M R/FVPA.R -M R/GetBinnedDataset.R -M R/HandleNumericsAndNAN.R -M R/MakeFPCAInputs.R -M R/MakeGPFunctionalData.R -M R/SetOptions.R -D man/HandleNumericsAndNAN.Rd -M man/MakeFPCAInputs.Rd -A man/MakeGPFunctionalData.Rd - -commit a79c5d4dcbaa8047ca03ee4d8ef18af981c2c41c -Author: hadjipantelis -Date: Wed Apr 20 14:50:06 2016 -0700 - - Add random GP data maker. - -A R/MakeGPFunctionalData.R - -commit 11c1b33db39d8c71cd93a0ce4a08ee6a35c7cb5d -Author: hadjipantelis -Date: Mon Apr 18 19:36:56 2016 -0700 - - Update CreatePathPlot.R - -M R/CreatePathPlot.R - -commit ca7b7aca5a691b9db0111f79c1de535b3d1cf770 -Author: hadjipantelis -Date: Fri Apr 15 21:08:25 2016 -0700 - - Change so FCReg receives sep. mean and cov bandwidths. - -M R/FCReg.R -M man/FCReg.Rd -M tests/testthat/test_funcReg.R - -commit 5c3e124cc89d1e35ebd15911fa3362a37bb3d69b -Author: hadjipantelis -Date: Wed Apr 13 23:50:47 2016 -0700 - - Fixing the way colours are used in the CreatePathPlot. - -M R/CreateOutliersPlot.R -M R/CreatePathPlot.R - -commit 3069fd43b659a98efe9b67630806db981ed498b5 -Author: hadjipantelis -Date: Mon Apr 11 17:26:42 2016 -0700 - - FindNN/BwNN added to Minb/GetMinb.R - -M NAMESPACE -A R/BwNN.R -M R/GetMinb.R -M R/GetSmoothedMeanCurve.R -M R/Minb.R -A man/BwNN.Rd -A tests/testthat/test_BwNN.R - -commit 7e9ecb5534c206c6aff081f897dc846aa308232a -Author: hadjipantelis -Date: Mon Apr 11 15:22:24 2016 -0700 - - Changing default smoothing options + minor other - -M R/CheckOptions.R -M R/FPCA.R -M R/GCVLwls2DV2.R -A R/GenerateFunctionalData.R -M R/GetSmoothedMeanCurve.R -M R/SetOptions.R -M man/FPCA.Rd -M man/GetNormalisedSample.Rd -M tests/testthat/test_FPCA.R - -commit 187e99842431732352d00b0c30c9441d259f0b1e -Author: hadjipantelis -Date: Wed Apr 6 16:32:33 2016 -0700 - - 1D bandwidth adjustment commented out. - -M R/GetSmoothedMeanCurve.R - -commit 9e1af06f73ae821ab9f49020f13ef529c22192a4 -Author: hadjipantelis -Date: Wed Apr 6 16:02:51 2016 -0700 - - Adding error option for normalisation - -M R/GetNormalisedSample.R - -commit 53d871718ffd21829a6b5da97c54b26b5c6d1576 -Author: hadjipantelis -Date: Tue Apr 5 15:47:40 2016 -0700 - - FVPA unit-tests, minor FVPA() changes. - -M man/FVPA.Rd - -commit 9efda1917d3f7ab2656a09d66b4d9df2fb783f34 -Author: hadjipantelis -Date: Tue Apr 5 15:47:04 2016 -0700 - - FVPA unit-tests, minor FVPA() changes. - -M R/FVPA.R -A tests/testthat/test_FVPA.R - -commit 32393ffd9796a4731189e3f222eaea811082decd -Author: hadjipantelis -Date: Mon Apr 4 11:47:37 2016 -0700 - - Minor FVPA changes - -M R/FVPA.R -M R/SetOptions.R - -commit f4641ea7193698d8f4ec5cb7e9e4a3cb4e7b2da3 -Author: hadjipantelis -Date: Mon Apr 4 09:40:45 2016 -0700 - - Updating FCReg - -M NAMESPACE -M R/FCReg.R -A R/oldFCReg.R -A R/oldfuncReg.R -M man/FCReg.Rd -M man/GetCrCovYX.Rd -M man/GetCrCovYZ.Rd -M man/GetNormalisedSample.Rd -A man/oldFCReg.Rd -M tests/testthat/test_funcReg.R - -commit f17a524d6c1b13a7cd62ae1eab44e5095d7830fd -Merge: ada618e 0ce405a -Author: hadjipantelis -Date: Fri Apr 1 19:46:00 2016 -0700 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit ada618ecffc0a088ad4d35cdb61376be70b7f947 -Author: hadjipantelis -Date: Fri Apr 1 19:45:35 2016 -0700 - - Changes at CE step and bw selection. - -M R/GetCrCovYX.R -M src/GetIndCEScoresCPPnewInd.cpp - -commit 0ce405a5fc62e3cdfd8a4b9e149dc466cbbfc6d6 -Author: hadjipantelis -Date: Fri Apr 1 14:12:52 2016 -0700 - - Minor fix - -M R/GetCrCovYX.R - -commit f8a20be907257dc2ecdf2f0d58605e957a01119b -Author: hadjipantelis -Date: Fri Apr 1 14:11:52 2016 -0700 - - Minor fix - -M R/GetCrCovYX.R - -commit 69839787325e986f636b7d6cb4fd4f545a79ec6c -Author: hadjipantelis -Date: Fri Apr 1 13:51:28 2016 -0700 - - Minor - -M R/GetCrCovYX.R - -commit 5f70495d500097511cf457ff2e25fd2311798e07 -Author: hadjipantelis -Date: Fri Apr 1 10:22:49 2016 -0700 - - Minor + adding BOBYQA to GCV CC solver. - -M R/GetCrCovYX.R -M R/funcReg.R -M tests/testthat/test_funcReg.R - -commit b8af6e7f74fda2517e34586b8e989b472c1d90f7 -Author: hadjipantelis -Date: Thu Mar 31 21:58:49 2016 -0700 - - Minor checks and additional tests for the concReg. - -M R/funcReg.R -M tests/testthat/test_funcReg.R - -commit 04f358d6102284dd9f4ef00f2df549cf30c88500 -Author: Xiongtao Dai -Date: Tue Mar 29 17:24:41 2016 -0700 - - new functional concurrent regression - -M R/funcReg.R -M tests/testthat/test_funcReg.R - -commit bcdba64425edae2b907390bf374b77a937913081 -Merge: cea7cd6 8cdd272 -Author: Xiongtao Dai -Date: Tue Mar 29 16:45:04 2016 -0700 - - Merge branch 'master' into conReg - -commit cea7cd6012163819e5e2a3dde90166634a9966ac -Author: Xiongtao Dai -Date: Tue Mar 29 16:45:01 2016 -0700 - - add funcReg test - -A tests/testthat/test_funcReg.R - -commit 8cdd272b35783e146c2990fbbe153dbbc0559328 -Author: hadjipantelis -Date: Fri Mar 18 12:44:36 2016 -0700 - - Fix at GetMinb to avoid outliers. - -M R/GetMinb.R -M tests/testthat/test_FPCA.R -M tests/testthat/test_getMinb.R - -commit e66f24a94cd26a2f6063f398156022e35ed8bbe1 -Author: Xiongtao Dai -Date: Fri Mar 18 09:09:01 2016 -0700 - - functions for concurrent regression - -M R/GetCrCovYX.R -M R/GetCrCovYZ.R -M R/GetRawCrCovFuncFunc.R -A R/funcReg.R - -commit b823b33f700aa4a2eea3d1b3c1468d5c99796d55 -Author: hadjipantelis -Date: Thu Mar 17 23:09:35 2016 -0700 - - Tidying up GCVLwls2DV2; spline cost heuristic - -M R/GCVLwls2DV2.R - -commit 721a499a912ac9ac59ee2f7092ce1a5ad8f0a350 -Author: hadjipantelis -Date: Mon Mar 14 19:51:15 2016 -0700 - - Normalisation reference added. - -M DESCRIPTION -M R/GetNormalisedSample.R - -commit 9f912350d3cf655a82c43e2af4cc7077630b9c10 -Author: hadjipantelis -Date: Mon Mar 14 14:27:09 2016 -0700 - - pow() namespace - -M src/CPPlwls1d.cpp - -commit 7d0724cc5e6caf5a5ba43f457cee053b027532c0 -Author: hadjipantelis -Date: Mon Mar 14 12:49:56 2016 -0700 - - pow(double(10),-6) to 1.0e-6 - -M src/Rmullwlsk.cpp -M src/RmullwlskCC.cpp - -commit e0abd11ce95ac1df083c76b3e068d5d49043a9ef -Author: hadjipantelis -Date: Mon Mar 14 10:33:03 2016 -0700 - - further pow() issue - -M DESCRIPTION -M src/CPPlwls1d.cpp - -commit 2eeb1ff3bff76717c2a849420d2cb3533b5feaad -Author: hadjipantelis -Date: Mon Mar 14 09:32:23 2016 -0700 - - Minor clarification in doc. - -M R/GetCrCovYX.R -M man/GetCrCovYX.Rd - -commit 4630e34b0546cd7ba8310ed2e0109ecd128cc809 -Author: hadjipantelis -Date: Mon Mar 14 09:22:31 2016 -0700 - - Minor fix on DESCRIPTION and to a unit-test - -M DESCRIPTION -M src/RmullwlskCC.cpp -M tests/testthat/test_FVEdataset.R -M tests/testthat/test_getCrCovYX.R - -commit df403029a7a45ebb7687f61be36eef72b618449e -Author: hadjipantelis -Date: Mon Mar 14 08:56:36 2016 -0700 - - adding bufSmall to NN check - -M src/Rmullwlsk.cpp -M src/RmullwlskCC.cpp - -commit e5b48631e6ffa960f92c80d31df7a78d14104f55 -Author: hadjipantelis -Date: Mon Mar 14 08:46:51 2016 -0700 - - Solaris 'pow' fix - -M src/Rmullwlsk.cpp -M src/RmullwlskCC.cpp - -commit 94870785f10d116a2b2d0addcfdca38fd09f9549 -Author: hadjipantelis -Date: Sat Mar 12 11:30:52 2016 -0800 - - Removing redundant 'Package for' after KH's comment - -M DESCRIPTION - -commit 0a5d1de3712398a38b374d55b577273851384628 -Author: hadjipantelis -Date: Sat Mar 12 11:27:21 2016 -0800 - - NAMESPACE changes for R-dev. - -M NAMESPACE - -commit 3ebccca1ce7ec6acb737559770f8f3de2e0313ce -Author: hadjipantelis -Date: Sat Mar 12 00:59:32 2016 -0800 - - Final fix - -M vignettes/fdapaceVignette.Rnw - -commit bf4d86595c5f43d38fd6725b47db2cf9f3850bab -Author: hadjipantelis -Date: Fri Mar 11 21:11:43 2016 -0800 - - Changes for vignettes (pending) - -M DESCRIPTION -M NAMESPACE -M R/FCReg.R -M R/FVPA.R -M data/medfly25.RData -A man/FVPA.Rd -A vignettes/DerivativesFlies.pdf -A vignettes/DerivativesFliesInspect.pdf -A vignettes/DiagPlotSparse.pdf -A vignettes/DiagnoFlies.pdf -A vignettes/DiagnoSimu.pdf -A vignettes/DifferentBandwidths.pdf -A vignettes/OutliersFlies.pdf -A vignettes/PathFlies.pdf -A vignettes/fdapaceVignette.Rnw -A vignettes/roxygen.bib - -commit bb345ed9b87d2ed53d4a11e4577400f482571f93 -Author: hadjipantelis -Date: Tue Mar 8 17:09:23 2016 -0800 - - minor - -M R/FCReg.R -M man/FCReg.Rd - -commit f2740d0c70bec355a5a3dcece0d9c44d75af1d9a -Author: hadjipantelis -Date: Tue Mar 8 16:53:58 2016 -0800 - - Removed FVPA.Rd - -D man/FVPA.Rd - -commit 15ef287dcf8d80309071c85ff10040bcf34cfdd0 -Author: hadjipantelis -Date: Tue Mar 8 16:45:40 2016 -0800 - - Minor things - -M NAMESPACE -M R/CreateBWPlot.R -M R/FCReg.R -M R/FVPA.R -D data/.swo -D data/.swp -M man/CreateBWPlot.Rd - -commit 855d8294dc61e778a8c7fa5f6cff2f9472dd6f80 -Merge: 6e6afd6 b05383a -Author: hadjipantelis -Date: Tue Mar 8 16:35:26 2016 -0800 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit 6e6afd677a90385a4fc5164b2e7a7c4353d5b62d -Author: hadjipantelis -Date: Tue Mar 8 16:34:58 2016 -0800 - - Minor - -M R/GetCrCovYX.R -M man/GetCrCovYX.Rd -M src/RmullwlskCC.cpp - -commit b05383ac075fe8029203b051074375e077c06f5d -Author: Xiongtao Dai -Date: Mon Mar 7 17:32:52 2016 -0800 - - test for getCrCovY[ZX].R - -M tests/testthat/test_getCrCovYX.R -M tests/testthat/test_getCrCovYZ.R - -commit 08be8df92f8611872236b6af44cb2fa09c37fda7 -Author: hadjipantelis -Date: Sat Mar 5 01:15:00 2016 -0800 - - Basic documentation fixes. - -M NAMESPACE -M R/CreateFuncBoxPlot.R -M R/CreateOutliersPlot.R -M man/CreateFuncBoxPlot.Rd -M man/CreateOutliersPlot.Rd -M man/GetCrCorYX.Rd -A man/GetCrCorYZ.Rd - -commit 47c619441da7baed3d5d2c756c3c18b116f2a20b -Author: hadjipantelis -Date: Fri Mar 4 12:14:40 2016 -0800 - - GetCrCorYZ - -M R/GetCrCorYX.R -A R/GetCrCorYZ.R - -commit c09b9d59a3d714fa01dfc2351032e13cd9e268f9 -Author: hadjipantelis -Date: Fri Mar 4 09:59:29 2016 -0800 - - Minor - -M R/GetCrCorYX.R - -commit 45feb1e214c777c5aab2a9f55b5c7918563813fa -Author: hadjipantelis -Date: Wed Mar 2 22:39:51 2016 -0800 - - Rewriting CVLwls1D + minor stuff. - -M R/CVLwls1D.R -M R/CheckOptions.R -M R/CreateBWPlot.R -M R/FPCA.R -M R/GetSmoothedCovarSurface.R -M R/GetSmoothedMeanCurve.R -M R/SetOptions.R -M R/fitted.FPCA.R -M man/CreateBWPlot.Rd -M man/CreateDiagnosticsPlot.Rd -M man/FPCA.Rd -M tests/testthat/test_cvlwls1d.R - -commit 0c90242044df18537c58fc4ee0817fac18f6c8f3 -Author: hadjipantelis -Date: Wed Mar 2 14:18:36 2016 -0800 - - Minor things/ Comment out CreateDiagnsticsPlot deriv. - -M R/CreateBWPlot.R -M R/CreateDiagnosticsPlot.R - -commit be06d07d5d455fa06a8828da03e3c8772a59da9f -Author: hadjipantelis -Date: Wed Mar 2 10:43:00 2016 -0800 - - CreateBWPlot.R and minor stuff. - -M NAMESPACE -A R/CreateBWPlot.R -M R/FPCA.R -A man/CreateBWPlot.Rd -M man/FPCA.Rd - -commit 8b5873496a492b26da27ef82703a4690eef1c2a2 -Author: Xiongtao Dai -Date: Wed Mar 2 07:17:49 2016 +0000 - - plot.FPCA -> CreateDiagnosticsPlot - -M NAMESPACE -A R/plot.FPCA.R -A man/plot.FPCA.Rd - -commit 129fc7ff4f04e35251ae7a22dd6fd13d50ff54d1 -Author: hadjipantelis -Date: Tue Mar 1 16:39:39 2016 -0800 - - WHO z-score functions and dataset renaming. - -M NAMESPACE -A R/MakeBWtoZscore02y.R -A R/MakeHCtoZscore02y.R -A R/MakeLNtoZscore02y.R -M R/medfly25.R -M data/medfly25.RData -A man/MakeBWtoZscore02y.Rd -A man/MakeHCtoZscore02y.Rd -A man/MakeLNtoZscore02y.Rd -M man/medfly25.Rd - -commit 6f43c44b0a6504296849aa2cb6ca472f32a16997 -Author: hadjipantelis -Date: Mon Feb 29 07:32:27 2016 -0800 - - Minor - -M R/GetNormalisedSample.R -M R/RcppExports.R -M src/RcppExports.cpp - -commit b87733ebaf2fdeda810f8c4efe40909f53cf86b2 -Author: Xiongtao Dai -Date: Sun Feb 28 01:00:54 2016 +0000 - - minor change plotting functions - -M R/CreateDiagnosticsPlot.R -M R/CreatePathPlot.R -M R/RcppExports.R -M src/RcppExports.cpp -D src/symbols.rds - -commit ea24dcf9d3fdb886555229bccdc1b99953ff07fb -Author: hadjipantelis -Date: Fri Feb 26 11:56:13 2016 -0800 - - Minor changes; all.equal -> identical, screeplot -> scree-plot - -M R/CreateDesignPlot.R -M R/CreateScreePlot.R - -commit eca40dcd79502f217f0683733d40f760f5c4b1e5 -Author: hadjipantelis -Date: Wed Feb 24 21:28:17 2016 -0800 - - Minor change to CreateDesignPlot for very dense samples. - -M R/CreateDesignPlot.R - -commit 0c38376fd944e425f16c54ab44ee0ef94125b584 -Author: hadjipantelis -Date: Wed Feb 24 17:00:38 2016 -0800 - - NaN in the smoother for derivatives - -M R/Lwls1D.R -M src/CPPlwls1d.cpp - -commit 25d519803b0d6a58e8099753fdaacc3ac863f1f1 -Author: hadjipantelis -Date: Tue Feb 23 16:37:24 2016 -0800 - - Warnings corrected. - -M R/CreateDiagnosticsPlot.R -M R/CreateModeOfVarPlot.R -R098 R/Medfly25.R R/medfly25.R -R093 man/Medfly25.Rd man/medfly25.Rd - -commit fb1d89882b7654c7e265fe0fccd36dc624f10ae1 -Author: hadjipantelis -Date: Tue Feb 23 16:17:49 2016 -0800 - - Ensuring new mu grid is fine. - -M R/CreateDiagnosticsPlot.R -M R/FPCAder.R -M R/GetLogLik.R -M R/MakeResultFPCA.R -M R/fitted.FPCA.R -M tests/testthat/test_FPCA.R -M tests/testthat/test_selectK.R - -commit d7125c7a913f3a6da523987484a807012d565cf1 -Author: hadjipantelis -Date: Mon Feb 22 21:05:33 2016 -0800 - - Updating docs. - -M man/CreateFuncBoxPlot.Rd -M man/CreatePathPlot.Rd - -commit 0e73055e520cf0925a7d7ac9006fb88cc8169818 -Author: hadjipantelis -Date: Mon Feb 22 21:04:47 2016 -0800 - - Fixes in plotting functions. - -M R/CreateFuncBoxPlot.R -M R/CreateOutliersPlot.R -M R/CreatePathPlot.R - -commit 4be75a3a4cd65a93cf77decb0bb085157207eabd -Author: hadjipantelis -Date: Fri Feb 19 23:34:08 2016 -0800 - - Changes in the default bandwidths. - -M R/CreateDiagnosticsPlot.R -M R/SetDerOption.R -M man/CreateDiagnosticsPlot.Rd - -commit 3d786e630f27635b380ff9d78f506f9abec27c57 -Author: hadjipantelis -Date: Fri Feb 19 22:33:30 2016 -0800 - - Refining CreateDiagnosticsPlot for derivatives. - -M R/CreateDiagnosticsPlot.R - -commit e68edebee7b0d5d560636aa128b3ab5aa0967609 -Merge: 5a870bd c8f8508 -Author: hadjipantelis -Date: Thu Feb 18 17:21:10 2016 -0800 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit 5a870bdfec8c54e157017604cfdeaa8c5e3dedd4 -Author: hadjipantelis -Date: Thu Feb 18 17:17:47 2016 -0800 - - Some basic derivative diagnostics. - -D medfly25.png - -commit 5538373379d13a0720170a150e0599935d5ad6b3 -Author: hadjipantelis -Date: Thu Feb 18 17:16:58 2016 -0800 - - Some basic derivative diagnostics. - -M R/CreateDiagnosticsPlot.R -M R/FPCAder.R -M R/SetDerOption.R -M README.org -M man/CreateDiagnosticsPlot.Rd -A medfly25.png - -commit c8f8508fc0b84fdc4bf6e307c89431e6f5baa48b -Author: hadjipantelis -Date: Wed Feb 17 10:44:11 2016 -0800 - - Update README.org - -M README.org - -commit 40c894261de480d07099de6a6647d5ec5e62c932 -Author: hadjipantelis -Date: Tue Feb 16 17:34:11 2016 -0800 - - Fixing the dyn. library loading issue. - -M NAMESPACE -M R/RcppExports.R -M R/pkgname.R -R096 man/tPACE.Rd man/fdapace.Rd -M src/RcppExports.cpp - -commit fc7f9ab41224d4f151aac406fbe86fc0e037c9e8 -Author: hadjipantelis -Date: Tue Feb 16 17:19:00 2016 -0800 - - Renaming - -M NAMESPACE -M R/CheckOptions.R -M R/FPCA.R -M R/GetSmoothedCovarSurface.R -M R/GetSmoothedMeanCurve.R -M R/SetOptions.R -M man/CreateFuncBoxPlot.Rd -M man/FPCA.Rd -M tests/testthat/test_FPCA.R -M tests/testthat/test_GetSmoothedCovarSurface.R -M tests/testthat/test_selectK.R - -commit 78636839033378e84a017b15d38edd7fa8fc33d8 -Author: hadjipantelis -Date: Tue Feb 16 16:15:13 2016 -0800 - - Minor changes - -M DESCRIPTION -M R/CreateFuncBoxPlot.R -M R/GetCovDense.R - -commit 5d231eeb2c8a335d1704fbc4088e048449c102e2 -Author: hadjipantelis -Date: Mon Feb 15 16:48:54 2016 -0800 - - Clean up - -M .gitignore -M NAMESPACE -D src/Rmullwlsk_old.cpp -D testingAllAround.R - -commit 4229c01eb8dab984491d50bd4c5fb47501a6c166 -Author: hadjipantelis -Date: Mon Feb 15 16:06:40 2016 -0800 - - Tests and renames - -M .gitignore -M NAMESPACE -M R/FPCAder.R -M R/RcppExports.R -M R/SetDerOption.R -M R/fitted.FPCA.R -R077 man/createCovPlot.Rd man/CreateCovPlot.Rd -R072 man/createDesignPlot.Rd man/CreateDesignPlot.Rd -R067 man/createDiagnosticsPlot.Rd man/CreateDiagnosticsPlot.Rd -R082 man/createFuncBoxPlot.Rd man/CreateFuncBoxPlot.Rd -R076 man/createModeOfVarPlot.Rd man/CreateModeOfVarPlot.Rd -R088 man/createOutliersPlot.Rd man/CreateOutliersPlot.Rd -R082 man/createPathPlot.Rd man/CreatePathPlot.Rd -R070 man/createScreePlot.Rd man/CreateScreePlot.Rd -M man/FPCA.Rd -M man/FPCAder.Rd -M man/FVPA.Rd -R080 man/getCrCorYX.Rd man/GetCrCorYX.Rd -R090 man/getCrCovYX.Rd man/GetCrCovYX.Rd -R089 man/getCrCovYZ.Rd man/GetCrCovYZ.Rd -R067 man/getNormalisedSample.Rd man/GetNormalisedSample.Rd -R085 man/lwls1d.Rd man/Lwls1D.Rd -R090 man/lwls2d.Rd man/Lwls2D.Rd -R077 man/makeFPCAinputs.Rd man/MakeFPCAInputs.Rd -R093 man/medfly25.Rd man/Medfly25.Rd -R090 man/selectK.Rd man/SelectK.Rd -R088 man/sparsify.Rd man/Sparsify.Rd -R083 man/wiener.Rd man/Wiener.Rd -M man/fitted.FPCA.Rd -M man/print.FPCA.Rd -M src/RcppExports.cpp -A testingAllAround.R -M tests/testthat/test_CreateTrueMean.R -M tests/testthat/test_FPCAder.R -M tests/testthat/test_SetOptions.R -A tests/testthat/test_fitted.R - -commit c0e8749e14cf2e14a0b8c86b64dda5456fcd8339 -Author: dmchris -Date: Thu Feb 11 21:11:32 2016 -0800 - - Rename wiener.R to Wiener.R - -R100 R/wiener.R R/Wiener.R - -commit 39d1becede6e21337e2a65ce5bffba2e20029700 -Author: dmchris -Date: Thu Feb 11 21:11:18 2016 -0800 - - Rename subsetFPCA.R to SubsetFPCA.R - -R099 R/subsetFPCA.R R/SubsetFPCA.R - -commit bb10acfca604f7506840b72f094838f47ac6274a -Author: dmchris -Date: Thu Feb 11 21:11:03 2016 -0800 - - Rename sparsify.R to Sparsify.R - -R100 R/sparsify.R R/Sparsify.R - -commit bf77bcc60f8470cfb88bb61373333f97d03820c7 -Author: dmchris -Date: Thu Feb 11 21:10:51 2016 -0800 - - Rename selectK.R to SelectK.R - -R100 R/selectK.R R/SelectK.R - -commit ec13ba4c43c952da56c2ce17d1a631ff409366df -Author: dmchris -Date: Thu Feb 11 21:10:39 2016 -0800 - - Rename rotateLwls2dV2.R to RotateLwls2DV2.R - -R100 R/rotateLwls2dV2.R R/RotateLwls2DV2.R - -commit 1d012ed937a56863025dde22a00df3a982472c3c -Author: dmchris -Date: Thu Feb 11 21:10:09 2016 -0800 - - Rename pc_covE.R to PC_CovE.R - -R100 R/pc_covE.R R/PC_CovE.R - -commit 4e120bb65c7d043bd0d74dcbf49b2e1acfcc7b8c -Author: dmchris -Date: Thu Feb 11 21:09:55 2016 -0800 - - Rename minb.R to Minb.R - -R100 R/minb.R R/Minb.R - -commit ec4fc0f965a970c42ae56dd39cfa21a22b151bdc -Author: dmchris -Date: Thu Feb 11 21:09:40 2016 -0800 - - Rename medfly25.R to Medfly25.R - -R100 R/medfly25.R R/Medfly25.R - -commit 33f12c0a6b679028b088e0025e6f73f83e2e3576 -Author: dmchris -Date: Thu Feb 11 21:09:23 2016 -0800 - - Rename mapX1d.R to MapX1D.R - -R100 R/mapX1d.R R/MapX1D.R - -commit 41437087b26950c27cbb5522189cfc284667156d -Author: dmchris -Date: Thu Feb 11 21:09:04 2016 -0800 - - Rename lwls1d.R to Lwls1D.R - -R100 R/lwls1d.R R/Lwls1D.R - -commit 23155e28f4b5c2e885e9cfb1f5a9c4792ab8f8e9 -Author: dmchris -Date: Thu Feb 11 21:08:49 2016 -0800 - - Rename getNormalisedSample.R to GetNormalisedSample.R - -R100 R/getNormalisedSample.R R/GetNormalisedSample.R - -commit e4b95e972330d6a33c68281e38256d52dfb9c282 -Author: dmchris -Date: Thu Feb 11 21:08:38 2016 -0800 - - Rename getMinb.R to GetMinb.R - -R100 R/getMinb.R R/GetMinb.R - -commit 6e7cc89bdd33a759e2fd705c8a47ce77fd45e2e1 -Author: dmchris -Date: Thu Feb 11 21:08:28 2016 -0800 - - Rename getLogLik.R to GetLogLik.R - -R100 R/getLogLik.R R/GetLogLik.R - -commit 2d9f5f4a852c02671d1fce0689397b5a277679ea -Author: dmchris -Date: Thu Feb 11 21:08:16 2016 -0800 - - Rename getCrCovYZ.R to GetCrCovYZ.R - -R100 R/getCrCovYZ.R R/GetCrCovYZ.R - -commit bc2c0c9c956cd9a0757635eedbac81783887aec3 -Author: dmchris -Date: Thu Feb 11 21:08:05 2016 -0800 - - Rename getCrCovYX.R to GetCrCovYX.R - -R100 R/getCrCovYX.R R/GetCrCovYX.R - -commit 79b2c4ade809b69bf93e43e43da40e40200004ed -Author: dmchris -Date: Thu Feb 11 21:07:53 2016 -0800 - - Rename getCrCorYX.R to GetCrCorYX.R - -R099 R/getCrCorYX.R R/GetCrCorYX.R - -commit 81ccf82da5b1c42df5a31fcb0a0cb9a0024ab028 -Author: dmchris -Date: Thu Feb 11 21:07:37 2016 -0800 - - Rename getCount.R to GetCount.R - -R100 R/getCount.R R/GetCount.R - -commit 48d3ecc58de799b80f3e6174e6656462181f941f -Author: dmchris -Date: Thu Feb 11 21:07:24 2016 -0800 - - Rename gcvlwls2dV2.R to GCVLwls2DV2.R - -R100 R/gcvlwls2dV2.R R/GCVLwls2DV2.R - -commit 6a83c8bafb97d61ac236c75a9a11ea22878b3d29 -Author: dmchris -Date: Thu Feb 11 21:07:00 2016 -0800 - - Rename gcvlwls1d1.R to GCVLwls1D1.R - -R100 R/gcvlwls1d1.R R/GCVLwls1D1.R - -commit 78f85701cd3bf945a99b9721bd63e5d19aedbb1f -Author: dmchris -Date: Thu Feb 11 21:06:41 2016 -0800 - - Rename designPlotCount.R to DesignPlotCount.R - -R099 R/designPlotCount.R R/DesignPlotCount.R - -commit aa0273c83bb2ffb17e65332fb1bcbaab91a90c53 -Author: dmchris -Date: Thu Feb 11 21:06:27 2016 -0800 - - Rename cvlwls1d.R to CVLwls1D.R - -R100 R/cvlwls1d.R R/CVLwls1D.R - -commit 1edae8f2aa14e429b4a1424786697546b17c3353 -Author: dmchris -Date: Thu Feb 11 21:06:04 2016 -0800 - - Rename createScreePlot.R to CreateScreePlot.R - -R100 R/createScreePlot.R R/CreateScreePlot.R - -commit 69f54c4a5b65522236217d0d5cd5e1457a82bc11 -Author: dmchris -Date: Thu Feb 11 21:05:52 2016 -0800 - - Rename createPathPlot.R to CreatePathPlot.R - -R100 R/createPathPlot.R R/CreatePathPlot.R - -commit fff9326b2033f334b4f2ce16b7d50ecbb17ef157 -Author: dmchris -Date: Thu Feb 11 21:05:40 2016 -0800 - - Rename createOutliersPlot.R to CreateOutliersPlot.R - -R100 R/createOutliersPlot.R R/CreateOutliersPlot.R - -commit 82bed0c465f99f23e76918bcb2f01d6023a25f45 -Author: dmchris -Date: Thu Feb 11 21:05:26 2016 -0800 - - Rename createModeOfVarPlot.R to CreateModeOfVarPlot.R - -R100 R/createModeOfVarPlot.R R/CreateModeOfVarPlot.R - -commit 79aa825cef7a7f3323ba1b324256c58235ae9643 -Author: dmchris -Date: Thu Feb 11 21:04:48 2016 -0800 - - Rename createFuncBoxPlot.R to CreateFuncBoxPlot.R - -R100 R/createFuncBoxPlot.R R/CreateFuncBoxPlot.R - -commit 43de40658a22ce79d760c7e063677dbd0f3f3259 -Author: dmchris -Date: Thu Feb 11 21:04:31 2016 -0800 - - Rename createDiagnosticsPlot.R to CreateDiagnosticsPlot.R - -R100 R/createDiagnosticsPlot.R R/CreateDiagnosticsPlot.R - -commit c7dbab3ffee187a8e35ae238c92f5ae2edffa3c8 -Author: dmchris -Date: Thu Feb 11 21:04:18 2016 -0800 - - Rename createDesignPlot.R to CreateDesignPlot.R - -R100 R/createDesignPlot.R R/CreateDesignPlot.R - -commit fb4ba6d5784d73b1c45ad5e19b89c4cd9e29878d -Author: dmchris -Date: Thu Feb 11 21:03:59 2016 -0800 - - Rename createCovPlot.R to CreateCovPlot.R - -R100 R/createCovPlot.R R/CreateCovPlot.R - -commit abe9e2323440e89f637b6472e11c42fe78dc1a08 -Author: dmchris -Date: Thu Feb 11 21:03:33 2016 -0800 - - Rename adjustBW1.R to AdjustBW1.R - -R099 R/adjustBW1.R R/AdjustBW1.R - -commit d818e21513fec8e0e1a62d33afc08992f9a1ce05 -Author: dmchris -Date: Thu Feb 11 20:47:40 2016 -0800 - - function renaming - - getA -> GetA, owls -> Lwls, 1d,2d ->1D, 2D. File name changed to be - consistent with function names inside (MakeFPCAInputs, Lwls2D). - -M NAMESPACE -M R/ConvertSupport.R -M R/FCReg.R -M R/FPCA.R -M R/FPCAder.R -M R/FVPA.R -M R/GetRawCov.R -M R/GetSmoothedCovarSurface.R -M R/GetSmoothedMeanCurve.R -R098 R/lwls2dV2.R R/Lwls2D.R -R094 R/makePACEinputs.R R/MakeFPCAInputs.R -M R/RcppExports.R -M R/adjustBW1.R -M R/createCovPlot.R -M R/createDesignPlot.R -M R/createDiagnosticsPlot.R -M R/createFuncBoxPlot.R -M R/createModeOfVarPlot.R -M R/createOutliersPlot.R -M R/createPathPlot.R -M R/createScreePlot.R -M R/cvlwls1d.R -M R/designPlotCount.R -M R/fitted.FPCA.R -M R/gcvlwls1d1.R -M R/gcvlwls2dV2.R -M R/getCount.R -M R/getCrCorYX.R -M R/getCrCovYX.R -M R/getCrCovYZ.R -M R/getLogLik.R -M R/getMinb.R -M R/getNormalisedSample.R -M R/lwls1d.R -M R/mapX1d.R -M R/medfly25.R -M R/minb.R -M R/pc_covE.R -M R/print.FPCA.R -M R/rotateLwls2dV2.R -M R/selectK.R -M R/sparsify.R -M R/subsetFPCA.R -M R/wiener.R -M tests/testthat/test_BinRawCov.R -M tests/testthat/test_FPCA.R -M tests/testthat/test_FPCAder.R -M tests/testthat/test_FVEdataset.R -M tests/testthat/test_FitEigenValues.R -M tests/testthat/test_GetCEScores.R -M tests/testthat/test_GetCovDense.R -M tests/testthat/test_GetEigenAnalysisResults.R -M tests/testthat/test_GetRho.R -M tests/testthat/test_GetSmoothedCovarSurface.R -R081 tests/testthat/test_lwls2dV2.R tests/testthat/test_Lwls2D.R -M tests/testthat/test_createDesignPlot.R -M tests/testthat/test_createPathPlot.R -M tests/testthat/test_cvlwls1d.R -M tests/testthat/test_funSim.R -M tests/testthat/test_gcvlwls1d1.R -M tests/testthat/test_gcvlwls2dV2.R -M tests/testthat/test_getCrCorYX.R -M tests/testthat/test_getCrCovYX.R -M tests/testthat/test_getCrCovYZ.R -M tests/testthat/test_getMinb.R -M tests/testthat/test_makeFPCAinputs.R -M tests/testthat/test_mapX1d.R -M tests/testthat/test_minb.R -M tests/testthat/test_pc_covE.R -M tests/testthat/test_rotateLwls2dV2.R -M tests/testthat/test_selectK.R -M tests/testthat/test_useBin.R -M tests/testthat/test_wiener.R - -commit b5d997e9564dbeb81853d3e4140add7a74ffc63d -Author: hadjipantelis -Date: Wed Feb 10 12:18:17 2016 -0800 - - Minor tidy-up - -M DESCRIPTION -M LICENSE -M R/FPCA.R -M R/medfly25.R -M man/FPCA.Rd -A man/medfly25.Rd -A src/symbols.rds - -commit f62a8552c0cd7bc9d817a31fca6604f36685d641 -Author: hadjipantelis -Date: Wed Feb 10 11:43:36 2016 -0800 - - minor - -R100 medfly25.R R/medfly25.R -M tests/testthat/test_CreateFolds.R -M tests/testthat/test_FPCA.R -M tests/testthat/test_FPCAder.R -M tests/testthat/test_FitEigenValues.R -M tests/testthat/test_GetCEScores.R -M tests/testthat/test_GetCovDense.R -M tests/testthat/test_GetRho.R -M tests/testthat/test_gcvlwls2dV2.R - -commit 2b666adcb6e23b2b84d2387e7587cf7450288a93 -Author: Xiongtao Dai -Date: Wed Feb 10 02:54:46 2016 -0800 - - reorganize FPCA; added tests - - Now `FPCA` is streamlined--get mu/cov, eigenanalysis, get scores, - return. `dataType` only specify the whether the data is regular or not, - and defines the default method of getting mu/cov, and scores. Any method - for getting mu/cov can be combined with any method for getting scores, - as long as the combination makes sense. - -M R/CheckOptions.R -M R/FPCA.R -M R/FPCAder.R -M R/GetCovDense.R -M R/GetMeanDense.R -A R/GetUserCov.R -A R/GetUserMeanCurve.R -M R/MakeResultFPCA.R -M R/SetOptions.R -M man/FPCAder.Rd -M tests/testthat/test_FPCA.R -M tests/testthat/test_FPCAder.R -D tests/testthat/test_no_FVE.R -M tests/testthat/test_useBin.R - -commit c5aa78cd39710b44214ae482aa92461e9347fdc8 -Author: hadjipantelis -Date: Mon Feb 8 17:31:59 2016 -0800 - - small bug fix - -M R/FPCAder.R - -commit f2f64015f9044e82ad8e2a7d6ea3b08c7e207aa9 -Author: hadjipantelis -Date: Mon Feb 8 17:28:48 2016 -0800 - - Docs. - -M man/FPCAder.Rd -M man/fitted.FPCA.Rd - -commit ea5df30bce451542caf459548546631cefa5b3ad -Author: hadjipantelis -Date: Mon Feb 8 17:24:18 2016 -0800 - - Changes on derivatives. - -M R/FPCAder.R -M R/SetDerOption.R -M R/fitted.FPCA.R - -commit ff5a56b83537a06f67dd02d5c765ce805831875f -Author: hadjipantelis -Date: Fri Feb 5 17:10:26 2016 -0800 - - The medfly dataset. - -A data/medfly25.RData -A medfly25.R - -commit a4f4969baf5ada4a7cff7b1c4557f0c6fa4ca81d -Author: Xiongtao Dai -Date: Fri Feb 5 18:45:14 2016 +0000 - - FPCAder no bandwidth choice - -M R/FPCAder.R -M R/SetDerOption.R -M man/FPCAder.Rd -D src/symbols.rds -M tests/testthat/test_FPCAder.R - -commit 333f0367951f875302b60596456730d597c2acfa -Author: Xiongtao Dai -Date: Fri Feb 5 17:33:42 2016 +0000 - - minor FPCAder - -M R/FPCAder.R -M R/fitted.FPCA.R -M R/gcvlwls1d1.R -M man/FPCAder.Rd -M tests/testthat/test_FPCAder.R - -commit 845ea2135c6fde603a3bb79759567a9603e10e9b -Author: hadjipantelis -Date: Thu Feb 4 10:53:54 2016 -0800 - - Minor fixes - -M R/FPCA.R -M R/SetOptions.R -M man/FPCA.Rd - -commit 54a81e24b70041c592f5d03c4c117485b893514d -Author: hadjipantelis -Date: Wed Feb 3 13:55:42 2016 -0800 - - Updated .Rd file - -M man/FPCA.Rd - -commit 758c1f70ab8b41a1da7858f8564d684a899fa372 -Author: hadjipantelis -Date: Wed Feb 3 13:51:03 2016 -0800 - - Got rid of 'MethodMu' - -M R/CheckOptions.R -M R/SetOptions.R - -commit 1e99055043903c73c5c5f5ca4cdbbcc0e0ed5248 -Author: hadjipantelis -Date: Wed Feb 3 13:45:43 2016 -0800 - - Minor bug/typo. - -M R/SetOptions.R - -commit 018cd2ae66b97dd4b52e70ab8bde274f148e13e0 -Author: hadjipantelis -Date: Wed Feb 3 13:33:06 2016 -0800 - - First attempt in smoothing dense data. - -M R/CheckOptions.R -M R/FPCA.R -M R/GetCovDense.R -M R/GetMeanDense.R -M R/SetOptions.R - -commit a6c3a5bf239d55d1234960178d379bf7e340a6ec -Merge: 9c0d356 f89d6cd -Author: Xiongtao Dai -Date: Wed Feb 3 00:53:38 2016 -0800 - - Merge branch 'master' of github.com:hadjipantelis/tPACE - -commit 9c0d3564181bb8f92af2894cea7876b3ee7da99c -Author: Xiongtao Dai -Date: Wed Feb 3 00:53:32 2016 -0800 - - minor improvement - -M R/SetOptions.R -M R/createPathPlot.R - -commit f89d6cdda72ffc2eafa88a4fc8e0ff148054cc71 -Author: hadjipantelis -Date: Tue Feb 2 19:01:51 2016 -0800 - - Minor title changes - -M R/createDesignPlot.R -M R/createDiagnosticsPlot.R - -commit 5d94d6c5fad2935e0272d927344183127c1baa5e -Author: hadjipantelis -Date: Sat Jan 30 13:26:09 2016 -0800 - - Reverting dataset addition. - -D R/DavisTmps.R -D data/DavisTmps.RData -D man/DavisTemps.Rd - -commit 0e10d741aa947a979e96bd5c85767948de28202f -Author: hadjipantelis -Date: Sat Jan 30 13:21:39 2016 -0800 - - DavisTmps dataset. - -A R/DavisTmps.R -A data/DavisTmps.RData -A man/DavisTemps.Rd -A man/FPCAder.Rd - -commit 802ee8304de2f01b3d160a1bc106954f4325eef4 -Author: hadjipantelis -Date: Fri Jan 29 11:56:02 2016 -0800 - - fitted.FPCA: Warning about using too high 'k' - -M R/fitted.FPCA.R - -commit 66b0c983293dcebdacf56e56ba9fa7541249e789 -Merge: 6ccd77c 5db3abd -Author: hadjipantelis -Date: Fri Jan 29 11:35:43 2016 -0800 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit 6ccd77c1133fae7502bebf0de0c6fdc34695f28e -Author: hadjipantelis -Date: Fri Jan 29 11:35:06 2016 -0800 - - GCV fix - -M R/fitted.FPCA.R - -commit 5db3abd5a42bed9bca4cc2560bc3b389c087f11d -Merge: c7af0b9 d16c86f -Author: Xiongtao Dai -Date: Fri Jan 29 19:33:26 2016 +0000 - - Merge branch 'master' of github.com:hadjipantelis/tPACE - -commit c7af0b94448a31532bcf5a6e18130ce82703e53d -Author: Xiongtao Dai -Date: Fri Jan 29 19:33:15 2016 +0000 - - minor - -M R/FPCAder.R - -commit d16c86f8992ee2f6ba72ba1457c21fe7afa54e06 -Author: hadjipantelis -Date: Fri Jan 29 11:30:46 2016 -0800 - - Removing example pdfs - -D DiagPlotSparse.pdf -D Means.pdf -D Phi1.pdf - -commit f7f7d10ce118210026ff9e190d6e58ffdca82301 -Author: hadjipantelis -Date: Fri Jan 29 10:46:47 2016 -0800 - - Minor - -M R/createModeOfVarPlot.R - -commit c8695576e6849e1a2cf60d85fc9ef2478d47db1e -Merge: 48ee69f f7651a6 -Author: hadjipantelis -Date: Fri Jan 29 10:44:09 2016 -0800 - - Merge. - -commit 48ee69fd18bf7a4defc704ee960f434d61570ba7 -Author: hadjipantelis -Date: Fri Jan 29 10:40:14 2016 -0800 - - Minor - -M R/createFuncBoxPlot.R -M R/createModeOfVarPlot.R -M R/createPathPlot.R - -commit f7651a6e5f96b75fd0e97b0982ecd41e4045b607 -Author: Xiongtao Dai -Date: Thu Jan 28 19:04:02 2016 -0800 - - minor - -M tests/testthat/test_FPCAder.R - -commit 578a75b909f7ec98b4320b903e46b49b9a7306ac -Author: Xiongtao Dai -Date: Thu Jan 28 19:02:54 2016 -0800 - - fix S3 method - -M NAMESPACE -R090 R/deriv.FPCA.R R/FPCAder.R -M R/fitted.FPCA.R -D man/deriv.FPCA.Rd -M man/fitted.FPCA.Rd -M tests/testthat/test_FPCAder.R -D tests/testthat/test_deriv.R - -commit 4bdf375b42bf6dc431a15d7907d09c77742fb51e -Author: Xiongtao Dai -Date: Thu Jan 28 18:35:32 2016 -0800 - - document() - -M NAMESPACE -M R/deriv.FPCA.R -A man/deriv.FPCA.Rd -M man/fitted.FPCA.Rd - -commit e6b96ed0d70d93023014b1c2daa383eedce6c06f -Author: Xiongtao Dai -Date: Thu Jan 28 18:33:30 2016 -0800 - - deriv.FPCA - -A R/SetDerOption.R -M R/createModeOfVarPlot.R -A R/deriv.FPCA.R -M R/fitted.FPCA.R -M man/createModeOfVarPlot.Rd -A tests/testthat/test_deriv.R - -commit 2624ae35125fdb77afb79cc93ca84d72fc44a217 -Author: hadjipantelis -Date: Wed Jan 27 12:22:45 2016 -0800 - - Documentation changes. - -M R/fitted.FPCA.R -M man/createModeOfVarPlot.Rd -M man/fitted.FPCA.Rd -M man/lwls1d.Rd - -commit daa17258ae8dcfd197ad6f86fc50946d40d0dcbf -Author: hadjipantelis -Date: Wed Jan 27 12:13:10 2016 -0800 - - Getting derivatives for fitted data, updated checks and 1D smoothers - -M DESCRIPTION -R100 LICENSE.txt LICENSE -M R/createModeOfVarPlot.R -M R/cvlwls1d.R -M R/fitted.FPCA.R -M R/gcvlwls1d1.R -R090 R/Rlwls1d.R R/lwls1d.R -M src/CPPlwls1d.cpp - -commit b343b37132e9eda136bbb7cf8e8477b9422577c0 -Author: Xiongtao Dai -Date: Wed Jan 27 00:02:22 2016 -0800 - - fix error/warning - -M R/BinData.R -M R/CheckData.R -M R/CheckOptions.R -M R/FPCA.R -M R/GetBinnedCurve.R -M R/HandleNumericsAndNAN.R -M R/SetOptions.R -M man/CheckData.Rd -M man/CheckOptions.Rd -M man/HandleNumericsAndNAN.Rd -M tests/testthat/test_CheckData.R - -commit 57473f6ae7b2bb394ae630347bdde1a66ef5b11d -Author: Xiongtao Dai -Date: Thu Jan 21 18:03:19 2016 -0800 - - integrate sigma2 and shrink for dense data - -M NAMESPACE -M R/FPCA.R -M R/GetCovDense.R -M R/GetINScores.R -M R/SetOptions.R -M R/pkgname.R -M man/FPCA.Rd -M man/createOutliersPlot.Rd -M man/fitted.FPCA.Rd -M tests/testthat/test_FPCA.R -A tests/testthat/test_GetCovDense.R - -commit ab58b61ef36a36c6975bf4c3e42b42281208db2e -Merge: 83e2d6d 4edd3bd -Author: Xiongtao Dai -Date: Thu Jan 21 16:05:53 2016 -0800 - - Merge branch 'master' into denseSigma2 - -commit 4edd3bd19c509f10b089c0e9db7e28d226fe9d3b -Merge: 06d1361 e7f39d8 -Author: Xiongtao Dai -Date: Thu Jan 21 15:59:32 2016 -0800 - - Merge branch 'master' of github.com:hadjipantelis/tPACE - -commit 06d1361119138d67bfdc59aa16892f629e337891 -Author: Xiongtao Dai -Date: Wed Jan 20 13:28:27 2016 -0800 - - fix selectK: FVEthreshold=1 - -M R/selectK.R - -commit e7f39d829e0d56275e20ba5e54508e8f669a5f01 -Author: Pantelis -Date: Wed Jan 20 08:57:12 2016 -0800 - - Minor patch - -M R/SetOptions.R -M src/symbols.rds - -commit 45a326c218e2f409ec4ac616f89b851b6ceafcea -Author: hadjipantelis -Date: Tue Jan 19 16:11:06 2016 -0800 - - Minor fixes to Set/CheckOptions, fitted and createOutliersPlot - -M R/CheckOptions.R -M R/SetOptions.R -M R/createOutliersPlot.R -M R/fitted.FPCA.R -A src/symbols.rds - -commit 4cc35121f2b7b2ba5d8d6b3b6bd4b3c1408d588c -Author: hadjipantelis -Date: Sat Jan 16 14:08:06 2016 -0800 - - Fixed Assertion -DNDEBUG flag issue. - -M src/CPPlwls1d.cpp -M src/RCPPmean.cpp -M src/RCPPvar.cpp -M src/interp2lin.cpp -D src/symbols.rds -M src/trapzRcpp.cpp - -commit 22ab2d54fa5491016e65fbe782e8f15f484f96fb -Author: hadjipantelis -Date: Fri Jan 15 16:38:09 2016 -0800 - - minor - -M NAMESPACE -M R/fitted.FPCA.R - -commit 238e589f2632087dbfbc342eba25bdfc817311bc -Author: hadjipantelis -Date: Fri Jan 15 16:26:35 2016 -0800 - - DER changes to fitted.FPCA. - -M NAMESPACE -D R/FPCAder.R -M R/fitted.FPCA.R -D man/FPCAder.Rd -M man/fitted.FPCA.Rd - -commit ea25f247e3ca513cb93632748dfe3c1f21460295 -Author: hadjipantelis -Date: Fri Jan 15 11:06:26 2016 -0800 - - minor NAMESPACE changes - -M DESCRIPTION -M NAMESPACE -M man/createOutliersPlot.Rd -A src/symbols.rds - -commit 83e2d6d63c3bcf5e2d6af52222c18af6053e86a7 -Author: Xiongtao Dai -Date: Wed Jan 13 06:27:32 2016 +0000 - - add CreateBasis - -A R/CreateBasis.R - -commit 798f5985e31c0c1691c0f7bc8e52d9dbfbca1227 -Merge: 3b6b2d8 2dea9d8 -Author: Xiongtao Dai -Date: Wed Jan 13 05:39:29 2016 +0000 - - Merge branch 'master' of github.com:hadjipantelis/tPACE - -commit 3b6b2d8236d0f16a3b11d189792894d475ffd01e -Author: Xiongtao Dai -Date: Wed Jan 13 05:25:53 2016 +0000 - - fix sparsify - -M R/sparsify.R - -commit 2dea9d85643f0eeb5a9ae47a6443c658cc1f131a -Author: dmchris -Date: Mon Jan 11 18:50:10 2016 -0800 - - updates for subsetFPCA - - subsetting function also subsets the cumulative FVE and adjust the - corresponding FVE value for output. - -M R/subsetFPCA.R - -commit 386376dc37ef0d9de358a9b6f4b23b825ae60dc6 -Author: hadjipantelis -Date: Sat Jan 9 23:42:25 2016 -0800 - - createOutliers default opts changes - -M R/RcppExports.R -M R/createOutliersPlot.R -M src/RcppExports.cpp - -commit d1c23d752d37d4e7888dca4aaa21aded89e23269 -Author: Xiongtao Dai -Date: Thu Jan 7 16:14:25 2016 -0800 - - createPathPlot documentation - -M R/createPathPlot.R -M man/FPCA.Rd -M man/createPathPlot.Rd -M man/selectK.Rd -D src/symbols.rds -M tests/testthat/test_createPathPlot.R - -commit ce7f9dd6122d7e6e03f6ee39941e581651084de0 -Merge: 742bfa7 e0053f5 -Author: Xiongtao Dai -Date: Thu Jan 7 16:06:37 2016 -0800 - - Merge branch 'userSigma2' - -commit e0053f55c65120c1bc3d03c9830b7addbe4f5e44 -Author: Xiongtao Dai -Date: Thu Jan 7 16:06:11 2016 -0800 - - minor - -M R/FPCA.R - -commit 742bfa7a179270df217104253245b97018ed2661 -Merge: 15ffded cc212dd -Author: hadjipantelis -Date: Thu Jan 7 15:22:20 2016 -0800 - - Merge pull request #2 from hadjipantelis/userSigma2 - - User sigma2 - -commit 0a06865cdc07a5b2387891067648c59a376de6cf -Author: Xiongtao Dai -Date: Thu Jan 7 01:58:30 2016 -0800 - - improve sigma2 estimate with userCov specified - -M R/GetSmoothedCovarSurface.R -M R/pc_covE.R -M tests/testthat/test_FPCA.R - -commit cc212dd662dec89dbba37f3ada64cd5368baa1c8 -Merge: be9e052 15ffded -Author: Xiongtao Dai -Date: Wed Jan 6 15:42:07 2016 -0800 - - Merge branch 'master' into userSigma2 - -commit 15ffded5f6af79255fb09629246651f2a732d693 -Author: Xiongtao Dai -Date: Wed Jan 6 15:30:17 2016 -0800 - - sample path plot - -M NAMESPACE -A R/createPathPlot.R -A man/createPathPlot.Rd -A tests/testthat/test_createPathPlot.R - -commit 9c4199756b45cbe59c6ff41d95878962190a6d7c -Author: Xiongtao Dai -Date: Wed Jan 6 14:33:34 2016 -0800 - - fix buff - -M R/GetSmoothedCovarSurface.R -M R/GetSmoothedMeanCurve.R - -commit 90c573f2f249ce2bf32d6890daca5b9d2e373f93 -Merge: 1bc3ad7 0a70b0c -Author: Xiongtao Dai -Date: Wed Jan 6 14:34:34 2016 -0800 - - Merge branch 'master' of github.com:hadjipantelis/tPACE - -commit 0a70b0ca2915cfa7f54051b1b779ade6dde16c90 -Author: dmchris -Date: Tue Jan 5 00:48:09 2016 -0800 - - incorporating subsetFPCA function and simplify fixedK option - - Changes have been tested with updated test file. The ‘fixedK’ option is - removed, where selectionMethod can be positive integer to specify fixed - number of components. Subsetting function is added and executed after - selectK inside FPCA function now. - -M R/CheckOptions.R -M R/FPCA.R -M R/SetOptions.R -M R/selectK.R -A R/subsetFPCA.R -M tests/testthat/test_selectK.R - -commit be9e052b7006ef4802437e8d9a74b2c158bdab4c -Author: Xiongtao Dai -Date: Mon Jan 4 22:52:31 2016 -0800 - - rho=NA -> NULL - -M R/FPCA.R - -commit 7e08b79dc71429fc278c9f189cf65eff1cdf91f1 -Author: Xiongtao Dai -Date: Mon Jan 4 17:40:59 2016 -0800 - - user-specified sigma2 - -M R/CheckOptions.R -M R/FPCA.R -M R/GetSmoothedCovarSurface.R -M R/SetOptions.R -M R/pc_covE.R -M man/FPCA.Rd -M man/createOutliersPlot.Rd -M man/selectK.Rd -M tests/testthat/test_FPCA.R - -commit b2e75b00677a6f77f56fa1a576c56032485d388f -Author: Xiongtao Dai -Date: Mon Jan 4 15:55:32 2016 -0800 - - no user sigma2 -> sigma2=1e-6 - -M R/GetSmoothedCovarSurface.R - -commit 1bc3ad715c905e4b336be2080d81f29828fa0be0 -Merge: 26d8cf0 027d65f -Author: Xiongtao Dai -Date: Sun Jan 3 16:24:27 2016 -0800 - - Merge branch 'master' into improveEigen - -commit 027d65ff650ad39c930ecf54f667d8cfe05813ca -Author: Xiongtao Dai -Date: Sun Jan 3 16:23:36 2016 -0800 - - same fix for GetSmoothMean - -M R/GetSmoothedMeanCurve.R - -commit 26d8cf0e9abaad69c44b45ced737b21b1cd449b1 -Author: Xiongtao Dai -Date: Sun Jan 3 16:08:18 2016 -0800 - - improve readability of GetEigenAnalysis.R - -M R/GetEigenAnalysisResults.R -D R/no_FVE.R - -commit a44dcd203807f143b0cc450d8edfd3ee78927c56 -Author: Xiongtao Dai -Date: Sun Jan 3 15:02:44 2016 -0800 - - small bug fix - -M R/GetSmoothedCovarSurface.R - -commit 4e798bd5f18d1df6934590945ba88e4178074ee0 -Author: Xiongtao Dai -Date: Sun Jan 3 12:05:57 2016 -0800 - - fix corr does not work on constant mu - -M R/GetEigenAnalysisResults.R - -commit f52bb0a020a7c6030cc23c80ad0692797b5ac474 -Author: dmchris -Date: Sat Jan 2 03:18:05 2016 -0800 - - selectK related fixes - - Fixed all issues mentioned in the email by Pantelis on Dec 12. The - option selectK is removed to avoid misunderstanding, where the right - option is selectionMethod. The modified version passes previous tests - as well. - -M R/CheckOptions.R -M R/FPCA.R -M R/getLogLik.R -M R/selectK.R -M tests/testthat/test_selectK.R - -commit b228dfdafb8c358beea57ff5bf2534ce050a5458 -Author: Pantelis -Date: Fri Dec 11 23:15:10 2015 -0800 - - Upgrading createOutliers functionality. - -M R/createOutliersPlot.R - -commit a694e77c3511b8b08622144661c37550d135779d -Author: Pantelis -Date: Wed Dec 9 17:27:29 2015 -0800 - - Further doc changes. - -M DESCRIPTION -M man/FPCA.Rd -M man/createFuncBoxPlot.Rd -M man/createOutliersPlot.Rd - -commit e2671e1c447ecaf20d5e55315eefaf6d68704584 -Author: Pantelis -Date: Wed Dec 9 17:11:22 2015 -0800 - - Change to docs and default options. - -M R/FPCA.R -M R/createFuncBoxPlot.R -M R/createOutliersPlot.R - -commit 92066291ad7e18a06928e4dd7db0fa4db485c12a -Author: Xiongtao Dai -Date: Wed Dec 9 14:50:01 2015 -0800 - - minor - -M R/pc_covE.R - -commit 3497ef14fa84d031030fea381bbce3ab1889d9d0 -Author: Pantelis -Date: Wed Dec 9 02:45:19 2015 -0800 - - Minor update. - -M R/FPCA.R -M man/FPCA.Rd - -commit 4638233915c779ebe1b4f1dae48e2bf378b67e85 -Author: Pantelis -Date: Wed Dec 9 02:38:21 2015 -0800 - - Corrections to selectK docs - -M DESCRIPTION -M NAMESPACE -M R/selectK.R -M man/FPCA.Rd -M man/createDiagnosticsPlot.Rd -M man/createFuncBoxPlot.Rd -A man/selectK.Rd - -commit 01933956ee2f2cb143e74caf535ff229a4bcc7d9 -Merge: 28acc10 413fa78 -Author: Pantelis -Date: Wed Dec 9 02:16:17 2015 -0800 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit 28acc10563ad392e49458a8089ce23a18ee1e67c -Author: Pantelis -Date: Wed Dec 9 02:15:48 2015 -0800 - - Upgrading FuncBoxPlot - -M DESCRIPTION -M R/createDiagnosticsPlot.R -M R/createFuncBoxPlot.R - -commit 413fa7841a3e971b5664ce7f8e5ae5c8a53c1541 -Author: dmchris -Date: Wed Dec 9 00:08:28 2015 -0800 - - incorporating selectK - - selectK can be applied inside or outside FPCA function now. The test - cases include dense case performance, inside vs. outside with - equivalent options for both dense and sparse data. Documentations are - updated for FPCA and selectK functions. Related changes in - CheckOptions() and SetOptions(). - -M R/CheckOptions.R -M R/FPCA.R -M R/SetOptions.R -A R/getLogLik.R -A R/selectK.R -A tests/testthat/test_selectK.R - -commit 011bb60dbf22cae5e6024e4b70f013070b0d54f4 -Author: Pantelis -Date: Tue Dec 8 17:29:46 2015 -0800 - - Minor changes - -M DESCRIPTION -M R/FPCA.R -M R/createOutliersPlot.R - -commit 46701dbf2c9ad62fe3a4e548f2958f3ae07ed7d9 -Author: Pantelis -Date: Tue Dec 8 12:11:04 2015 -0800 - - Additional Outlier Functionality. - -M DESCRIPTION -M R/GetBinnedCurve.R -M R/createDesignPlot.R -M R/createOutliersPlot.R -M man/FCReg.Rd -M man/createDesignPlot.Rd -M man/createOutliersPlot.Rd - -commit 9db1f55f08971d42c9cf5ee0008d870537207316 -Author: Pantelis -Date: Fri Dec 4 23:10:43 2015 -0800 - - New outlier plots - -M R/createDiagnosticsPlot.R -M R/createOutliersPlot.R - -commit 221e6c69f3a0084d6fc2416df9c8e434359e346f -Author: Pantelis -Date: Wed Dec 2 12:04:42 2015 -0800 - - Minor update to createDesignPlot.R - -M R/createDesignPlot.R - -commit 08de59111d66ed5527df3aca30bf13a08eab096e -Author: Pantelis -Date: Wed Dec 2 02:45:45 2015 -0800 - - beta0 addition - -M R/FCReg.R - -commit 3dac1951413ed366b593da18691cc613b10d1660 -Author: Pantelis -Date: Tue Dec 1 12:11:55 2015 -0800 - - Minor check added. - -M R/createDesignPlot.R - -commit 7657822a2352c8efa5deb6a4154c8481f1b8d233 -Author: Pantelis -Date: Tue Dec 1 01:07:12 2015 -0800 - - CrCov/Regression functionality renaming - -M NAMESPACE -R081 R/FPCAregFuncExp.R R/FCReg.R -R097 R/CrCovYX.R R/getCrCovYX.R -R096 R/CrCovYZ.R R/getCrCovYZ.R -R070 man/FPCAregFuncExp.Rd man/FCReg.Rd -R090 man/CrCovYX.Rd man/getCrCovYX.Rd -R089 man/CrCovYZ.Rd man/getCrCovYZ.Rd -M src/symbols.rds -R086 tests/testthat/test_CrCovYX.R tests/testthat/test_getCrCovYX.R -R082 tests/testthat/test_CrCovYZ.R tests/testthat/test_getCrCovYZ.R - -commit c9bfee81781765340bf2ced580cdc7d0ef9946f0 -Author: Xiongtao Dai -Date: Mon Nov 30 21:21:11 2015 -0800 - - document() such that the package can be installed - -M NAMESPACE -M R/RcppExports.R -D man/FPCAregFunc.Rd -M man/print.FPCA.Rd -M src/RcppExports.cpp - -commit e5640229aae58167da53463f6e451d09004bfb85 -Author: Pantelis -Date: Mon Nov 30 19:13:12 2015 -0800 - - Various changes in renaming and cleaning up. - -M DESCRIPTION -M NAMESPACE -D R/FPCAregFunc.R -D R/FPCAregScalar.R -D R/FPCAregScalarExp.R -M R/GetBinnedCurve.R -M R/RcppExports.R -D R/createBetaPlots.R -D R/fitted.FRegObj.R -M R/lwls2dV2.R -M R/print.FPCA.R -M man/CheckData.Rd -M man/CheckOptions.Rd -M man/CrCovYX.Rd -M man/CrCovYZ.Rd -M man/FPCA.Rd -M man/FPCAder.Rd -M man/FPCAregFunc.Rd -M man/FPCAregFuncExp.Rd -D man/FPCAregScalar.Rd -D man/FPCAregScalarExp.Rd -M man/FVPA.Rd -M man/HandleNumericsAndNAN.Rd -M man/SetOptions.Rd -D man/createBetaPlots.Rd -M man/createCovPlot.Rd -M man/createDesignPlot.Rd -M man/createDiagnosticsPlot.Rd -M man/createFuncBoxPlot.Rd -M man/createModeOfVarPlot.Rd -M man/createOutliersPlot.Rd -M man/createScreePlot.Rd -M man/fitted.FPCA.Rd -D man/fitted.FregObj.Rd -M man/getCrCorYX.Rd -M man/getNormalisedSample.Rd -M man/lwls1d.Rd -M man/lwls2d.Rd -M man/makeFPCAinputs.Rd -M man/print.FPCA.Rd -M man/sparsify.Rd -M man/tPACE.Rd -M man/wiener.Rd -M src/RcppExports.cpp -A src/symbols.rds -D tests/testthat/test_FPCAregScalar.R -D tests/testthat/test_FPCAregScalarExp.R -M tests/testthat/test_lwls2dV2.R - -commit f42371fb41f0e622f21685e42b19c62bda58c09b -Author: Xiongtao Dai -Date: Mon Nov 30 17:01:15 2015 -0800 - - document() - -M NAMESPACE -D man/CrCovYXfast.Rd -M man/getNormalisedSample.Rd - -commit 3a7dbb912ca3014f04820ef7dbe1e9424ef91608 -Merge: 8fbdfc7 44d5342 -Author: Xiongtao Dai -Date: Mon Nov 30 16:56:43 2015 -0800 - - Merge branch 'master' of github.com:hadjipantelis/tPACE - - Conflicts: - NAMESPACE - man/CrCovYXfast.Rd - man/getNormalisedSample.Rd - -commit 8fbdfc719ec4f24a31a75701a2e5c901b03c4afd -Author: Xiongtao Dai -Date: Mon Nov 30 16:49:34 2015 -0800 - - changed names - -M NAMESPACE -M R/CrCovYX.R -M R/CrCovYZ.R -M R/FPCAder.R -M R/FPCAregFunc.R -M R/FPCAregScalar.R -M R/FPCAregScalarExp.R -M R/GetSmoothedCovarSurface.R -M R/GetSmoothedMeanCurve.R -M R/RcppExports.R -M R/Rlwls1d.R -M R/cvlwls1d.R -M R/gcvlwls1d1.R -M R/gcvlwls2dV2.R -M R/lwls2dV2.R -M R/makePACEinputs.R -M R/pc_covE.R -M man/CheckData.Rd -M man/CheckOptions.Rd -M man/CrCovYX.Rd -M man/CrCovYXfast.Rd -M man/CrCovYZ.Rd -M man/FPCA.Rd -M man/FPCAder.Rd -M man/FPCAregFunc.Rd -M man/FPCAregFuncExp.Rd -M man/FPCAregScalar.Rd -M man/FPCAregScalarExp.Rd -M man/FVPA.Rd -M man/GetNormalisedSample.Rd -M man/HandleNumericsAndNAN.Rd -M man/SetOptions.Rd -M man/createBetaPlots.Rd -M man/createCovPlot.Rd -M man/createDesignPlot.Rd -M man/createDiagnosticsPlot.Rd -M man/createFuncBoxPlot.Rd -M man/createModeOfVarPlot.Rd -M man/createOutliersPlot.Rd -M man/createScreePlot.Rd -M man/fitted.FPCA.Rd -M man/fitted.FregObj.Rd -M man/getCrCorYX.Rd -R084 man/Rlwls1d.Rd man/lwls1d.Rd -R089 man/lwls2dV2.Rd man/lwls2d.Rd -R077 man/makePACEinputs.Rd man/makeFPCAinputs.Rd -M man/print.FPCA.Rd -M man/sparsify.Rd -M man/tPACE.Rd -M man/wiener.Rd -M src/RcppExports.cpp -D src/symbols.rds -M tests/testthat/test_FPCAregScalar.R -M tests/testthat/test_FPCAregScalarExp.R -M tests/testthat/test_FVEdataset.R -M tests/testthat/test_funSim.R -M tests/testthat/test_lwls2dV2.R -R083 tests/testthat/test_makePACEinputs.R tests/testthat/test_makeFPCAinputs.R - -commit 44d5342d5d750dd12003d1c11a800d750e1f2a87 -Author: Pantelis -Date: Mon Nov 30 16:51:19 2015 -0800 - - Fixing NAMESPACE, etc. - -M NAMESPACE -D man/CrCovYXfast.Rd -R051 man/GetNormalisedSample.Rd man/getNormalisedSample.Rd - -commit 8883fd8322ee9c2b606e291e6f2b33ebd3eea9fc -Author: Pantelis -Date: Mon Nov 30 16:47:51 2015 -0800 - - Cleaning up unused functions. - -D R/CrCovYXfast.R -D R/MultipleCC.R - -commit f892c79061f5b382ebb010823ddddc5e59520780 -Merge: 4ec87d1 ab2a950 -Author: Pantelis -Date: Mon Nov 30 16:43:37 2015 -0800 - - 'getNormalised' renaming. - -commit 4ec87d138dacb5625b247cc2258b44620a650ae5 -Author: Pantelis -Date: Mon Nov 30 16:42:02 2015 -0800 - - 'getNormalised' renaming. - -M .gitignore -R084 R/GetNormalisedSample.R R/getNormalisedSample.R - -commit ab2a950956c140677867c06e0923cba01469ea19 -Author: Xiongtao Dai -Date: Sun Nov 29 13:16:58 2015 -0800 - - remove notes - -M .gitignore -D notesXiongtao.txt - -commit 2012d89e7ba55beb155ea98c631066e496f8365b -Author: Pantelis -Date: Sun Nov 29 01:47:40 2015 -0800 - - General tidy-up; comments, docs & examples. - -M DESCRIPTION -M R/CrCovYX.R -M R/CrCovYXfast.R -M R/CrCovYZ.R -M R/FPCA.R -M R/FPCAder.R -M R/GetNormalisedSample.R -M R/createCovPlot.R -M R/createDiagnosticsPlot.R -M R/createFuncBoxPlot.R -M R/createModeOfVarPlot.R -M R/createOutliersPlot.R -M R/createScreePlot.R -M R/fitted.FPCA.R -M R/fitted.FRegObj.R -M R/gcvlwls1d1.R -M R/getMinb.R -M R/makePACEinputs.R -M R/pc_covE.R -M R/rotateLwls2dV2.R -M R/wiener.R -M man/CrCovYX.Rd -M man/CrCovYXfast.Rd -M man/CrCovYZ.Rd -M man/FPCA.Rd -M man/FPCAder.Rd -M man/GetNormalisedSample.Rd -M man/createCovPlot.Rd -M man/createDiagnosticsPlot.Rd -M man/createFuncBoxPlot.Rd -M man/createModeOfVarPlot.Rd -M man/createOutliersPlot.Rd -M man/createScreePlot.Rd -M man/fitted.FPCA.Rd -M man/fitted.FregObj.Rd -M man/makePACEinputs.Rd -M man/wiener.Rd -A src/symbols.rds - -commit 502842ce5085ef87b08d3bd99579b0362eb3156e -Author: Xiongtao Dai -Date: Sat Nov 28 18:43:20 2015 -0800 - - BinRawBov Comments - -M R/BinRawCov.R - -commit 90f03938806f0ef0d6b8e5d82fe318a7b4ce6d91 -Author: Pantelis -Date: Sat Nov 28 16:48:04 2015 -0800 - - BinRawCov speed-up. - -M R/BinRawCov.R -M R/RcppExports.R -A src/RCPPmean.cpp -A src/RCPPvar.cpp -M src/RcppExports.cpp - -commit 73f1e646ffc7b8f092977d10bfba612ab01950bb -Author: Xiongtao Dai -Date: Sat Nov 28 02:31:24 2015 -0800 - - added test_useBin.R and generated documentations - -M NAMESPACE -M R/RcppExports.R -M man/FPCA.Rd -A man/GetNormalisedSample.Rd -M man/createCovPlot.Rd -M man/createOutliersPlot.Rd -A man/getCrCorYX.Rd -M src/RcppExports.cpp -M tests/testthat/test_useBin.R - -commit 7957881c3dfbfda7322c1f613e45cea53481daac -Author: Pantelis -Date: Fri Nov 27 23:47:50 2015 -0800 - - Cross-correlation from Cross-covariances - -M R/FPCA.R -M R/MakeResultFPCA.R -M R/SetOptions.R -A R/getCrCorYX.R -A tests/testthat/test_getCrCorYX.R - -commit 9a2bfb6c0ce3825115f0a730b1ea6cf80c2e9aa2 -Author: Pantelis -Date: Fri Nov 27 14:22:11 2015 -0800 - - Adding/adjusting some unit-tests. - -M tests/testthat/test_CrCovYX.R -M tests/testthat/test_FPCA.R - -commit d7c777dee61d2a6db5934c974bb43a797a686a01 -Merge: a2cba3a cdeeaa0 -Author: hadjipantelis -Date: Fri Nov 27 13:38:00 2015 -0800 - - Merge pull request #1 from hadjipantelis/fix2dRotation - - matrix transpositions in interp2lin and RmullwlskCC - -commit a2cba3ad08eecac565d7ffca2d286029bef38e9b -Author: Pantelis -Date: Fri Nov 27 13:36:35 2015 -0800 - - Normalising code. - -M R/CrCovYX.R -A R/GetNormalisedSample.R -M tests/testthat/test_CrCovYX.R - -commit b7331a09725c3f0605c6b4a3ae85967a0129db22 -Author: Pantelis -Date: Wed Nov 25 21:04:18 2015 -0800 - - Tidying up the plotting functions. - -M R/RcppExports.R -M R/createCovPlot.R -M R/createDesignPlot.R -M R/createDiagnosticsPlot.R -M R/createOutliersPlot.R -M src/RcppExports.cpp - -commit cdeeaa06828d0aa8e2822715ab8e88b5ece60a1d -Author: Xiongtao Dai -Date: Wed Nov 25 01:57:30 2015 -0800 - - matrix transpositions in interp2lin and RmullwlskCC - -M src/RmullwlskCC.cpp -M src/interp2lin.cpp -M tests/testthat/test_interp2lin.R -M tests/testthat/test_lwls2dV2.R - -commit 3eb0dfee2f61b60fb3ac27804ca31022ec55c824 -Author: Xiongtao Dai -Date: Tue Nov 24 13:36:29 2015 -0800 - - test_createDesignPlot and other documents - -M .gitignore -M R/createDesignPlot.R -A man/CrCovYXfast.Rd -A man/FPCAregFuncExp.Rd -A man/FPCAregScalarExp.Rd -A man/createBetaPlots.Rd -M man/createDesignPlot.Rd -A man/createModeOfVarPlot.Rd -A man/lwls2dV2.Rd -A tests/testthat/test_createDesignPlot.R - -commit 6658e0fab55873f2ebe00eceabd766684f115b56 -Author: Xiongtao Dai -Date: Tue Nov 24 13:30:36 2015 -0800 - - createDesignPlot improved; document lwls2dV2 - -M DESCRIPTION -M NAMESPACE -M R/RcppExports.R -M R/Rlwls1d.R -M R/createDesignPlot.R -M R/designPlotCount.R -M R/lwls2dV2.R -M man/CheckData.Rd -M man/CheckOptions.Rd -M man/CrCovYX.Rd -M man/CrCovYZ.Rd -M man/FPCA.Rd -M man/FPCAder.Rd -M man/FPCAregFunc.Rd -M man/FPCAregScalar.Rd -M man/FVPA.Rd -M man/HandleNumericsAndNAN.Rd -M man/Rlwls1d.Rd -M man/SetOptions.Rd -M man/createCovPlot.Rd -M man/createDesignPlot.Rd -M man/createDiagnosticsPlot.Rd -M man/createFuncBoxPlot.Rd -M man/createOutliersPlot.Rd -M man/createScreePlot.Rd -M man/fitted.FPCA.Rd -M man/fitted.FregObj.Rd -M man/makePACEinputs.Rd -M man/print.FPCA.Rd -M man/sparsify.Rd -M man/tPACE.Rd -M man/wiener.Rd -M src/RcppExports.cpp - -commit ec8b52aebd8cfa1fe0d490262fe251269c3096cf -Author: Pantelis -Date: Sun Nov 22 14:11:24 2015 -0800 - - Changes in the interface of plotting functions - -M R/createFuncBoxPlot.R -M R/createModeOfVarPlot.R -M R/createScreePlot.R - -commit 5af43ac06326b6dcf172acdf450c40b089c994a9 -Author: Pantelis -Date: Sat Nov 21 19:12:35 2015 -0800 - - Minor: the estim. phi's are positively correlated with mu - -M R/FPCA.R -M R/FPCAregFuncExp.R -M R/GetEigenAnalysisResults.R - -commit 3e33e21ea0ca93501535a3ffb5718a95bc0a5333 -Author: Pantelis -Date: Sat Nov 21 01:50:10 2015 -0800 - - Changes in default options in regression functions - -M R/FPCAregFuncExp.R -M R/createFuncBoxPlot.R -M R/createOutliersPlot.R - -commit c8a4a599872751205721b98a939f56837844c58b -Author: Pantelis -Date: Thu Nov 19 22:38:15 2015 -0800 - - Changes to plotting functions. - -M R/createDiagnosticsPlot.R -M R/createFuncBoxPlot.R -A R/createModeOfVarPlot.R -M R/createScreePlot.R - -commit 1265c470ef60cfbf1646b572ae9e1df54aade5c6 -Author: Pantelis -Date: Thu Nov 19 09:53:38 2015 -0800 - - minor change - -M R/CrCovYX.R - -commit c20dd387f8e9e02c16bf91b0dd2e586894341473 -Author: Pantelis -Date: Wed Nov 18 14:51:30 2015 -0800 - - Concurrent model bug fixes - -M R/CrCovYX.R -M R/FPCAregFuncExp.R - -commit 46618f1e504399d71688e156c718815ee148f2de -Author: Pantelis -Date: Tue Nov 17 21:08:57 2015 -0800 - - Concurrent model - -A R/FPCAregFuncExp.R -M R/FPCAregScalarExp.R -M tests/testthat/test_FPCAregScalarExp.R - -commit 597780c0f5df38c95340dff2c04cf3aa1907cdac -Author: Pantelis -Date: Tue Nov 17 16:53:23 2015 -0800 - - Work on the extension of the FLM - -M R/CrCovYX.R -A R/CrCovYXfast.R -A R/FPCAregScalarExp.R -A tests/testthat/test_FPCAregScalarExp.R - -commit 78dd85f066b73c6dfec8726ecef55e38ac388475 -Author: hadjipantelis -Date: Mon Nov 16 09:47:42 2015 -0800 - - Bug fix. - -M R/Rlwls1d.R - -commit deeb78b3c3c01fcb39df2fdb192744e9be5b5326 -Author: Xiongtao Dai -Date: Sun Nov 15 14:46:00 2015 -0800 - - fix parenthesis in Rlwls1d - -M R/Rlwls1d.R - -commit 04047d1fe303ccf356189bdfab2353267954682f -Author: hadjipantelis -Date: Sat Nov 14 14:28:20 2015 -0800 - - Check for NA/NaNs in input values. - -M R/Rlwls1d.R - -commit 2d2946a7f5477e2563c31552202e0f59c15ee7e5 -Author: hadjipantelis -Date: Sat Nov 14 13:56:52 2015 -0800 - - Symmetry checks. - -M R/no_FVE.R - -commit c0f88a762e780989263d33790053de7124623da1 -Author: Xiongtao Dai -Date: Thu Nov 12 22:18:16 2015 -0800 - - rm rARPACK dependency; use `eigen` rather than `eigs` - -M DESCRIPTION -M R/no_FVE.R -M R/pkgname.R - -commit b307f3d585365c626f0691f4bc8b2d2173da19c8 -Merge: d6696a3 49f44e0 -Author: Xiongtao Dai -Date: Thu Nov 12 11:08:04 2015 -0800 - - Merge branch 'master' of github.com:hadjipantelis/tPACE - -commit 49f44e0b282a9926e6193dae7d9dabb6124c48b4 -Author: hadjipantelis -Date: Thu Nov 12 10:29:23 2015 -0800 - - Bug fix. - -M R/GetRawCrCovFuncFunc.R - -commit 5199b50e81a8b162bd6ad4f5446bbb3035abdf58 -Author: Pantelis -Date: Tue Nov 10 13:20:20 2015 -0800 - - 'fast' Cross-Covariance smoothing added. - -M R/CrCovYX.R -M R/GetRawCrCovFuncFunc.R -M tests/testthat/test_CrCovYX.R - -commit fccfe62e0d37cdfb8c23408c49ac9b6319aae77f -Author: Pantelis -Date: Tue Nov 10 11:32:29 2015 -0800 - - Additional Cross-Cov Checks - -M tests/testthat/test_CrCovYX.R - -commit 6913c90c1e5970f49231eea7587ad120ffdb9219 -Author: Pantelis -Date: Tue Nov 10 09:48:47 2015 -0800 - - Typo correction - -M R/FPCAregScalar.R - -commit 8db5cb5900e7dfcc3629a7b788a4551b2cc99c6f -Author: Pantelis -Date: Tue Nov 10 03:18:45 2015 -0800 - - Unit tests for CrossCovYZ.R - -M R/FPCAregScalar.R -M R/RcppExports.R -M src/CPPlwls1d.cpp -M src/RcppExports.cpp -M tests/testthat/test_CrCovYZ.R - -commit d6696a3fa9f0da5d466b40fbb04c198981415d59 -Merge: 6500be8 581a943 -Author: Xiongtao Dai -Date: Sat Nov 7 13:01:04 2015 -0800 - - Merge branch 'sparsify' - -commit 6500be8a7737189c9402f38681ec70d146fb702d -Merge: 6762e7a a00e9f3 -Author: Pantelis -Date: Thu Nov 5 19:54:45 2015 -0800 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit 6762e7a0d976ad1de90b103de80d82e5309dbc94 -Author: Pantelis -Date: Thu Nov 5 19:54:20 2015 -0800 - - Bug fixes in createDesignPlot/TruncateObs/FPCAregScalar - -M R/CrCovYZ.R -M R/FPCAregScalar.R -M R/TruncateObs.R -M R/createDesignPlot.R -M tests/testthat/test_FPCAregScalar.R - -commit a00e9f380312117dd7758646f2d157d0da60dfc8 -Merge: 5afa6e4 2a6a776 -Author: Xiongtao Dai -Date: Wed Nov 4 10:23:36 2015 -0800 - - Merge branch 'improve2D' - -commit 581a943261a540eb90bb9cbec4e82c288a60174f -Author: Xiongtao Dai -Date: Wed Nov 4 10:10:40 2015 -0800 - - Eigenfunction maximal point before minimal point - -M R/GetEigenAnalysisResults.R - -commit 2a6a7766dcfa5961ecd041eeeb168d48c3bbc451 -Author: Xiongtao Dai -Date: Wed Nov 4 10:08:55 2015 -0800 - - rename old 2Dsmoother - -M src/Rmullwlsk_old.cpp - -commit 94d440119f194bc08237907c218237ee55d620f1 -Author: Xiongtao Dai -Date: Wed Nov 4 10:07:59 2015 -0800 - - 2Dsmoother speed improvement by removing `intersect` - -M src/Rmullwlsk.cpp -A src/Rmullwlsk_old.cpp -M tests/testthat/test_Rmullwlsk.R - -commit 5afa6e44bbbb64b657197147768254ab722623a5 -Author: Pantelis -Date: Wed Nov 4 00:27:11 2015 -0800 - - Minor changes in plotting and regression functions - -M R/FPCAregScalar.R -M R/createBetaPlots.R -M R/createFuncBoxPlot.R -M R/createOutliersPlot.R - -commit f02ba8690a73382dcb1109524c508e37b931c776 -Author: hadjipantelis -Date: Mon Nov 2 21:53:03 2015 -0800 - - Missing an apostrophe! - -M R/FPCA.R - -commit 64d67ddb996a2833676c52cbaf1fe30429d4e0ed -Author: Xiongtao Dai -Date: Mon Nov 2 14:26:00 2015 -0800 - - Added an option allowing sparsifying into fragments - -M R/sparsify.R -M tests/testthat/test_wiener.R - -commit 99b1e706fa09a227d030059d9e068aa68577bba5 -Author: Pantelis -Date: Sat Oct 31 02:04:35 2015 -0700 - - Basic fix in createDesignPlot axis issue - -M R/createDesignPlot.R - -commit 43cbb1528a0257812e995752e7aa03d992889ff3 -Author: Pantelis -Date: Fri Oct 30 20:34:53 2015 -0700 - - FVPA implementation - -D Rplots.pdf -D Rplots1.pdf - -commit d63ca26e264198f47fe066c74d50a2a03bf6aa9d -Author: Pantelis -Date: Fri Oct 30 20:34:12 2015 -0700 - - FVPA implementation - -M NAMESPACE -A R/FVPA.R -A Rplots.pdf -A Rplots1.pdf -A man/FVPA.Rd -M man/createCovPlot.Rd -M man/makePACEinputs.Rd -M man/print.FPCA.Rd - -commit 1e2c89f521ec65392bb428ad8d3940bbdf94b6b1 -Merge: e7410f4 7924b19 -Author: Xiongtao Dai -Date: Thu Oct 29 09:06:07 2015 -0700 - - Merge branch 'fix' - -commit 7924b194760f401a50a2b29c2a67d95b0406c373 -Author: Xiongtao Dai -Date: Thu Oct 29 09:04:02 2015 -0700 - - Fix and added test for `GetBinnedDataset`, fix `BinRawCov`. - `makePACEinputs` added feature. - -M R/BinRawCov.R -M R/GetBinnedDataset.R -M R/makePACEinputs.R -M tests/testthat/test_GetBinnedDataset.R - -commit e7410f4758c646bc3d17dd09393039e1422b8449 -Merge: f723990 310c8a5 -Author: Pantelis -Date: Tue Oct 27 23:51:05 2015 -0700 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit f7239906c06cadbd092efe39680b6acf89b3bb0d -Author: Pantelis -Date: Tue Oct 27 23:50:25 2015 -0700 - - Removing plots added by accident. - -D Rplots.pdf -D Rplots1.pdf -M tests/testthat/test_lwls2dV2.R - -commit 310c8a5d4e38081626d629f502e6f1a153d8de01 -Author: hadjipantelis -Date: Tue Oct 27 15:26:00 2015 -0700 - - Update createDiagnosticsPlot.R - -M R/createDiagnosticsPlot.R - -commit 4de3489b28ce2c97e9a4bddf4056323e2f8c55d1 -Author: Pantelis -Date: Tue Oct 27 11:34:54 2015 -0700 - - Calibrating createDesignPlot. - -M R/createDesignPlot.R -A Rplots.pdf -A Rplots1.pdf - -commit 9420899e6f7973099e27c2e6aecc555ad7ccc8f9 -Author: Pantelis -Date: Tue Oct 27 10:40:09 2015 -0700 - - Sorting out createCovPlot. - -M R/createCovPlot.R - -commit 5f1893d4f9a01c2322b45c41ad7eac165cecc6f1 -Author: Pantelis -Date: Tue Oct 27 00:55:39 2015 -0700 - - Rewriting createDesignPlot - -M NAMESPACE -M R/createDesignPlot.R -M man/print.FPCA.Rd - -commit b487b87ef8066b29cb288d21447ec388991cbd5d -Author: Pantelis -Date: Mon Oct 26 22:33:35 2015 -0700 - - Tidying up some plotting functions - -M NAMESPACE -M R/createDiagnosticsPlot.R -M R/createFuncBoxPlot.R -M R/createOutliersPlot.R -M R/createScreePlot.R -M man/createDiagnosticsPlot.Rd -A man/createFuncBoxPlot.Rd -A man/createOutliersPlot.Rd -M man/createScreePlot.Rd -M man/fitted.FPCA.Rd - -commit 6c7eef58748f12188a2c7976654d23b799bca7d3 -Author: Pantelis -Date: Mon Oct 26 15:22:23 2015 -0700 - - Minor change to smoother and addition of 'k' option to 'fitted.FPCA()' - -M R/fitted.FPCA.R -M src/Rmullwlsk.cpp - -commit 1b0ecf4014068b8c618d9636d88f8ed580e8a767 -Merge: b1dcdec 265f6a1 -Author: CrossD -Date: Sat Oct 24 16:37:57 2015 -0700 - - Merge branch 'demo' - -commit 265f6a16b941f0386a3b3ee49ae7cecac5a21bba -Author: Xiongtao Dai -Date: Fri Oct 23 15:11:06 2015 -0700 - - remove tPACE:: - -M R/CrCovYX.R -M R/CrCovYZ.R - -commit b1dcdec016d41b1a8db2c0d1b19f4a9680a0a1d8 -Author: hadjipantelis -Date: Thu Oct 22 02:07:56 2015 -0700 - - Update README.org - -M README.org - -commit 909a46ddc34565266aa93bbab4552e540784ab99 -Author: Xiongtao Dai -Date: Wed Oct 21 23:50:31 2015 -0700 - - minor test case fix - -M tests/testthat/test_GetRho.R - -commit 6d2afd19d29f367778f6918d96dc7593cf7226be -Author: Pantelis -Date: Wed Oct 21 19:08:34 2015 -0700 - - Minor - -M tests/testthat/test_CheckData.R -M tests/testthat/test_FitEigenValues.R -M tests/testthat/test_GetEigenAnalysisResults.R -D tests/testthat/test_lwls1.csv - -commit f0189ca2f5c3b7f2dcdacab58475520921ff7cf7 -Merge: 2e242de 76dec87 -Author: Xiongtao Dai -Date: Wed Oct 21 16:40:06 2015 -0700 - - Merge branch 'master' of github.com:hadjipantelis/tPACE - -commit 2e242de95f8d1f643402c748e85f0ac9b003deca -Author: Xiongtao Dai -Date: Wed Oct 21 16:39:40 2015 -0700 - - bug in GetSmoothedCovarSurface.R fixed - -M R/GetSmoothedCovarSurface.R -M tests/testthat/test_GetCEScores.R -M tests/testthat/test_GetSmoothedCovarSurface.R - -commit 76dec87b598b491d7beb0cbba605139813227ebb -Author: Pantelis -Date: Wed Oct 21 16:09:34 2015 -0700 - - Minor changes to tests. - -M tests/testthat/test_GetEigenAnalysisResults.R -M tests/testthat/test_GetSmoothedCovarSurface.R -M tests/testthat/test_interp2lin.R -M tests/testthat/test_no_FVE.R -M tests/testthat/test_pc_covE.R - -commit 282d054501e0f749d43b2801709e92afdfb723aa -Author: Pantelis -Date: Wed Oct 21 12:19:28 2015 -0700 - - Clean-up and scaffolding for parallel' - -M .gitignore -M R/RcppExports.R -M R/lwls2dV2.R -M src/RcppExports.cpp -M src/Rmullwlsk.cpp -M tests/testthat/test_GetRawCrCovFuncFunc.R -M tests/testthat/test_GetRawCrCovFuncScal.R -M tests/testthat/test_gcvlwls2dV2.R -M tests/testthat/test_lwls2dV2.R - -commit e510c467c5a55c8732ead061764d9dadd3809f73 -Author: Xiongtao Dai -Date: Sun Oct 18 13:02:28 2015 -0700 - - update help - -M man/FPCA.Rd - -commit 1eafb9b1e85e552b2a263ea6f3e2d100e48f5ccb -Author: Xiongtao Dai -Date: Sun Oct 18 13:01:14 2015 -0700 - - option fixes for useBinnedCov kCV numCVcurves - minor fix for lwls2dV2 - -M R/CheckOptions.R -M R/GetSmoothedCovarSurface.R -M R/SetOptions.R -M R/gcvlwls2dV2.R -M R/lwls2dV2.R -M tests/testthat/test_gcvlwls2dV2.R - -commit 42fdf45f988672b6a92643ab6b378202b1187548 -Author: Xiongtao Dai -Date: Sun Oct 18 12:11:13 2015 -0700 - - fix options - -M R/CheckOptions.R -M R/FPCA.R -M R/GetSmoothedCovarSurface.R -M R/SetOptions.R -D src/symbols.rds - -commit 97b4926a905a54d12bf7a860587a7d509ebe502d -Merge: 62fd5f8 551955a -Author: Xiongtao Dai -Date: Sun Oct 18 10:52:24 2015 -0700 - - Merge branch 'master' of github.com:hadjipantelis/tPACE - -commit 551955a15ab5f7ff78f0e1f2f7216873f90faa13 -Author: Pantelis -Date: Fri Oct 16 17:03:33 2015 -0700 - - commented out some numComp functionality. - -M R/MakeResultFPCA.R - -commit 14eb79384976caf96bc6c2ceb233297998654005 -Author: Pantelis -Date: Fri Oct 16 16:50:48 2015 -0700 - - New doc - -M man/FPCA.Rd -A man/HandleNumericsAndNAN.Rd - -commit ee015a9aa9d2f6aceb59ef604fd3c0fa0f9e76ee -Author: Pantelis -Date: Fri Oct 16 16:48:28 2015 -0700 - - Changes to options and docs - -M R/CheckOptions.R -M R/FPCA.R -M R/GetEigenAnalysisResults.R -M R/MakeResultFPCA.R -M R/SetOptions.R -M tests/testthat/test_SetOptions.R - -commit 66cbe64261bc5e24829ec48bfa07ebc436b0c156 -Author: Pantelis -Date: Fri Oct 16 16:18:53 2015 -0700 - - minor FVE fix - -M R/GetEigenAnalysisResults.R - -commit 62fd5f8954683803eefe3959f8f39e27e05865a0 -Merge: 7d3ae10 5169ec5 -Author: CrossD -Date: Fri Oct 16 09:28:57 2015 -0700 - - Merge branch 'master' of github.com:hadjipantelis/tPACE - -commit 5169ec5d3a9548a36b60c4971f289418442f9899 -Author: Pantelis -Date: Thu Oct 15 19:20:51 2015 -0700 - - Unit test for GetBinnedDataset() - -A tests/testthat/test_GetBinnedDataset.R - -commit 7ffdfc09b263104eb41f673be948bcb3fd63ac40 -Author: Pantelis -Date: Thu Oct 15 18:51:02 2015 -0700 - - Bugs fixes for GetBinnedDataset. - -M R/GetBinnedDataset.R -M tests/testthat/test_GetBinnedCurve.R - -commit 82ef97ad2165037332ada8ae831ede21033423a3 -Author: Pantelis -Date: Thu Oct 15 17:31:02 2015 -0700 - - Adding unit-test for k=1 case. - -M tests/testthat/test_FPCA.R - -commit e45dcf3776bb25fb9a7087a4f9ba690be664ba19 -Author: Pantelis -Date: Thu Oct 15 17:11:22 2015 -0700 - - Bug fix for the case of k=1 - -M R/GetEigenAnalysisResults.R - -commit 7d3ae108513fdad15a92133ffa9e50c5ba62c5f0 -Merge: 806c5e2 4fa95e9 -Author: CrossD -Date: Wed Oct 14 23:10:54 2015 -0700 - - merge - -commit 806c5e2b122fa9facf53efdf64f13c75e640f2e0 -Author: CrossD -Date: Wed Oct 14 23:07:52 2015 -0700 - - minor - -M R/GetSmoothedCovarSurface.R -M R/RcppExports.R -M R/lwls2dV2.R -M src/RcppExports.cpp -D src/Rlwls1d.cpp_back - -commit 4fa95e97fbf58440bbb31a5ca7666ca6f71be4f5 -Author: dmchris -Date: Wed Oct 14 22:38:20 2015 -0700 - - FVE bug fix. - - changes in no_FVE, GetEigenAnalysisResults and MakeResultFPCA. Moved - thresholding from no_FVE to GetEigenAnalysisResults after checking maxk. - Added new output cumFVE. FPCA Roxygen doc needs to change - correspondingly. - -M R/FPCA.R -M R/GetEigenAnalysisResults.R -M R/MakeResultFPCA.R -M R/no_FVE.R - -commit 79a557cd3bbe5b75e8586aef51da7246208e5807 -Author: dmchris -Date: Wed Oct 14 16:19:23 2015 -0700 - - Update GetEigenAnalysisResults.R - -M R/GetEigenAnalysisResults.R - -commit 67126f4745eb17882522ce3febc372ab119d3f97 -Author: dmchris -Date: Wed Oct 14 16:05:49 2015 -0700 - - Update no_FVE.R - -M R/no_FVE.R - -commit 56a715eb4aa34802a8abc463f1cf5de0a57f2896 -Author: hadjipantelis -Date: Wed Oct 14 15:57:54 2015 -0700 - - update in default values of no_FVE - -M R/no_FVE.R - -commit c38255ac72c98cc8935ca380480b9c398d746ee4 -Author: Pantelis -Date: Tue Oct 13 19:51:20 2015 -0700 - - Patch for userCov + unit tests. - -M R/CheckOptions.R -M R/CrCovYX.R -M R/CrCovYZ.R -M R/FPCA.R -M R/GetRawCrCovFuncScal.R -M R/GetSmoothedCovarSurface.R -M R/GetSmoothedMeanCurve.R -M tests/testthat/test_FPCA.R - -commit a43de3d6e8493f47f77e45ca72f4df8b5a492390 -Author: Pantelis -Date: Mon Oct 12 13:11:55 2015 -0700 - - Dense userMu patch. - -M R/FPCA.R -M R/GetCovDense.R -M R/GetMeanDense.R - -commit ebbace073b04e03cfa04c23b1a9e489cf514cadf -Author: Pantelis -Date: Mon Oct 12 12:04:40 2015 -0700 - - Tidying up user-defined mu - -M R/CheckOptions.R -M R/FPCA.R -M R/GetSmoothedMeanCurve.R - -commit 5a26a93e1e52350c31291801847ef38e18d3adf0 -Author: hadjipantelis -Date: Sat Oct 10 15:54:37 2015 -0700 - - Updated HandleNumericsAndNAN to check for repeated measurements. - -M R/HandleNumericsAndNAN.R - -commit 8222ec59d7ab8e4b4a2da696c4fe60cc36754284 -Author: Pantelis -Date: Sat Oct 10 15:36:37 2015 -0700 - - Adding handlers for NA inputs. - -M R/CheckData.R -M R/FPCA.R -A R/HandleNumericsAndNAN.R -M tests/testthat/test_FPCA.R - -commit 83505dc6d581d3a6fda7e0ebc96e5cdf83abe14d -Author: Pantelis -Date: Thu Oct 8 12:04:16 2015 -0700 - - Forcing 'signif(x,14)' to the whole function; correcting minor typos - -M R/BinRawCov.R -M R/FPCA.R -M R/GetCEScores.R -M src/interp2lin.cpp - -commit c223ef351124da068752e42b0149ea4dcd17be4a -Author: Pantelis -Date: Tue Oct 6 23:48:51 2015 -0700 - - Documentation fixes to fitted.FPCA and SetOptions - -M NAMESPACE -M R/SetOptions.R -M R/fitted.FPCA.R -A man/Rlwls1d.Rd -M man/SetOptions.Rd -M man/fitted.FPCA.Rd -A man/fitted.FregObj.Rd -A src/symbols.rds -M tests/testthat/test_gcvlwls2dV2.R - -commit d2e6d9a15f3de8881714c3d04587722c7f59d2c5 -Author: Pantelis -Date: Mon Oct 5 19:44:29 2015 -0700 - - Minor, verbose correction - -M R/RcppExports.R -M R/SetOptions.R -M R/gcvlwls2dV2.R -M src/RcppExports.cpp - -commit 2f61a79c1fa59de16e43288bec512ac073b7edd2 -Author: Xiongtao Dai -Date: Mon Oct 5 17:42:25 2015 -0700 - - minor - -M R/RcppExports.R -M R/Rlwls1d.R -M src/RcppExports.cpp -D src/Rlwls1d.cpp - -commit 2b84179e2f140bacea8367b93154694d1c403bc7 -Author: Pantelis -Date: Mon Oct 5 17:25:10 2015 -0700 - - Making CPPlwls1d.cpp and related wrapper - -M R/RcppExports.R -A R/Rlwls1d.R -A src/CPPlwls1d.cpp -M src/RcppExports.cpp -A src/Rlwls1d.cpp_back - -commit 87114b85205fbcc3373d4c74abc7b8c05e935050 -Merge: 703631a 8b653ae -Author: Pantelis -Date: Mon Oct 5 17:02:17 2015 -0700 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit 703631a0840f710d929e3df8cdafd5f2aa3355c4 -Author: Pantelis -Date: Mon Oct 5 16:59:19 2015 -0700 - - minor FPCAregScalar change - -M R/FPCAregScalar.R - -commit 8b653ae120fd78ff7ccc8c51cf0b9f805bc12371 -Author: Xiongtao Dai -Date: Mon Oct 5 15:24:18 2015 -0700 - - 2d smoother works for integer valued numbers - -M R/lwls2dV2.R - -commit 651080f655b7548d24c5f38eeb67977fe9510ff1 -Merge: a111a11 5f81784 -Author: Pantelis -Date: Mon Oct 5 13:44:43 2015 -0700 - - Merge branch 'ColoradoWork' of https://github.com/hadjipantelis/tPACE into ColoradoWork - -commit a111a11e51d34fcf8ec5baa3b3848feab23f6301 -Author: Pantelis -Date: Mon Oct 5 11:47:12 2015 -0700 - - Updating CrCovY*.R documentation - -M NAMESPACE -M R/CrCovYX.R -M R/CrCovYZ.R -M R/RcppExports.R -M man/CheckData.Rd -M man/CheckOptions.Rd -A man/CrCovYX.Rd -A man/CrCovYZ.Rd -M man/FPCA.Rd -M man/FPCAder.Rd -A man/FPCAregFunc.Rd -M man/FPCAregScalar.Rd -M man/SetOptions.Rd -M man/createCovPlot.Rd -M man/createDesignPlot.Rd -M man/createDiagnosticsPlot.Rd -M man/createScreePlot.Rd -M man/fitted.FPCA.Rd -M man/makePACEinputs.Rd -M man/print.FPCA.Rd -M man/sparsify.Rd -M man/tPACE.Rd -M man/wiener.Rd -M src/RcppExports.cpp - -commit e957e06dbdb9b8596ced456c7597130bd79cf87d -Merge: 5c59398 4e890af -Author: Pantelis -Date: Mon Oct 5 09:36:41 2015 -0700 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE into ColoradoWork - -commit 4e890afc369b2a3a217cd97f5b06ec90edd94973 -Author: CrossD -Date: Fri Oct 2 00:00:29 2015 -0700 - - devtools::document() - -M NAMESPACE -M R/RcppExports.R -M man/CheckData.Rd -M man/CheckOptions.Rd -M man/FPCA.Rd -M man/FPCAder.Rd -M man/FPCAregScalar.Rd -M man/SetOptions.Rd -M man/createCovPlot.Rd -M man/createDesignPlot.Rd -M man/createDiagnosticsPlot.Rd -M man/createScreePlot.Rd -M man/fitted.FPCA.Rd -M man/makePACEinputs.Rd -M man/print.FPCA.Rd -M man/sparsify.Rd -M man/tPACE.Rd -M man/wiener.Rd -M src/RcppExports.cpp -D src/symbols.rds - -commit 1759d756ffc95489ce10eb5835331f1fef9e0ab9 -Merge: 11d555b 34aa48d -Author: CrossD -Date: Thu Oct 1 23:03:37 2015 -0700 - - Merge branch 'master' of github.com:hadjipantelis/tPACE - -commit 11d555bfa461114708246498b2f1d345c2a70a4c -Author: CrossD -Date: Thu Oct 1 23:03:24 2015 -0700 - - minor - -M R/FPCA.R - -commit 34aa48d87053052cf46ec3a6fde531c505b77d99 -Author: Pantelis -Date: Thu Oct 1 17:21:55 2015 -0700 - - Minor. - -M R/FPCAregScalar.R -M src/Rlwls1d.cpp - -commit 5f81784131fb4b2c9d5639ae65505951c01ccb4e -Author: hadjipantelis -Date: Sat Sep 19 02:55:12 2015 -0700 - - MultipleCC.R - -A R/MultipleCC.R -A R/fitted.FRegObj.R - -commit 5c59398125d78eeb8e94f00bf6afea5a23eaa5f0 -Author: Pantelis -Date: Fri Sep 18 02:06:28 2015 -0700 - - Commenting out possible issues in FPCAreg* - -M R/FPCAregFunc.R - -commit 41cee0fe0cfe04768a65b1f9f17778fa927b0d98 -Author: hadjipantelis -Date: Wed Sep 9 04:15:44 2015 -0700 - - Verbose option for bandwith selection during GCV. - -M R/FPCAregFunc.R - -commit 5ce11cff23537ac666666f7c5c5dcfe8535ced62 -Author: Pantelis -Date: Tue Sep 8 09:05:02 2015 -0700 - - Adding GINV functionality in FPCAregFunc. - -M R/FPCAregFunc.R - -commit e40642a09b41cbe7d87a124eb561235ae3ca5251 -Author: Pantelis -Date: Mon Sep 7 22:09:52 2015 -0700 - - Smoothing options for FPCAregFunc.R - -M R/FPCAregFunc.R - -commit 8f876c56cf422e4580a30b1367ce932d3c44cbb3 -Author: Pantelis -Date: Mon Sep 7 01:31:29 2015 -0700 - - Minor - -M R/FPCAregFunc.R - -commit 20cf7d73506e57dedd569ccf65deba377adcf4af -Merge: 73cb05c 5ef9964 -Author: Pantelis -Date: Sat Sep 5 22:19:59 2015 -0700 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit 73cb05cf4ee28e4928ede54eddeb6e84685e09f8 -Author: Pantelis -Date: Sat Sep 5 22:19:25 2015 -0700 - - Unscaling the Zetas - -M R/FPCAregFunc.R - -commit 5ef9964302e637d3f75c1de48de0d16b2532548f -Author: hadjipantelis -Date: Sat Sep 5 20:55:55 2015 -0700 - - Bug fix in FPCAregFunc - -M R/FPCAregFunc.R - -commit 0c950a6a7b06e53773dda0261afee3b0cc41c096 -Author: Pantelis -Date: Sat Sep 5 17:07:33 2015 -0700 - - FPCAregFunc ironing out. - -M R/FPCAregFunc.R - -commit d7e621bc53bb93a49d5df5026d78f36ef3d69a22 -Author: Pantelis -Date: Sat Sep 5 02:06:01 2015 -0700 - - Time-varying functional regression model work - -M R/CrCovYX.R -M R/FPCA.R -A R/FPCAregFunc.R -M R/FPCAregScalar.R - -commit c069ede6b74c0fe94460bd450ed9d4f715ea9a3a -Author: Pantelis -Date: Fri Sep 4 17:17:31 2015 -0700 - - Minor changes to make input arguments of plotting functions. - -M R/createDiagnosticsPlot.R -M R/createFuncBoxPlot.R - -commit 95b119164388d268bf983abf3730d3edced74f90 -Author: Pantelis -Date: Fri Sep 4 17:09:02 2015 -0700 - - Minor bug fix in a unit test and in the output structure of FPCA. - -M R/FPCA.R -M R/MakeResultFPCA.R -M tests/testthat/test_FPCAregScalar.R - -commit 212786a3fee058385349580dbc283956e1c4a6d2 -Author: hadjipantelis -Date: Fri Sep 4 05:53:18 2015 -0700 - - Test for functional cross-cov. - -A tests/testthat/test_CrCovYX.R - -commit 6839ab592c49512c9cb3e28e29540eb982341632 -Author: hadjipantelis -Date: Fri Sep 4 02:01:11 2015 -0700 - - Unit tests for cross-cov between scalar and function - -A tests/testthat/test_CrCovYZ.R -M tests/testthat/test_FPCA.R - -commit 331d3e1a954e22e67c67a0e1671408796634fd07 -Author: Pantelis -Date: Wed Sep 2 19:12:18 2015 -0700 - - Minor change on default useBins arguments - -M R/SetOptions.R - -commit fcd000019b969487aa72da7c6f44746c2d823a63 -Author: Pantelis -Date: Tue Sep 1 01:15:48 2015 -0700 - - Minor changes to scalar-functional cross-cov estimation. - -M R/CrCovYZ.R - -commit aa6bfc3b477c96f902e5c177d0db1f21d51262d6 -Author: Pantelis -Date: Mon Aug 31 06:03:18 2015 -0700 - - CrossCovariance F2F and minor stuff - -A R/CrCovYX.R -M R/RcppExports.R -M R/createBetaPlots.R -M R/lwls2dV2.R -M src/RcppExports.cpp -M src/Rmullwlsk.cpp -A src/RmullwlskCC.cpp -M tests/testthat/test_lwls2dV2.R - -commit 15358a72dfdf51e21617dffaabe910ac07f2e4be -Author: Pantelis -Date: Sun Aug 30 00:33:47 2015 -0700 - - Adding bagplot functionality - -M DESCRIPTION -M R/createFuncBoxPlot.R -M R/createOutliersPlot.R - -commit 3c7238e3dd773004260a0c72457d38d6e874038d -Author: Pantelis -Date: Sat Aug 29 14:17:16 2015 -0700 - - Added functional box-plot - -M R/FPCAregScalar.R -A R/createFuncBoxPlot.R - -commit 3b3c910b50d78a6f647f78bcea9e35275f6db844 -Author: Pantelis -Date: Fri Aug 28 19:05:41 2015 -0700 - - Plotting utility for functional betas. - -A R/createBetaPlots.R - -commit de2349586bb6420510865dcbe3dd8fb3ebdb2d1d -Author: hadjipantelis -Date: Fri Aug 28 13:32:51 2015 -0700 - - minor; removed caret dep. from DESCRIPTION - -M DESCRIPTION -M NAMESPACE -M R/pkgname.R -M man/CheckData.Rd -M man/CheckOptions.Rd -M man/FPCA.Rd -M man/FPCAder.Rd -M man/FPCAregScalar.Rd -M man/SetOptions.Rd -M man/createCovPlot.Rd -M man/createDesignPlot.Rd -M man/createDiagnosticsPlot.Rd -M man/createScreePlot.Rd -M man/fitted.FPCA.Rd -M man/makePACEinputs.Rd -M man/print.FPCA.Rd -M man/sparsify.Rd -M man/tPACE.Rd -M man/wiener.Rd - -commit 6bf56ad2aacab0e42a3e84a65de2fdbe89d28dbc -Author: hadjipantelis -Date: Fri Aug 28 04:55:12 2015 -0700 - - Added createOutliersPlot.R - -A R/createOutliersPlot.R - -commit a39694f4fc306244c70b9d862a1f888a56475c06 -Author: hadjipantelis -Date: Thu Aug 27 20:10:38 2015 -0700 - - Multiple functional predictors (dense) - -M R/FPCAregScalar.R -M R/makePACEinputs.R -M tests/testthat/test_FPCAregScalar.R - -commit 533bf75edbe18155111049127f93bdbafcb5dcca -Author: Pantelis -Date: Thu Aug 27 01:09:48 2015 -0700 - - Further works on Functional Regression. - -A R/CrCovYZ.R -M R/FPCAregScalar.R -A R/GetRawCrCovFuncFunc.R -A R/GetRawCrCovFuncScal.R -A tests/testthat/test_FPCAregScalar.R -A tests/testthat/test_GetRawCrCovFuncFunc.R -A tests/testthat/test_GetRawCrCovFuncScal.R - -commit 2132bd706b3678a1bc2247086b11bb54004376f1 -Author: Pantelis Hadjipantelis -Date: Tue Aug 25 23:16:41 2015 -0700 - - Added full PACE-QUO functionality. - -M DESCRIPTION -M R/FPCAder.R - -commit 6f5230db0764b8b094284ae75ba383256050d7a4 -Author: hadjipantelis -Date: Mon Aug 24 22:14:32 2015 -0700 - - Setting 'useBins' as default. - -M R/SetOptions.R - -commit b5a86181f1d91643db68b37aec822b70fd64232c -Author: dmchris -Date: Mon Aug 24 21:56:19 2015 -0700 - - add unit test for FPCAder - -A tests/testthat/test_FPCAder.R - -commit f44dc8dc6d0b1cbcaafe3cdbaee11fe0e4d049ea -Author: Xiongtao Dai -Date: Tue Aug 25 00:46:42 2015 +0800 - - sparsify and wiener documentation; CreateFolds added; .Rd updated - -M NAMESPACE -A R/CreateFolds.R -M R/sparsify.R -M R/wiener.R -M man/CheckData.Rd -M man/CheckOptions.Rd -D man/CreateOptions.Rd -M man/FPCAder.Rd -A man/FPCAregScalar.Rd -A man/createCovPlot.Rd -A man/createDesignPlot.Rd -A man/createScreePlot.Rd -A man/fitted.FPCA.Rd -M man/print.FPCA.Rd -A man/sparsify.Rd -A man/wiener.Rd - -commit 4dc07738ce6b05d49cca357ef718eb17f8093c8a -Author: Xiongtao Dai -Date: Mon Aug 24 12:56:57 2015 +0800 - - new createFolds - -M .gitignore -M R/gcvlwls2dV2.R -A tests/testthat/test_CreateFolds.R - -commit 14d5a5ca68112bddea4065a17826800286968ced -Merge: 0f9a95c 0feb763 -Author: Xiongtao Dai -Date: Mon Aug 24 01:39:10 2015 +0800 - - Merge branch 'master' of github.com:hadjipantelis/tPACE - -commit 0f9a95c0494ecc4e16ca79b49a3ede7743e1f6da -Author: Xiongtao Dai -Date: Mon Aug 24 01:38:59 2015 +0800 - - minor - -M R/gcvlwls2dV2.R - -commit 0feb763eb6e122ab355e5f307cc0e4a30fece340 -Author: Pantelis -Date: Fri Aug 21 16:05:22 2015 -0700 - - Minor addition to Roxygen descriptions. - -M R/CheckOptions.R -M R/FPCA.R -M R/SetOptions.R -M R/fitted.FPCA.R -M R/print.FPCA.R -M man/CreateOptions.Rd -M man/FPCA.Rd -M tests/testthat/test_SetOptions.R - -commit f5daa33504ede285432569f41480640af920a2a0 -Author: dmchris -Date: Thu Aug 20 16:17:10 2015 -0700 - - modify roxygen2 doc for createScreePlot - -M R/createScreePlot.R - -commit fde2c5e8fecf61e810f8256c02c117819009a6e6 -Author: dmchris -Date: Thu Aug 20 16:07:24 2015 -0700 - - Roxygen doc for 4 plotting functions, change the name createCorrPlot to createCovPlot - -M NAMESPACE -M R/FPCA.R -R070 R/createCorrPlot.R R/createCovPlot.R -M R/createDesignPlot.R -M R/createScreePlot.R -M man/FPCA.Rd -M tests/testthat/test_FPCA.R -M tests/testthat/test_FVEdataset.R - -commit c16b6dfd26487458c6841f81d702821c5e9574b7 -Author: hadjipantelis -Date: Wed Aug 19 00:31:19 2015 -0700 - - minor update for stepAIC - -M R/FPCAregScalar.R - -commit 22b7eeae5faf9f017e7498b48e1de0ce20aa54d1 -Merge: c792c3f 1a6d058 -Author: Xiongtao Dai -Date: Wed Aug 19 16:19:22 2015 +0900 - - Merge remote-tracking branch 'upstream/master' - -commit c792c3f3414ae2a8f26965a6bf99a39195b4a7c0 -Author: Xiongtao Dai -Date: Wed Aug 19 16:19:00 2015 +0900 - - pkgnames add authors - -M R/pkgname.R -M man/tPACE.Rd - -commit 1a6d058b3814df488c8a300c7c6b1aa55f1f1a34 -Author: hadjipantelis -Date: Wed Aug 19 00:03:36 2015 -0700 - - Dense functional regression for scalar covariate added. - -A R/FPCAregScalar.R - -commit 927b5292c63f117dd3aa99aaf14f6017b7cd540e -Author: hadjipantelis -Date: Tue Aug 18 20:15:45 2015 -0700 - - Accel. GetRho via subsampling and c++ - -M R/FPCA.R -M R/GetCEScores.R -M R/RcppExports.R -A src/GetIndCEScoresCPP.cpp -A src/GetIndCEScoresCPPnewInd.cpp -M src/RcppExports.cpp -M tests/testthat/test_GetCEScores.R - -commit d07171e8351ca030dc618f98040b9aa75fc8978b -Author: Pantelis -Date: Mon Aug 17 17:31:20 2015 -0700 - - Fixing test_* after the removal of redundant files - -M tests/testthat/test_FPCA.R -M tests/testthat/test_FVEdataset.R -M tests/testthat/test_GetCEScores.R -M tests/testthat/test_GetRho.R -M tests/testthat/test_GetSmoothedCovarSurface.R -M tests/testthat/test_GetSmoothedMeanCurve.R -M tests/testthat/test_SetOptions.R -D tests/testthat/test_convertMuPhi.R -D tests/testthat/test_gcvlwls2d.R_old -M tests/testthat/test_pc_covE.R - -commit 2700b0dae74b30be20d68ef2a029bb1b4d92ff2e -Author: Pantelis -Date: Mon Aug 17 16:52:16 2015 -0700 - - Removing files deemed redundant. - -D R/CreateOptions.R -D R/adjustBW2.R -D R/convertMuPhi.R -D R/gcvlwls1d0.R -D R/gcvlwls2d.R -D R/roxygen.bib -D src/trapzRcppP.cpp - -commit 7906e711bf87d3af70dc7a3aae9e01f0c26b0e02 -Author: Pantelis -Date: Mon Aug 17 12:14:42 2015 -0700 - - minor corrections - -M R/CheckData.R -M R/CheckOptions.R -M R/FPCAder.R -M src/symbols.rds - -commit cc4d11197251d0f03e4ded748d9094966f4fda09 -Author: Xiongtao Dai -Date: Fri Aug 14 15:09:27 2015 -0700 - - pracma::funcNames - -M R/ConvertSupport.R -M R/GetRawCov.R -M R/cvlwls1d.R -M R/gcvlwls1d1.R -M src/symbols.rds -M tests/testthat.R - -commit 1175c9f3121f5224f2b1ec1bfb49b404a9679d6f -Author: Xiongtao Dai -Date: Fri Aug 14 14:44:10 2015 -0700 - - fixed export import - -M DESCRIPTION -M NAMESPACE -M R/CheckData.R -M R/CheckOptions.R -M R/CreateOptions.R -M R/FPCA.R -M R/FPCAder.R -M R/TruncateObs.R -M R/createCorrPlot.R -M R/createDesignPlot.R -M R/createDiagnosticsPlot.R -M R/createScreePlot.R -M R/fitted.FPCA.R -M R/makePACEinputs.R -A R/pkgname.R -M R/print.FPCA.R -M R/sparsify.R -M R/wiener.R -M man/CheckData.Rd -M man/CheckOptions.Rd -M man/CreateOptions.Rd -M man/FPCA.Rd -M man/FPCAder.Rd -M man/SetOptions.Rd -M man/createDiagnosticsPlot.Rd -M man/makePACEinputs.Rd -A man/print.FPCA.Rd -A man/tPACE.Rd -M src/trapzRcppP.cpp - -commit 2ce1e98b603f952fb415980fab7a3782152db2b0 -Author: Xiongtao Dai -Date: Fri Aug 14 10:38:36 2015 -0700 - - minor - -M R/GetCEScores.R - -commit a1587ae82522cb6d4b42f3f4419af9798a585d05 -Author: Xiongtao Dai -Date: Thu Aug 13 11:04:05 2015 -0700 - - forgot to upload test for FitEigenValues.R - -A tests/testthat/test_FitEigenValues.R - -commit 917060748827a52eeb6dca0cebf70de7e65f2495 -Author: hadjipantelis -Date: Fri Aug 7 22:53:36 2015 -0700 - - Removed 'CreateEigenfncts' and 'getEigens', tided up FPCA/FPCAder/FPCA.fitted, renamed bwmuGcv/bwcvGcv to the more compehensible bwmuMethod/bwcovMethod. - -M R/CheckOptions.R -D R/CreateEigenfncts.R -M R/CreateOptions.R -M R/FPCA.R -M R/FPCAder.R -M R/GetSmoothedMeanCurve.R -M R/SetOptions.R -M R/fitted.FPCA.R -D R/getEigens.R -M man/CreateOptions.Rd -M man/FPCA.Rd -A man/FPCAder.Rd -D tests/testthat/test_CreateEigenfncts.R -M tests/testthat/test_FVEdataset.R -M tests/testthat/test_GetRho.R -M tests/testthat/test_Rrotatemullwlsk.R -M tests/testthat/test_cvlwls1d.R -M tests/testthat/test_funSim.R -M tests/testthat/test_gcvlwls2dV2.R -D tests/testthat/test_getEigens.R -M tests/testthat/test_lwls2dV2.R - -commit c0cdc5938eea1904d11f3e01812917c4e3aebc38 -Author: Pantelis -Date: Fri Aug 7 17:59:50 2015 -0700 - - Adding dependancy in DESCRIPTION - -M DESCRIPTION - -commit 3983308ce5307b062b472bd0d47b4ac506bf00d0 -Author: Pantelis -Date: Fri Aug 7 17:45:35 2015 -0700 - - FPCAder() and required changes to fitted.FPCA() - -A R/FPCAder.R -M R/RcppExports.R -M R/fitted.FPCA.R -M src/RcppExports.cpp -A src/trapzRcppP.cpp - -commit 3a3403d4353977c380c4a7085466e87cb4ed0a73 -Author: hadjipantelis -Date: Fri Aug 7 01:50:33 2015 -0700 - - Changes to convince R that a vector is a 1-D matrix - -D ConvexHullExample0999.pdf -M R/GetCEScores.R -M R/GetEigenAnalysisResults.R - -commit ea689527224542a6b48e7ff49e4f1410040afd0b -Author: hadjipantelis -Date: Fri Aug 7 00:33:37 2015 -0700 - - Adding option to aggressively sparsify a sample. - -A ConvexHullExample0999.pdf -A R/sparsify.R -M R/wiener.R - -commit fe4fd16cc9c24e00082c27a6a4f041bf9739b59e -Author: hadjipantelis -Date: Tue Jul 28 08:09:39 2015 -0700 - - Added unit test for GetBinnedCurve & corrected the syntax in some calls. - -M R/BinData.R -M R/GetBinnedCurve.R -M R/GetBinnedDataset.R -A tests/testthat/test_GetBinnedCurve.R - -commit f919735887d0293a5cf939fcc02256b1f456afbe -Author: hadjipantelis -Date: Mon Jul 27 18:11:12 2015 -0700 - - removing unused datasets. - -M .gitignore -M NAMESPACE -D data/FVEdata.mat -D data/LogFVEresults.mat -D data/rng123_200curves.mat -M man/CheckData.Rd -M man/CheckOptions.Rd -M man/CreateOptions.Rd -M man/FPCA.Rd -M man/SetOptions.Rd -M man/createDiagnosticsPlot.Rd -M man/makePACEinputs.Rd -A src/symbols.rds - -commit 86bfcf5ac51d5aaf3d30b38c57b6888165661d82 -Author: hadjipantelis -Date: Sun Jul 26 15:08:25 2015 -0700 - - Changes from 'trapz' to 'trapzRcpp' and from 'kern' to 'kernel_type' - -M R/GetEigenAnalysisResults.R -M R/GetRho.R -M R/GetSmoothedMeanCurve.R -M R/cvlwls1d.R -M R/gcvlwls1d1.R -M R/getEigens.R -M R/pc_covE.R -M R/print.FPCA.R - -commit bbeb9e130591f0e4a4692dab97924c94ba54d4e3 -Author: hadjipantelis -Date: Sun Jul 26 14:36:37 2015 -0700 - - Updated trapzRcpp to return quiet_NaN (fail-safe change). - -M src/trapzRcpp.cpp - -commit 6128c44c60d8f9ba1c475d59773388004722158c -Author: hadjipantelis -Date: Fri Jul 24 21:50:52 2015 -0700 - - Updated 'mapX1d.R' to stop if NA are produced - -M R/mapX1d.R - -commit cf328485220e6dbac354eb444b1af4a24de8c33e -Author: hadjipantelis -Date: Fri Jul 24 07:58:46 2015 -0700 - - Adding check for duplicate within-subject time entries - -M R/CheckData.R - -commit a0d492009001cec6ef568db126455d7e47054012 -Author: hadjipantelis -Date: Fri Jul 24 06:44:10 2015 -0700 - - Changes to 'GetRawCov' to make it more efficient. - -M R/FPCA.R -M R/GetRawCov.R - -commit 68d81f3ef76dd750bcc7465bf313f6d91b0efe1a -Author: hadjipantelis -Date: Thu Jul 23 01:09:02 2015 -0700 - - Changes to incorporate the 'DenseWithMV' functionality - -M R/FPCA.R -M R/GetMeanDense.R -M R/List2Mat.R -M R/MakeResultFPCA.R -M R/mapX1d.R - -commit 88b614125ba2702425f218b2aa77ad5d47ecd4bc -Author: Pantelis -Date: Wed Jul 22 20:42:26 2015 -0700 - - Adding functionality to truncate the grid in the case of dense data. - -M R/FPCA.R - -commit d88e386cbb9f922c0051f4c351e9b8a912a56f88 -Author: Pantelis -Date: Wed Jul 22 20:06:43 2015 -0700 - - Minor changes to accomodate 'MissingWithMV' - -M R/GetCovDense.R -M R/GetMeanDense.R - -commit 96975ff3f96edb9dde72ed95f2dbd07b9f9d8c8d -Author: Pantelis -Date: Wed Jul 22 19:29:29 2015 -0700 - - Minor enh. to GetINScores.R - -M R/GetINScores.R -M R/RcppExports.R -M src/RcppExports.cpp - -commit ebf974d96ac63f27b87f43ccb152da3c419ba93e -Merge: 174d719 269400d -Author: Pantelis -Date: Wed Jul 22 16:51:52 2015 -0700 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit 174d7192c84d115b2c95227d12be0b74b1e1e82c -Author: Pantelis -Date: Wed Jul 22 16:51:25 2015 -0700 - - Faster trapz function, assurance that the converted support cov K is symmetric, eigs with smaller upper limit and some renamings - -M R/ConvertSupport.R -M R/GetCovDense.R -M R/GetEigenAnalysisResults.R -M R/GetINScores.R -M R/no_FVE.R -A src/trapzRcpp.cpp -A tests/testthat/test_trapzRcpp.R - -commit 269400d3e10e0de1f3889cbcbb19efb7d2dc9d98 -Author: hadjipantelis -Date: Wed Jul 22 01:05:07 2015 -0700 - - Added option for 'createDiagnosticsPlot' to not open a new device. - -M R/createDiagnosticsPlot.R - -commit 3d2d3daf0e120b278de4ffed046059811119c8bf -Author: Pantelis -Date: Mon Jul 20 16:59:16 2015 -0700 - - Added basic 'print.FPCA()' command and ?createDiagnosticsPlot - -M NAMESPACE -M R/createDiagnosticsPlot.R -A R/print.FPCA.R -M man/CheckData.Rd -M man/CheckOptions.Rd -M man/CreateOptions.Rd -M man/FPCA.Rd -M man/SetOptions.Rd -A man/createDiagnosticsPlot.Rd -M man/makePACEinputs.Rd - -commit edf6eda84c21237994b69348374f3c76937c4998 -Author: hadjipantelis -Date: Mon Jul 20 12:33:57 2015 -0700 - - Changing 'LazyData' to FALSE from TRUE - -M DESCRIPTION - -commit 98cce460c5b7e96fe9736fdeebcdd4488965f422 -Author: hadjipantelis -Date: Sun Jul 19 22:28:06 2015 -0700 - - Adding references, removing 'newdata' option, fixing the syntax a bit, change 'method' to 'methodXi' - -M R/CheckOptions.R -M R/CreateOptions.R -M R/FPCA.R -M R/SetOptions.R -M man/CheckData.Rd -M man/CheckOptions.Rd -M man/CreateOptions.Rd -M man/FPCA.Rd -M man/SetOptions.Rd -M man/makePACEinputs.Rd - -commit e1cc83d0d6194340bbfe02212632c154f7aa6d90 -Author: hadjipantelis -Date: Sun Jul 19 14:37:38 2015 -0700 - - Changed instances where T and F where overloaded. - -M R/CreateEigenfncts.R -M tests/testthat/test_Rmullwlsk.R -M tests/testthat/test_Rrotatemullwlsk.R - -commit dbe5a12544f8b49e3d59c25ce456e35dcc53f7b8 -Author: hadjipantelis -Date: Sun Jul 19 14:23:10 2015 -0700 - - Dropping some pracma::isempty and adding RcppExports - -M .gitignore -M DESCRIPTION -M R/ConvertSupport.R -M R/GetRawCov.R -M R/GetSmoothedMeanCurve.R -M R/gcvlwls1d1.R -A src/RcppExports.cpp - -commit 00d7ce4ac6b19c0560e529edf39608e54aecb803 -Author: hadjipantelis -Date: Sun Jul 19 04:21:28 2015 -0700 - - Corrected typo in getEigens from previous commit - -M R/getEigens.R - -commit ae18280676d79fbdb628d76e3a204e654a61852f -Author: hadjipantelis -Date: Sun Jul 19 03:52:00 2015 -0700 - - Changed instances of 'pracma::interp1' to 'stats::approx() & stats::splines() - -M R/FitEigenValues.R -M R/GetSmoothedMeanCurve.R -M R/fitted.FPCA.R -M R/getEigens.R - -commit 99a72fcf63f15f816625fd4f3fd937bea32bd64b -Author: Xiongtao -Date: Sat Jul 18 09:57:32 2015 +0100 - - add FitEigenValues - -A R/FitEigenValues.R - -commit c57b09a58eeb62d58a5113f0252a7476351b96ad -Merge: 3fb7418 a6ab6f1 -Author: Xiongtao -Date: Sat Jul 18 09:57:06 2015 +0100 - - merge - -commit 3fb7418f2c5af2e617d964faf9850c28bd975825 -Author: Xiongtao -Date: Sat Jul 18 09:47:12 2015 +0100 - - fit method and a fix in interp1 - -M R/FPCA.R -M R/MakeResultFPCA.R -M R/SetOptions.R -M R/fitted.FPCA.R -M tests/testthat/test_BinRawCov.R - -commit a6ab6f14a0b8bb9975112b0d07b324aa0e1fa0ba -Author: Pantelis -Date: Fri Jul 17 20:20:06 2015 -0700 - - Creating Screeplot, Diagnostics plot, changing relavant Set/Check/CreateOptions.R and FPCA.R - -M R/CheckOptions.R -M R/CreateOptions.R -M R/FPCA.R -M R/SetOptions.R -M R/createCorrPlot.R -M R/createDesignPlot.R -A R/createDiagnosticsPlot.R -A R/createScreePlot.R - -commit 11237c831b7945a767eb9150a83bf693da2dab3c -Author: Xiongtao -Date: Sat Jul 18 01:01:01 2015 +0100 - - test_funSim normalization - -M tests/testthat/test_funSim.R - -commit 5774e2e7712f24a90767b4de2addb2dcd806cd1e -Merge: ee8a2b6 522cf0f -Author: Xiongtao -Date: Sat Jul 18 00:43:04 2015 +0100 - - Merge branch 'master' of github.com:hadjipantelis/tPACE - -commit 522cf0f7d75eccca67bf60b9f7ddea08cb10db32 -Author: hadjipantelis -Date: Fri Jul 17 12:38:34 2015 -0700 - - Added some default options to createDesignPlot so it does not require an FPCA object as input, added .bib file for references, corrected a typo or two in doc. Added long sim example ('test_funSim.R') - -M R/FPCA.R -M R/createDesignPlot.R -A R/roxygen.bib -A tests/testthat/test_funSim.R - -commit ee8a2b6120eb6d2ef199ca2ef23fbc4f1a0c23b0 -Merge: c6a6de6 32f0ffb -Author: Xiongtao Dai -Date: Fri Jul 17 10:10:24 2015 -0700 - - Merge branch 'master' of github.com:hadjipantelis/tPACE - -commit 32f0ffb19370c6b4903456cb827d3922a6dd7ac5 -Author: Pantelis -Date: Fri Jul 17 01:36:05 2015 -0700 - - An omission, a typo and a clarification - -M R/GetBinNum.R -M R/wiener.R - -commit b6bc27682b4d883940db5ce8cd7bc0e3e978a998 -Author: Pantelis -Date: Wed Jul 15 16:03:18 2015 -0700 - - Finalised the 'numComponents' options - -M R/MakeResultFPCA.R - -commit c6a6de6c08298575b0f2eaefda8cecf11ecb2d94 -Author: Xiongtao Dai -Date: Wed Jul 15 13:32:05 2015 -0700 - - nothing - -D src/interp2lin.cpp_back - -commit a0093ffa83d11e24516e36bce06c92849d3daf7a -Author: hadjipantelis -Date: Wed Jul 15 12:10:01 2015 -0700 - - Added 'numComponents' options / need to clear 'xiVar' output - -M R/CheckOptions.R -M R/CreateOptions.R -M R/FPCA.R -M R/MakeResultFPCA.R -M R/SetOptions.R -M R/cvlwls1d.R - -commit 4ed3c222d7e79ce373d1f29b39bd0c17d410906a -Author: hadjipantelis -Date: Tue Jul 14 21:23:26 2015 -0700 - - Added check that the data are only numeric (or integer) as well as coercion step in the main FPCA function. - -M R/CheckData.R -M R/FPCA.R - -commit c09a552e041dc5bbffdefb8837fea0aca0ebdd0d -Author: hadjipantelis -Date: Tue Jul 14 03:18:03 2015 -0700 - - Making sure that all member of 'y' and 't' are of class 'numeric'. - -D PACEresult0.png -D data/untitled.fig - -commit 8247f7ffd3c7c70a81e819ff4f84899d49fac04b -Author: hadjipantelis -Date: Tue Jul 14 03:17:16 2015 -0700 - - Making sure that all member of 'y' and 't' are of class 'numeric'. - -A PACEresult0.png -M R/CheckData.R -A data/untitled.fig - -commit b5b96592228182007191a0df9e0954689d294112 -Merge: 8c6abac f6581df -Author: Xiongtao -Date: Tue Jul 14 00:18:52 2015 +0100 - - Merge branch 'master' of github.com:hadjipantelis/tPACE - -commit 8c6abac20d9740d8e478842a8aba3af1603d9708 -Author: Xiongtao -Date: Tue Jul 14 00:18:22 2015 +0100 - - minor - -M R/GetRho.R - -commit f6581df1aa04c7b5239279706cfd015f4a9c238f -Merge: 446243f db3694e -Author: Pantelis -Date: Mon Jul 13 15:37:41 2015 -0700 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit 446243f07b9d07cf1737128e373fef77c17338b3 -Author: Pantelis -Date: Mon Jul 13 15:36:03 2015 -0700 - - Added the 'fitted' S3 function, changes FPCA output to be an FPCA object. - -M NAMESPACE -M R/MakeResultFPCA.R -A R/fitted.FPCA.R - -commit db3694e9d96973c4b1da567ca7eb885d63325edb -Merge: a5ef0aa 44aa135 -Author: Xiongtao Dai -Date: Fri Jul 10 08:51:44 2015 -0700 - - Merge branch 'master' of github.com:hadjipantelis/tPACE - -commit a5ef0aac761fa694679bd13921ed12b37d3b6e6f -Author: Xiongtao Dai -Date: Fri Jul 10 08:51:19 2015 -0700 - - fix rho and rotationCut - -M R/FPCA.R -M R/GetRho.R -M R/GetSmoothedCovarSurface.R -M man/CheckData.Rd -M man/CheckOptions.Rd -M man/CreateOptions.Rd -M man/FPCA.Rd -M man/SetOptions.Rd -M man/makePACEinputs.Rd -M notesXiongtao.txt -M tests/testthat/test_GetRho.R -M tests/testthat/test_GetSmoothedCovarSurface.R - -commit 44aa1351aeefb9d398d8ddfb4dc9bbb83a4d39eb -Author: Pantelis -Date: Thu Jul 9 21:58:04 2015 -0700 - - Added 'FVE' item in the output structure; Doxygen entry added. - -M R/FPCA.R -M R/MakeResultFPCA.R - -commit e790ee6e55eda365c366e07eb320d8721dcdaf5c -Author: Pantelis -Date: Wed Jul 8 23:39:34 2015 -0700 - - Fixed bug in rotateLwls2dV2, added large dataset for MATLAB comparison, added check in Rlwls1d - -M R/CreateOptions.R -M R/SetOptions.R -M R/pc_covE.R -M R/rotateLwls2dV2.R -A data/200curvesByExampleSeed123.RData -R100 FVEdata.mat data/FVEdata.mat -A data/datasetToTestRrotatedSmoother.RData -A data/rng123_200curves.mat -M src/Rlwls1d.cpp -M src/RrotatedMullwlsk.cpp - -commit 187915e71700fd8399443965dae462988e58ac6e -Author: Xiongtao -Date: Wed Jul 8 07:58:10 2015 +0100 - - FPCA help document - -M R/FPCA.R -A man/CheckData.Rd -A man/CheckOptions.Rd -A man/CreateOptions.Rd -A man/FPCA.Rd -A man/SetOptions.Rd -A man/makePACEinputs.Rd - -commit 0fc16ee972fe940392ac5757cadd922609e46388 -Author: Xiongtao -Date: Wed Jul 8 01:45:37 2015 +0100 - - fixed 2D CV - -M R/gcvlwls2dV2.R -D R/lwls1d.R -D R/lwls2d.R -M R/lwls2dV2.R -D R/rotateLwls2d.R -M tests/testthat/test_gcvlwls2dV2.R -D tests/testthat/test_lwls.R -D tests/testthat/test_lwls2d.R -M tests/testthat/test_lwls2dV2.R -D tests/testthat/test_rotateLwls2d.R -M tests/testthat/test_useBin.R - -commit 0012d3a024e851a51af0af8fe745e71a06ae8f21 -Author: Pantelis -Date: Mon Jul 6 16:29:24 2015 -0700 - - Minor fixed in the gcvlwls1d1, first pass for the docs of CreateOptions. - -M DESCRIPTION -M R/CreateOptions.R -M R/FPCA.R -M R/SetOptions.R -M R/cvlwls1d.R -M R/gcvlwls1d1.R -M R/minb.R -M src/Rlwls1d.cpp -M src/interp2lin.cpp -M tests/testthat/test_FVEdataset.R -M tests/testthat/test_GetSmoothedMeanCurve.R - -commit 82158573617840718578fa5ad595dc558c3bb175 -Author: Pantelis -Date: Mon Jul 6 12:42:22 2015 -0700 - - Writing up the doc for CreateOptions - -M R/CheckOptions.R -M R/CreateOptions.R -M R/SetOptions.R -M src/Rlwls1d.cpp - -commit 34bda7d807ae096dabc84d9278d734b1d6469fe7 -Author: hadjipantelis -Date: Sun Jul 5 02:09:00 2015 -0700 - - Corrected forgotten declaration. - -M src/dropZeroElementsXYWin.cpp - -commit 00aa7156b60ec3ee5819beb3952f0850ca84cc22 -Author: hadjipantelis -Date: Sat Jul 4 23:24:57 2015 -0700 - - Fixing (partially) the zero weights issue in 1-D and moving all lwls1d to Rlwls1d. locfit dependancy dropped. - -A R/RcppExports.R -M R/cvlwls1d.R -M R/pc_covE.R -M src/Rlwls1d.cpp -A src/dropZeroElementsXYWin.cpp - -commit b4bdbe013423ce2594a834163c3ea8f6843c8aac -Author: hadjipantelis -Date: Sat Jul 4 15:29:00 2015 -0700 - - Cleaning unit-tests and adding the CPP 1-D smoother functionality - -D R/RcppExports.R - -commit d69ca256567d24a9c3a04e5af2a32716673de896 -Author: hadjipantelis -Date: Sat Jul 4 15:28:41 2015 -0700 - - Cleaning unit-tests and adding the CPP 1-D smoother functionality - -A R/RcppExports.R - -commit b36fc5d6a939401ec1492efed8bc0a3be633a8bf -Merge: 296e99f 35cb2d3 -Author: hadjipantelis -Date: Sat Jul 4 15:12:53 2015 -0700 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit 296e99fd03e6c6263d8083bdab7ef10e619281fa -Author: hadjipantelis -Date: Sat Jul 4 15:11:04 2015 -0700 - - Cleaning unit-tests and adding the CPP 1-D smoother functionality - -M R/CreateTrueMean.R -M R/GetSmoothedMeanCurve.R -M R/cvlwls1d.R -M R/gcvlwls1d1.R -M tests/testthat/test_GetSmoothedMeanCurve.R - -commit 35cb2d34649f715a4f0b7c0744689395a28ec6b2 -Merge: 45c796c b364d67 -Author: Xiongtao -Date: Sat Jul 4 20:01:17 2015 +0100 - - merge - -commit 45c796c5da2dde8123fb7afc9382d9ebca26b3b5 -Author: Xiongtao -Date: Sat Jul 4 19:59:56 2015 +0100 - - minor - -M tests/testthat/test_GetCEScores.R - -commit a9a6259fcb74e51063909a8825a62733eac4cfbf -Author: Xiongtao -Date: Sat Jul 4 19:57:32 2015 +0100 - - Fixed truncation case - -M .gitignore -M R/FPCA.R -M R/GetCEScores.R -M R/GetRho.R -M R/MakeResultFPCA.R -D R/RcppExports.R -M R/TruncateObs.R -M R/gcvlwls2d.R -M R/gcvlwls2dV2.R -M R/pc_covE.R -D src/RcppExports.cpp -M tests/testthat/test_FPCA.R -M tests/testthat/test_GetCEScores.R -M tests/testthat/test_GetRho.R - -commit b364d67fc93d01e685d5f7f0b866f931eb412022 -Author: hadjipantelis -Date: Sat Jul 4 01:17:54 2015 -0700 - - Further small fixes in the unit-tests - -M R/GetSmoothedMeanCurve.R -M tests/testthat/test_GetRawCov.R - -commit c1a483fc837335163b69c156d685a92cbfbb8cd5 -Author: hadjipantelis -Date: Sat Jul 4 00:39:35 2015 -0700 - - Further small fixes in the unit-tests - -M R/cvlwls1d.R -M tests/testthat/test_cvlwls1d.R -M tests/testthat/test_gcvlwls1d1.R -M tests/testthat/test_gcvlwls2d.R_old -M tests/testthat/test_gcvlwls2dV2.R -M tests/testthat/test_getEigens.R -M tests/testthat/test_getMinb.R - -commit 94d35d8239f8b965625b85d0847f7074c7344865 -Author: hadjipantelis -Date: Fri Jul 3 23:31:26 2015 -0700 - - Small fixes in the unit-tests. - -M R/RcppExports.R -M src/RcppExports.cpp -M tests/testthat/test_GetSmoothedMeanCurve.R -M tests/testthat/test_IsRegular.R -M tests/testthat/test_Rmullwlsk.R -M tests/testthat/test_SetOptions.R -M tests/testthat/test_lwls2dV2.R -M tests/testthat/test_no_FVE.R - -commit e2c2cc838bca6b4f3d93279897874a23bf0de0de -Author: hadjipantelis -Date: Thu Jul 2 22:27:12 2015 -0700 - - Faster 1-D smoother ready. Not integrated. Updated unit-tests. - -A src/Rlwls1d.cpp -M tests/testthat/test_lwls.R - -commit 1bf6b8b83e8a8f68f82e296b83c2ecd4e3b9bead -Merge: b0cae00 f0ebbb2 -Author: Xiongtao -Date: Thu Jul 2 17:45:28 2015 +0100 - - Merge branch 'master' of github.com:hadjipantelis/tPACE - -commit b0cae006ce27cc401ca3c8475660f69934eb203b -Author: Xiongtao -Date: Thu Jul 2 17:44:36 2015 +0100 - - minor - -M R/TruncateObs.R - -commit f0ebbb2b6372eecf2d73106bf83805482cee2186 -Author: hadjipantelis -Date: Thu Jul 2 03:32:55 2015 -0700 - - Fixed boundary behaviour issue in interp2lin. - -M src/interp2lin.cpp - -commit b2ba44f8a64dbed787902cd06e678a15da0aecde -Author: hadjipantelis -Date: Wed Jul 1 23:18:40 2015 -0700 - - updating gitignore - -M .gitignore - -commit 341713a88b80b5b4ae2679ce46968560d8932fbe -Merge: c693530 1745b7c -Author: Xiongtao Dai -Date: Wed Jul 1 22:49:24 2015 -0700 - - merge - -commit c693530f26946a73240ff307fc179c21d0b1da21 -Author: Xiongtao Dai -Date: Wed Jul 1 22:45:23 2015 -0700 - - fixed some .Machine$double.eps - -M R/BinRawCov.R -M R/ConvertSupport.R -M R/FPCA.R -M R/GetCEScores.R -M R/GetSmoothedCovarSurface.R -M R/RcppExports.R -A notesXiongtao.txt -M src/RcppExports.cpp - -commit 1745b7ca7f0fa93273b977d4a23bab79e69d8bf0 -Author: Pantelis -Date: Wed Jul 1 17:27:40 2015 -0700 - - Updated interp2lin functionality to use only two std::finds and changes Rrotatedmullwlsk to have correct bwCheck behaviour - -M R/RcppExports.R -M src/RcppExports.cpp -M src/RrotatedMullwlsk.cpp -M src/interp2lin.cpp -M tests/testthat/test_Rrotatemullwlsk.R - -commit c727c5ec28153d894f02e3b0984ad282eab0bbf7 -Author: Xiongtao -Date: Wed Jul 1 07:21:39 2015 +0100 - - support buff fix - -M R/ConvertSupport.R -M R/FPCA.R -M R/GetSmoothedCovarSurface.R -M R/RcppExports.R -M src/RcppExports.cpp - -commit 8c6ea8b6966d48f59029744a121b00b077b87565 -Author: hadjipantelis -Date: Tue Jun 30 17:14:49 2015 -0700 - - Changed interp2lin out-of-grid behaviour (NaN instead of ::error - -M src/interp2lin.cpp -M tests/testthat/test_interp2lin.R - -commit ec6a9ca8620ef2b6fb4e05b03dca16c3dc59b7ad -Author: hadjipantelis -Date: Tue Jun 30 12:28:08 2015 -0700 - - Correcting a typo in an error message and moving 'rgl' dependancy to 'Suggests' from 'Depends' - -M DESCRIPTION -M src/interp2lin.cpp - -commit 517491d787da7b5f2c74294309ce7db998efaf0b -Author: hadjipantelis -Date: Tue Jun 30 00:28:52 2015 -0700 - - Upgraded interp2lin to use std::find instead of a linear search - -M R/RcppExports.R -M src/RcppExports.cpp -M src/interp2lin.cpp - -commit db159d0b605a147cd3ff0f8748be39acf4a5098b -Author: Xiongtao -Date: Tue Jun 30 05:14:53 2015 +0100 - - interp2lin integrated - -M R/ConvertSupport.R -M R/RcppExports.R -M R/gcvlwls2dV2.R -M src/RcppExports.cpp -M tests/testthat/test_interp2lin.R - -commit 48a8e25eda96a870d0b84d1b0488218ec11f56c5 -Merge: fe012b7 7060fb6 -Author: Xiongtao -Date: Tue Jun 30 02:21:04 2015 +0100 - - Merge remote-tracking branch 'upstream/master' - -commit fe012b7ceea2238a1ae49adf6bdc0135f14ed8b0 -Author: Xiongtao -Date: Tue Jun 30 02:20:47 2015 +0100 - - test cases fixes by Xiongtao; devtools::test() should work - -M R/RcppExports.R -M R/getMinb.R -M src/RcppExports.cpp -M tests/testthat/test_GetRawCov.R -M tests/testthat/test_GetSmoothedMeanCurve.R -M tests/testthat/test_Rmullwlsk.R -M tests/testthat/test_Rrotatemullwlsk.R -M tests/testthat/test_cvlwls1d.R -M tests/testthat/test_gcvlwls1d1.R -R098 tests/testthat/test_gcvlwls2d.R tests/testthat/test_gcvlwls2d.R_old -M tests/testthat/test_gcvlwls2dV2.R -M tests/testthat/test_getEigens.R -M tests/testthat/test_getMinb.R -M tests/testthat/test_lwls2d.R -M tests/testthat/test_lwls2dV2.R -M tests/testthat/test_no_FVE.R -M tests/testthat/test_rotateLwls2d.R - -commit 7060fb62d8b16644e80ac5babd20d710e0fd68ce -Author: Pantelis -Date: Mon Jun 29 14:29:31 2015 -0700 - - Upgraded interp2lin.cpp - -M src/interp2lin.cpp -A src/interp2lin.cpp_back -M tests/testthat/test_interp2lin.R - -commit bc137a7f3329dac7f37fbf4afae9b9ff1ac29d47 -Author: dmchris -Date: Mon Jun 29 12:29:55 2015 -0400 - - RegularWithMV -> DenseWithMV - -M R/IsRegular.R - -commit 4b5c4c09ad806d50ed3be28e0db26498bc26053d -Author: dmchris -Date: Mon Jun 29 11:57:30 2015 -0400 - - modify createCorrPlot - -M R/createCorrPlot.R - -commit 921e2e7c5a2b7c69a083d3c7e0bf4886997ddeee -Author: hadjipantelis -Date: Mon Jun 29 02:59:25 2015 -0700 - - Added interp2lin basic unit test - -A tests/testthat/test_interp2lin.R - -commit a60e8a49bb19c5137e01495c9851f44039681855 -Author: hadjipantelis -Date: Mon Jun 29 02:50:21 2015 -0700 - - Added Rcpp implementation of bilinear interpolation method - -A src/interp2lin.cpp - -commit e699bd88c30f65436a0003e653610fdf8dc8408a -Author: dmchris -Date: Fri Jun 26 12:40:45 2015 -0400 - - Tests required: incorporate dense irregular (Dense) and DenseWithMV cases - -M R/FPCA.R -M R/GetINScores.R -M R/IsRegular.R -M R/SetOptions.R - -commit ebe2181407646a2955e332f24b030a7d02627032 -Merge: 125ec34 4eab96b -Author: hadjipantelis -Date: Thu Jun 25 14:24:47 2015 -0700 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit 4eab96b94352b5938521bbcb0ef146b7f35989b7 -Author: dmchris -Date: Wed Jun 24 03:34:23 2015 -0700 - - SetOptions: set method=IN for DenseWithMV - -M R/SetOptions.R - -commit 250c0e1435f139a68917334a7cf6a9b68d81b30c -Author: dmchris -Date: Tue Jun 23 18:31:30 2015 -0700 - - GetINScores for missing values in trapz integration - -M R/GetINScores.R - -commit 739fceede3ab24705aef82e1d81144582120ac42 -Author: dmchris -Date: Tue Jun 23 18:30:10 2015 -0700 - - mean, cov estimation for Dense & DenseWithMV - -M R/GetCovDense.R -M R/GetMeanDense.R - -commit ee0b93df3838eb06a84b0d1a4c194c6e7a4a9180 -Author: dmchris -Date: Tue Jun 23 18:19:31 2015 -0700 - - modifications: t[[1]] -> sort(unique(unlist(t))) - -M R/FPCA.R -M R/GetINScores.R -M R/IsRegular.R - -commit 34de488ee9162f599b62441cff6ff0bf2b59c56e -Author: dmchris -Date: Mon Jun 22 11:48:23 2015 -0700 - - covariance plot caption: "correlation" -> "covariance" - -M R/createCorrPlot.R - -commit ce201422aba0773710d9e3d0afaf2e4fd9beef40 -Merge: 65480ce a105821 -Author: Pantelis -Date: Mon Jun 22 10:52:28 2015 -0700 - - merging the cppSmoother branch in master - -commit a10582171910e99249f12b04cfd3a2b210a76e63 -Author: Xiongtao Dai -Date: Mon Jun 22 10:45:03 2015 -0700 - - rotate V2 test - -A tests/testthat/test_rotateLwls2dV2.R - -commit 22d49ed11042b5f989defcf144bf0ff7a1d50ff7 -Author: Xiongtao Dai -Date: Mon Jun 22 10:44:24 2015 -0700 - - rotate V2 - -M DESCRIPTION -A R/rotateLwls2dV2.R -D tests/testthat/GetCEScores.R - -commit 4e27cf8192b3a4c81ed1bb704be8e5cbb8ff4b89 -Author: Xiongtao -Date: Sun Jun 21 05:06:45 2015 +0100 - - rotate smoother done - -M R/pc_covE.R -M src/RrotatedMullwlsk.cpp -M tests/testthat/test_pc_covE.R - -commit 65480cec87288a016d932ec72b329cae07af7064 -Author: Pantelis -Date: Sat Jun 20 19:10:50 2015 -0700 - - Added BSD license - -A LICENSE.txt -D notesXiongtao.txt - -commit 18ce2215576106bc4668dffe5020e12ee2560ceb -Author: dmchris -Date: Sat Jun 20 04:33:34 2015 -0700 - - modify IsRegular, FPCA runs for Dense case, tested with wiener simulations - -M R/IsRegular.R - -commit 9a63ddf687e8d16789c97a215f89cf24b421117b -Author: dmchris -Date: Sat Jun 20 01:56:24 2015 -0700 - - To be tested: FPCA featuring Dense case structure - -M R/FPCA.R - -commit 34aaa1039c634a6407411176270f9255407f35e1 -Author: dmchris -Date: Sat Jun 20 01:52:39 2015 -0700 - - To be tested: FPCA featuring Dense case structure - -M R/FPCA.R - -commit eabd3d2bd4727ad6189ae4b8ca0d30d683f3fd67 -Author: dmchris -Date: Sat Jun 20 01:49:58 2015 -0700 - - Dense Case functions addition - -A R/GetCovDense.R -A R/GetINScores.R -A R/GetMeanDense.R -A R/List2Mat.R -A R/MakeResultFPCA.R - -commit ea3f2825681ae5167c0b4f7e5435dee47e6de4c7 -Author: dmchris -Date: Sat Jun 20 01:49:36 2015 -0700 - - SetOptions, IsRegular and test cases modifications - -M R/IsRegular.R -M R/SetOptions.R -M tests/testthat/test_IsRegular.R -A tests/testthat/test_SetOptions.R - -commit b19371ee7fcc034e41afe8b8cdd9b32f3a88e81a -Author: Xiongtao -Date: Sat Jun 20 07:52:38 2015 +0100 - - GetSmoothedCovarSurface with lwls2dV2 - -M R/GetSmoothedCovarSurface.R -M R/gcvlwls2dV2.R -M R/pc_covE.R -M tests/testthat/test_GetSmoothedCovarSurface.R - -commit d46aed01c573b2ff0600f0eb836077606cb7f51c -Author: Xiongtao -Date: Sat Jun 20 07:00:36 2015 +0100 - - fixed gcvlwls2dv2 and added more tests; degenerate case handling - -M R/gcvlwls2dV2.R -M R/getMinb.R -M src/Rmullwlsk.cpp -M tests/testthat/test_gcvlwls2dV2.R - -commit b4284b5be34d77541ca5efaf008c1b4d3951a4cc -Author: Xiongtao Dai -Date: Fri Jun 19 18:45:48 2015 -0700 - - 2D gcv trycatch - -M R/RcppExports.R -M R/gcvlwls2dV2.R -M R/lwls2d.R -M R/lwls2dV2.R -M src/RcppExports.cpp -M src/Rmullwlsk.cpp -M tests/testthat/test_Rmullwlsk.R -M tests/testthat/test_gcvlwls2dV2.R -M tests/testthat/test_lwls2dV2.R - -commit 667ffbe2d2581887b7fab5a3c4342f785add9457 -Author: Pantelis -Date: Thu Jun 18 20:38:08 2015 -0700 - - Added options to R(rotated)mullwlsk.cpp to make only a bandwidth check; all tests successful. - -M src/Rmullwlsk.cpp -M src/RrotatedMullwlsk.cpp -M tests/testthat/test_Rmullwlsk.R -M tests/testthat/test_Rrotatemullwlsk.R - -commit 125ec34960b26d81f5596d8dcf01828da0313dbf -Merge: f37ab8e ffbb6da -Author: hadjipantelis -Date: Wed Jun 17 13:11:14 2015 -0700 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit ffbb6dadf969142855d4c1374de9f8a5cdffe7f0 -Merge: 4f897dc 405ca3c -Author: Xiongtao Dai -Date: Wed Jun 17 12:56:00 2015 -0700 - - minor changes from 'handin' - -commit a4b25cfeb41674196cce0c48cee0b11a89dd2cc4 -Author: hadjipantelis -Date: Wed Jun 17 12:37:58 2015 -0700 - - R(rotated)mullwlsk.cpp now returns correct warnin g and error messages for wrong kernel and insufficient number of measurements respectively. - -M src/Rmullwlsk.cpp -M src/RrotatedMullwlsk.cpp -M tests/testthat/test_Rmullwlsk.R -M tests/testthat/test_Rrotatemullwlsk.R - -commit f37ab8eb9062140089efc13af522f373224100cc -Author: Xiongtao -Date: Wed Jun 17 09:05:28 2015 +0100 - - roughly working version of the matlab gcv2d - -M R/RcppExports.R -A R/gcvlwls2dV2.R -A R/lwls2dV2.R -M notesXiongtao.txt -M src/RcppExports.cpp -M src/Rmullwlsk.cpp -A tests/testthat/test_FPCA.R -A tests/testthat/test_gcvlwls2dV2.R -A tests/testthat/test_lwls2dV2.R - -commit db924aed5783930ee357a6724ed78f271cc9c7d0 -Merge: 4f897dc 138b5d5 -Author: Xiongtao -Date: Tue Jun 16 22:08:30 2015 +0100 - - Merge remote-tracking branch 'upstream/cppSmoother' into cppSmoother - -commit 4f897dc18cdd5bb9a5a0026a8e897f993be2910d -Author: Pantelis -Date: Mon Jun 15 18:11:50 2015 -0700 - - basic README.org - -A README.org - -commit 138b5d5a823420b3c1be31bdf4101947cb38bc44 -Author: Pantelis -Date: Mon Jun 15 16:17:56 2015 -0700 - - Rrotatedmullwlsk.cpp and tests added - -A data/InputForRotatedMllwlskInCpp.RData -A src/RrotatedMullwlsk.cpp -A tests/testthat/test_Rrotatemullwlsk.R - -commit 405ca3ca8d34e9f5b6a12ad63ab1869416be3389 -Merge: 05dc572 0bb95f8 -Author: Xiongtao Dai -Date: Mon Jun 15 12:35:24 2015 -0700 - - Merge remote-tracking branch 'upstream/master' into handin - -commit 0bb95f8d391cca299780e2817cb920959a575cfe -Author: hadjipantelis -Date: Sun Jun 14 14:25:02 2015 -0700 - - Added checking in case one uses incoherent kernel_type - -M src/Rmullwlsk.cpp -M tests/testthat/test_Rmullwlsk.R - -commit 5a63359775b2e972495a103a7cdbc8f1a07c4982 -Author: hadjipantelis -Date: Sun Jun 14 00:38:07 2015 -0700 - - operational Rmullwlsk, tests of Rmullwlsk. NAMESPACE and DESC. additions - -M .gitignore -M DESCRIPTION -M NAMESPACE -A R/RcppExports.R -R100 misc/InputFormMllwlskInCpp.RData data/InputFormMllwlskInCpp.RData -D misc/NOTES.TXT -D misc/testRunMullwlsk.R -A src/RcppExports.cpp -R083 misc/Rmullwlsk.cpp src/Rmullwlsk.cpp -A tests/testthat/test_Rmullwlsk.R - -commit 850d756d9cac5cc5d5172ffffe562754611c6edf -Author: hadjipantelis -Date: Sat Jun 13 18:50:17 2015 -0700 - - Fixed numerical issue with rectangular kernel - -M misc/Rmullwlsk.cpp -M misc/testRunMullwlsk.R - -commit 05dc57267b7bb2edfb4702d3e7f185b0508d90ce -Merge: 2fc6e83 8fe556f -Author: Xiongtao Dai -Date: Sat Jun 13 12:57:33 2015 -0700 - - Merge remote-tracking branch 'upstream/master' into handin - -commit a6d4012975ae4b2ea120fd575c74eec1a279c9d3 -Author: hadjipantelis -Date: Sat Jun 13 03:31:23 2015 -0700 - - Some ident. fixes and comments in Rmullwlsk - -M misc/Rmullwlsk.cpp - -commit 8fe556f179ffded309098a892470a2b0ea4bf74b -Author: hadjipantelis -Date: Sat Jun 13 03:16:21 2015 -0700 - - Working Rmullwlsk for Epan. kernel - -M misc/Rmullwlsk.cpp -A misc/testRunMullwlsk.R - -commit 214f204c424c83589ef426cfd23c461bf7944e73 -Author: Pantelis -Date: Fri Jun 12 20:19:51 2015 -0700 - - deleted Untitled Document added by mistake - -D misc/Untitled Document - -commit 404195b0b6f802d6f08b61c8e82e4d358ef78230 -Author: Pantelis -Date: Fri Jun 12 20:18:30 2015 -0700 - - deleted asdf.Rhistory - -D asdf.Rhistory - -commit aee3649624236364d36b86481cac8e285da9f4a7 -Author: Pantelis -Date: Fri Jun 12 20:16:28 2015 -0700 - - buggy mullwlsk.m - still wokring on it - issue with subIndexing - -A asdf.Rhistory -A misc/InputFormMllwlskInCpp.RData -A misc/NOTES.TXT -A misc/Rmullwlsk.cpp -A misc/Untitled Document - -commit 2fc6e835487d9d0de4409fee5733a9807df43ffb -Author: Xiongtao -Date: Wed Jun 10 21:00:59 2015 +0100 - - minor - -M R/FPCA.R -M R/lwls2d.R -M tests/testthat/test_FVEdataset.R - -commit b7f2a77f9ab29eeb12422cdee917688389b405c6 -Author: Xiongtao -Date: Wed Jun 10 17:43:19 2015 +0100 - - fixes for pc_covE etc - -M .gitignore -M R/CheckOptions.R -M R/FPCA.R -M R/GetCEScores.R -M R/GetEigenAnalysisResults.R -M R/GetSmoothedCovarSurface.R -M R/SetOptions.R -M R/gcvlwls2d.R -M R/lwls1d.R -M R/lwls2d.R -M R/no_FVE.R -M R/pc_covE.R -M notesXiongtao.txt -M tests/testthat/test_FVEdataset.R -M tests/testthat/test_lwls2d.R - -commit 8e0ac8dbfd42dc7de31697ab72c5ad87f940e333 -Merge: 9e71c4d 8d222a2 -Author: Xiongtao -Date: Wed Jun 10 10:52:02 2015 +0100 - - minor - -commit 9e71c4d952b05444ee1d911b6b93bc88f231a3f0 -Author: Xiongtao -Date: Wed Jun 10 10:47:46 2015 +0100 - - interp -> interp2 remove akima dependency - -M .gitignore -M DESCRIPTION -M R/ConvertSupport.R -M notesXiongtao.txt -M tests/testthat/test_ConvertSupport.R - -commit 8d222a2f6b0cad382803077fb2442f4c967a983e -Author: dmchris -Date: Wed Jun 10 02:29:36 2015 -0700 - - Modified createCorrPlot.R to incorporate raw cov scatter plot and rgl package check - -M R/createCorrPlot.R - -commit f028e7fe56f4f8ce54b5a68ff3b37736e33a03ed -Author: Pantelis -Date: Tue Jun 9 19:40:37 2015 -0700 - - Delete automatically generated Rhistory - -D .Rhistory - -commit efd962ad11fba8d4cc01e9ae982aca0b2d4f264a -Author: Pantelis -Date: Tue Jun 9 19:38:59 2015 -0700 - - Typo in SetOptions, Fixed hardcoded number in GetRawCov. - -M .gitignore -M R/CreateOptions.R -M R/SetOptions.R - -commit 7b5f8968c4a0715cc7bf439cd85b2ecd046d0bfe -Author: Pantelis -Date: Tue Jun 9 19:38:05 2015 -0700 - - Typo in SetOptions, Fixed hardcoded number in GetRawCov. - -A .Rhistory -M R/GetRawCov.R - -commit 3b0ee0541ffbd326403f2739cef494526f2d5adb -Author: Pantelis -Date: Mon Jun 8 18:48:35 2015 -0700 - - Added gc(), renamed tpairn, added LogFEVresults.mat for comparison, added corrPlotType option - -M .gitignore -M R/BinRawCov.R -M R/FPCA.R -M R/GetBinnedDataset.R -M R/GetEigenAnalysisResults.R -M R/GetRawCov.R -M R/GetSmoothedCovarSurface.R -M R/GetSmoothedMeanCurve.R -M R/SetOptions.R -M R/gcvlwls2d.R -M R/getMinb.R -M R/pc_covE.R -A data/LogFVEresults.mat -M tests/testthat/test_FVEdataset.R -M tests/testthat/test_GetRawCov.R -M tests/testthat/test_gcvlwls2d.R -M tests/testthat/test_lwls2d.R - -commit 986a50446c0f35db948bd9abfd1b6e08c8db841b -Author: Pantelis -Date: Mon Jun 8 10:09:31 2015 -0700 - - Changes to FPCA.R and other minor corrections - -M .gitignore -M R/FPCA.R -M R/gcvlwls2d.R -M tests/testthat/test_FVEdataset.R - -commit ebd0809e8242b9233af17d3d11bf0db76659fca9 -Merge: 78a5a14 05b173f -Author: Xiongtao Dai -Date: Mon Jun 8 03:01:36 2015 -0700 - - Merge remote-tracking branch 'upstream/master' - -commit 78a5a14f6b6beea0940ba8c912d6c407d486ae1f -Author: Xiongtao Dai -Date: Mon Jun 8 03:01:23 2015 -0700 - - GetRho works - -M R/GetCEScores.R -A R/GetRho.R -M R/SetOptions.R -A R/TruncateObs.R -M notesXiongtao.txt -M tests/testthat/test_GetCEScores.R -A tests/testthat/test_GetRho.R - -commit 05b173f68246aec0690226e5b58617a77c291fc3 -Author: hadjipantelis -Date: Sun Jun 7 23:58:10 2015 -0700 - - Providing alternative for memory usage issue - -A FVEdata.mat -M R/CheckOptions.R -M R/GetSmoothedCovarSurface.R -M R/GetSmoothedMeanCurve.R -R094 R/CVlwls1d.R R/cvlwls1d.R -M R/gcvlwls2d.R -M R/getMinb.R -A tests/testthat/test_FVEdataset.R -M tests/testthat/test_getMinb.R - -commit 79cde6d92da7929bc690f1ee33ed5917173a3608 -Merge: 55cb67d c7a332d -Author: Xiongtao Dai -Date: Sun Jun 7 16:20:40 2015 -0700 - - Merge remote-tracking branch 'upstream/master' - -commit 55cb67d97e03dd80335085d98b26b4ca2688fe05 -Author: Xiongtao Dai -Date: Sun Jun 7 16:20:14 2015 -0700 - - GetCEScores works - -M DESCRIPTION -M R/ConvertSupport.R -M R/FPCA.R -M R/GetCEScores.R -M R/GetEigenAnalysisResults.R -M R/SetOptions.R -M R/mapX1d.R -A tests/testthat/GetCEScores.R -A tests/testthat/test_ConvertSupport.R -A tests/testthat/test_GetCEScores.R -M tests/testthat/test_GetEigenAnalysisResults.R - -commit f72de226c2ccb61d8eff46c1cd7a311081f51309 -Author: Xiongtao Dai -Date: Sun Jun 7 13:20:19 2015 -0700 - - added ConvertSupport, GetCEScores - -M DESCRIPTION -A R/ConvertSupport.R -M R/FPCA.R -A R/GetCEScores.R -M notesXiongtao.txt - -commit c7a332d62fed3a85fa644bfa9fef8807b7c0d407 -Author: hadjipantelis -Date: Sun Jun 7 02:04:55 2015 -0700 - - Fixed makePACEinputs bug, added test case - -M R/makePACEinputs.R -M tests/testthat/test_makePACEinputs.R - -commit b1435e8f651a21ef44c7a692dec0e51773095645 -Author: Xiongtao Dai -Date: Sat Jun 6 23:19:37 2015 -0700 - - cut OK for cov. Eigenfunctions trapz integrate to 1 - -M R/FPCA.R -M R/GetEigenAnalysisResults.R -M R/GetSmoothedCovarSurface.R -M tests/testthat/test_GetEigenAnalysisResults.R -M tests/testthat/test_GetSmoothedCovarSurface.R - -commit 93333050ff4c75be67eec79fff2ec80d593273d0 -Author: hadjipantelis -Date: Sat Jun 6 16:28:07 2015 -0700 - - Making PACE inputs conv. function - -A .gitignore -A R/makePACEinputs.R -A tests/testthat/test_makePACEinputs.R - -commit ebcefd1230c14ea21cc3bdddcfaf9a1704173d8d -Merge: 2f2236b fd87c77 -Author: Xiongtao Dai -Date: Sat Jun 6 13:53:38 2015 -0700 - - Merge remote-tracking branch 'upstream/master' - -commit 2f2236ba2c7ddcdb3b7a3495ef25b620cf0946e3 -Author: Xiongtao Dai -Date: Sat Jun 6 13:53:18 2015 -0700 - - tmp - -M R/GetSmoothedCovarSurface.R -M tests/testthat/test_GetEigenAnalysisResults.R - -commit fd87c77d1ceac4fada515479bc4e8e0a323e273e -Author: dmchris -Date: Thu Jun 4 23:00:39 2015 -0700 - - modify createCorrPlot.R & include library plot3D and rgl for 3d plotting - -M DESCRIPTION -M R/createCorrPlot.R - -commit 826ae17485b39384b1e2c1fc031f880841c92cbd -Author: Xiongtao Dai -Date: Thu Jun 4 12:13:18 2015 -0700 - - changed test cases - -M R/GetEigenAnalysisResults.R -M R/GetSmoothedCovarSurface.R -M R/gcvlwls2d.R -M R/no_FVE.R -M R/pc_covE.R -M tests/testthat/test_BinRawCov.R -M tests/testthat/test_GetEigenAnalysisResults.R -M tests/testthat/test_GetSmoothedCovarSurface.R -M tests/testthat/test_cvlwls1d.R -M tests/testthat/test_pc_covE.R - -commit 28e5c7f5d8b1cfaaf6bdb87b933a3565a6926ef0 -Merge: 914e2c9 471198e -Author: Xiongtao -Date: Thu Jun 4 16:51:27 2015 +0100 - - Merge remote-tracking branch 'upstream/master' - -commit 914e2c93d352727d8f3435b1a67d4b84920bb5eb -Author: Xiongtao -Date: Thu Jun 4 16:51:04 2015 +0100 - - added Eigenanalysis, changed no_FVE - -A R/GetEigenAnalysisResults.R -M R/getMinb.R -M R/no_FVE.R -M notesXiongtao.txt -A tests/testthat/test_GetEigenAnalysisResults.R -M tests/testthat/test_getEigens.R -A tests/testthat/test_no_FVE.R - -commit 471198e03e38ab5eadbdafb239063c34adbfb1cb -Author: dmchris -Date: Thu Jun 4 05:31:01 2015 -0700 - - createCorrPlot, using package plot3D, subject to test - -M DESCRIPTION -A R/createCorrPlot.R - -commit f0b112741a6ba30822fb5c20b3eb7f238749c609 -Author: dmchris -Date: Thu Jun 4 04:41:05 2015 -0700 - - createDesignPlot function - -A R/createDesignPlot.R -A R/designPlotCount.R - -commit d0709d032e490e7934f4e9cbb8f92fb750275521 -Author: Xiongtao -Date: Thu Jun 4 08:10:18 2015 +0100 - - lwls maxK->maxk - -M R/lwls2d.R -M R/rotateLwls2d.R - -commit 36ddee7c1641ecb8b65b2363b90dddf7aabaa38e -Merge: b0eb065 73225c3 -Author: Xiongtao Dai -Date: Wed Jun 3 13:52:59 2015 -0700 - - Merge remote-tracking branch 'upstream/master' - -commit b0eb0659acb17fab7eb1d90d0c5d3e21f677665f -Author: Xiongtao Dai -Date: Wed Jun 3 13:52:54 2015 -0700 - - tmp - -M R/GetSmoothedCovarSurface.R -M notesXiongtao.txt - -commit 73225c3e9c001633ff8f37777dfb1087a73f24d5 -Author: dmchris -Date: Tue Jun 2 02:53:05 2015 -0700 - - Modify pc_covE with rotationCut option - -M R/pc_covE.R - -commit 54788837df83153893656d61197ef09aa138ab80 -Merge: 17564d0 94e9528 -Author: Pantelis -Date: Mon Jun 1 19:35:18 2015 -0700 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit 17564d08c92c76d902460c987863110506c5d142 -Author: Pantelis -Date: Mon Jun 1 19:33:49 2015 -0700 - - renaming and cleaning up variables, added options for rotation cut & out percent - -M R/BinData.R -M R/BinRawCov.R -M R/CVlwls1d.R -M R/CheckOptions.R -M R/CreateOptions.R -M R/CreateTrueMean.R -M R/FPCA.R -M R/GetBinNum.R -M R/GetBinnedDataset.R -M R/GetRawCov.R -M R/GetSmoothedCovarSurface.R -M R/GetSmoothedMeanCurve.R -M R/IsRegular.R -M R/SetOptions.R -M R/adjustBW1.R -M R/adjustBW2.R -M R/convertMuPhi.R -M R/gcvlwls1d0.R -M R/gcvlwls1d1.R -M R/gcvlwls2d.R -M R/getEigens.R -M R/getMinb.R -M R/lwls1d.R -M R/lwls2d.R -M R/mapX1d.R -M R/no_FVE.R -M R/pc_covE.R -M R/rotateLwls2d.R -M tests/testthat/test_BinRawCov.R -M tests/testthat/test_GetSmoothedMeanCurve.R - -commit 94e9528f94aba0170349996ba249b1f7dbbb05f3 -Merge: 8118407 46ef864 -Author: Xiongtao -Date: Mon Jun 1 19:07:45 2015 +0100 - - Merge remote-tracking branch 'upstream/master' - -commit 8118407a1c9deb14deaa4187bef5584792144ce2 -Author: Xiongtao -Date: Mon Jun 1 19:07:13 2015 +0100 - - SmoothCov testcases - -M notesXiongtao.txt -M tests/test_GetSmoothedCovarSurface.R - -commit 46ef8640cf08893b3cba17a6b3a0521fca14b179 -Author: Pantelis -Date: Mon Jun 1 10:42:34 2015 -0700 - - Changes in the tests folder structure and minor fixes on the GetRawCov and gcvlwls1d1 - -M DESCRIPTION -M R/GetRawCov.R -M R/gcvlwls1d1.R -M notesXiongtao.txt -A tests/testthat.R -R100 tests/test_BinRawCov.R tests/testthat/test_BinRawCov.R -R100 tests/test_CheckData.R tests/testthat/test_CheckData.R -R100 tests/test_CreateEigenfncts.R tests/testthat/test_CreateEigenfncts.R -R100 tests/test_CreateTrueMean.R tests/testthat/test_CreateTrueMean.R -R100 tests/test_GetRawCov.R tests/testthat/test_GetRawCov.R -R100 tests/test_GetSmoothedCovarSurface.R tests/testthat/test_GetSmoothedCovarSurface.R -R100 tests/test_GetSmoothedMeanCurve.R tests/testthat/test_GetSmoothedMeanCurve.R -R100 tests/test_IsRegular.R tests/testthat/test_IsRegular.R -R100 tests/test_convertMuPhi.R tests/testthat/test_convertMuPhi.R -R100 tests/test_cvlwls1d.R tests/testthat/test_cvlwls1d.R -R100 tests/test_gcvlwls1d1.R tests/testthat/test_gcvlwls1d1.R -R100 tests/test_gcvlwls2d.R tests/testthat/test_gcvlwls2d.R -R100 tests/test_getEigens.R tests/testthat/test_getEigens.R -R100 tests/test_getMinb.R tests/testthat/test_getMinb.R -R100 tests/test_lwls.R tests/testthat/test_lwls.R -R100 tests/test_lwls1.csv tests/testthat/test_lwls1.csv -R100 tests/test_lwls2d.R tests/testthat/test_lwls2d.R -R100 tests/test_mapX1d.R tests/testthat/test_mapX1d.R -R100 tests/test_minb.R tests/testthat/test_minb.R -R100 tests/test_pc_covE.R tests/testthat/test_pc_covE.R -R100 tests/test_rotateLwls2d.R tests/testthat/test_rotateLwls2d.R -R100 tests/test_useBin.R tests/testthat/test_useBin.R -R100 tests/test_wiener.R tests/testthat/test_wiener.R - -commit e48648db4b5e493910e6aa0412ded0cea0a5e280 -Author: Xiongtao -Date: Mon Jun 1 09:20:17 2015 +0100 - - some tests and small modifications - -M R/GetSmoothedCovarSurface.R -M R/getMinb.R -M R/lwls2d.R -M R/rotateLwls2d.R -M tests/test_GetSmoothedCovarSurface.R -M tests/test_gcvlwls2d.R -M tests/test_pc_covE.R -M tests/test_rotateLwls2d.R - -commit 429769d2a5b41b560c34f4b9926015f1330a8a54 -Author: Xiongtao -Date: Mon Jun 1 00:56:46 2015 +0100 - - binned 2D smoother - -A R/BinRawCov.R -M R/gcvlwls2d.R -A tests/test_BinRawCov.R -M tests/test_gcvlwls2d.R -M tests/test_lwls2d.R -M tests/test_rotateLwls2d.R - -commit c469bd2cb385ae5fe327e16b66858362e546cfc9 -Author: Xiongtao -Date: Sun May 31 21:24:22 2015 +0100 - - tmp - -M R/GetSmoothedCovarSurface.R -M R/gcvlwls2d.R -M R/getMinb.R -R070 tests/test_gcv_lwls2d.R tests/test_gcvlwls2d.R -M tests/test_getMinb.R - -commit 63bf1dc2b22280680f4da7b4e1fbf035bcf7a383 -Merge: c9481a5 3ecdce2 -Author: Xiongtao -Date: Sun May 31 08:20:04 2015 +0100 - - ours - -commit c9481a5f7e9a9e4537dfd280b2fa4b4d56088617 -Author: Xiongtao -Date: Sun May 31 08:14:02 2015 +0100 - - tmp - -M R/GetSmoothedCovarSurface.R -M R/gcvlwls2d.R -M tests/test_GetSmoothedCovarSurface.R - -commit 3ecdce2b9af1c5e31faf042c8a38f6326b5afd9d -Author: hadjipantelis -Date: Sun May 31 00:09:55 2015 -0700 - - Changing SetOptions.R - -M R/SetOptions.R - -commit 4ae1cb16f5ad1189f1c91525478ff3b9348e1295 -Author: hadjipantelis -Date: Sat May 30 23:45:50 2015 -0700 - - Remove ..Rcheck folder - -D ..Rcheck/00check.log -D ..Rcheck/00install.out -D ..Rcheck/tPACE/DESCRIPTION -D ..Rcheck/tPACE/Meta/Rd.rds -D ..Rcheck/tPACE/Meta/data.rds -D ..Rcheck/tPACE/Meta/hsearch.rds -D ..Rcheck/tPACE/Meta/links.rds -D ..Rcheck/tPACE/Meta/nsInfo.rds -D ..Rcheck/tPACE/Meta/package.rds -D ..Rcheck/tPACE/NAMESPACE -D ..Rcheck/tPACE/R/tPACE -D ..Rcheck/tPACE/R/tPACE.rdb -D ..Rcheck/tPACE/R/tPACE.rdx -D ..Rcheck/tPACE/data/Rdata.rdb -D ..Rcheck/tPACE/data/Rdata.rds -D ..Rcheck/tPACE/data/Rdata.rdx -D ..Rcheck/tPACE/help/AnIndex -D ..Rcheck/tPACE/help/aliases.rds -D ..Rcheck/tPACE/help/paths.rds -D ..Rcheck/tPACE/help/tPACE.rdb -D ..Rcheck/tPACE/help/tPACE.rdx -D ..Rcheck/tPACE/html/00Index.html -D ..Rcheck/tPACE/html/R.css -D ..Rcheck/tests/startup.Rs -D ..Rcheck/tests/test_CheckData.R -D ..Rcheck/tests/test_CheckData.Rout.fail -D ..Rcheck/tests/test_CreateEigenfncts.R -D ..Rcheck/tests/test_CreateTrueMean.R -D ..Rcheck/tests/test_GetRawCov.R -D ..Rcheck/tests/test_GetSmoothedCovarSurface.R -D ..Rcheck/tests/test_GetSmoothedMeanCurve.R -D ..Rcheck/tests/test_IsRegular.R -D ..Rcheck/tests/test_convertMuPhi.R -D ..Rcheck/tests/test_cvlwls1d.R -D ..Rcheck/tests/test_gcv_lwls2d.R -D ..Rcheck/tests/test_gcvlwls1d1.R -D ..Rcheck/tests/test_getEigens.R -D ..Rcheck/tests/test_getMinb.R -D ..Rcheck/tests/test_lwls.R -D ..Rcheck/tests/test_lwls1.csv -D ..Rcheck/tests/test_lwls2d.R -D ..Rcheck/tests/test_mapX1d.R -D ..Rcheck/tests/test_minb.R -D ..Rcheck/tests/test_pc_covE.R -D ..Rcheck/tests/test_rotateLwls2d.R -D ..Rcheck/tests/test_useBin.R -D ..Rcheck/tests/test_wiener.R - -commit c9d8823bd8c5624f514884765d44a40468bf40ec -Author: hadjipantelis -Date: Sat May 30 23:41:44 2015 -0700 - - Fixing issues at "tests" - -A ..Rcheck/00check.log -A ..Rcheck/00install.out -A ..Rcheck/tPACE/DESCRIPTION -A ..Rcheck/tPACE/Meta/Rd.rds -A ..Rcheck/tPACE/Meta/data.rds -A ..Rcheck/tPACE/Meta/hsearch.rds -A ..Rcheck/tPACE/Meta/links.rds -A ..Rcheck/tPACE/Meta/nsInfo.rds -A ..Rcheck/tPACE/Meta/package.rds -A ..Rcheck/tPACE/NAMESPACE -A ..Rcheck/tPACE/R/tPACE -A ..Rcheck/tPACE/R/tPACE.rdb -A ..Rcheck/tPACE/R/tPACE.rdx -A ..Rcheck/tPACE/data/Rdata.rdb -A ..Rcheck/tPACE/data/Rdata.rds -A ..Rcheck/tPACE/data/Rdata.rdx -A ..Rcheck/tPACE/help/AnIndex -A ..Rcheck/tPACE/help/aliases.rds -A ..Rcheck/tPACE/help/paths.rds -A ..Rcheck/tPACE/help/tPACE.rdb -A ..Rcheck/tPACE/help/tPACE.rdx -A ..Rcheck/tPACE/html/00Index.html -A ..Rcheck/tPACE/html/R.css -A ..Rcheck/tests/startup.Rs -A ..Rcheck/tests/test_CheckData.R -A ..Rcheck/tests/test_CheckData.Rout.fail -A ..Rcheck/tests/test_CreateEigenfncts.R -A ..Rcheck/tests/test_CreateTrueMean.R -A ..Rcheck/tests/test_GetRawCov.R -A ..Rcheck/tests/test_GetSmoothedCovarSurface.R -A ..Rcheck/tests/test_GetSmoothedMeanCurve.R -A ..Rcheck/tests/test_IsRegular.R -A ..Rcheck/tests/test_convertMuPhi.R -A ..Rcheck/tests/test_cvlwls1d.R -A ..Rcheck/tests/test_gcv_lwls2d.R -A ..Rcheck/tests/test_gcvlwls1d1.R -A ..Rcheck/tests/test_getEigens.R -A ..Rcheck/tests/test_getMinb.R -A ..Rcheck/tests/test_lwls.R -A ..Rcheck/tests/test_lwls1.csv -A ..Rcheck/tests/test_lwls2d.R -A ..Rcheck/tests/test_mapX1d.R -A ..Rcheck/tests/test_minb.R -A ..Rcheck/tests/test_pc_covE.R -A ..Rcheck/tests/test_rotateLwls2d.R -A ..Rcheck/tests/test_useBin.R -A ..Rcheck/tests/test_wiener.R -M R/CheckData.R -M R/SetOptions.R -M tests/test_GetRawCov.R -M tests/test_GetSmoothedCovarSurface.R -M tests/test_cvlwls1d.R -M tests/test_getEigens.R -M tests/test_lwls.R -M tests/test_lwls2d.R -M tests/test_mapX1d.R -M tests/test_pc_covE.R - -commit 96ee7ff0dd9a9868dd41185357b57fc11604225e -Author: dmchris -Date: Sat May 30 21:08:00 2015 -0700 - - bug fix: cyy -> cxxn - -M R/pc_covE.R - -commit 45cc7ee13ac6309c8b69b749eb150a27fed77304 -Merge: 8e5b799 1f6913f -Author: Xiongtao -Date: Sun May 31 05:01:21 2015 +0100 - - Merge remote-tracking branch 'upstream/master' - -commit 8e5b7995ae94595a7e4171682f8252ef3d0918af -Author: Xiongtao -Date: Sun May 31 04:59:43 2015 +0100 - - minor - -M R/GetSmoothedCovarSurface.R - -commit 1f6913f1c390aec2cf274d7ce483bb0f19ba1580 -Author: dmchris -Date: Sat May 30 20:08:29 2015 -0700 - - library control - -M DESCRIPTION - -commit 35ebaadfd7d243c9431d910cd18ab33cc58cda0f -Author: dmchris -Date: Sat May 30 20:04:45 2015 -0700 - - tab -> 2 spaces - -M R/pc_covE.R - -commit 7df0e409960362b9ee4eaa9a01f0efdfdbef3f4f -Merge: 560121b e18c9df -Author: dmchris -Date: Sat May 30 19:59:46 2015 -0700 - - library control - -commit 560121b1428f45afaefd9e2915bed8ec7693c31a -Author: dmchris -Date: Sat May 30 19:55:36 2015 -0700 - - Merge remote-tracking branch 'origin/master' - - Conflicts: - R/pc_covE.R - -M DESCRIPTION -M R/GetSmoothedCovarSurface.R -M R/gcvlwls2d.R -M R/no_FVE.R -M R/pc_covE.R -D tests/GetSmoothedCovarSurface.R -D tests/pc_covE.R -R100 tests/GetRawCov.R tests/test_GetRawCov.R -A tests/test_GetSmoothedCovarSurface.R -R100 tests/convertMuPhi.R tests/test_convertMuPhi.R -R100 tests/gcv_lwls2d.R tests/test_gcv_lwls2d.R -R100 tests/getMinb.R tests/test_getMinb.R -R100 tests/lwls.R tests/test_lwls.R -R100 tests/lwls1.csv tests/test_lwls1.csv -R100 tests/lwls2d.R tests/test_lwls2d.R -A tests/test_pc_covE.R -R100 tests/rotateLwls2d.R tests/test_rotateLwls2d.R -R100 tests/useBin.R tests/test_useBin.R -R100 tests/wiener.R tests/test_wiener.R - -commit e18c9df905b869482d5ddeaac4a1c493bf4ff6f5 -Author: Xiongtao -Date: Sat May 30 23:51:11 2015 +0100 - - modified pc_covE - -M R/GetSmoothedCovarSurface.R -M R/pc_covE.R -M tests/test_pc_covE.R - -commit 4fe52142991b49b81cf60e9f305a4293094f3f16 -Author: Xiongtao -Date: Sat May 30 22:40:00 2015 +0100 - - rename tests - -R100 tests/GetRawCov.R tests/test_GetRawCov.R -R100 tests/GetSmoothedCovarSurface.R tests/test_GetSmoothedCovarSurface.R -R100 tests/convertMuPhi.R tests/test_convertMuPhi.R -R100 tests/gcv_lwls2d.R tests/test_gcv_lwls2d.R -R100 tests/getMinb.R tests/test_getMinb.R -R100 tests/lwls.R tests/test_lwls.R -R100 tests/lwls1.csv tests/test_lwls1.csv -R100 tests/lwls2d.R tests/test_lwls2d.R -R100 tests/pc_covE.R tests/test_pc_covE.R -R100 tests/rotateLwls2d.R tests/test_rotateLwls2d.R -R100 tests/useBin.R tests/test_useBin.R -R100 tests/wiener.R tests/test_wiener.R - -commit 2f7d6fcc3a22154cb8957939729bcdb5f72520ce -Merge: 83c778d fbfc641 -Author: Xiongtao -Date: Sat May 30 22:15:30 2015 +0100 - - Merge remote-tracking branch 'upstream/master' - -commit fbfc641275d4173b8a686deb9233cbcdf6eb7e14 -Author: dmchris -Date: Sat May 30 06:17:23 2015 -0700 - - revised pc_covE.R for sigma^2 estimation and its test function for dense and sparse data - -M R/pc_covE.R -A tests/pc_covE.R - -commit 1543fe9fb234fe3a8292e354dee68759c8da2aa5 -Author: dmchris -Date: Sat May 30 05:35:15 2015 -0700 - - tpairn is now N by 2; added output: diag, a 2-column matrix for diagonal raw cov - - Please look at the description of diag in comment part. - -M R/GetRawCov.R - -commit ccf7f4a4ea91a3311fc391495879803c42fcc2f6 -Author: Pantelis -Date: Fri May 29 20:05:05 2015 -0700 - - Fixed transposition issue with tpairn arguments - -M R/GetRawCov.R - -commit 69ffafc8f9291a8444d4bb74191d3a3930c2f1e0 -Author: Pantelis -Date: Fri May 29 19:59:19 2015 -0700 - - Fixing Set/Check Options, added CreateOptions, added basic GetSmoothedMeanCurve test - -M R/CheckOptions.R -A R/CreateOptions.R -M R/FPCA.R -M R/GetSmoothedMeanCurve.R -M R/SetOptions.R -A tests/test_GetSmoothedMeanCurve.R - -commit 83c778d2f13c81c2cf9a718cb14c15726058a92b -Merge: 6724c71 76dbfbb -Author: Xiongtao -Date: Sat May 30 03:30:46 2015 +0100 - - Merge remote-tracking branch 'upstream/master' - -commit 6724c71093a14aac1377f61253d44469d8c12afe -Author: Xiongtao -Date: Sat May 30 03:30:33 2015 +0100 - - minor - -M R/GetSmoothedCovarSurface.R -M R/gcvlwls2d.R -M tests/GetSmoothedCovarSurface.R - -commit 76dbfbb850fe155d08b78a8e4ca52b25743fe763 -Merge: 3bbde52 53bab32 -Author: Pantelis -Date: Fri May 29 17:49:47 2015 -0700 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - - Conflicts: - R/SetOptions.R - -commit 3bbde52eb0fc15db5fd4168c2abe7d4ea97e4cf4 -Author: Pantelis -Date: Fri May 29 17:40:05 2015 -0700 - - Fixing the Set/Check Options.R - -M R/FPCA.R -M R/SetOptions.R - -commit 53bab3236bede4bf9c5d2616f80312accb4dacdb -Author: dmchris -Date: Fri May 29 17:05:11 2015 -0700 - - function for sigma^2 estimation, integral test required - -A R/pc_covE.R - -commit 26a42a2881878773ca0f9449bc3ea7e21f6e3a58 -Author: Xiongtao -Date: Fri May 29 23:12:09 2015 +0100 - - working version of SmoothCov - -M R/FPCA.R -M R/GetSmoothedCovarSurface.R -M R/SetOptions.R -M R/gcvlwls2d.R -M R/lwls2d.R -M notesXiongtao.txt -A tests/GetSmoothedCovarSurface.R -M tests/gcv_lwls2d.R -A tests/useBin.R - -commit 6e1815e7d6addb4ad92888074fd3fda1a57fc574 -Merge: 2c406bc b7e289d -Author: Xiongtao Dai -Date: Fri May 29 11:36:00 2015 -0700 - - Merge remote-tracking branch 'upstream/master' - -commit 2c406bca3d0f673e79dcd8108fcbbc715cfbc775 -Author: Xiongtao Dai -Date: Fri May 29 11:35:43 2015 -0700 - - minor - -M R/GetSmoothedCovarSurface.R -M notesXiongtao.txt - -commit b7e289dbf645f572579e142543aab9be99cf504f -Author: Pantelis -Date: Thu May 28 19:29:56 2015 -0700 - - Changed GCV/CV/etc. options from numeric to words, Added options for binning, Added basic basic binning cap. - -M R/BinData.R -M R/CheckOptions.R -M R/FPCA.R -M R/GetBinnedCurve.R -A R/GetBinnedDataset.R -M R/GetSmoothedMeanCurve.R -M R/SetOptions.R - -commit 87a610887ffdc84c2411791568cb2de3e2c065e3 -Author: Xiongtao Dai -Date: Thu May 28 11:33:21 2015 -0700 - - clean - -D R/gcvlwls2d1.R - -commit c3cd65bd307efe6d2507c24d13dec186237ba5fe -Author: Pantelis -Date: Wed May 27 17:39:11 2015 -0700 - - intefrace specifications - -D mt19937ar.c -D mt19937ar.out - -commit 564aa0b2ffe158ebd18cb2e0cb713021f099ed09 -Author: Pantelis -Date: Wed May 27 17:38:42 2015 -0700 - - intefrace specifications - -D R/.FPCA.R.swp -M R/FPCA.R -M R/GetSmoothedCovarSurface.R -M R/getEigens.R -A mt19937ar.c -A mt19937ar.out - -commit edf3bd54f30065db97e0ed41155d6ef462a7e2e8 -Author: Pantelis -Date: Wed May 27 11:44:10 2015 -0700 - - Minor things - -M R/FPCA.R -A R/GetSmoothedCovarSurface.R -M R/gcvlwls2d1.R -M tests/gcv_lwls2d.R - -commit 43403c2c7f74b8956c68808de00e0cbdba5aa327 -Author: hadjipantelis -Date: Tue May 26 02:32:02 2015 -0700 - - Added test_cvlwls1d.R - -A tests/test_cvlwls1d.R - -commit 4880570d23e40f1a5fff722472c4f5cb13324d9e -Author: hadjipantelis -Date: Tue May 26 02:18:46 2015 -0700 - - Added cvlwls1d.R and the related test - -A R/CVlwls1d.R -M R/GetSmoothedMeanCurve.R - -commit 8466ed2cd00c65e8e7fd0d04e79718c8e3f35ec1 -Author: Xiongtao -Date: Tue May 26 02:17:57 2015 +0100 - - added convertMuphi and modified mapX1d - -A R/convertMuPhi.R -M R/mapX1d.R -A tests/convertMuPhi.R - -commit c19daf5379c2a0a71c108709ca284af0f64a2989 -Author: Xiongtao -Date: Tue May 26 01:47:08 2015 +0100 - - changed desc - -M DESCRIPTION -M run_tests.R - -commit ae0baf76d8f3273356fd82f534156159c9a28b2b -Author: Xiongtao -Date: Tue May 26 01:42:51 2015 +0100 - - changed desc, added namespace - -M DESCRIPTION -A NAMESPACE -M R/mapX1d.R - -commit ee428f7eeb733b59f2958d2c447e381587613898 -Author: Pantelis -Date: Mon May 25 17:21:37 2015 -0700 - - Populating FPCA.R - Adding the GetSmoothedMeanCurve.R - -A R/.FPCA.R.swp -M R/CheckOptions.R -M R/FPCA.R -A R/GetSmoothedMeanCurve.R - -commit 83d2b382cffd8bfc461a0d8c4e6793c9dd5f39b8 -Author: Pantelis -Date: Fri May 22 17:07:32 2015 -0700 - - Added getEigens.R and populated the DESCRIPTION a bit - -A DESCRIPTION -A R/getEigens.R -A data/xcovForGetEigens1.csv -A tests/test_getEigens.R - -commit c35965e4f26abb9438710b35c824df3815b46289 -Merge: e4e9d8e bc6b4fc -Author: Xiongtao Dai -Date: Wed May 20 21:16:11 2015 -0700 - - Merge branch 'master' of github.com:hadjipantelis/tPACE - -commit e4e9d8e15e841681eb46744ed932ccfd73641848 -Author: Xiongtao Dai -Date: Wed May 20 18:02:40 2015 -0700 - - reorganize - -R099 BinData.R R/BinData.R -R100 CheckData.R R/CheckData.R -R100 CheckOptions.R R/CheckOptions.R -R100 CreateEigenfncts.R R/CreateEigenfncts.R -R100 CreateTrueMean.R R/CreateTrueMean.R -R100 FPCA.R R/FPCA.R -R100 GetBinNum.R R/GetBinNum.R -R100 GetBinnedCurve.R R/GetBinnedCurve.R -R100 GetRawCov.R R/GetRawCov.R -R100 IsRegular.R R/IsRegular.R -R100 SetOptions.R R/SetOptions.R -R100 adjustBW1.R R/adjustBW1.R -R100 adjustBW2.R R/adjustBW2.R -R100 gcvlwls1d0.R R/gcvlwls1d0.R -R100 gcvlwls1d1.R R/gcvlwls1d1.R -R100 gcvlwls2d.R R/gcvlwls2d.R -R100 gcvlwls2d1.R R/gcvlwls2d1.R -R100 getCount.R R/getCount.R -R100 getMinb.R R/getMinb.R -R100 lwls1d.R R/lwls1d.R -R100 lwls2d.R R/lwls2d.R -R100 mapX1d.R R/mapX1d.R -R100 minb.R R/minb.R -R100 no_FVE.R R/no_FVE.R -R100 rotateLwls2d.R R/rotateLwls2d.R -R100 wiener.R R/wiener.R -M notesXiongtao.txt - -commit bc6b4fc261a8b427e1c1b6500451ff9f7d4ce60b -Author: dmchris -Date: Mon May 18 23:17:55 2015 -0700 - - modify adjustBW1, adjustBW2, regular code 2->Dense - -M adjustBW1.R -M adjustBW2.R - -commit d536e961628f0f8864916ea930175a79b9e84e0b -Author: Xiongtao Dai -Date: Mon May 18 17:19:52 2015 -0700 - - rotate - -M gcvlwls2d.R -M lwls1d.R -M lwls2d.R -M notesXiongtao.txt -A rotateLwls2d.R -A tests/rotateLwls2d.R - -commit bca3a8aa3907b1af458eeccf7f5f39a79e05fee9 -Author: Xiongtao -Date: Sun May 17 23:56:24 2015 +0100 - - CV for 2D smoother - -M gcvlwls2d.R -M lwls2d.R -M tests/gcv_lwls2d.R - -commit ef8123d2ae6746e583b15c49aca20462e6a7c94e -Author: CrossD -Date: Sun May 17 01:48:08 2015 -0700 - - gcvlwls2d with getMinb - -M GetRawCov.R -M gcvlwls2d.R -A getCount.R -M getMinb.R -M tests/gcv_lwls2d.R -M tests/getMinb.R - -commit 69689858e434476d98f8d3ca30ec4c20abc722a3 -Author: CrossD -Date: Sat May 16 18:52:19 2015 -0700 - - gcvlwls2d raw - -M GetRawCov.R -A gcvlwls2d.R -A gcvlwls2d1.R -A getMinb.R -M lwls2d.R -M notesXiongtao.txt -A tests/GetRawCov.R -A tests/gcv_lwls2d.R -A tests/getMinb.R -M tests/lwls.R -M tests/lwls2d.R -A tests/wiener.R -A wiener.R - -commit 097222b692e71993b90a04e68ef9b7123420af76 -Merge: 339e558 1a0dfb7 -Author: CrossD -Date: Sat May 16 11:40:51 2015 -0700 - - Merge remote-tracking branch 'upstream/master' - -commit 1a0dfb7fa6fe565b5a7a019332a7a9fabf3d752f -Author: hadjipantelis -Date: Mon May 11 23:43:08 2015 -0700 - - GetRawCov.R fix-up - -M GetRawCov.R - -commit 339e558d8358f4197c8e715bc40fd5c098e236ad -Merge: 820ee48 90aa41c -Author: Xiongtao Dai -Date: Sun May 10 13:38:26 2015 -0700 - - merge - -commit 820ee4888c6037e5a47da927d3466e1b14f2706f -Author: Xiongtao Dai -Date: Sun May 10 13:38:11 2015 -0700 - - update lwls2d - -M lwls2d.R -M notesXiongtao.txt -M tests/lwls2d.R - -commit 90aa41ce0298cbfdf91bd429954f70d0351d644c -Merge: 7b11ca2 d63a0ad -Author: Pantelis -Date: Fri May 8 22:58:00 2015 -0700 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit 7b11ca2dfe71e14439e0888fd6f81f68849685d5 -Author: Pantelis -Date: Fri May 8 22:56:00 2015 -0700 - - gcvlwls1d*.R and ones test - -M CheckOptions.R -M SetOptions.R -A data/dataForGcvLwls.RData -A data/dataForGcvLwlsTest.RData -A gcvlwls1d0.R -A gcvlwls1d1.R -A tests/test_gcvlwls1d1.R - -commit d63a0ad3adc1ac6ebfb0b083a51970bc3f2bcd22 -Author: dmchris -Date: Fri May 8 17:44:40 2015 -0700 - - no_FVE: change LM to LR - -M no_FVE.R - -commit c599098e3bb5464e83ac474fe8cb19317fbbdb71 -Author: dmchris -Date: Thu May 7 23:53:16 2015 -0700 - - modify adjustBW2.R - - Delete an unused argument: npoly. - -M adjustBW2.R - -commit aa65e40ee9980f7d5680ed00fa9ae67177c7612e -Author: dmchris -Date: Thu May 7 23:51:23 2015 -0700 - - add no_FVE.R - - The function selects optimal number of FPCs using FVE criterion. One - thing to note is “LM” or “LR” in eigen-decomposition. - -A no_FVE.R - -commit 997086ccd77083b3d9388f36361564899c27b344 -Merge: 5de20e6 9fdeb6f -Author: Xiongtao Dai -Date: Tue May 5 15:25:59 2015 -0700 - - merged with lwls2d added. - -commit 5de20e6a0b337a215155ad75ec44793ba7dc7ae4 -Author: Xiongtao Dai -Date: Tue May 5 15:25:35 2015 -0700 - - lwls2d - -A lwls2d.R -A tests/lwls2d.R - -commit 9fdeb6f827a6d5650f51d273b2e3146dcaf93d9a -Author: Pantelis -Date: Mon May 4 18:48:34 2015 -0700 - - Getting the Raw Covariance updates - -D .mapX1d.R.swp -M GetRawCov.R - -commit 1ccbdc748ebf4bc5d0d2efc18f764baa306a7bed -Merge: 8b9dc37 5955dd3 -Author: Xiongtao Dai -Date: Mon May 4 16:29:33 2015 -0700 - - Merge remote-tracking branch 'upstream/master' - -commit 8b9dc3748402cd2671915856cbd17f7dae24c806 -Author: Xiongtao Dai -Date: Mon May 4 16:28:49 2015 -0700 - - lwls1d - -M lwls1d.R -M tests/lwls.R - -commit 5955dd3ced02662c4ce61cf32e170c912b6221af -Merge: 142526e f90cc7e -Author: Pantelis -Date: Mon May 4 16:14:13 2015 -0700 - - Merge branch 'master' of https://github.com/hadjipantelis/tPACE - -commit 142526efde51d660a6e8c59c2dad3f710ce30a0a -Author: Pantelis -Date: Mon May 4 16:13:14 2015 -0700 - - Getting the Raw Covariance - -A .mapX1d.R.swp -A GetRawCov.R -M IsRegular.R -A data/dataForGetRawCov.RData -M mapX1d.R -M tests/test_IsRegular.R - -commit f90cc7e45ab35ba3eece6474746c23eab0cff781 -Author: dmchris -Date: Mon May 4 16:00:42 2015 -0700 - - adjustBW in R - - adjustBW1 and adjustBW2 are added for bwd modification for mean and cov - estimation. - -A adjustBW1.R -A adjustBW2.R - -commit d5deb7141ff145186a4b39c413440813945f05f5 -Author: Xiongtao Dai -Date: Mon May 4 10:07:12 2015 -0700 - - lwls1d added - -A lwls1d.R -A tests/lwls.R -A tests/lwls1.csv - -commit 7e420aa95a457f8427d38b5ebd2d22b12a2de7e4 -Merge: 6ea0cdc 0a38e63 -Author: Xiongtao Dai -Date: Sun May 3 17:22:23 2015 -0700 - - Merge remote-tracking branch 'upstream/master' - -commit 6ea0cdc1835caaef5d68353e46f0d0289c37d918 -Author: Xiongtao Dai -Date: Sun May 3 03:09:55 2015 -0700 - - notes added - -A notesXiongtao.txt - -commit 0a38e6314ec8b230b6aba2d5e12a270d73b79b43 -Author: Pantelis -Date: Fri May 1 18:53:18 2015 -0700 - - Building up mapX1d function and tests - -D .minb.R.swp -A mapX1d.R -M tests/test_IsRegular.R -A tests/test_mapX1d.R -M tests/test_minb.R - -commit e722462e5e1d6044257c734640c2a86203315af4 -Author: Pantelis -Date: Fri May 1 17:53:48 2015 -0700 - - Replacing is regular - -A tests/test_IsRegular.R - -commit 903000124419bc20728c1b77745fa1be24799c02 -Author: Pantelis -Date: Fri May 1 17:50:43 2015 -0700 - - Building up minb function and tests - -R100 tests/test_IsRegular.R tests/test_minb.R - -commit e876fc22f21cf85a07a3d8b3332b4a751e5479b3 -Author: Pantelis -Date: Fri May 1 17:48:19 2015 -0700 - - Building up minb function and tests - -D .CheckOptions.R.swp -R085 .CheckData.R.swp .minb.R.swp -M BinData.R -M GetBinNum.R -A minb.R -M tests/test_IsRegular.R - -commit d6fdc4522e6d985c8a123b009587b5c4b74beccd -Author: Pantelis -Date: Fri May 1 14:25:21 2015 -0700 - - Making a basic dataset and correcting some typo comments - -A .CheckOptions.R.swp -M FPCA.R -M SetOptions.R -A data/.swo -A data/.swp -A data/dataGeneratedByExampleSeed123.RData - -commit 51370bc1108f1dd631da4b2c058a5af0961f9676 -Author: Pantelis -Date: Fri May 1 13:34:41 2015 -0700 - - basic little changes / adding ROxygen comments - -A .CheckData.R.swp -M CheckData.R -M CheckOptions.R -M FPCA.R - -commit 6f167b0b0e41ca973f8fd2f81e1c480227c4010e -Author: Pantelis -Date: Mon Apr 27 19:24:32 2015 -0700 - - Removed some system files - -D .project -D .settings/de.walware.r.core.prefs - -commit e9e1a97c9cdd3ba9800fa6349aacd4a5be909f2a -Author: Pantelis -Date: Mon Apr 27 19:20:14 2015 -0700 - - First commit - -A .project -A .settings/de.walware.r.core.prefs -A BinData.R -A CheckData.R -A CheckOptions.R -A CreateEigenfncts.R -A CreateTrueMean.R -A FPCA.R -A GetBinNum.R -A GetBinnedCurve.R -A IsRegular.R -A SetOptions.R -A run_tests.R -A tests/test_CheckData.R -A tests/test_CreateEigenfncts.R -A tests/test_CreateTrueMean.R -A tests/test_IsRegular.R diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/inst/doc/fdapaceVig.R b/fdapace.Rcheck/00_pkg_src/fdapace/inst/doc/fdapaceVig.R deleted file mode 100644 index 3b332637..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/inst/doc/fdapaceVig.R +++ /dev/null @@ -1,110 +0,0 @@ -## ----setup, include=FALSE------------------------------------------------ -knitr::opts_chunk$set(echo = TRUE) - -## ----eval=FALSE---------------------------------------------------------- -# FPCAobj <- FPCA(Ly=yList, Lt=tList) - -## ----eval=TRUE, echo=TRUE------------------------------------------------ - library(fdapace) - - # Set the number of subjects (N) and the - # number of measurements per subjects (M) - N <- 200; - M <- 100; - set.seed(123) - - # Define the continuum - s <- seq(0,10,length.out = M) - - # Define the mean and 2 eigencomponents - meanFunct <- function(s) s + 10*exp(-(s-5)^2) - eigFunct1 <- function(s) +cos(2*s*pi/10) / sqrt(5) - eigFunct2 <- function(s) -sin(2*s*pi/10) / sqrt(5) - - # Create FPC scores - Ksi <- matrix(rnorm(N*2), ncol=2); - Ksi <- apply(Ksi, 2, scale) - Ksi <- Ksi %*% diag(c(5,2)) - - # Create Y_true - yTrue <- Ksi %*% t(matrix(c(eigFunct1(s),eigFunct2(s)), ncol=2)) + t(matrix(rep(meanFunct(s),N), nrow=M)) - -## ----eval=TRUE, echo=TRUE------------------------------------------------ - L3 <- MakeFPCAInputs(IDs = rep(1:N, each=M), tVec=rep(s,N), t(yTrue)) - FPCAdense <- FPCA(L3$Ly, L3$Lt) - - # Plot the FPCA object - plot(FPCAdense) - - # Find the standard deviation associated with each component - sqrt(FPCAdense$lambda) - - -## ----eval=TRUE, echo=TRUE------------------------------------------------ - # Create sparse sample - # Each subject has one to five readings (median: 3) - set.seed(123) - ySparse <- Sparsify(yTrue, s, sparsity = c(1:5)) - - # Give your sample a bit of noise - ySparse$yNoisy <- lapply(ySparse$Ly, function(x) x + 0.5*rnorm(length(x))) - - # Do FPCA on this sparse sample - # Notice that sparse FPCA will smooth the data internally (Yao et al., 2005) - # Smoothing is the main computational cost behind sparse FPCA - FPCAsparse <- FPCA(ySparse$yNoisy, ySparse$Lt, list(plot = TRUE)) - - -## ----eval=TRUE, echo=TRUE------------------------------------------------ - FPCAsparseMuBW5 <- FPCA(ySparse$yNoisy, ySparse$Lt, optns= list(userBwMu = 5)) - -## ----eval=TRUE, echo=TRUE------------------------------------------------ -par(mfrow=c(1,2)) -CreatePathPlot( FPCAsparse, subset = 1:3, main = "GCV bandwidth", pch = 16) -CreatePathPlot( FPCAsparseMuBW5, subset = 1:3, main = "User-defined bandwidth", pch = 16) - -## ----eval=TRUE, echo=TRUE------------------------------------------------ - FPCAsparseRect <- FPCA(ySparse$yNoisy, ySparse$Lt, optns = list(kernel = 'rect')) # Use rectangular kernel - -## ----eval=TRUE, echo=TRUE------------------------------------------------ -SelectK( FPCAsparse, criterion = 'FVE', FVEthreshold = 0.95) # K = 2 -SelectK( FPCAsparse, criterion = 'AIC') # K = 2 - -## ----eval=TRUE, echo=TRUE------------------------------------------------ -fittedCurvesP0 <- fitted(FPCAsparse) # equivalent: fitted(FPCAsparse, derOptns=list(p = 0)); -# Get first order derivatives of fitted curves, smooth using Epanechnikov kernel -fittedCurcesP1 <- fitted(FPCAsparse, derOptns=list(p = 1, kernelType = 'epan')) - -## ----eval=TRUE, echo=TRUE------------------------------------------------ - # load data - data(medfly25) - - # Turn the original data into a list of paired amplitude and timing lists - Flies <- MakeFPCAInputs(medfly25$ID, medfly25$Days, medfly25$nEggs) - fpcaObjFlies <- FPCA(Flies$Ly, Flies$Lt, list(plot = TRUE, methodMuCovEst = 'smooth', userBwCov = 2)) - -## ----eval=TRUE, echo=TRUE------------------------------------------------ -par(mfrow=c(1,2)) - CreatePathPlot(fpcaObjFlies, subset = c(3,5,135), main = 'K = 11', pch = 4); grid() - CreatePathPlot(fpcaObjFlies, subset = c(3,5,135), K = 3, main = 'K = 3', pch = 4) ; grid() - -## ----eval=TRUE, echo=TRUE------------------------------------------------ -par(mfrow=c(1,2)) - CreateOutliersPlot(fpcaObjFlies, optns = list(K = 3, variant = 'KDE')) - CreateFuncBoxPlot(fpcaObjFlies, xlab = 'Days', ylab = '# of eggs laid', optns = list(K =3, variant='bagplot')) - -## ----eval=TRUE, echo=TRUE------------------------------------------------ -par(mfrow=c(1,2)) - CreatePathPlot(fpcaObjFlies, subset = c(3,5,135), K = 3, main = 'K = 3', showObs = FALSE) ; grid() - CreatePathPlot(fpcaObjFlies, subset = c(3,5,135), K = 3, main = 'K = 3', showObs = FALSE, derOptns = list(p = 1, bw = 1.01 , kernelType = 'epan') ) ; grid() - -## ----eval=TRUE, echo=TRUE------------------------------------------------ -fpcaObjFlies79 <- FPCA(Flies$Ly, Flies$Lt, list(nRegGrid = 79, methodMuCovEst = 'smooth', userBwCov = 2)) # Use 79 equidistant points for the support -CreateBWPlot(fpcaObjFlies79 , derOptns = list(p = 1, bw = 2.0 , kernelType = 'rect') ) - -## ----eval=TRUE, echo=TRUE------------------------------------------------ -A <- FClust(Flies$Ly, Flies$Lt, optnsFPCA = list(methodMuCovEst = 'smooth', userBwCov = 2, FVEthreshold = 0.90), k = 2) -# The Neg-Entropy Criterion can be found as: A$clusterObj@bestResult@criterionValue -CreatePathPlot( fpcaObjFlies, K=2, showObs=FALSE, lty=1, col= A$cluster, xlab = 'Days', ylab = '# of eggs laid') -grid() - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/inst/doc/fdapaceVig.Rmd b/fdapace.Rcheck/00_pkg_src/fdapace/inst/doc/fdapaceVig.Rmd deleted file mode 100644 index 34b25aaf..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/inst/doc/fdapaceVig.Rmd +++ /dev/null @@ -1,206 +0,0 @@ ---- -title: "Functional PCA in R" -author: "Hadjipantelis, Dai, Ji, Han, Muller & Wang - UC Davis, USA" -date: "1 December 2017" -bibliography: roxygen.bib -output: html_document -vignette: > - %\VignetteIndexEntry{Introduction to fdapace} - %\VignetteEngine{knitr::rmarkdown} - %\VignetteEncoding{UTF-8} ---- - -```{r setup, include=FALSE} -knitr::opts_chunk$set(echo = TRUE) -``` - -## Overview - -The basic work-flow behind the PACE approach for sparse functional data is as follows (see eg. [@Yao05; @Liu09] for more information): - -1. Calculate the smoothed mean $\hat{\mu}$ (using local linear smoothing) aggregating all the available readings together. -2. Calculate for each curve separately its own raw covariance and then aggregate all these raw covariances to generate the sample raw covariance. -3. Use the off-diagonal elements of the sample raw covariance to estimate the smooth covariance. -4. Perform eigenanalysis on the smoothed covariance to obtain the estimated eigenfunctions $\hat{\phi}$ and eigenvalues $\hat{\lambda}$, then project that smoothed covariance on a positive semi-definite surface [@Hall2008]. -5. Use Conditional Expectation (PACE step) to estimate the corresponding scores $\hat{\xi}$. -ie. \newline -$\hat{\xi}_{ik} = \hat{E}[\hat{\xi}_{ik}|Y_i] = \hat{\lambda}_k \hat{\phi}_{ik}^T \Sigma_{Y_i}^{-1}(Y_i-\hat{\mu}_i)$. - -As a working assumption a dataset is treated as sparse if it has on average less than 20, potentially irregularly sampled, measurements per subject. A user can manually change the automatically determined `dataType` if that is necessary. -For densely observed functional data simplified procedures are available to obtain the eigencomponents and associated functional principal components scores (see eg. [@Castro86] for more information). In particular in this case we: - -1. Calculate the cross-sectional mean $\hat{\mu}$. -2. Calculate the cross-sectional covariance surface (which is guaranteed to be positive semi-definite). -3. Perform eigenanalysis on the covariance to estimate the eigenfunctions $\hat{\phi}$ and eigenvalues $\hat{\lambda}$. -4. Use numerical integration to estimate the corresponding scores $\hat{\xi}$. - ie. \newline - $\hat{\xi}_{ik} = \int_0^T [ y(t) - \hat{\mu}(t)] \phi_i(t) dt$ - -In the case of sparse FPCA the most computational intensive part is the smoothing of the sample's raw covariance function. For this, we employ a local weighted bilinear smoother. - -A sibling MATLAB package for `fdapace` can be found in [here](http://www.stat.ucdavis.edu/PACE). - -## FPCA in R using fdapace - -The simplest scenario is that one has two lists `yList` and `tList` where `yList` is a list of vectors, each containing the observed values $Y_{ij}$ for the $i$th subject and `tList` is a list of vectors containing corresponding time points. In this case one uses: - -```{r,eval=FALSE} -FPCAobj <- FPCA(Ly=yList, Lt=tList) -``` -The generated `FPCAobj` will contain all the basic information regarding the desired FPCA. - -### Generating a toy dense functional dataset from scratch - - -```{r,eval=TRUE, echo=TRUE} - library(fdapace) - - # Set the number of subjects (N) and the - # number of measurements per subjects (M) - N <- 200; - M <- 100; - set.seed(123) - - # Define the continuum - s <- seq(0,10,length.out = M) - - # Define the mean and 2 eigencomponents - meanFunct <- function(s) s + 10*exp(-(s-5)^2) - eigFunct1 <- function(s) +cos(2*s*pi/10) / sqrt(5) - eigFunct2 <- function(s) -sin(2*s*pi/10) / sqrt(5) - - # Create FPC scores - Ksi <- matrix(rnorm(N*2), ncol=2); - Ksi <- apply(Ksi, 2, scale) - Ksi <- Ksi %*% diag(c(5,2)) - - # Create Y_true - yTrue <- Ksi %*% t(matrix(c(eigFunct1(s),eigFunct2(s)), ncol=2)) + t(matrix(rep(meanFunct(s),N), nrow=M)) -``` - -### Running FPCA on a dense dataset - -```{r,eval=TRUE, echo=TRUE} - L3 <- MakeFPCAInputs(IDs = rep(1:N, each=M), tVec=rep(s,N), t(yTrue)) - FPCAdense <- FPCA(L3$Ly, L3$Lt) - - # Plot the FPCA object - plot(FPCAdense) - - # Find the standard deviation associated with each component - sqrt(FPCAdense$lambda) - -``` -### Running FPCA on a sparse and noisy dataset - -```{r,eval=TRUE, echo=TRUE} - # Create sparse sample - # Each subject has one to five readings (median: 3) - set.seed(123) - ySparse <- Sparsify(yTrue, s, sparsity = c(1:5)) - - # Give your sample a bit of noise - ySparse$yNoisy <- lapply(ySparse$Ly, function(x) x + 0.5*rnorm(length(x))) - - # Do FPCA on this sparse sample - # Notice that sparse FPCA will smooth the data internally (Yao et al., 2005) - # Smoothing is the main computational cost behind sparse FPCA - FPCAsparse <- FPCA(ySparse$yNoisy, ySparse$Lt, list(plot = TRUE)) - -``` - -## Further functionality - - `FPCA` calculates the bandwidth utilized by each smoother using generalised cross-validation or $k$-fold cross-validation automatically. Dense data are not smoothed by default. The argument `methodMuCovEst` can be switched between `smooth` and `cross-sectional` if one wants to utilize different estimation techniques when work with dense data. - -The bandwidth used for estimating the smoothed mean and the smoothed covariance are available under `...bwMu` and `bwCov` respectively. Users can nevertheless provide their own bandwidth estimates: - -```{r,eval=TRUE, echo=TRUE} - FPCAsparseMuBW5 <- FPCA(ySparse$yNoisy, ySparse$Lt, optns= list(userBwMu = 5)) -``` -Visualising the fitted trajectories is a good way to see if the new bandwidth made any sense: - - -```{r,eval=TRUE, echo=TRUE} -par(mfrow=c(1,2)) -CreatePathPlot( FPCAsparse, subset = 1:3, main = "GCV bandwidth", pch = 16) -CreatePathPlot( FPCAsparseMuBW5, subset = 1:3, main = "User-defined bandwidth", pch = 16) -``` ---- - `FPCA` uses a Gaussian kernel when smoothing sparse functional data; other kernel types (eg. Epanechnikov/`epan`) are also available (see `?FPCA`). The kernel used for smoothing the mean and covariance surface is the same. It can be found under `$optns\$kernel` of the returned object. For instance, one can switch the default Gaussian kernel (`gauss`) for a rectangular kernel (`rect`) as follows: - -```{r,eval=TRUE, echo=TRUE} - FPCAsparseRect <- FPCA(ySparse$yNoisy, ySparse$Lt, optns = list(kernel = 'rect')) # Use rectangular kernel -``` - - `FPCA` returns automatically the smallest number of components required to explain 99.99% of a sample's variance. Using the function `selectK` one can determine the number of relevant components according to AIC, BIC or a different Fraction-of-Variance-Explained threshold. For example: - -```{r,eval=TRUE, echo=TRUE} -SelectK( FPCAsparse, criterion = 'FVE', FVEthreshold = 0.95) # K = 2 -SelectK( FPCAsparse, criterion = 'AIC') # K = 2 -``` -When working with functional data (usually not very sparse) the estimation of derivatives is often of interest. Using \texttt{fitted.FPCA} one can directly obtain numerical derivatives by defining the appropriate order `p`; `fdapace` provides for the first two derivatives ( `p =1` or `2`). Because the numerically differentiated data are smoothed the user can define smoothing specific arguments (see `?fitted.FPCA` for more information); the derivation is done by using the derivative of the linear fit. Similarly using the function `FPCAder` , one can augment an `FPCA` object with functional derivatives of a sample's mean function and eigenfunctions. - -```{r,eval=TRUE, echo=TRUE} -fittedCurvesP0 <- fitted(FPCAsparse) # equivalent: fitted(FPCAsparse, derOptns=list(p = 0)); -# Get first order derivatives of fitted curves, smooth using Epanechnikov kernel -fittedCurcesP1 <- fitted(FPCAsparse, derOptns=list(p = 1, kernelType = 'epan')) -``` - -## A real-world example - -We use the `medfly25` dataset that this available with `fdapace` to showcase `FPCA` and its related functionality. `medfly25` is a dataset containing the eggs laid from 789 medflies (Mediterranean fruit flies, Ceratitis capitata) during the first 25 days of their lives. It is a subset of the dataset used by Carey at al. (1998) [@Carey98]; only flies having lived at least 25 days are shown. The data are rather noisy, dense and with a characteristic flat start. For that reason in contrast with above we will use a smoothing estimating procedure despite having dense data. - -```{r,eval=TRUE, echo=TRUE} - # load data - data(medfly25) - - # Turn the original data into a list of paired amplitude and timing lists - Flies <- MakeFPCAInputs(medfly25$ID, medfly25$Days, medfly25$nEggs) - fpcaObjFlies <- FPCA(Flies$Ly, Flies$Lt, list(plot = TRUE, methodMuCovEst = 'smooth', userBwCov = 2)) -``` - -Based on the scree-plot we see that the first three components appear to encapsulate most of the relevant variation. The number of eigencomponents to reach a 99.99% FVE is $11$ but just $3$ eigencomponents are enough to reach a 95.0%. We can easily inspect the following visually, using the `CreatePathPlot` command. - -```{r,eval=TRUE, echo=TRUE} -par(mfrow=c(1,2)) - CreatePathPlot(fpcaObjFlies, subset = c(3,5,135), main = 'K = 11', pch = 4); grid() - CreatePathPlot(fpcaObjFlies, subset = c(3,5,135), K = 3, main = 'K = 3', pch = 4) ; grid() -``` - -One can perform outlier detection [@Febrero2007] as well as visualize data using a functional box-plot. To achieve these tasks one can use the functions `CreateOutliersPlot` nd `CreateFuncBoxPlot`. Different ranking methodologies (KDE, bagplot [@Rousseeuw1999,@Hyndman2010] or point-wise) are available and can potentially identify different aspects of a sample. For example here it is notable that the kernel density estimator `KDE` variant identifies two main clusters within the main body of sample. By construction the `bagplot` method would use a single bag and this feature would be lost. Both functions return a (temporarily) invisible copy of a list containing the labels associated with each of sample curve0 .`CreateOutliersPlot` returns a (temporarily) invisible copy of a list containing the labels associated with each of sample curve. -```{r,eval=TRUE, echo=TRUE} -par(mfrow=c(1,2)) - CreateOutliersPlot(fpcaObjFlies, optns = list(K = 3, variant = 'KDE')) - CreateFuncBoxPlot(fpcaObjFlies, xlab = 'Days', ylab = '# of eggs laid', optns = list(K =3, variant='bagplot')) -``` - -Functional data lend themselves naturally to questions about their rate of change; their derivatives. As mentioned previously using `fdapace` one can generate estimates of the sample's derivatives ( `fitted.FPCA`) or the derivatives of the principal modes of variation (`FPCAder`). In all cases, one defines a `derOptns` list of options to control the derivation parameters. Getting derivatives is obtained by using a local linear smoother as above. - -```{r,eval=TRUE, echo=TRUE} -par(mfrow=c(1,2)) - CreatePathPlot(fpcaObjFlies, subset = c(3,5,135), K = 3, main = 'K = 3', showObs = FALSE) ; grid() - CreatePathPlot(fpcaObjFlies, subset = c(3,5,135), K = 3, main = 'K = 3', showObs = FALSE, derOptns = list(p = 1, bw = 1.01 , kernelType = 'epan') ) ; grid() -``` - -We note that if finite support kernel types are used (eg. `rect` or `epan` ), bandwidths smaller than the distance between two adjacent points over which the data are registered onto will lead to (expected) `NaN` estimates. In case of dense data, the grid used is (by default) equal to the grid the data were originally registered on; in the case of sparse data, the grid used (by default) spans the range of the sample's supports and uses 51 points. A user can change the number of points using the argument `nRegGrid` . -One can investigate the effect a particular kernel type ( `kernelType` ) or bandwidth size (`bw`) has on the generated derivatives by using the function `CreateBWPlot` and providing a relevant `derOptns` list. This will generate estimates about the mean function $\mu(t)$ as well as the first two principal modes of variation $\phi_1(t)$ and $\phi_2(t)$ for different multiples of `bw`. - -```{r,eval=TRUE, echo=TRUE} -fpcaObjFlies79 <- FPCA(Flies$Ly, Flies$Lt, list(nRegGrid = 79, methodMuCovEst = 'smooth', userBwCov = 2)) # Use 79 equidistant points for the support -CreateBWPlot(fpcaObjFlies79 , derOptns = list(p = 1, bw = 2.0 , kernelType = 'rect') ) -``` - -As the `medfly` sample is dense we can immediately use standard multivaritte clustering functionality to identify potential subgroups within it; the function `FClust` is the wrapper around the clustering functionality provided by `fdapace`. By default `FClust` utilises a Gaussian Mixture Model approach based on the package `Rmixmod` [@Biernacki2006], as a general rule clustering optimality is based on negative entropy criterion. In the `medfly` dataset clustering the data allows to immediately recognise a particular subgroup of flies that lay no or very few eggs during the period examined. - - -```{r,eval=TRUE, echo=TRUE} -A <- FClust(Flies$Ly, Flies$Lt, optnsFPCA = list(methodMuCovEst = 'smooth', userBwCov = 2, FVEthreshold = 0.90), k = 2) -# The Neg-Entropy Criterion can be found as: A$clusterObj@bestResult@criterionValue -CreatePathPlot( fpcaObjFlies, K=2, showObs=FALSE, lty=1, col= A$cluster, xlab = 'Days', ylab = '# of eggs laid') -grid() -``` - -## References - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/inst/doc/fdapaceVig.html b/fdapace.Rcheck/00_pkg_src/fdapace/inst/doc/fdapaceVig.html deleted file mode 100644 index 4f77b6b1..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/inst/doc/fdapaceVig.html +++ /dev/null @@ -1,414 +0,0 @@ - - - - - - - - - - - - - - -Functional PCA in R - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - -
-

Overview

-

The basic work-flow behind the PACE approach for sparse functional data is as follows (see eg. (Yao, Müller, and Wang 2005; Liu and Müller 2009) for more information):

-
    -
  1. Calculate the smoothed mean \(\hat{\mu}\) (using local linear smoothing) aggregating all the available readings together.
  2. -
  3. Calculate for each curve separately its own raw covariance and then aggregate all these raw covariances to generate the sample raw covariance.
  4. -
  5. Use the off-diagonal elements of the sample raw covariance to estimate the smooth covariance.
  6. -
  7. Perform eigenanalysis on the smoothed covariance to obtain the estimated eigenfunctions \(\hat{\phi}\) and eigenvalues \(\hat{\lambda}\), then project that smoothed covariance on a positive semi-definite surface (Hall, Müller, and Yao 2008).
  8. -
  9. Use Conditional Expectation (PACE step) to estimate the corresponding scores \(\hat{\xi}\). ie. \(\hat{\xi}_{ik} = \hat{E}[\hat{\xi}_{ik}|Y_i] = \hat{\lambda}_k \hat{\phi}_{ik}^T \Sigma_{Y_i}^{-1}(Y_i-\hat{\mu}_i)\).
  10. -
-

As a working assumption a dataset is treated as sparse if it has on average less than 20, potentially irregularly sampled, measurements per subject. A user can manually change the automatically determined dataType if that is necessary. For densely observed functional data simplified procedures are available to obtain the eigencomponents and associated functional principal components scores (see eg. (Castro, Lawton, and Sylvestre 1986) for more information). In particular in this case we:

-
    -
  1. Calculate the cross-sectional mean \(\hat{\mu}\).
  2. -
  3. Calculate the cross-sectional covariance surface (which is guaranteed to be positive semi-definite).
  4. -
  5. Perform eigenanalysis on the covariance to estimate the eigenfunctions \(\hat{\phi}\) and eigenvalues \(\hat{\lambda}\).
  6. -
  7. Use numerical integration to estimate the corresponding scores \(\hat{\xi}\). ie. \(\hat{\xi}_{ik} = \int_0^T [ y(t) - \hat{\mu}(t)] \phi_i(t) dt\)
  8. -
-

In the case of sparse FPCA the most computational intensive part is the smoothing of the sample’s raw covariance function. For this, we employ a local weighted bilinear smoother.

-

A sibling MATLAB package for fdapace can be found in here.

-
-
-

FPCA in R using fdapace

-

The simplest scenario is that one has two lists yList and tList where yList is a list of vectors, each containing the observed values \(Y_{ij}\) for the \(i\)th subject and tList is a list of vectors containing corresponding time points. In this case one uses:

-
FPCAobj <- FPCA(Ly=yList, Lt=tList)
-

The generated FPCAobj will contain all the basic information regarding the desired FPCA.

-
-

Generating a toy dense functional dataset from scratch

-
  library(fdapace)
- 
-  # Set the number of subjects (N) and the
-  # number of measurements per subjects (M) 
-  N <- 200;
-  M <- 100;
-  set.seed(123)
-
-  # Define the continuum
-  s <- seq(0,10,length.out = M)
-
-  # Define the mean and 2 eigencomponents
-  meanFunct <- function(s) s + 10*exp(-(s-5)^2)
-  eigFunct1 <- function(s) +cos(2*s*pi/10) / sqrt(5)
-  eigFunct2 <- function(s) -sin(2*s*pi/10) / sqrt(5)
-
-  # Create FPC scores
-  Ksi <- matrix(rnorm(N*2), ncol=2);
-  Ksi <- apply(Ksi, 2, scale)
-  Ksi <- Ksi %*% diag(c(5,2))
-
-  # Create Y_true
-  yTrue <- Ksi %*% t(matrix(c(eigFunct1(s),eigFunct2(s)), ncol=2)) + t(matrix(rep(meanFunct(s),N), nrow=M))
-
-
-

Running FPCA on a dense dataset

-
  L3 <- MakeFPCAInputs(IDs = rep(1:N, each=M), tVec=rep(s,N), t(yTrue))
-  FPCAdense <- FPCA(L3$Ly, L3$Lt)
-
-  # Plot the FPCA object
-  plot(FPCAdense)
-

-
  # Find the standard deviation associated with each component
-  sqrt(FPCAdense$lambda)
-
## [1] 5.050606 1.999073
-
-
-

Running FPCA on a sparse and noisy dataset

-
  # Create sparse sample  
-  # Each subject has one to five readings (median: 3)
-  set.seed(123)
-  ySparse <- Sparsify(yTrue, s, sparsity = c(1:5))
-
-  # Give your sample a bit of noise 
-  ySparse$yNoisy <- lapply(ySparse$Ly, function(x) x + 0.5*rnorm(length(x)))
-
-  # Do FPCA on this sparse sample
-  # Notice that sparse FPCA will smooth the data internally (Yao et al., 2005)
-  # Smoothing is the main computational cost behind sparse FPCA
-  FPCAsparse <- FPCA(ySparse$yNoisy, ySparse$Lt, list(plot = TRUE))
-

-
-
-
-

Further functionality

-

FPCA calculates the bandwidth utilized by each smoother using generalised cross-validation or \(k\)-fold cross-validation automatically. Dense data are not smoothed by default. The argument methodMuCovEst can be switched between smooth and cross-sectional if one wants to utilize different estimation techniques when work with dense data.

-

The bandwidth used for estimating the smoothed mean and the smoothed covariance are available under ...bwMu and bwCov respectively. Users can nevertheless provide their own bandwidth estimates:

-
 FPCAsparseMuBW5 <- FPCA(ySparse$yNoisy, ySparse$Lt, optns= list(userBwMu = 5))
-

Visualising the fitted trajectories is a good way to see if the new bandwidth made any sense:

-
par(mfrow=c(1,2))
-CreatePathPlot( FPCAsparse, subset = 1:3, main = "GCV bandwidth", pch = 16)
-CreatePathPlot( FPCAsparseMuBW5, subset = 1:3, main = "User-defined bandwidth", pch = 16)
-
-
-

-

FPCA uses a Gaussian kernel when smoothing sparse functional data; other kernel types (eg. Epanechnikov/epan) are also available (see ?FPCA). The kernel used for smoothing the mean and covariance surface is the same. It can be found under $optns\$kernel of the returned object. For instance, one can switch the default Gaussian kernel (gauss) for a rectangular kernel (rect) as follows:

-
 FPCAsparseRect <- FPCA(ySparse$yNoisy, ySparse$Lt, optns = list(kernel = 'rect')) # Use rectangular kernel
-

FPCA returns automatically the smallest number of components required to explain 99.99% of a sample’s variance. Using the function selectK one can determine the number of relevant components according to AIC, BIC or a different Fraction-of-Variance-Explained threshold. For example:

-
SelectK( FPCAsparse, criterion = 'FVE', FVEthreshold = 0.95) # K = 2
-
## $K
-## [1] 2
-## 
-## $criterion
-## [1] 95.68368
-
SelectK( FPCAsparse, criterion = 'AIC') # K = 2
-
## $K
-## [1] 2
-## 
-## $criterion
-## [1] 1004.783
-

When working with functional data (usually not very sparse) the estimation of derivatives is often of interest. Using one can directly obtain numerical derivatives by defining the appropriate order p; fdapace provides for the first two derivatives ( p =1 or 2). Because the numerically differentiated data are smoothed the user can define smoothing specific arguments (see ?fitted.FPCA for more information); the derivation is done by using the derivative of the linear fit. Similarly using the function FPCAder , one can augment an FPCA object with functional derivatives of a sample’s mean function and eigenfunctions.

-
fittedCurvesP0 <- fitted(FPCAsparse) # equivalent: fitted(FPCAsparse, derOptns=list(p = 0));
-# Get first order derivatives of fitted curves, smooth using Epanechnikov kernel
-fittedCurcesP1 <- fitted(FPCAsparse, derOptns=list(p = 1, kernelType = 'epan'))
-
## Warning in fitted.FPCA(FPCAsparse, derOptns = list(p = 1, kernelType = "epan")): Potentially you use too many components to estimate derivatives. 
-##   Consider using SelectK() to find a more informed estimate for 'K'.
-
-
-

A real-world example

-

We use the medfly25 dataset that this available with fdapace to showcase FPCA and its related functionality. medfly25 is a dataset containing the eggs laid from 789 medflies (Mediterranean fruit flies, Ceratitis capitata) during the first 25 days of their lives. It is a subset of the dataset used by Carey at al. (1998) (Carey et al. 1998); only flies having lived at least 25 days are shown. The data are rather noisy, dense and with a characteristic flat start. For that reason in contrast with above we will use a smoothing estimating procedure despite having dense data.

-
  # load data
-  data(medfly25)
-
-  # Turn the original data into a list of paired amplitude and timing lists
-  Flies <- MakeFPCAInputs(medfly25$ID, medfly25$Days, medfly25$nEggs)
-  fpcaObjFlies <- FPCA(Flies$Ly, Flies$Lt, list(plot = TRUE, methodMuCovEst = 'smooth', userBwCov = 2))
-

-

Based on the scree-plot we see that the first three components appear to encapsulate most of the relevant variation. The number of eigencomponents to reach a 99.99% FVE is \(11\) but just \(3\) eigencomponents are enough to reach a 95.0%. We can easily inspect the following visually, using the CreatePathPlot command.

-
par(mfrow=c(1,2))
-  CreatePathPlot(fpcaObjFlies, subset = c(3,5,135), main = 'K = 11', pch = 4); grid()
-  CreatePathPlot(fpcaObjFlies, subset = c(3,5,135), K = 3, main = 'K = 3', pch = 4) ; grid()
-

-

One can perform outlier detection (Febrero, Galeano, and González-Manteiga 2007) as well as visualize data using a functional box-plot. To achieve these tasks one can use the functions CreateOutliersPlot nd CreateFuncBoxPlot. Different ranking methodologies (KDE, bagplot (Rousseeuw, Ruts, and Tukey 1999,Hyndman and Shang (2010)) or point-wise) are available and can potentially identify different aspects of a sample. For example here it is notable that the kernel density estimator KDE variant identifies two main clusters within the main body of sample. By construction the bagplot method would use a single bag and this feature would be lost. Both functions return a (temporarily) invisible copy of a list containing the labels associated with each of sample curve0 .CreateOutliersPlot returns a (temporarily) invisible copy of a list containing the labels associated with each of sample curve.

-
par(mfrow=c(1,2))
-  CreateOutliersPlot(fpcaObjFlies, optns = list(K = 3, variant = 'KDE'))
-  CreateFuncBoxPlot(fpcaObjFlies, xlab = 'Days', ylab = '# of eggs laid', optns = list(K =3, variant='bagplot'))
-
## Warning in CreateFuncBoxPlot(fpcaObjFlies, xlab = "Days", ylab = "# of
-## eggs laid", : Cannot use bagplot because aplpack::compute.bagplot is
-## unavailable; reverting to point-wise
-

-

Functional data lend themselves naturally to questions about their rate of change; their derivatives. As mentioned previously using fdapace one can generate estimates of the sample’s derivatives ( fitted.FPCA) or the derivatives of the principal modes of variation (FPCAder). In all cases, one defines a derOptns list of options to control the derivation parameters. Getting derivatives is obtained by using a local linear smoother as above.

-
par(mfrow=c(1,2))
-  CreatePathPlot(fpcaObjFlies, subset = c(3,5,135), K = 3, main = 'K = 3', showObs = FALSE) ; grid()
-  CreatePathPlot(fpcaObjFlies, subset = c(3,5,135), K = 3, main = 'K = 3', showObs = FALSE, derOptns = list(p = 1, bw = 1.01 , kernelType = 'epan') ) ; grid()
-

-

We note that if finite support kernel types are used (eg. rect or epan ), bandwidths smaller than the distance between two adjacent points over which the data are registered onto will lead to (expected) NaN estimates. In case of dense data, the grid used is (by default) equal to the grid the data were originally registered on; in the case of sparse data, the grid used (by default) spans the range of the sample’s supports and uses 51 points. A user can change the number of points using the argument nRegGrid . One can investigate the effect a particular kernel type ( kernelType ) or bandwidth size (bw) has on the generated derivatives by using the function CreateBWPlot and providing a relevant derOptns list. This will generate estimates about the mean function \(\mu(t)\) as well as the first two principal modes of variation \(\phi_1(t)\) and \(\phi_2(t)\) for different multiples of bw.

-
fpcaObjFlies79 <- FPCA(Flies$Ly, Flies$Lt, list(nRegGrid = 79, methodMuCovEst = 'smooth', userBwCov = 2)) # Use 79 equidistant points for the support
-CreateBWPlot(fpcaObjFlies79 , derOptns = list(p = 1, bw = 2.0 , kernelType = 'rect') )
-

-

As the medfly sample is dense we can immediately use standard multivaritte clustering functionality to identify potential subgroups within it; the function FClust is the wrapper around the clustering functionality provided by fdapace. By default FClust utilises a Gaussian Mixture Model approach based on the package Rmixmod (Biernacki et al. 2006), as a general rule clustering optimality is based on negative entropy criterion. In the medfly dataset clustering the data allows to immediately recognise a particular subgroup of flies that lay no or very few eggs during the period examined.

-
A <- FClust(Flies$Ly, Flies$Lt, optnsFPCA = list(methodMuCovEst = 'smooth', userBwCov = 2, FVEthreshold = 0.90), k = 2)
-# The Neg-Entropy Criterion can be found as: A$clusterObj@bestResult@criterionValue 
-CreatePathPlot( fpcaObjFlies, K=2, showObs=FALSE, lty=1, col= A$cluster, xlab = 'Days', ylab = '# of eggs laid')
-grid()
-

-
-
-

References

-
-
-

Biernacki, C, G Celeux, G Govaert, and F Langrognet. 2006. “Model-Based Cluster and Discriminant Analysis with the Mixmod Software.” Computational Statistics & Data Analysis 51 (2). Elsevier: 587–600.

-
-
-

Carey, JR, P Liedo, H-G Müller, J-L Wang, and J-M Chiou. 1998. “Relationship of Age Patterns of Fecundity to Mortality, Longevity, and Lifetime Reproduction in a Large Cohort of Mediterranean Fruit Fly Females.” The Journals of Gerontology Series A: Biological Sciences and Medical Sciences 53 (4). Oxford University Press: B245–B251.

-
-
-

Castro, PE, WH Lawton, and EA Sylvestre. 1986. “Principal Modes of Variation for Processes with Continuous Sample Curves.” Technometrics 28 (4). Taylor & Francis Group: 329–37.

-
-
-

Febrero, M, P Galeano, and W González-Manteiga. 2007. “A Functional Analysis of Nox Levels: Location and Scale Estimation and Outlier Detection.” Computational Statistics 22 (3). Springer: 411–27.

-
-
-

Hall, P, H-G Müller, and F Yao. 2008. “Modelling Sparse Generalized Longitudinal Observations with Latent Gaussian Processes.” Journal of the Royal Statistical Society: Series B (Statistical Methodology) 70 (4). Wiley Online Library: 703–23.

-
-
-

Hyndman, RJ, and HL Shang. 2010. “Rainbow Plots, Bagplots, and Boxplots for Functional Data.” Journal of Computational and Graphical Statistics 19 (1).

-
-
-

Liu, B, and H-G Müller. 2009. “Estimating Derivatives for Samples of Sparsely Observed Functions, with Application to Online Auction Dynamics.” Journal of the American Statistical Association 104 (486). Taylor & Francis: 704–17.

-
-
-

Rousseeuw, PJ, I Ruts, and JW Tukey. 1999. “The Bagplot: A Bivariate Boxplot.” The American Statistician 53 (4). Taylor & Francis Group: 382–87.

-
-
-

Yao, F, H-G Müller, and J-L Wang. 2005. “Functional Data Analysis for Sparse Longitudinal Data.” Journal of the American Statistical Association 100 (470). Taylor & Francis: 577–90.

-
-
-
- - - - -
- - - - - - - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/200curvesByExampleSeed123.RData b/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/200curvesByExampleSeed123.RData deleted file mode 100644 index 165684e2..00000000 Binary files a/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/200curvesByExampleSeed123.RData and /dev/null differ diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/InputForRotatedMllwlskInCpp.RData b/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/InputForRotatedMllwlskInCpp.RData deleted file mode 100644 index 48b9583c..00000000 Binary files a/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/InputForRotatedMllwlskInCpp.RData and /dev/null differ diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/InputFormMllwlskInCpp.RData b/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/InputFormMllwlskInCpp.RData deleted file mode 100644 index 37d3f247..00000000 Binary files a/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/InputFormMllwlskInCpp.RData and /dev/null differ diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/YmatFromWFPCAexample_rng123.RData b/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/YmatFromWFPCAexample_rng123.RData deleted file mode 100644 index bfc838d5..00000000 Binary files a/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/YmatFromWFPCAexample_rng123.RData and /dev/null differ diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/dataForGcvLwls.RData b/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/dataForGcvLwls.RData deleted file mode 100644 index e1eecd68..00000000 Binary files a/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/dataForGcvLwls.RData and /dev/null differ diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/dataForGcvLwlsTest.RData b/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/dataForGcvLwlsTest.RData deleted file mode 100644 index 423f668f..00000000 Binary files a/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/dataForGcvLwlsTest.RData and /dev/null differ diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/dataForGetRawCov.RData b/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/dataForGetRawCov.RData deleted file mode 100644 index 6bc4bb1a..00000000 Binary files a/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/dataForGetRawCov.RData and /dev/null differ diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/dataGeneratedByExampleSeed123.RData b/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/dataGeneratedByExampleSeed123.RData deleted file mode 100644 index 88f251a6..00000000 Binary files a/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/dataGeneratedByExampleSeed123.RData and /dev/null differ diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/datasetToTestRrotatedSmoother.RData b/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/datasetToTestRrotatedSmoother.RData deleted file mode 100644 index 34a62f67..00000000 Binary files a/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/datasetToTestRrotatedSmoother.RData and /dev/null differ diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/gene.dat b/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/gene.dat deleted file mode 100644 index 31c42d1c..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/gene.dat +++ /dev/null @@ -1,4441 +0,0 @@ -5641 3 1 -0.79346 -5641 3 2 -0.72282 -5641 3 3 -1.1507 -5641 3 4 -1.2593 -5641 3 5 -1.1293 -5641 3 6 -1.7204 -5641 3 7 -1.8905 -5641 3 8 -1.8289 -5641 3 9 -1.2071 -5641 3 10 -1.13 -5641 3 11 -1.4441 -5641 3 12 -1.406 -5641 3 13 -1.1594 -5641 3 14 -1.1599 -5641 3 15 -1.2878 -5641 3 16 -0.85163 -5641 3 17 -0.92525 -5641 3 18 -0.78914 -5641 3 19 -1.3369 -5641 3 20 -1.5664 -5641 3 21 -1.2087 -5641 3 22 -1.6093 -5641 3 23 -1.7531 -5641 3 24 -1.758 -5641 3 25 -1.6204 -5641 3 26 -1.8012 -5641 3 27 -1.9443 -5641 3 28 -2.1064 -5641 3 29 -2.1235 -5641 3 30 -2.0531 -5641 3 31 -1.8445 -5641 3 32 -2.1241 -5641 3 33 -1.9314 -5641 3 34 -1.9622 -5641 3 35 -1.713 -5641 3 36 -1.7509 -5641 3 37 -1.6296 -5641 3 38 -1.3865 -5641 3 39 -1.7515 -5641 3 40 -1.3763 -5641 3 41 -0.94793 -5641 3 42 -1.2154 -5641 3 43 -1.3163 -5641 3 44 -1.4855 -5641 3 45 -1.7739 -5641 3 46 -1.1058 -5641 3 47 -1.9344 -5641 3 48 -1.5353 -5641 3 49 -1.0951 -5641 3 50 -1.7092 -5641 3 51 -1.4659 -5641 3 52 -1.2541 -5641 3 53 -1.5393 -5641 3 54 -1.5075 -5641 3 55 -1.3383 -5641 3 56 -1.5323 -5641 3 57 -0.76116 -5641 3 58 -0.020631 -10888 3 1 -2.9237 -10888 3 2 -2.3027 -10888 3 3 -2.5953 -10888 3 4 -2.6431 -10888 3 5 -2.9831 -10888 3 6 -1.9908 -10888 3 7 -1.6091 -10888 3 8 -1.9276 -10888 3 9 -1.7989 -10888 3 10 -1.979 -10888 3 11 -1.7403 -10888 3 12 -1.7994 -10888 3 13 -2.4304 -10888 3 14 -1.7085 -10888 3 15 -3.0015 -10888 3 16 -2.2597 -10888 3 17 -2.5687 -10888 3 18 -2.9699 -10888 3 19 -2.6344 -10888 3 20 -2.4365 -10888 3 21 -2.1965 -10888 3 22 -2.7078 -10888 3 23 -2.4194 -10888 3 24 -2.2789 -10888 3 25 -2.5334 -10888 3 26 -2.868 -10888 3 27 -2.7163 -10888 3 28 -2.2781 -10888 3 29 -2.2212 -10888 3 30 -1.7868 -10888 3 31 -1.3285 -10888 3 32 -2.3139 -10888 3 33 -2.1579 -10888 3 34 -1.3323 -10888 3 35 -1.1929 -10888 3 36 -1.3453 -10888 3 37 -0.81118 -10888 3 38 -0.61914 -10888 3 39 -0.5528 -10888 3 40 -1.433 -10888 3 41 -3.2909 -10888 3 42 -2.4675 -10888 3 43 -2.3171 -10888 3 44 -2.3398 -10888 3 45 -1.9107 -10888 3 46 -2.4868 -10888 3 47 -1.9697 -10888 3 48 -1.9728 -10888 3 49 -2.222 -10888 3 50 -1.2862 -10888 3 51 -2.2955 -10888 3 52 -1.826 -10888 3 53 -1.412 -10888 3 54 -1.9418 -10888 3 55 -0.91909 -10888 3 56 1.2252 -10888 3 57 1.7191 -10888 3 58 2.5376 -2916 1 1 0.012875 -2916 1 2 0.54291 -2916 1 3 0.39255 -2916 1 4 1.0531 -2916 1 5 1.8504 -2916 1 6 2.6788 -2916 1 7 3.258 -2916 1 8 3.2666 -2916 1 9 2.8947 -2916 1 10 2.5465 -2916 1 11 2.5699 -2916 1 12 1.7148 -2916 1 13 1.4883 -2916 1 14 1.1486 -2916 1 15 0.95165 -2916 1 16 0.60407 -2916 1 17 1.0956 -2916 1 18 -0.39961 -2916 1 19 -1.4592 -2916 1 20 -0.97673 -2916 1 21 -1.0708 -2916 1 22 -1.4571 -2916 1 23 -1.5132 -2916 1 24 -1.5329 -2916 1 25 -2.1501 -2916 1 26 -1.9411 -2916 1 27 -2.0356 -2916 1 28 -2.1392 -2916 1 29 -2.2907 -2916 1 30 -2.1826 -2916 1 31 -2.1945 -2916 1 32 -1.9167 -2916 1 33 -2.3744 -2916 1 34 -2.1768 -2916 1 35 -2.6607 -2916 1 36 -2.0388 -2916 1 37 -1.8542 -2916 1 38 -2.0915 -2916 1 39 -1.7683 -2916 1 40 -1.3575 -2916 1 41 -1.8819 -2916 1 42 -2.0613 -2916 1 43 -1.8365 -2916 1 44 -1.8292 -2916 1 45 -1.9567 -2916 1 46 -1.6103 -2916 1 47 -1.8209 -2916 1 48 -1.11 -2916 1 49 -1.4996 -2916 1 50 -0.98583 -2916 1 51 -1.4011 -2916 1 52 -1.4696 -2916 1 53 -1.2322 -2916 1 54 -1.1479 -2916 1 55 -2.2176 -2916 1 56 -2.191 -2916 1 57 -2.4955 -2916 1 58 -2.8947 -4602 1 1 0.6648 -4602 1 2 0.71952 -4602 1 3 0.69399 -4602 1 4 1.0951 -4602 1 5 1.351 -4602 1 6 2.0205 -4602 1 7 2.0547 -4602 1 8 2.1753 -4602 1 9 2.3976 -4602 1 10 2.1094 -4602 1 11 2.0807 -4602 1 12 1.742 -4602 1 13 1.625 -4602 1 14 1.4568 -4602 1 15 1.0819 -4602 1 16 1.6432 -4602 1 17 1.1584 -4602 1 18 1.2409 -4602 1 19 0.3143 -4602 1 20 0.58087 -4602 1 21 0.58163 -4602 1 22 0.39639 -4602 1 23 0.094816 -4602 1 24 -0.1501 -4602 1 25 -0.29 -4602 1 26 -0.20552 -4602 1 27 -0.78168 -4602 1 28 -0.65061 -4602 1 29 -0.36965 -4602 1 30 -0.6619 -4602 1 31 -1.1946 -4602 1 32 -1.1276 -4602 1 33 -1.1635 -4602 1 34 -1.3549 -4602 1 35 -1.1001 -4602 1 36 -1.2154 -4602 1 37 -1.3714 -4602 1 38 -1.6283 -4602 1 39 -1.4729 -4602 1 40 -0.67314 -4602 1 41 -0.33132 -4602 1 42 -0.39986 -4602 1 43 -0.33167 -4602 1 44 -0.83143 -4602 1 45 -0.89797 -4602 1 46 -0.75742 -4602 1 47 -0.55735 -4602 1 48 -0.41359 -4602 1 49 -0.38334 -4602 1 50 -0.82859 -4602 1 51 -0.25305 -4602 1 52 -0.88527 -4602 1 53 -0.7697 -4602 1 54 -0.49219 -4602 1 55 -1.5014 -4602 1 56 -1.7083 -4602 1 57 -1.9584 -4602 1 58 -1.5321 -4795 3 1 -1.7925 -4795 3 2 -1.9611 -4795 3 3 -1.976 -4795 3 4 -1.9186 -4795 3 5 -1.9686 -4795 3 6 -2.2917 -4795 3 7 -1.9044 -4795 3 8 -1.6386 -4795 3 9 -2.0419 -4795 3 10 -1.6748 -4795 3 11 -2.1899 -4795 3 12 -1.1541 -4795 3 13 -2.0625 -4795 3 14 -2.2392 -4795 3 15 -1.9201 -4795 3 16 -1.7523 -4795 3 17 -1.8647 -4795 3 18 -2.2165 -4795 3 19 -1.8356 -4795 3 20 -1.7325 -4795 3 21 -1.5851 -4795 3 22 -1.6729 -4795 3 23 -1.3059 -4795 3 24 -1.3808 -4795 3 25 -1.2628 -4795 3 26 -1.7965 -4795 3 27 -1.7009 -4795 3 28 -1.5518 -4795 3 29 -1.6073 -4795 3 30 -1.2234 -4795 3 31 -0.91518 -4795 3 32 -0.76311 -4795 3 33 -1.1418 -4795 3 34 -1.381 -4795 3 35 -0.91266 -4795 3 36 -1.1619 -4795 3 37 -1.2233 -4795 3 38 -1.1135 -4795 3 39 -0.85427 -4795 3 40 -1.2815 -4795 3 41 -1.3147 -4795 3 42 -1.0157 -4795 3 43 -1.4202 -4795 3 44 -1.2221 -4795 3 45 -1.1709 -4795 3 46 -2.1365 -4795 3 47 -2.0055 -4795 3 48 -1.93 -4795 3 49 -1.8437 -4795 3 50 -1.5225 -4795 3 51 -1.9601 -4795 3 52 -0.4449 -4795 3 53 -0.94623 -4795 3 54 -0.65994 -4795 3 55 0.57873 -4795 3 56 1.2035 -4795 3 57 1.6094 -4795 3 58 1.5759 -7269 1 1 1.0482 -7269 1 2 1.3086 -7269 1 3 1.6183 -7269 1 4 1.6691 -7269 1 5 2.0618 -7269 1 6 2.4132 -7269 1 7 2.3888 -7269 1 8 2.3113 -7269 1 9 2.5517 -7269 1 10 2.5471 -7269 1 11 2.629 -7269 1 12 2.0421 -7269 1 13 1.8806 -7269 1 14 1.4594 -7269 1 15 1.5782 -7269 1 16 1.4648 -7269 1 17 1.3702 -7269 1 18 0.93122 -7269 1 19 0.26492 -7269 1 20 0.58102 -7269 1 21 0.1621 -7269 1 22 -0.089822 -7269 1 23 -0.34356 -7269 1 24 -0.55483 -7269 1 25 -0.82152 -7269 1 26 -0.94071 -7269 1 27 -1.5533 -7269 1 28 -1.5751 -7269 1 29 -1.3185 -7269 1 30 -1.733 -7269 1 31 -1.57 -7269 1 32 -1.4701 -7269 1 33 -1.1053 -7269 1 34 -1.4502 -7269 1 35 -0.59434 -7269 1 36 -0.7028 -7269 1 37 -0.52149 -7269 1 38 -1.155 -7269 1 39 -1.1425 -7269 1 40 -0.70915 -7269 1 41 -1.1731 -7269 1 42 -0.7073 -7269 1 43 -0.85389 -7269 1 44 -1.2348 -7269 1 45 -1.0732 -7269 1 46 -0.64193 -7269 1 47 -0.94265 -7269 1 48 -0.32552 -7269 1 49 -0.48599 -7269 1 50 -0.49183 -7269 1 51 -1.0672 -7269 1 52 -0.92053 -7269 1 53 -1.1667 -7269 1 54 -1.3988 -7269 1 55 -1.5481 -7269 1 56 -1.9106 -7269 1 57 -2.0763 -7269 1 58 -2.2972 -1078 1 1 0.79292 -1078 1 2 0.9523 -1078 1 3 1.3392 -1078 1 4 1.4554 -1078 1 5 1.8893 -1078 1 6 2.2347 -1078 1 7 2.2338 -1078 1 8 2.1101 -1078 1 9 2.1066 -1078 1 10 1.9989 -1078 1 11 2.0791 -1078 1 12 1.5794 -1078 1 13 1.3979 -1078 1 14 1.0516 -1078 1 15 1.2115 -1078 1 16 0.97424 -1078 1 17 1.0062 -1078 1 18 0.20274 -1078 1 19 -0.20633 -1078 1 20 -0.20398 -1078 1 21 -0.46979 -1078 1 22 -0.93601 -1078 1 23 -0.74061 -1078 1 24 -0.67741 -1078 1 25 -0.95927 -1078 1 26 -1.047 -1078 1 27 -1.372 -1078 1 28 -1.6804 -1078 1 29 -1.5373 -1078 1 30 -1.6602 -1078 1 31 -1.1499 -1078 1 32 -1.5344 -1078 1 33 -1.7358 -1078 1 34 -1.2336 -1078 1 35 -0.93484 -1078 1 36 -1.103 -1078 1 37 -1.0708 -1078 1 38 -1.1203 -1078 1 39 -0.61519 -1078 1 40 -1.3955 -1078 1 41 -0.49976 -1078 1 42 -0.7862 -1078 1 43 -0.57059 -1078 1 44 -0.90059 -1078 1 45 -0.56299 -1078 1 46 -1.1129 -1078 1 47 -0.64078 -1078 1 48 -0.48783 -1078 1 49 -0.62334 -1078 1 50 -0.26929 -1078 1 51 -0.50791 -1078 1 52 -0.73632 -1078 1 53 -0.50362 -1078 1 54 -1.0207 -1078 1 55 -1.7806 -1078 1 56 -1.4889 -1078 1 57 -1.7085 -1078 1 58 -1.6877 -1745 1 1 0.84809 -1745 1 2 1.376 -1745 1 3 2.1127 -1745 1 4 1.9301 -1745 1 5 2.6181 -1745 1 6 2.6503 -1745 1 7 2.2885 -1745 1 8 1.8839 -1745 1 9 0.92443 -1745 1 10 0.92023 -1745 1 11 1.1347 -1745 1 12 1.1064 -1745 1 13 0.96041 -1745 1 14 1.2286 -1745 1 15 0.88536 -1745 1 16 0.92572 -1745 1 17 0.80553 -1745 1 18 -0.076896 -1745 1 19 -0.31587 -1745 1 20 -0.25326 -1745 1 21 -0.46411 -1745 1 22 -0.65685 -1745 1 23 -0.92195 -1745 1 24 -0.64383 -1745 1 25 -1.0379 -1745 1 26 -1.216 -1745 1 27 -1.3579 -1745 1 28 -1.2745 -1745 1 29 -1.3508 -1745 1 30 -1.4414 -1745 1 31 -1.031 -1745 1 32 -1.5037 -1745 1 33 -1.7109 -1745 1 34 -1.1026 -1745 1 35 -1.2745 -1745 1 36 -1.3144 -1745 1 37 -1.7634 -1745 1 38 -1.5522 -1745 1 39 -1.004 -1745 1 40 -1.1416 -1745 1 41 -0.89195 -1745 1 42 -1.0741 -1745 1 43 -1.1459 -1745 1 44 -0.89495 -1745 1 45 -1.1294 -1745 1 46 -0.67528 -1745 1 47 -0.72801 -1745 1 48 -0.53878 -1745 1 49 -0.1955 -1745 1 50 -0.3293 -1745 1 51 -0.55041 -1745 1 52 -0.9832 -1745 1 53 -0.55637 -1745 1 54 -0.81295 -1745 1 55 -1.7716 -1745 1 56 -1.5527 -1745 1 57 -1.8052 -1745 1 58 -2.1866 -13124 3 1 -2.4971 -13124 3 2 -2.5373 -13124 3 3 -2.4136 -13124 3 4 -2.2974 -13124 3 5 -2.2307 -13124 3 6 -2.1471 -13124 3 7 -1.8089 -13124 3 8 -1.7506 -13124 3 9 -1.6594 -13124 3 10 -1.5625 -13124 3 11 -1.5174 -13124 3 12 -1.7709 -13124 3 13 -1.6885 -13124 3 14 -2.0027 -13124 3 15 -2.1217 -13124 3 16 -1.7514 -13124 3 17 -1.8223 -13124 3 18 -1.7503 -13124 3 19 -1.1565 -13124 3 20 -1.4987 -13124 3 21 -1.4364 -13124 3 22 -1.5246 -13124 3 23 -1.1547 -13124 3 24 -0.85294 -13124 3 25 -0.97046 -13124 3 26 -0.4414 -13124 3 27 -0.27693 -13124 3 28 -0.29009 -13124 3 29 -0.58615 -13124 3 30 -0.53882 -13124 3 31 -0.65488 -13124 3 32 -0.35291 -13124 3 33 -0.64562 -13124 3 34 -0.70815 -13124 3 35 -0.68461 -13124 3 36 -1.0094 -13124 3 37 -1.0507 -13124 3 38 -1.071 -13124 3 39 -0.84101 -13124 3 40 -1.0441 -13124 3 41 -0.85233 -13124 3 42 -1.2883 -13124 3 43 -1.3098 -13124 3 44 -1.3918 -13124 3 45 -0.62437 -13124 3 46 -1.2385 -13124 3 47 -1.7198 -13124 3 48 -0.84072 -13124 3 49 -1.1826 -13124 3 50 -0.90406 -13124 3 51 -0.99757 -13124 3 52 -0.92359 -13124 3 53 -0.88185 -13124 3 54 -0.76023 -13124 3 55 -0.36434 -13124 3 56 -0.029165 -13124 3 57 0.66863 -13124 3 58 0.66612 -7397 3 1 -2.935 -7397 3 2 -2.8941 -7397 3 3 -2.595 -7397 3 4 -2.9575 -7397 3 5 -2.7484 -7397 3 6 -2.6137 -7397 3 7 -2.4772 -7397 3 8 -2.2623 -7397 3 9 -2.5435 -7397 3 10 -2.301 -7397 3 11 -2.513 -7397 3 12 -1.4675 -7397 3 13 -2.4154 -7397 3 14 -2.374 -7397 3 15 -1.6868 -7397 3 16 -2.2708 -7397 3 17 -2.1148 -7397 3 18 -2.0927 -7397 3 19 -2.3797 -7397 3 20 -2.2327 -7397 3 21 -1.9034 -7397 3 22 -2.0437 -7397 3 23 -1.9306 -7397 3 24 -1.309 -7397 3 25 -1.7931 -7397 3 26 -1.8825 -7397 3 27 -1.3705 -7397 3 28 -1.288 -7397 3 29 -1.8199 -7397 3 30 -1.627 -7397 3 31 -2.1355 -7397 3 32 -2.1393 -7397 3 33 -2.6322 -7397 3 34 -1.9628 -7397 3 35 -2.3385 -7397 3 36 -2.0218 -7397 3 37 -2.2874 -7397 3 38 -2.0252 -7397 3 39 -1.8153 -7397 3 40 -2.3615 -7397 3 41 -3.1811 -7397 3 42 -2.5212 -7397 3 43 -2.5742 -7397 3 44 -2.3961 -7397 3 45 -2.9316 -7397 3 46 -2.8931 -7397 3 47 -2.3292 -7397 3 48 -2.4506 -7397 3 49 -2.6527 -7397 3 50 -2.3129 -7397 3 51 -2.6529 -7397 3 52 -2.3822 -7397 3 53 -2.1897 -7397 3 54 -2.8689 -7397 3 55 -2.0812 -7397 3 56 0.32188 -7397 3 57 1.3789 -7397 3 58 1.8227 -6866 3 1 -2.2204 -6866 3 2 -2.1197 -6866 3 3 -2.0283 -6866 3 4 -1.7947 -6866 3 5 -1.1938 -6866 3 6 -1.2809 -6866 3 7 -1.6594 -6866 3 8 -1.86 -6866 3 9 -1.9558 -6866 3 10 -2.0185 -6866 3 11 -2.2633 -6866 3 12 -2.0099 -6866 3 13 -2.1414 -6866 3 14 -2.0686 -6866 3 15 -1.6393 -6866 3 16 -1.4278 -6866 3 17 -1.5052 -6866 3 18 -1.2922 -6866 3 19 -1.1492 -6866 3 20 -1.1816 -6866 3 21 -1.3116 -6866 3 22 -1.4018 -6866 3 23 -1.133 -6866 3 24 -1.1776 -6866 3 25 -0.92822 -6866 3 26 -0.83618 -6866 3 27 -0.33538 -6866 3 28 -0.55901 -6866 3 29 -0.47966 -6866 3 30 -0.53473 -6866 3 31 -1.1856 -6866 3 32 -1.8321 -6866 3 33 -1.8238 -6866 3 34 -1.3965 -6866 3 35 -1.2294 -6866 3 36 -1.5218 -6866 3 37 -0.51136 -6866 3 38 -1.1256 -6866 3 39 -0.99192 -6866 3 40 -1.402 -6866 3 41 -0.62486 -6866 3 42 -0.38479 -6866 3 43 -0.7805 -6866 3 44 -0.80139 -6866 3 45 -0.66597 -6866 3 46 -0.3756 -6866 3 47 -1.0019 -6866 3 48 -0.47293 -6866 3 49 -0.67972 -6866 3 50 -0.47457 -6866 3 51 -0.65573 -6866 3 52 -0.26031 -6866 3 53 -0.3687 -6866 3 54 -0.56012 -6866 3 55 0.75234 -6866 3 56 0.54986 -6866 3 57 1.0801 -6866 3 58 1.0315 -1744 3 1 -2.2727 -1744 3 2 -2.6149 -1744 3 3 -2.0871 -1744 3 4 -2.1624 -1744 3 5 -1.8717 -1744 3 6 -1.8731 -1744 3 7 -1.6399 -1744 3 8 -1.5838 -1744 3 9 -1.2569 -1744 3 10 -1.2291 -1744 3 11 -1.105 -1744 3 12 -1.3092 -1744 3 13 -1.1471 -1744 3 14 -1.4367 -1744 3 15 -2.0917 -1744 3 16 -1.1912 -1744 3 17 -1.2659 -1744 3 18 -2.0436 -1744 3 19 -1.7859 -1744 3 20 -1.7299 -1744 3 21 -1.8774 -1744 3 22 -2.3822 -1744 3 23 -2.2119 -1744 3 24 -1.8291 -1744 3 25 -2.0212 -1744 3 26 -1.6686 -1744 3 27 -1.7595 -1744 3 28 -1.7209 -1744 3 29 -1.7115 -1744 3 30 -1.5953 -1744 3 31 -1.7217 -1744 3 32 -1.4696 -1744 3 33 -1.4471 -1744 3 34 -1.0806 -1744 3 35 -1.5074 -1744 3 36 -1.2352 -1744 3 37 -1.3727 -1744 3 38 -1.1228 -1744 3 39 -1.2331 -1744 3 40 -1.1951 -1744 3 41 -0.29478 -1744 3 42 -1.3315 -1744 3 43 -1.5556 -1744 3 44 -1.0823 -1744 3 45 -0.87551 -1744 3 46 -1.3008 -1744 3 48 -0.19811 -1744 3 49 -0.45936 -1744 3 50 -0.27704 -1744 3 51 -0.34483 -1744 3 52 -1.0286 -1744 3 53 0.4811 -1744 3 54 0.72541 -1744 3 55 1.9851 -1744 3 56 2.2727 -1744 3 57 2.4818 -1744 3 58 2.0396 -4294 3 1 -2.7475 -4294 3 2 -2.5094 -4294 3 3 -2.427 -4294 3 4 -2.0922 -4294 3 5 -2.0596 -4294 3 6 -1.7612 -4294 3 7 -1.7399 -4294 3 8 -1.7083 -4294 3 9 -1.3598 -4294 3 10 -1.2163 -4294 3 11 -1.4821 -4294 3 12 -1.9341 -4294 3 13 -1.6585 -4294 3 14 -1.788 -4294 3 15 -1.7361 -4294 3 16 -1.4663 -4294 3 17 -1.5466 -4294 3 18 -1.3588 -4294 3 19 -1.4329 -4294 3 20 -1.4414 -4294 3 21 -1.5503 -4294 3 22 -1.8134 -4294 3 23 -1.6691 -4294 3 24 -1.7187 -4294 3 25 -1.9935 -4294 3 26 -1.792 -4294 3 27 -1.4476 -4294 3 28 -1.4945 -4294 3 29 -1.9585 -4294 3 30 -1.5737 -4294 3 31 -1.5261 -4294 3 32 -1.5481 -4294 3 33 -1.5125 -4294 3 34 -1.6459 -4294 3 35 -2.3148 -4294 3 36 -1.6525 -4294 3 37 -2.5251 -4294 3 38 -2.5696 -4294 3 39 -2.1973 -4294 3 40 -1.3856 -4294 3 41 -1.7097 -4294 3 42 -1.4321 -4294 3 43 -1.2026 -4294 3 44 -1.5029 -4294 3 45 -1.0703 -4294 3 46 -1.4015 -4294 3 47 -1.3826 -4294 3 48 -1.3404 -4294 3 49 -1.4686 -4294 3 50 -1.4942 -4294 3 51 -1.2091 -4294 3 52 -0.93255 -4294 3 53 -1.3839 -4294 3 54 -1.5552 -4294 3 55 -1.3285 -4294 3 56 -0.068597 -4294 3 57 0.63569 -4294 3 58 0.78854 -6020 2 1 -0.72444 -6020 2 2 -0.76817 -6020 2 3 -1.004 -6020 2 4 -0.8603 -6020 2 5 -0.78179 -6020 2 6 -0.41719 -6020 2 7 -0.53807 -6020 2 8 -0.53256 -6020 2 9 -0.67077 -6020 2 10 -1.1659 -6020 2 11 -1.1104 -6020 2 12 -1.1296 -6020 2 13 -1.2649 -6020 2 14 -1.1946 -6020 2 15 -1.1507 -6020 2 16 -0.75183 -6020 2 17 -0.72139 -6020 2 18 -0.47571 -6020 2 19 -0.48232 -6020 2 20 -0.36371 -6020 2 21 -0.16425 -6020 2 22 0.15927 -6020 2 23 0.32528 -6020 2 24 -0.044916 -6020 2 25 0.63644 -6020 2 26 0.35244 -6020 2 27 0.34664 -6020 2 28 0.63471 -6020 2 29 0.31018 -6020 2 30 0.41415 -6020 2 31 0.13964 -6020 2 32 0.11521 -6020 2 33 0.50556 -6020 2 34 -0.17909 -6020 2 35 0.54732 -6020 2 36 -0.34159 -6020 2 37 0.54648 -6020 2 38 0.25057 -6020 2 39 -0.56087 -6020 2 40 -1.5746 -6020 2 41 -0.37623 -6020 2 42 -1.3944 -6020 2 43 -1.4232 -6020 2 44 -1.7043 -6020 2 45 -1.586 -6020 2 46 -1.2329 -6020 2 47 -2.2449 -6020 2 48 -1.5766 -6020 2 49 -1.3626 -6020 2 50 -1.9903 -6020 2 51 -1.7058 -6020 2 52 -1.0173 -6020 2 53 -1.3015 -6020 2 54 -0.76902 -6020 2 55 0.3175 -6020 2 56 0.74246 -6020 2 57 0.87454 -6020 2 58 1.1087 -12558 3 1 -1.9098 -12558 3 2 -2.2504 -12558 3 3 -2.3542 -12558 3 4 -1.7173 -12558 3 5 -1.7936 -12558 3 6 -1.925 -12558 3 7 -1.935 -12558 3 8 -1.8081 -12558 3 9 -2.1531 -12558 3 10 -1.4244 -12558 3 11 -1.848 -12558 3 12 -1.1934 -12558 3 13 -1.1576 -12558 3 14 -2.0252 -12558 3 15 -2.3111 -12558 3 16 -1.9399 -12558 3 17 -1.9278 -12558 3 18 -2.3593 -12558 3 19 -2.3845 -12558 3 20 -2.3021 -12558 3 21 -1.9214 -12558 3 22 -2.2228 -12558 3 23 -1.9805 -12558 3 24 -2.235 -12558 3 25 -2.041 -12558 3 26 -2.2422 -12558 3 27 -1.6459 -12558 3 28 -1.9747 -12558 3 29 -2.1425 -12558 3 30 -2.3564 -12558 3 31 -1.0808 -12558 3 32 -1.5839 -12558 3 33 -1.0907 -12558 3 34 -1.8253 -12558 3 35 -1.0533 -12558 3 36 -1.059 -12558 3 37 -1.3892 -12558 3 38 -0.93776 -12558 3 39 -0.8534 -12558 3 40 -1.434 -12558 3 41 -1.2886 -12558 3 42 -1.2159 -12558 3 43 -1.3142 -12558 3 44 -0.68278 -12558 3 45 -0.047018 -12558 3 46 -0.47469 -12558 3 47 -1.3302 -12558 3 48 1.0768 -12558 3 49 0.59085 -12558 3 50 -0.84664 -12558 3 51 -1.1913 -12558 3 52 -1.0452 -12558 3 53 -1.5946 -12558 3 54 -1.5418 -12558 3 55 -1.2384 -12558 3 56 -1.0844 -12558 3 57 -0.98738 -12558 3 58 -1.1304 -4550 3 1 -3.778 -4550 3 2 -3.7013 -4550 3 3 -3.4236 -4550 3 4 -3.8591 -4550 3 5 -4.2063 -4550 3 6 -4.177 -4550 3 7 -4.1718 -4550 3 8 -4.2285 -4550 3 9 -4.428 -4550 3 10 -4.0572 -4550 3 11 -4.1206 -4550 3 12 -3.5574 -4550 3 13 -4.2401 -4550 3 14 -4.12 -4550 3 15 -3.6542 -4550 3 16 -3.2404 -4550 3 17 -3.3338 -4550 3 18 -3.7621 -4550 3 19 -3.5018 -4550 3 20 -3.1215 -4550 3 21 -2.4137 -4550 3 22 -2.9459 -4550 3 23 -2.9292 -4550 3 24 -2.2957 -4550 3 25 -2.3441 -4550 3 26 -3.0366 -4550 3 27 -2.4036 -4550 3 28 -2.335 -4550 3 29 -2.5374 -4550 3 30 -1.9795 -4550 3 31 -2.1784 -4550 3 32 -2.461 -4550 3 33 -2.5887 -4550 3 34 -2.3384 -4550 3 35 -2.1609 -4550 3 36 -2.1472 -4550 3 37 -1.7959 -4550 3 38 -1.1212 -4550 3 39 -1.6657 -4550 3 40 -3.1536 -4550 3 41 -2.9683 -4550 3 42 -4.4004 -4550 3 43 -4.2828 -4550 3 44 -4.8756 -4550 3 45 -4.5265 -4550 3 46 -4.3486 -4550 3 47 -3.9635 -4550 3 48 -4.9043 -4550 3 49 -4.0765 -4550 3 50 -3.6007 -4550 3 51 -4.404 -4550 3 52 -3.9554 -4550 3 53 -3.1806 -4550 3 54 -3.6648 -4550 3 55 -3.014 -4550 3 56 1.7581 -4550 3 57 2.3147 -4550 3 58 3.1392 -17907 3 1 -2.2106 -17907 3 2 -2.3216 -17907 3 3 -2.6404 -17907 3 4 -2.0838 -17907 3 5 -2.368 -17907 3 6 -2.4199 -17907 3 7 -1.9293 -17907 3 8 -2.1786 -17907 3 9 -2.0776 -17907 3 10 -1.9324 -17907 3 11 -2.4206 -17907 3 12 -2.0579 -17907 3 13 -2.4495 -17907 3 14 -2.2969 -17907 3 15 -2.9193 -17907 3 16 -1.3253 -17907 3 17 -2.2407 -17907 3 18 -1.8839 -17907 3 19 -1.8358 -17907 3 20 -2.2464 -17907 3 21 -1.952 -17907 3 22 -2.048 -17907 3 23 -1.7441 -17907 3 24 -1.308 -17907 3 25 -1.9929 -17907 3 26 -2.0884 -17907 3 27 -1.9483 -17907 3 28 -1.7738 -17907 3 29 -1.7972 -17907 3 30 -1.2237 -17907 3 31 -1.4877 -17907 3 32 -1.2919 -17907 3 33 -1.5378 -17907 3 34 -0.95394 -17907 3 35 -1.4501 -17907 3 36 -0.81707 -17907 3 37 -1.2893 -17907 3 38 -0.96707 -17907 3 39 -0.20339 -17907 3 40 -1.6816 -17907 3 41 -0.51592 -17907 3 42 -2.4516 -17907 3 43 -2.0551 -17907 3 44 -1.5648 -17907 3 45 -1.4546 -17907 3 46 -1.7113 -17907 3 47 -1.1216 -17907 3 48 -1.9126 -17907 3 49 -1.5625 -17907 3 50 -1.7861 -17907 3 51 -2.0267 -17907 3 52 -1.2595 -17907 3 53 -1.7043 -17907 3 54 -1.2201 -17907 3 55 -1.2529 -17907 3 56 0.5353 -17907 3 57 0.87361 -17907 3 58 0.60546 -9772 3 1 -0.38784 -9772 3 2 -0.71272 -9772 3 3 -0.58395 -9772 3 4 -0.58439 -9772 3 5 -0.45742 -9772 3 6 -1.0198 -9772 3 7 -1.4433 -9772 3 8 -1.5137 -9772 3 9 -1.4051 -9772 3 10 -1.0695 -9772 3 11 -1.1391 -9772 3 12 -1.6012 -9772 3 13 -0.86499 -9772 3 14 -1.2874 -9772 3 15 -1.066 -9772 3 16 -0.60874 -9772 3 17 -0.59527 -9772 3 18 -0.12706 -9772 3 19 -0.55067 -9772 3 20 -0.46257 -9772 3 21 -0.31258 -9772 3 22 -0.52803 -9772 3 23 -0.54244 -9772 3 24 -0.67885 -9772 3 25 -0.76104 -9772 3 26 -1.0072 -9772 3 27 -1.6537 -9772 3 28 -1.8046 -9772 3 29 -1.3995 -9772 3 30 -1.5469 -9772 3 31 -2.078 -9772 3 32 -1.8745 -9772 3 33 -1.673 -9772 3 34 -2.0578 -9772 3 35 -1.5238 -9772 3 36 -1.5538 -9772 3 37 -1.2933 -9772 3 38 -1.7632 -9772 3 39 -1.6508 -9772 3 40 -1.5172 -9772 3 41 -0.64418 -9772 3 42 -1.155 -9772 3 43 -0.99452 -9772 3 44 -1.0034 -9772 3 45 -1.0511 -9772 3 46 -1.0011 -9772 3 47 -0.97482 -9772 3 48 -1.0189 -9772 3 49 -0.8697 -9772 3 50 -0.66891 -9772 3 51 -1.0655 -9772 3 52 -0.10921 -9772 3 53 -0.42596 -9772 3 54 -0.52896 -9772 3 55 0.17541 -9772 3 56 -0.50596 -9772 3 57 -0.48372 -9772 3 58 -0.62951 -2088 3 1 -0.54359 -2088 3 2 -0.65546 -2088 3 3 -0.74479 -2088 3 4 -0.61564 -2088 3 5 -0.86965 -2088 3 6 -1.2706 -2088 3 7 -1.2448 -2088 3 8 -1.1392 -2088 3 9 -1.3068 -2088 3 10 -0.9382 -2088 3 11 -1.4724 -2088 3 12 -0.84077 -2088 3 13 -1.2435 -2088 3 14 -1.1408 -2088 3 15 -1.284 -2088 3 16 -1.0574 -2088 3 17 -1.2419 -2088 3 18 -1.1373 -2088 3 19 -1.0329 -2088 3 20 -0.99262 -2088 3 21 -0.70482 -2088 3 22 -0.82487 -2088 3 23 -0.55322 -2088 3 24 -0.52084 -2088 3 25 -1.2845 -2088 3 26 -1.0749 -2088 3 27 -1.0902 -2088 3 28 -1.1671 -2088 3 29 -0.75964 -2088 3 30 -0.87079 -2088 3 31 -0.52594 -2088 3 32 -0.017274 -2088 3 33 -1.9159 -2088 3 34 -0.18597 -2088 3 35 -0.61599 -2088 3 36 -0.70537 -2088 3 37 -0.60526 -2088 3 38 -0.66251 -2088 3 39 -0.32633 -2088 3 40 -1.3035 -2088 3 41 -0.92662 -2088 3 42 -1.6479 -2088 3 43 -1.2818 -2088 3 44 -0.7126 -2088 3 45 -0.92059 -2088 3 46 -1.8693 -2088 3 47 -1.3506 -2088 3 48 -1.0264 -2088 3 49 -0.99432 -2088 3 50 -0.59921 -2088 3 51 -1.2595 -2088 3 52 -0.24357 -2088 3 53 -0.43002 -2088 3 54 0.083507 -2088 3 55 -0.033828 -2088 3 56 0.46972 -2088 3 57 0.21572 -2088 3 58 0.97072 -10417 1 1 0.97492 -10417 1 2 1.0717 -10417 1 3 1.2324 -10417 1 4 1.2593 -10417 1 5 1.685 -10417 1 6 2.0139 -10417 1 7 2.2429 -10417 1 8 2.2013 -10417 1 9 2.2248 -10417 1 10 2.0139 -10417 1 11 2.4604 -10417 1 12 1.5907 -10417 1 13 1.3883 -10417 1 14 1.1179 -10417 1 15 1.0831 -10417 1 16 0.96327 -10417 1 17 1.0842 -10417 1 18 0.4454 -10417 1 19 -0.024521 -10417 1 20 0.38816 -10417 1 21 0.15865 -10417 1 22 -0.21118 -10417 1 23 -0.48191 -10417 1 24 -0.46717 -10417 1 25 -0.47723 -10417 1 26 -0.40083 -10417 1 27 -0.55778 -10417 1 28 -0.74242 -10417 1 29 -0.37738 -10417 1 30 -0.63417 -10417 1 31 -0.48312 -10417 1 32 -0.65404 -10417 1 33 -0.79972 -10417 1 34 -0.57369 -10417 1 35 -1.3658 -10417 1 36 -1.0051 -10417 1 37 -1.5472 -10417 1 38 -1.461 -10417 1 39 -1.4412 -10417 1 40 -0.87002 -10417 1 41 -1.143 -10417 1 42 -0.9128 -10417 1 43 -0.66796 -10417 1 44 -0.83015 -10417 1 45 -1.0066 -10417 1 46 -0.93714 -10417 1 47 -1.127 -10417 1 48 -0.72119 -10417 1 49 -0.76209 -10417 1 50 -0.69445 -10417 1 51 -0.62477 -10417 1 52 -0.68916 -10417 1 53 -0.63353 -10417 1 54 -1.2612 -10417 1 55 -1.6555 -10417 1 56 -1.7668 -10417 1 57 -1.9891 -10417 1 58 -1.6532 -3966 3 1 -1.8578 -3966 3 2 -1.8985 -3966 3 3 -2.1196 -3966 3 4 -1.7855 -3966 3 5 -2.0354 -3966 3 6 -1.9596 -3966 3 7 -1.0689 -3966 3 8 -1.4064 -3966 3 9 -1.4869 -3966 3 10 -1.5505 -3966 3 11 -1.8055 -3966 3 12 -1.7008 -3966 3 13 -2.0745 -3966 3 14 -1.83 -3966 3 15 -1.9553 -3966 3 16 -1.6857 -3966 3 17 -1.9451 -3966 3 18 -2.0127 -3966 3 19 -1.868 -3966 3 20 -1.5625 -3966 3 21 -1.9624 -3966 3 22 -1.9119 -3966 3 23 -1.9749 -3966 3 24 -1.6513 -3966 3 25 -1.6689 -3966 3 26 -1.7814 -3966 3 27 -1.8707 -3966 3 28 -1.6933 -3966 3 29 -1.5086 -3966 3 30 -1.5261 -3966 3 31 -0.16813 -3966 3 32 -0.73535 -3966 3 33 -0.9151 -3966 3 34 -0.40462 -3966 3 35 -0.48592 -3966 3 36 -0.39817 -3966 3 37 -1.0161 -3966 3 38 -0.24353 -3966 3 39 0.10998 -3966 3 40 -0.78803 -3966 3 41 -0.52916 -3966 3 42 -1.0944 -3966 3 43 -0.90698 -3966 3 44 -0.36188 -3966 3 45 -0.64918 -3966 3 46 -1.019 -3966 3 47 -1.2155 -3966 3 48 -0.96465 -3966 3 49 -0.85491 -3966 3 50 -0.78928 -3966 3 51 -0.81293 -3966 3 52 -0.64781 -3966 3 53 -0.78736 -3966 3 54 -0.48355 -3966 3 55 0.39936 -3966 3 56 2.5213 -3966 3 57 1.2019 -3966 3 58 -0.070349 -8606 1 1 0.86305 -8606 1 2 0.73865 -8606 1 3 1.0447 -8606 1 4 1.2953 -8606 1 5 2.0084 -8606 1 6 2.0611 -8606 1 7 2.4025 -8606 1 8 2.2306 -8606 1 9 2.5086 -8606 1 10 2.5674 -8606 1 11 2.5404 -8606 1 12 2.4038 -8606 1 13 2.5399 -8606 1 14 2.3899 -8606 1 15 2.7886 -8606 1 16 2.5011 -8606 1 17 3.0747 -8606 1 18 1.3217 -8606 1 19 0.092391 -8606 1 20 0.19143 -8606 1 21 0.16806 -8606 1 22 -0.58406 -8606 1 23 -0.57016 -8606 1 24 -0.56912 -8606 1 25 -1.2479 -8606 1 26 -0.89981 -8606 1 27 -1.0149 -8606 1 28 -1.0868 -8606 1 29 -0.71627 -8606 1 30 -0.88356 -8606 1 31 -0.76246 -8606 1 32 -1.1053 -8606 1 33 -1.6964 -8606 1 34 -1.0147 -8606 1 35 -1.4891 -8606 1 36 -0.85 -8606 1 37 -0.49243 -8606 1 38 -0.65674 -8606 1 39 -0.26814 -8606 1 40 -0.26076 -8606 1 41 -0.26291 -8606 1 42 -1.0745 -8606 1 43 -1.047 -8606 1 44 -0.69626 -8606 1 45 -0.4487 -8606 1 46 -0.44785 -8606 1 47 -0.084818 -8606 1 48 0.48961 -8606 1 49 0.48843 -8606 1 50 0.8026 -8606 1 51 1.0675 -8606 1 52 -1.6418 -8606 1 53 -0.35512 -8606 1 54 -0.57959 -8606 1 55 -1.7847 -8606 1 56 -1.4698 -8606 1 57 -1.5665 -8606 1 58 -2.2529 -14722 1 1 0.35404 -14722 1 2 0.20618 -14722 1 3 0.45756 -14722 1 4 0.8705 -14722 1 5 1.0183 -14722 1 6 1.4905 -14722 1 7 1.5019 -14722 1 8 1.6652 -14722 1 9 1.6308 -14722 1 10 1.5357 -14722 1 11 1.6721 -14722 1 12 1.1555 -14722 1 13 0.95899 -14722 1 14 1.4377 -14722 1 15 1.0575 -14722 1 16 1.1023 -14722 1 17 1.0022 -14722 1 18 0.64513 -14722 1 19 0.32201 -14722 1 20 0.16842 -14722 1 21 0.034455 -14722 1 22 -0.090135 -14722 1 23 -0.4606 -14722 1 24 -0.6877 -14722 1 25 -0.71392 -14722 1 26 -0.65058 -14722 1 27 -0.66523 -14722 1 28 -0.54618 -14722 1 29 -0.82859 -14722 1 30 -0.86747 -14722 1 31 -1.1282 -14722 1 32 -1.7028 -14722 1 33 -0.99836 -14722 1 34 -1.2961 -14722 1 35 -0.56379 -14722 1 36 -0.99903 -14722 1 37 -0.92851 -14722 1 38 -1.3723 -14722 1 39 -1.4075 -14722 1 40 -1.2459 -14722 1 41 -0.344 -14722 1 42 -0.98982 -14722 1 43 -1.0033 -14722 1 44 -1.2384 -14722 1 45 -1.1863 -14722 1 46 -1.175 -14722 1 47 -1.6308 -14722 1 48 -1.5412 -14722 1 49 -1.0187 -14722 1 50 -1.07 -14722 1 51 -1.2885 -14722 1 52 -0.80448 -14722 1 53 -1.2782 -14722 1 54 -1.06 -14722 1 55 -0.99544 -14722 1 56 -1.1429 -14722 1 57 -1.0468 -14722 1 58 -1.5905 -5711 3 1 -1.8451 -5711 3 2 -2.0949 -5711 3 3 -2.2672 -5711 3 4 -2.3024 -5711 3 5 -1.708 -5711 3 6 -1.6447 -5711 3 7 -1.8971 -5711 3 8 -2.0226 -5711 3 9 -2.0946 -5711 3 10 -1.5226 -5711 3 11 -1.8791 -5711 3 12 -1.7306 -5711 3 13 -1.4611 -5711 3 14 -1.8045 -5711 3 15 -1.4203 -5711 3 16 -1.6994 -5711 3 17 -1.5835 -5711 3 18 -1.5248 -5711 3 19 -1.8595 -5711 3 20 -1.7914 -5711 3 21 -1.5399 -5711 3 22 -1.6443 -5711 3 23 -1.2062 -5711 3 24 -1.2156 -5711 3 25 -1.1959 -5711 3 26 -1.0254 -5711 3 27 -1.0114 -5711 3 28 -1.1722 -5711 3 29 -1.3578 -5711 3 30 -0.97305 -5711 3 31 -0.67548 -5711 3 33 -0.47264 -5711 3 34 -0.29619 -5711 3 36 -0.4131 -5711 3 37 -0.74616 -5711 3 38 -0.8259 -5711 3 39 -1.3027 -5711 3 40 -1.2955 -5711 3 41 -1.5403 -5711 3 43 -1.5539 -5711 3 44 -1.6726 -5711 3 45 -1.9712 -5711 3 46 -1.2532 -5711 3 47 -2.3553 -5711 3 48 -1.6145 -5711 3 49 -1.8022 -5711 3 50 -1.9177 -5711 3 51 -2.2349 -5711 3 53 -1.8872 -5711 3 54 -2.1151 -5711 3 55 -1.6481 -5711 3 56 -1.0895 -5711 3 57 -0.11998 -5711 3 58 0.82429 -15634 1 1 1.0031 -15634 1 2 0.89532 -15634 1 3 0.18505 -15634 1 4 2.6189 -15634 1 5 4.174 -15634 1 6 4.8863 -15634 1 7 3.6903 -15634 1 8 2.5679 -15634 1 9 -0.5557 -15634 1 10 -1.3196 -15634 1 11 -0.91746 -15634 1 12 -1.4929 -15634 1 13 -3.0427 -15634 1 14 -2.378 -15634 1 15 -1.7144 -15634 1 16 -1.8245 -15634 1 17 -2.2278 -15634 1 18 -3.3753 -15634 1 19 -3.026 -15634 1 20 -1.982 -15634 1 21 -2.4781 -15634 1 22 -2.6698 -15634 1 23 -3.1143 -15634 1 24 -2.7738 -15634 1 25 -2.6823 -15634 1 26 -3.3244 -15634 1 27 -3.3223 -15634 1 28 -3.4011 -15634 1 29 -3.223 -15634 1 30 -2.8073 -15634 1 31 -2.6632 -15634 1 32 -2.5265 -15634 1 33 -3.0611 -15634 1 34 -2.5951 -15634 1 35 -2.7975 -15634 1 36 -2.1079 -15634 1 37 -2.3848 -15634 1 38 -1.8038 -15634 1 39 -1.6098 -15634 1 40 -2.2318 -15634 1 41 -0.7009 -15634 1 42 -2.8811 -15634 1 43 -2.5688 -15634 1 44 -3.0257 -15634 1 45 -2.6368 -15634 1 46 -2.5873 -15634 1 47 -2.6786 -15634 1 48 -3.1108 -15634 1 49 -2.387 -15634 1 50 -2.0863 -15634 1 51 -3.1362 -15634 1 52 -2.7512 -15634 1 53 -2.326 -15634 1 54 -2.3103 -15634 1 55 -2.4037 -15634 1 56 -2.8056 -15634 1 57 -2.865 -15634 1 58 -3.0461 -18404 3 1 -1.7452 -18404 3 2 -1.621 -18404 3 3 -1.85 -18404 3 4 -1.8237 -18404 3 5 -1.9213 -18404 3 6 -1.7725 -18404 3 7 -2.039 -18404 3 8 -2.2283 -18404 3 9 -2.1167 -18404 3 10 -2.0428 -18404 3 11 -2.4272 -18404 3 12 -1.881 -18404 3 13 -2.1481 -18404 3 14 -2.0699 -18404 3 15 -1.8183 -18404 3 16 -2.1091 -18404 3 17 -2.4895 -18404 3 18 -2.4064 -18404 3 19 -1.8772 -18404 3 20 -2.0244 -18404 3 21 -2.001 -18404 3 22 -2.0067 -18404 3 23 -2.7635 -18404 3 24 -2.2521 -18404 3 25 -2.5578 -18404 3 26 -2.676 -18404 3 27 -2.5018 -18404 3 28 -2.4063 -18404 3 29 -2.9202 -18404 3 30 -2.4185 -18404 3 31 -1.2527 -18404 3 32 -1.4148 -18404 3 33 -1.9804 -18404 3 34 -1.5345 -18404 3 35 -1.6964 -18404 3 36 -1.4762 -18404 3 37 -1.3606 -18404 3 38 -0.64196 -18404 3 39 -1.4378 -18404 3 40 -2.0101 -18404 3 41 -2.5716 -18404 3 42 -2.6758 -18404 3 43 -2.0284 -18404 3 44 -2.2688 -18404 3 45 -2.2123 -18404 3 46 -2.8862 -18404 3 47 -2.6285 -18404 3 48 -2.6445 -18404 3 49 -1.966 -18404 3 50 -1.872 -18404 3 51 -2.6848 -18404 3 52 -2.0878 -18404 3 53 -2.0086 -18404 3 54 -1.9586 -18404 3 55 -2.3817 -18404 3 56 -1.919 -18404 3 57 -2.0213 -18404 3 58 -0.23672 -16901 1 1 1.0269 -16901 1 2 1.1906 -16901 1 3 1.7092 -16901 1 4 1.6832 -16901 1 5 2.0055 -16901 1 6 2.3466 -16901 1 7 2.3787 -16901 1 8 2.4351 -16901 1 9 2.2659 -16901 1 10 2.2475 -16901 1 11 2.3215 -16901 1 12 1.7972 -16901 1 13 1.7221 -16901 1 14 1.6965 -16901 1 15 1.1247 -16901 1 16 0.89712 -16901 1 17 1.3231 -16901 1 18 0.63019 -16901 1 19 -0.3615 -16901 1 20 0.20156 -16901 1 21 0.013578 -16901 1 22 -0.25303 -16901 1 23 -0.55243 -16901 1 24 -0.48872 -16901 1 25 -0.50075 -16901 1 26 -0.42621 -16901 1 27 -1.2565 -16901 1 28 -1.2993 -16901 1 29 -1.0358 -16901 1 30 -1.3995 -16901 1 31 -1.5251 -16901 1 32 -1.7372 -16901 1 33 -1.2306 -16901 1 34 -1.5274 -16901 1 35 -1.0723 -16901 1 36 -1.6023 -16901 1 37 -1.9799 -16901 1 38 -1.8196 -16901 1 39 -1.1328 -16901 1 40 -1.3123 -16901 1 41 -1.8708 -16901 1 42 -0.78702 -16901 1 43 -0.97184 -16901 1 44 -1.1106 -16901 1 45 -1.5558 -16901 1 46 -1.0278 -16901 1 47 -1.543 -16901 1 48 -1.0516 -16901 1 49 -0.41008 -16901 1 50 -0.95468 -16901 1 51 -1.1978 -16901 1 52 -0.75432 -16901 1 53 -1.1044 -16901 1 54 -1.2133 -16901 1 55 -1.4844 -16901 1 56 -1.4492 -16901 1 57 -1.9265 -16901 1 58 -1.7604 -5107 3 1 -3.2018 -5107 3 2 -3.3843 -5107 3 3 -2.2362 -5107 3 4 -2.4237 -5107 3 5 -3.694 -5107 3 6 -2.9812 -5107 3 7 -2.5195 -5107 3 8 -2.6642 -5107 3 9 -2.8177 -5107 3 10 -2.6846 -5107 3 11 -2.8251 -5107 3 12 -2.1831 -5107 3 13 -2.7414 -5107 3 14 -2.1354 -5107 3 15 -2.9456 -5107 3 16 -2.0017 -5107 3 17 -2.4889 -5107 3 18 -3.1887 -5107 3 19 -2.793 -5107 3 20 -1.9506 -5107 3 21 -2.4753 -5107 3 22 -3.1781 -5107 3 23 -3.3725 -5107 3 24 -3.0194 -5107 3 25 -2.5735 -5107 3 26 -3.4571 -5107 3 27 -3.0161 -5107 3 28 -3.0851 -5107 3 29 -2.1181 -5107 3 30 -3.3768 -5107 3 31 -1.28 -5107 3 32 -2.3247 -5107 3 33 -1.9758 -5107 3 34 -1.839 -5107 3 35 -2.0688 -5107 3 36 -1.7895 -5107 3 37 -1.6746 -5107 3 38 -1.0105 -5107 3 39 -1.6089 -5107 3 40 -1.9377 -5107 3 41 -2.4127 -5107 3 42 -3.63 -5107 3 43 -3.2126 -5107 3 44 -3.2969 -5107 3 45 -2.5532 -5107 3 46 -3.8899 -5107 3 47 -2.3105 -5107 3 48 -2.9655 -5107 3 49 -2.5128 -5107 3 50 -2.7894 -5107 3 51 -3.0372 -5107 3 52 -3.0159 -5107 3 53 -1.6996 -5107 3 54 -1.5095 -5107 3 55 -2.5096 -5107 3 56 -2.8045 -5107 3 57 -2.1336 -5107 3 58 -2.4208 -11988 1 1 0.19607 -11988 1 2 0.48623 -11988 1 3 0.32146 -11988 1 4 0.43916 -11988 1 5 0.59019 -11988 1 6 1.5428 -11988 1 7 1.8111 -11988 1 8 1.4385 -11988 1 9 1.8449 -11988 1 10 1.5088 -11988 1 11 1.8077 -11988 1 12 1.4713 -11988 1 13 1.5026 -11988 1 14 1.7863 -11988 1 15 1.3992 -11988 1 16 0.61646 -11988 1 17 1.3488 -11988 1 18 0.47486 -11988 1 19 0.025249 -11988 1 20 -0.15009 -11988 1 21 -0.35413 -11988 1 22 -0.3152 -11988 1 23 -0.81424 -11988 1 24 -0.77863 -11988 1 25 -0.70491 -11988 1 26 -1.1233 -11988 1 27 -1.2515 -11988 1 28 -1.2304 -11988 1 29 -1.047 -11988 1 30 -1.0364 -11988 1 31 -0.98892 -11988 1 32 -1.6361 -11988 1 33 -1.9184 -11988 1 34 -1.0295 -11988 1 35 -1.4788 -11988 1 36 -1.3412 -11988 1 37 -1.4026 -11988 1 38 -1.582 -11988 1 39 -1.1393 -11988 1 40 -1.539 -11988 1 41 0.62259 -11988 1 42 -1.1183 -11988 1 43 -1.3686 -11988 1 44 -1.2846 -11988 1 45 -1.2138 -11988 1 46 -0.79284 -11988 1 47 -1.458 -11988 1 48 -0.5518 -11988 1 49 -0.68496 -11988 1 50 -0.92185 -11988 1 51 -0.80494 -11988 1 52 -0.79504 -11988 1 53 -0.5305 -11988 1 54 -0.91446 -11988 1 55 -1.055 -11988 1 56 -1.5522 -11988 1 57 -1.8499 -11988 1 58 -1.8077 -1497 3 1 -0.83347 -1497 3 2 -0.60602 -1497 3 3 -0.50768 -1497 3 4 -0.12228 -1497 3 5 -0.089261 -1497 3 6 0.13937 -1497 3 7 -0.28999 -1497 3 8 -0.63059 -1497 3 9 -0.80241 -1497 3 10 -1.0125 -1497 3 11 -1.1906 -1497 3 12 -0.70604 -1497 3 13 -0.76433 -1497 3 14 -0.47512 -1497 3 15 -0.46089 -1497 3 16 -0.89103 -1497 3 17 -0.95839 -1497 3 18 -0.85265 -1497 3 19 -0.53415 -1497 3 20 -0.73143 -1497 3 21 -0.53766 -1497 3 22 -0.55648 -1497 3 23 -0.84211 -1497 3 24 -0.76137 -1497 3 25 -0.74501 -1497 3 26 -0.84287 -1497 3 27 -1.7811 -1497 3 28 -1.4792 -1497 3 29 -1.3465 -1497 3 30 -1.1287 -1497 3 31 -1.2442 -1497 3 32 -1.0138 -1497 3 34 -1.0155 -1497 3 35 -0.83597 -1497 3 36 -1.0295 -1497 3 37 -1.3312 -1497 3 38 -1.2932 -1497 3 39 -1.4636 -1497 3 40 -0.91007 -1497 3 41 -0.7217 -1497 3 42 -0.91422 -1497 3 43 -0.43768 -1497 3 44 -0.45618 -1497 3 45 -1.3501 -1497 3 46 -1.0353 -1497 3 47 -0.69839 -1497 3 48 -0.912 -1497 3 49 -0.86292 -1497 3 50 -1.0496 -1497 3 51 -0.80288 -1497 3 52 -0.42316 -1497 3 53 -0.89189 -1497 3 54 -1.2367 -1497 3 55 -0.59829 -1497 3 56 -0.82854 -1497 3 57 -0.17422 -1497 3 58 -0.13364 -5253 3 1 -1.8305 -5253 3 2 -1.3747 -5253 3 3 -1.2648 -5253 3 4 -1.0548 -5253 3 5 -0.80461 -5253 3 6 -0.62518 -5253 3 7 -0.79874 -5253 3 8 -0.9037 -5253 3 9 -0.61828 -5253 3 10 -1.2379 -5253 3 11 -1.3482 -5253 3 12 -1.1932 -5253 3 13 -1.2876 -5253 3 14 -1.2727 -5253 3 15 -1.985 -5253 3 16 -2.0099 -5253 3 17 -2.0247 -5253 3 18 -1.6439 -5253 3 19 -1.4805 -5253 3 20 -1.7065 -5253 3 21 -1.5958 -5253 3 22 -1.2129 -5253 3 23 -1.6271 -5253 3 24 -1.8869 -5253 3 25 -1.5425 -5253 3 26 -1.6397 -5253 3 27 -1.8794 -5253 3 28 -1.7913 -5253 3 29 -1.5403 -5253 3 30 -1.7086 -5253 3 31 -0.99957 -5253 3 32 -1.1678 -5253 3 33 -1.3357 -5253 3 34 -1.1386 -5253 3 35 -1.2081 -5253 3 36 -1.0198 -5253 3 37 -1.8859 -5253 3 38 -1.4049 -5253 3 39 -1.8191 -5253 3 40 -1.5514 -5253 3 41 0.023271 -5253 3 42 -1.4723 -5253 3 43 -1.371 -5253 3 44 -1.814 -5253 3 45 -2.1164 -5253 3 46 -1.563 -5253 3 47 -1.5777 -5253 3 48 -1.9931 -5253 3 49 -1.6801 -5253 3 50 -2.0626 -5253 3 51 -1.7401 -5253 3 52 -1.382 -5253 3 53 -1.7373 -5253 3 54 -1.6044 -5253 3 55 -1.8285 -5253 3 56 -1.5251 -5253 3 57 -0.60472 -5253 3 58 0.64566 -18020 2 1 -2.7715 -18020 2 2 -2.9358 -18020 2 3 -2.059 -18020 2 4 -2.4567 -18020 2 5 -2.178 -18020 2 6 -2.2988 -18020 2 7 -2.1034 -18020 2 8 -2.3327 -18020 2 9 -2.314 -18020 2 10 -2.157 -18020 2 11 -2.098 -18020 2 12 -2.2676 -18020 2 13 -2.2741 -18020 2 14 -2.1313 -18020 2 15 -2.8338 -18020 2 16 -2.2703 -18020 2 17 -2.039 -18020 2 18 -2.1486 -18020 2 19 -1.8943 -18020 2 20 -1.834 -18020 2 21 -1.8851 -18020 2 22 -2.0213 -18020 2 23 -0.61385 -18020 2 24 0.069984 -18020 2 25 0.070269 -18020 2 26 0.90947 -18020 2 27 1.5968 -18020 2 28 1.5699 -18020 2 29 1.2938 -18020 2 30 1.6316 -18020 2 31 0.16238 -18020 2 32 0.22566 -18020 2 33 -0.12398 -18020 2 34 0.41864 -18020 2 35 0.11115 -18020 2 36 0.27903 -18020 2 37 0.8615 -18020 2 38 0.1493 -18020 2 39 1.2974 -18020 2 40 -1.2458 -18020 2 41 -1.404 -18020 2 42 -3.612 -18020 2 43 -2.7087 -18020 2 44 -2.2865 -18020 2 45 -1.1036 -18020 2 46 -0.98605 -18020 2 47 -0.54312 -18020 2 48 -2.4153 -18020 2 49 -2.5295 -18020 2 50 -1.8163 -18020 2 51 -2.2852 -18020 2 52 -0.57137 -18020 2 53 -0.63458 -18020 2 54 0.4624 -18020 2 55 1.6921 -18020 2 56 2.4776 -18020 2 57 2.8338 -18020 2 58 3.1303 -14025 1 1 0.098804 -14025 1 2 0.56716 -14025 1 3 1.0031 -14025 1 4 1.3854 -14025 1 5 1.7936 -14025 1 6 2.5883 -14025 1 7 2.3739 -14025 1 8 1.892 -14025 1 9 0.99601 -14025 1 10 0.44224 -14025 1 11 0.94348 -14025 1 12 0.37037 -14025 1 13 -0.021034 -14025 1 14 0.053731 -14025 1 15 0.21842 -14025 1 16 0.02306 -14025 1 17 0.066196 -14025 1 18 -0.63761 -14025 1 19 -0.35125 -14025 1 20 -0.26844 -14025 1 21 -0.58678 -14025 1 22 -0.65438 -14025 1 23 -0.71807 -14025 1 24 -0.62297 -14025 1 25 -1.2239 -14025 1 26 -0.75573 -14025 1 27 -1.0756 -14025 1 28 -1.0586 -14025 1 29 -0.76954 -14025 1 30 -0.95455 -14025 1 31 -1.7038 -14025 1 32 -1.843 -14025 1 33 -1.8669 -14025 1 34 -1.6253 -14025 1 35 -1.9312 -14025 1 36 -1.5826 -14025 1 37 -1.7684 -14025 1 38 -1.892 -14025 1 39 -1.2066 -14025 1 40 -1.2372 -14025 1 41 -1.2117 -14025 1 42 -1.1063 -14025 1 43 -1.087 -14025 1 44 -1.1207 -14025 1 45 -1.3447 -14025 1 46 -1.3718 -14025 1 47 -0.35295 -14025 1 48 -0.79913 -14025 1 49 -0.83841 -14025 1 50 -1.0848 -14025 1 51 -0.35242 -14025 1 52 -0.97423 -14025 1 53 -0.4607 -14025 1 54 -0.87531 -14025 1 55 -1.4323 -14025 1 56 -1.493 -14025 1 57 -1.4178 -14025 1 58 -1.2133 -5962 3 1 -2.5466 -5962 3 2 -2.3681 -5962 3 3 -2.6224 -5962 3 4 -3.0472 -5962 3 5 -3.8854 -5962 3 6 -4.2686 -5962 3 7 -3.8078 -5962 3 8 -3.2147 -5962 3 9 -3.0718 -5962 3 10 -2.7762 -5962 3 11 -2.7236 -5962 3 12 -2.5308 -5962 3 13 -3.2928 -5962 3 14 -2.7877 -5962 3 15 -3.3594 -5962 3 16 -3.4924 -5962 3 17 -2.9802 -5962 3 18 -2.7203 -5962 3 19 -2.6798 -5962 3 20 -2.1874 -5962 3 21 -2.0187 -5962 3 22 -2.0023 -5962 3 23 -2.0047 -5962 3 24 -2.1081 -5962 3 25 -2.5776 -5962 3 26 -2.3074 -5962 3 27 -2.3492 -5962 3 28 -2.2424 -5962 3 29 -2.3186 -5962 3 30 -1.9346 -5962 3 31 -1.1333 -5962 3 32 -0.88048 -5962 3 33 -0.9283 -5962 3 34 -0.4244 -5962 3 35 -1.9794 -5962 3 36 -0.54051 -5962 3 37 -1.1824 -5962 3 38 -1.5526 -5962 3 39 -1.5425 -5962 3 40 -1.0785 -5962 3 41 -1.7195 -5962 3 42 -3.2952 -5962 3 43 -2.4553 -5962 3 44 -2.39 -5962 3 45 -1.5981 -5962 3 46 -1.8299 -5962 3 47 -1.8514 -5962 3 48 -2.0582 -5962 3 49 -2.2394 -5962 3 50 -1.5851 -5962 3 51 -1.8478 -5962 3 52 -0.13488 -5962 3 53 -0.80823 -5962 3 54 -0.71257 -5962 3 55 -0.64596 -5962 3 56 0.5024 -5962 3 57 0.98108 -5962 3 58 2.0211 -1760 3 1 -1.2527 -1760 3 2 -1.6417 -1760 3 3 -1.2375 -1760 3 4 -1.7768 -1760 3 5 -1.9944 -1760 3 7 -0.90744 -1760 3 8 -0.48887 -1760 3 9 -0.5059 -1760 3 10 -0.86994 -1760 3 11 -1.0363 -1760 3 12 -0.82948 -1760 3 13 -1.0376 -1760 3 14 -0.76698 -1760 3 15 -1.4402 -1760 3 16 -1.5172 -1760 3 17 -1.8798 -1760 3 18 -1.3748 -1760 3 19 -1.2218 -1760 3 20 -1.2795 -1760 3 21 -1.1563 -1760 3 22 -0.95514 -1760 3 23 -1.2946 -1760 3 24 -1.2071 -1760 3 25 -1.2071 -1760 3 26 -1.3576 -1760 3 27 -1.8372 -1760 3 28 -1.5284 -1760 3 29 -1.7639 -1760 3 30 -1.2731 -1760 3 31 -0.81087 -1760 3 32 -1.1205 -1760 3 33 -1.6408 -1760 3 34 -1.0565 -1760 3 35 -1.5893 -1760 3 36 -1.3715 -1760 3 37 -1.8063 -1760 3 38 -0.99967 -1760 3 39 -0.88289 -1760 3 40 -1.2689 -1760 3 41 -1.9939 -1760 3 42 -2.1569 -1760 3 43 -1.5939 -1760 3 44 -1.5194 -1760 3 45 -0.78723 -1760 3 46 -1.5329 -1760 3 47 -0.99591 -1760 3 48 -1.3906 -1760 3 49 -1.1312 -1760 3 50 -0.60552 -1760 3 51 -1.1972 -1760 3 52 -1.0801 -1760 3 53 -0.74178 -1760 3 54 -0.70749 -1760 3 55 -0.032406 -1760 3 56 1.6001 -1760 3 57 1.3215 -1760 3 58 0.71199 -10233 3 1 -1.0143 -10233 3 2 -0.80716 -10233 3 3 -0.90052 -10233 3 4 -0.91978 -10233 3 5 -0.86863 -10233 3 6 -1.251 -10233 3 7 -1.3839 -10233 3 8 -1.3124 -10233 3 9 -0.66518 -10233 3 10 -0.80787 -10233 3 13 -1.1763 -10233 3 14 -1.0807 -10233 3 15 -1.6122 -10233 3 16 -1.2668 -10233 3 17 -1.843 -10233 3 18 -1.6732 -10233 3 19 -1.632 -10233 3 20 -1.7119 -10233 3 21 -1.6041 -10233 3 22 -1.5334 -10233 3 23 -1.6946 -10233 3 24 -1.6099 -10233 3 25 -1.3759 -10233 3 26 -1.4808 -10233 3 27 -1.6325 -10233 3 28 -1.6107 -10233 3 29 -1.6168 -10233 3 30 -1.4689 -10233 3 31 -0.9167 -10233 3 32 -1.1712 -10233 3 33 -0.86935 -10233 3 34 -1.3319 -10233 3 35 -1.5854 -10233 3 36 -1.0442 -10233 3 37 -0.95923 -10233 3 38 -0.9685 -10233 3 39 -1.1301 -10233 3 40 -1.3559 -10233 3 41 -2.0001 -10233 3 42 -1.904 -10233 3 43 -1.5139 -10233 3 44 -1.4099 -10233 3 45 -1.9853 -10233 3 46 -1.7578 -10233 3 47 -1.5256 -10233 3 48 -2.0745 -10233 3 49 -1.4741 -10233 3 50 -1.6102 -10233 3 51 -1.6673 -10233 3 52 -0.44619 -10233 3 53 -1.3883 -10233 3 54 -0.9464 -10233 3 55 0.039786 -10233 3 56 1.1473 -10233 3 57 1.1929 -10233 3 58 1.8366 -9668 3 1 -2.8022 -9668 3 2 -2.7567 -9668 3 3 -2.6208 -9668 3 4 -2.4485 -9668 3 5 -2.6207 -9668 3 6 -1.8639 -9668 3 7 -1.5712 -9668 3 8 -1.1596 -9668 3 9 -0.60345 -9668 3 10 -1.0266 -9668 3 11 -0.28794 -9668 3 12 -1.1413 -9668 3 13 -0.92926 -9668 3 14 -1.5798 -9668 3 15 -1.6448 -9668 3 16 -1.3155 -9668 3 17 -1.3594 -9668 3 18 -1.9011 -9668 3 19 -2.2338 -9668 3 20 -2.2802 -9668 3 21 -1.9042 -9668 3 22 -2.4548 -9668 3 23 -2.7236 -9668 3 24 -1.6292 -9668 3 25 -2.1842 -9668 3 26 -1.8546 -9668 3 27 -2.2061 -9668 3 28 -2.2971 -9668 3 29 -2.1818 -9668 3 30 -2.1488 -9668 3 31 -1.8793 -9668 3 32 -1.6506 -9668 3 33 -1.5604 -9668 3 34 -1.6285 -9668 3 35 -1.8928 -9668 3 36 -1.6833 -9668 3 37 -1.8787 -9668 3 38 -1.648 -9668 3 39 -1.8299 -9668 3 40 -1.8796 -9668 3 41 -2.0378 -9668 3 42 -2.5248 -9668 3 43 -2.372 -9668 3 44 -2.2715 -9668 3 45 -1.4612 -9668 3 46 -1.3099 -9668 3 47 -1.7588 -9668 3 48 -1.9286 -9668 3 49 -1.9729 -9668 3 50 -1.6712 -9668 3 51 -2.092 -9668 3 52 -1.7958 -9668 3 53 -1.9246 -9668 3 54 -2.0138 -9668 3 55 -1.7633 -9668 3 56 0.37726 -9668 3 57 1.6916 -9668 3 58 1.3501 -12750 1 1 0.27515 -12750 1 2 0.51283 -12750 1 3 0.71669 -12750 1 4 0.95748 -12750 1 5 1.3638 -12750 1 6 1.7739 -12750 1 7 1.8032 -12750 1 8 1.6298 -12750 1 9 1.4504 -12750 1 10 1.2996 -12750 1 11 1.5536 -12750 1 12 0.91621 -12750 1 13 0.64563 -12750 1 14 0.30894 -12750 1 15 0.52025 -12750 1 16 0.46398 -12750 1 17 -0.49047 -12750 1 18 -0.25551 -12750 1 19 -0.73395 -12750 1 20 -0.71207 -12750 1 21 -0.62867 -12750 1 22 -0.86447 -12750 1 23 -0.77196 -12750 1 24 -0.83368 -12750 1 25 -1.1805 -12750 1 26 -1.3374 -12750 1 27 -1.6298 -12750 1 28 -1.3922 -12750 1 29 -1.6275 -12750 1 30 -1.6827 -12750 1 31 -1.1139 -12750 1 32 -1.2841 -12750 1 33 -1.4273 -12750 1 34 -1.1431 -12750 1 35 -0.75992 -12750 1 36 -0.80388 -12750 1 37 -1.2353 -12750 1 38 -0.5556 -12750 1 39 -0.67353 -12750 1 40 -1.3565 -12750 1 41 -1.4599 -12750 1 42 -0.95032 -12750 1 43 -0.8221 -12750 1 44 -1.2258 -12750 1 45 -0.7137 -12750 1 46 -0.69885 -12750 1 47 -1.3797 -12750 1 48 -0.57731 -12750 1 49 -0.38457 -12750 1 50 -0.61111 -12750 1 51 -0.46575 -12750 1 52 -0.47485 -12750 1 53 -0.68962 -12750 1 54 -0.71412 -12750 1 55 -1.2092 -12750 1 56 -1.2743 -12750 1 57 -1.3927 -12750 1 58 -1.4753 -7107 2 1 -4.1022 -7107 2 2 -4.2534 -7107 2 3 -4.4378 -7107 2 4 -3.7574 -7107 2 5 -3.801 -7107 2 6 -3.4211 -7107 2 7 -3.2858 -7107 2 8 -3.2989 -7107 2 9 -3.6529 -7107 2 10 -3.3334 -7107 2 11 -3.4396 -7107 2 12 -3.2918 -7107 2 13 -3.3722 -7107 2 14 -3.5124 -7107 2 15 -3.3288 -7107 2 16 -3.1227 -7107 2 17 -1.7678 -7107 2 18 -0.81458 -7107 2 19 1.8906 -7107 2 20 1.1111 -7107 2 21 1.5919 -7107 2 22 1.5818 -7107 2 23 3.2307 -7107 2 24 3.4077 -7107 2 25 3.7184 -7107 2 26 3.8384 -7107 2 27 4.4754 -7107 2 28 4.072 -7107 2 29 3.9207 -7107 2 30 4.0182 -7107 2 31 2.922 -7107 2 32 2.8843 -7107 2 33 2.8827 -7107 2 34 2.8448 -7107 2 35 2.8126 -7107 2 36 3.005 -7107 2 37 4.0054 -7107 2 38 3.5281 -7107 2 39 3.8668 -7107 2 40 0.9327 -7107 2 41 0.096867 -7107 2 42 -3.3952 -7107 2 43 -3.06 -7107 2 44 -2.6703 -7107 2 45 -1.9956 -7107 2 46 -1.9027 -7107 2 47 -1.9665 -7107 2 48 -3.8593 -7107 2 49 -4.2911 -7107 2 50 -2.4844 -7107 2 51 -3.669 -7107 2 52 -0.43768 -7107 2 53 -1.0939 -7107 2 54 0.95939 -7107 2 55 2.39 -7107 2 56 4.2534 -7107 2 57 3.6148 -7107 2 58 4.383 -7028 2 1 -2.5505 -7028 2 2 -2.4491 -7028 2 3 -2.285 -7028 2 4 -2.234 -7028 2 5 -2.13 -7028 2 7 -1.988 -7028 2 8 -2.3272 -7028 2 9 -2.3893 -7028 2 10 -2.6542 -7028 2 12 0.22354 -7028 2 13 -2.4932 -7028 2 14 -2.4512 -7028 2 15 -1.0397 -7028 2 16 -1.9016 -7028 2 17 -1.7318 -7028 2 18 -1.0406 -7028 2 19 0.59166 -7028 2 20 0.08764 -7028 2 21 0.78481 -7028 2 22 1.0425 -7028 2 23 1.4651 -7028 2 24 1.8966 -7028 2 25 1.3582 -7028 2 26 2.1972 -7028 2 27 2.9122 -7028 2 28 2.6157 -7028 2 29 2.1388 -7028 2 30 2.384 -7028 2 31 1.4098 -7028 2 32 1.9567 -7028 2 33 2.7662 -7028 2 34 1.62 -7028 2 35 2.9011 -7028 2 36 2.2204 -7028 2 37 2.9271 -7028 2 38 2.8923 -7028 2 39 2.5272 -7028 2 40 1.3125 -7028 2 41 -0.47399 -7028 2 42 -3.3681 -7028 2 43 -3.1407 -7028 2 44 -3.2044 -7028 2 45 -2.1731 -7028 2 46 -1.8413 -7028 2 47 -2.1645 -7028 2 48 -3.3795 -7028 2 49 -3.4742 -7028 2 50 -2.3603 -7028 2 51 -3.7444 -7028 2 52 0.17153 -7028 2 53 -1.3046 -7028 2 54 0.15857 -7028 2 55 1.9574 -7028 2 56 3.0514 -7028 2 57 2.5748 -7028 2 58 3.3268 -18251 2 1 -2.2682 -18251 2 2 -2.0378 -18251 2 3 -2.3661 -18251 2 4 -1.8691 -18251 2 5 -2.3196 -18251 2 7 -1.8782 -18251 2 8 -1.9847 -18251 2 9 -1.7841 -18251 2 10 -1.5515 -18251 2 12 -1.6619 -18251 2 13 -1.7558 -18251 2 14 -1.8905 -18251 2 15 -1.8175 -18251 2 16 -1.146 -18251 2 17 -1.1364 -18251 2 18 0.38376 -18251 2 19 1.8603 -18251 2 20 1.4784 -18251 2 21 1.7256 -18251 2 22 1.726 -18251 2 23 1.6531 -18251 2 24 1.7097 -18251 2 25 1.5349 -18251 2 26 1.6342 -18251 2 27 1.4803 -18251 2 28 1.4754 -18251 2 29 1.3678 -18251 2 30 1.7578 -18251 2 31 1.808 -18251 2 32 1.0281 -18251 2 33 0.95571 -18251 2 34 1.4594 -18251 2 35 1.8077 -18251 2 36 1.5619 -18251 2 37 1.795 -18251 2 38 1.4462 -18251 2 39 1.8131 -18251 2 40 -0.18738 -18251 2 41 -0.60884 -18251 2 42 -2.4798 -18251 2 43 -1.5005 -18251 2 44 -1.2006 -18251 2 45 -0.66347 -18251 2 46 -1.2924 -18251 2 47 -1.2758 -18251 2 48 -1.3807 -18251 2 49 -0.58783 -18251 2 50 -0.8918 -18251 2 51 -1.7464 -18251 2 52 0.29046 -18251 2 53 -0.025449 -18251 2 54 0.46437 -18251 2 55 1.9269 -18251 2 56 2.2104 -18251 2 57 2.3196 -18251 2 58 2.7216 -5596 2 1 -2.3757 -5596 2 2 -3.7815 -5596 2 3 -4.4686 -5596 2 4 -3.1403 -5596 2 5 -3.5073 -5596 2 6 -3.7768 -5596 2 7 -3.8978 -5596 2 8 -3.9283 -5596 2 9 -3.5931 -5596 2 10 -3.7889 -5596 2 13 -3.9335 -5596 2 14 -3.8209 -5596 2 15 -1.5319 -5596 2 16 -3.2229 -5596 2 17 -2.7382 -5596 2 18 -1.3633 -5596 2 19 1.1983 -5596 2 20 0.64008 -5596 2 21 1.0222 -5596 2 22 1.6351 -5596 2 23 1.8606 -5596 2 24 2.2717 -5596 2 25 2.818 -5596 2 26 3.1313 -5596 2 27 3.2944 -5596 2 28 3.2181 -5596 2 29 2.8944 -5596 2 30 2.8381 -5596 2 31 2.9004 -5596 2 32 3.3313 -5596 2 33 3.7637 -5596 2 34 2.5325 -5596 2 35 3.2123 -5596 2 36 3.2608 -5596 2 37 3.963 -5596 2 38 4.0358 -5596 2 39 3.3732 -5596 2 40 2.1083 -5596 2 41 -1.3061 -5596 2 42 -4.0378 -5596 2 43 -3.301 -5596 2 44 -2.8992 -5596 2 45 -2.1248 -5596 2 46 -1.7525 -5596 2 47 -1.489 -5596 2 48 -4.5086 -5596 2 49 -3.8503 -5596 2 50 -2.6474 -5596 2 51 -4.6998 -5596 2 52 0.97213 -5596 2 53 0.9847 -5596 2 54 1.1808 -5596 2 56 4.9464 -5596 2 58 4.4504 -8154 2 1 -2.9647 -8154 2 2 -2.8465 -8154 2 3 -2.7535 -8154 2 4 -2.7667 -8154 2 5 -2.9503 -8154 2 6 -2.5141 -8154 2 7 -2.2861 -8154 2 8 -2.7593 -8154 2 9 -2.7662 -8154 2 10 -2.3499 -8154 2 11 -2.901 -8154 2 12 -2.0403 -8154 2 13 -2.1136 -8154 2 14 -2.2808 -8154 2 15 -1.4499 -8154 2 16 -2.1873 -8154 2 17 -1.7927 -8154 2 18 -1.1691 -8154 2 19 0.50762 -8154 2 20 -0.3823 -8154 2 21 0.35563 -8154 2 22 0.63589 -8154 2 23 1.5066 -8154 2 24 1.8207 -8154 2 25 1.6716 -8154 2 26 2.2113 -8154 2 27 2.3232 -8154 2 28 2.1804 -8154 2 29 2.219 -8154 2 30 2.2771 -8154 2 31 1.2564 -8154 2 32 1.3094 -8154 2 33 1.6742 -8154 2 34 1.4324 -8154 2 35 1.1455 -8154 2 36 1.3402 -8154 2 37 1.4883 -8154 2 38 1.0765 -8154 2 39 1.962 -8154 2 40 0.037706 -8154 2 41 -1.1688 -8154 2 42 -2.2425 -8154 2 43 -1.7824 -8154 2 44 -1.3859 -8154 2 45 -0.98286 -8154 2 46 -1.1925 -8154 2 47 -1.3082 -8154 2 48 -2.429 -8154 2 49 -2.731 -8154 2 50 -1.8424 -8154 2 51 -2.3956 -8154 2 52 -0.31538 -8154 2 53 -0.60671 -8154 2 54 0.087781 -8154 2 55 1.4027 -8154 2 56 2.4532 -8154 2 57 2.4028 -8154 2 58 3.1717 -13096 1 1 0.82586 -13096 1 2 0.95486 -13096 1 3 0.89852 -13096 1 4 1.2833 -13096 1 5 1.4719 -13096 1 6 2.0835 -13096 1 7 2.2499 -13096 1 8 2.3295 -13096 1 9 2.6478 -13096 1 10 2.5256 -13096 1 11 2.6215 -13096 1 12 0.84617 -13096 1 13 1.9111 -13096 1 14 1.6534 -13096 1 15 1.3125 -13096 1 16 1.2033 -13096 1 17 1.4624 -13096 1 18 0.66444 -13096 1 19 -0.3221 -13096 1 20 -0.075235 -13096 1 21 -0.17418 -13096 1 22 -0.66227 -13096 1 23 -0.63085 -13096 1 24 -1.0554 -13096 1 25 -0.94173 -13096 1 26 -1.0251 -13096 1 27 -0.76692 -13096 1 28 -0.53302 -13096 1 29 -1.4666 -13096 1 30 -1.258 -13096 1 31 -1.1464 -13096 1 32 -2.2161 -13096 1 33 -1.4588 -13096 1 34 -1.4825 -13096 1 35 -0.45397 -13096 1 36 -0.68988 -13096 1 37 -0.90199 -13096 1 38 -1.0943 -13096 1 39 -1.2507 -13096 1 40 -1.252 -13096 1 41 -0.24918 -13096 1 42 -1.6052 -13096 1 43 -1.559 -13096 1 44 -1.8464 -13096 1 45 -1.4468 -13096 1 46 -1.3952 -13096 1 47 -1.4436 -13096 1 48 -1.3475 -13096 1 49 -1.1845 -13096 1 50 -1.8209 -13096 1 51 -1.7579 -13096 1 52 -1.4183 -13096 1 53 -1.6582 -13096 1 54 -1.836 -13096 1 55 -2.2532 -13096 1 56 -2.5001 -13096 1 57 -2.4932 -13096 1 58 -1.86 -10483 2 1 -1.2518 -10483 2 2 -1.2025 -10483 2 3 -1.0684 -10483 2 4 -1.1692 -10483 2 5 -1.118 -10483 2 6 -0.80405 -10483 2 7 -0.82036 -10483 2 8 -0.92475 -10483 2 9 -0.79807 -10483 2 10 -0.49089 -10483 2 11 -0.68753 -10483 2 12 -0.55966 -10483 2 13 -0.80062 -10483 2 14 -0.49696 -10483 2 15 -0.75615 -10483 2 16 -0.91673 -10483 2 17 -0.82756 -10483 2 18 -0.59655 -10483 2 19 0.6894 -10483 2 20 0.49021 -10483 2 21 0.4045 -10483 2 22 0.92317 -10483 2 23 0.51972 -10483 2 24 0.66154 -10483 2 25 0.64959 -10483 2 26 0.45592 -10483 2 27 0.59671 -10483 2 28 0.61468 -10483 2 29 0.77217 -10483 2 30 1.0582 -10483 2 31 0.4629 -10483 2 32 0.70546 -10483 2 33 0.61369 -10483 2 34 0.8733 -10483 2 35 0.52559 -10483 2 36 0.8406 -10483 2 37 0.80432 -10483 2 38 0.4842 -10483 2 39 0.27694 -10483 2 40 -0.018798 -10483 2 41 -0.07291 -10483 2 42 -0.38115 -10483 2 43 -0.75655 -10483 2 44 -0.97372 -10483 2 45 -0.071398 -10483 2 46 -0.7185 -10483 2 47 -1.241 -10483 2 48 -0.8384 -10483 2 49 -0.74566 -10483 2 50 -0.72121 -10483 2 51 -0.75247 -10483 2 52 -0.10146 -10483 2 53 -0.3927 -10483 2 54 -0.070677 -10483 2 55 0.79456 -10483 2 56 1.2025 -10483 2 57 1.68 -10483 2 58 1.2607 -9480 2 1 -2.4009 -9480 2 2 -2.6158 -9480 2 3 -1.9066 -9480 2 4 -1.8948 -9480 2 5 -1.4874 -9480 2 6 -1.5892 -9480 2 7 -1.3921 -9480 2 8 -1.3654 -9480 2 9 -1.4148 -9480 2 10 -1.6128 -9480 2 11 -1.7279 -9480 2 12 -1.5062 -9480 2 13 -1.0767 -9480 2 14 -1.8399 -9480 2 15 -1.7329 -9480 2 16 -1.2085 -9480 2 17 -0.85771 -9480 2 18 -0.46659 -9480 2 19 0.26335 -9480 2 20 0.096116 -9480 2 21 0.22733 -9480 2 22 0.32166 -9480 2 23 0.79156 -9480 2 24 1.5095 -9480 2 25 1.3546 -9480 2 26 1.7305 -9480 2 27 1.7231 -9480 2 28 1.5473 -9480 2 29 1.5143 -9480 2 30 1.3566 -9480 2 31 -0.032963 -9480 2 32 0.50067 -9480 2 33 0.98325 -9480 2 34 0.60991 -9480 2 35 1.1406 -9480 2 36 1.1152 -9480 2 37 1.51 -9480 2 38 1.4206 -9480 2 39 2.1084 -9480 2 40 0.79058 -9480 2 41 -0.94401 -9480 2 42 -1.2661 -9480 2 43 -1.4958 -9480 2 44 -1.8016 -9480 2 45 -1.1233 -9480 2 46 -1.3229 -9480 2 47 -1.7649 -9480 2 48 -0.80416 -9480 2 49 -1.343 -9480 2 50 -0.46563 -9480 2 51 -0.77728 -9480 2 52 0.09011 -9480 2 53 0.011545 -9480 2 54 -0.042161 -9480 2 55 0.79544 -9480 2 56 1.9066 -9480 2 57 1.7829 -9480 2 58 1.9625 -11842 3 1 -2.236 -11842 3 2 -2.1199 -11842 3 3 -1.79 -11842 3 4 -1.17 -11842 3 5 -1.3822 -11842 3 6 -1.3758 -11842 3 7 -1.2821 -11842 3 8 -1.2688 -11842 3 9 -0.78279 -11842 3 10 -0.64987 -11842 3 11 -0.83769 -11842 3 12 -0.82933 -11842 3 13 -1.258 -11842 3 14 -0.72608 -11842 3 15 -1.3391 -11842 3 16 -1.9359 -11842 3 17 -1.3032 -11842 3 18 -1.9297 -11842 3 19 -2.0197 -11842 3 20 -1.8419 -11842 3 21 -1.592 -11842 3 22 -1.6896 -11842 3 23 -1.7644 -11842 3 24 -2.2208 -11842 3 25 -2.1856 -11842 3 26 -2.2103 -11842 3 27 -1.9618 -11842 3 28 -1.7803 -11842 3 29 -2.1709 -11842 3 30 -1.6451 -11842 3 31 0.16225 -11842 3 32 0.17169 -11842 3 33 0.027947 -11842 3 34 -0.31748 -11842 3 35 -0.091141 -11842 3 36 0.17765 -11842 3 37 0.45627 -11842 3 38 0.87568 -11842 3 39 0.66053 -11842 3 40 -0.21036 -11842 3 41 0.14771 -11842 3 42 -1.4328 -11842 3 43 -1.7523 -11842 3 44 -0.97116 -11842 3 45 -0.74562 -11842 3 46 -0.52471 -11842 3 47 -0.29803 -11842 3 48 -0.91412 -11842 3 49 -1.1102 -11842 3 50 -1.0996 -11842 3 51 -1.6844 -11842 3 52 -1.3647 -11842 3 53 -1.6583 -11842 3 54 -1.4025 -11842 3 55 -1.2641 -11842 3 56 -1.538 -11842 3 57 -1.8828 -11842 3 58 0.50754 -5125 3 1 -1.3828 -5125 3 2 -1.3701 -5125 3 3 -1.8362 -5125 3 4 -1.9782 -5125 3 5 -2.2321 -5125 3 6 -2.6164 -5125 3 7 -1.974 -5125 3 8 -1.7956 -5125 3 9 -1.7807 -5125 3 10 -1.778 -5125 3 11 -1.9007 -5125 3 12 -1.6936 -5125 3 13 -1.7139 -5125 3 14 -1.7765 -5125 3 15 -1.4176 -5125 3 16 -1.591 -5125 3 17 -1.6128 -5125 3 18 -1.5797 -5125 3 19 -1.5089 -5125 3 20 -1.5447 -5125 3 21 -1.3361 -5125 3 22 -1.4867 -5125 3 23 -1.3247 -5125 3 24 -1.1999 -5125 3 25 -1.2894 -5125 3 26 -1.2243 -5125 3 27 -0.93212 -5125 3 28 -0.87465 -5125 3 29 -1.1033 -5125 3 30 -0.95942 -5125 3 31 -0.73921 -5125 3 32 -0.70976 -5125 3 33 -1.0494 -5125 3 34 -0.58553 -5125 3 35 -0.8757 -5125 3 36 -0.96322 -5125 3 37 -0.75712 -5125 3 38 -0.94316 -5125 3 39 -0.77872 -5125 3 40 -1.1979 -5125 3 41 -1.5335 -5125 3 42 -1.3287 -5125 3 43 -1.2863 -5125 3 44 -1.3147 -5125 3 45 -1.3252 -5125 3 46 -1.4355 -5125 3 47 -1.4558 -5125 3 48 -1.1293 -5125 3 49 -1.2362 -5125 3 50 -0.68634 -5125 3 51 -0.27041 -5125 3 52 -0.86892 -5125 3 53 -0.096449 -5125 3 54 -0.26915 -5125 3 55 0.69522 -5125 3 56 1.6068 -5125 3 57 1.4974 -5125 3 58 2.0524 -5939 2 1 -3.1223 -5939 2 2 -3.2783 -5939 2 3 -2.887 -5939 2 4 -2.6972 -5939 2 5 -2.8282 -5939 2 6 -2.5501 -5939 2 7 -2.6004 -5939 2 8 -2.2922 -5939 2 9 -2.465 -5939 2 10 -2.4474 -5939 2 11 -2.4604 -5939 2 12 -2.059 -5939 2 13 -1.9968 -5939 2 14 -2.2331 -5939 2 15 -2.1022 -5939 2 16 -2.1254 -5939 2 17 -1.3521 -5939 2 18 -0.98427 -5939 2 19 0.48172 -5939 2 20 -0.3805 -5939 2 21 0.092261 -5939 2 22 0.46139 -5939 2 23 1.6261 -5939 2 24 1.9909 -5939 2 25 1.7876 -5939 2 26 2.2637 -5939 2 27 2.4978 -5939 2 28 2.4403 -5939 2 29 2.3742 -5939 2 30 2.3813 -5939 2 31 0.0087803 -5939 2 32 0.38007 -5939 2 33 0.76438 -5939 2 34 0.11169 -5939 2 35 1.1245 -5939 2 36 0.088837 -5939 2 37 1.3653 -5939 2 38 1.1192 -5939 2 39 2.0883 -5939 2 40 -0.31288 -5939 2 41 -0.50561 -5939 2 42 -1.682 -5939 2 43 -1.3057 -5939 2 44 -0.74766 -5939 2 45 -0.66427 -5939 2 46 -1.5915 -5939 2 47 -1.9436 -5939 2 48 -1.9885 -5939 2 49 -2.3045 -5939 2 50 -2.156 -5939 2 51 -2.3584 -5939 2 52 0.10199 -5939 2 53 -0.98724 -5939 2 54 0.11465 -5939 2 55 0.92157 -5939 2 56 2.6453 -5939 2 57 2.3028 -5939 2 58 3.0481 -7288 1 1 0.56036 -7288 1 2 0.47119 -7288 1 3 0.68405 -7288 1 4 1.1679 -7288 1 5 1.6553 -7288 1 6 1.8647 -7288 1 7 1.876 -7288 1 8 1.9879 -7288 1 9 1.5718 -7288 1 10 1.4256 -7288 1 11 1.591 -7288 1 12 0.69104 -7288 1 13 0.65341 -7288 1 14 0.88616 -7288 1 15 0.51554 -7288 1 16 0.65228 -7288 1 17 0.38495 -7288 1 18 -0.10926 -7288 1 19 -0.025263 -7288 1 20 -0.41453 -7288 1 21 -0.70473 -7288 1 22 -0.46509 -7288 1 23 -0.41516 -7288 1 24 -0.68369 -7288 1 25 -0.71685 -7288 1 26 -0.91793 -7288 1 27 -1.4537 -7288 1 28 -1.4579 -7288 1 29 -1.2596 -7288 1 30 -1.3936 -7288 1 31 -0.881 -7288 1 32 -1.4757 -7288 1 33 -1.1735 -7288 1 34 -1.198 -7288 1 35 -0.61134 -7288 1 36 -0.62953 -7288 1 37 -0.54527 -7288 1 38 -0.75178 -7288 1 39 -1.003 -7288 1 40 -0.47245 -7288 1 41 -0.78081 -7288 1 42 -0.68434 -7288 1 43 -0.52801 -7288 1 44 -0.71609 -7288 1 45 -0.69067 -7288 1 46 -0.92498 -7288 1 47 -0.7524 -7288 1 48 -0.90356 -7288 1 49 -0.1212 -7288 1 50 -0.47989 -7288 1 51 -0.91712 -7288 1 52 -1.06 -7288 1 53 -1.3278 -7288 1 54 -1.2272 -7288 1 55 -1.3411 -7288 1 56 -1.5365 -7288 1 57 -1.4069 -7288 1 58 -2.0408 -17446 3 1 -0.68659 -17446 3 2 -0.90586 -17446 3 3 -0.88038 -17446 3 4 -0.91058 -17446 3 5 -0.9549 -17446 3 6 -1.5964 -17446 3 7 -1.4389 -17446 3 8 -1.2262 -17446 3 9 -1.2513 -17446 3 10 -1.2167 -17446 3 11 -0.84325 -17446 3 12 -1.8643 -17446 3 13 -1.0332 -17446 3 14 -1.5157 -17446 3 15 -1.3701 -17446 3 16 -1.2103 -17446 3 17 -0.70187 -17446 3 18 -1.2572 -17446 3 19 -2.2039 -17446 3 20 -1.8386 -17446 3 21 -1.6683 -17446 3 22 -1.9815 -17446 3 23 -1.6022 -17446 3 24 -1.7611 -17446 3 25 -2.0166 -17446 3 26 -2.2263 -17446 3 27 -1.7727 -17446 3 28 -2.033 -17446 3 29 -1.9066 -17446 3 30 -1.8568 -17446 3 31 -2.3642 -17446 3 32 -2.1568 -17446 3 33 -2.0101 -17446 3 34 -2.4108 -17446 3 35 -2.131 -17446 3 36 -2.208 -17446 3 37 -2.3814 -17446 3 38 -2.4148 -17446 3 39 -2.172 -17446 3 40 -2.2718 -17446 3 41 -2.7133 -17446 3 42 -2.4115 -17446 3 43 -2.5691 -17446 3 44 -2.2144 -17446 3 45 -2.2019 -17446 3 46 -2.0138 -17446 3 47 -3.1516 -17446 3 48 -2.2947 -17446 3 49 -2.086 -17446 3 50 -1.8884 -17446 3 51 -1.8032 -17446 3 52 -2.1694 -17446 3 53 -2.0265 -17446 3 54 -2.5761 -17446 3 55 -1.7054 -17446 3 56 -0.27012 -17446 3 57 -0.11167 -17446 3 58 1.3106 -7626 1 1 0.40894 -7626 1 2 0.44998 -7626 1 3 0.88768 -7626 1 4 1.1766 -7626 1 5 1.3692 -7626 1 6 1.8087 -7626 1 7 2.0432 -7626 1 8 1.856 -7626 1 9 1.5051 -7626 1 10 1.3141 -7626 1 11 1.1953 -7626 1 12 1.1905 -7626 1 13 1.0657 -7626 1 14 1.2501 -7626 1 15 1.2471 -7626 1 16 1.0179 -7626 1 17 0.80295 -7626 1 18 0.73537 -7626 1 19 0.30854 -7626 1 20 0.40773 -7626 1 21 0.16358 -7626 1 22 0.2516 -7626 1 23 -0.20718 -7626 1 24 -0.29804 -7626 1 25 -0.40783 -7626 1 26 -0.89264 -7626 1 27 -1.0557 -7626 1 28 -0.86111 -7626 1 29 -0.74738 -7626 1 30 -0.78292 -7626 1 31 -1.12 -7626 1 32 -1.8114 -7626 1 33 -1.8994 -7626 1 34 -0.90914 -7626 1 35 -1.2612 -7626 1 36 -1.3961 -7626 1 37 -1.1666 -7626 1 38 -1.1697 -7626 1 39 -0.69896 -7626 1 40 -0.92088 -7626 1 41 -0.37355 -7626 1 42 -0.54371 -7626 1 43 -0.66163 -7626 1 44 -1.1993 -7626 1 45 -0.85896 -7626 1 46 -0.66826 -7626 1 47 -1.3009 -7626 1 48 -0.56389 -7626 1 49 -0.48078 -7626 1 50 -0.88382 -7626 1 51 -0.48478 -7626 1 52 -0.98807 -7626 1 53 -0.71154 -7626 1 54 -0.96145 -7626 1 55 -1.3076 -7626 1 56 -1.2825 -7626 1 57 -1.5546 -7626 1 58 -1.5198 -9432 2 1 -3.5477 -9432 2 2 -3.6674 -9432 2 3 -3.5145 -9432 2 4 -3.7037 -9432 2 5 -3.8575 -9432 2 6 -3.0589 -9432 2 7 -3.1529 -9432 2 8 -2.9369 -9432 2 9 -4.0039 -9432 2 10 -3.0987 -9432 2 11 -2.6082 -9432 2 12 -2.5499 -9432 2 13 -3.3606 -9432 2 14 -3.7775 -9432 2 15 -3.5615 -9432 2 16 -2.9392 -9432 2 17 -2.2508 -9432 2 18 -2.0557 -9432 2 19 -0.14162 -9432 2 20 -1.0419 -9432 2 21 -0.47629 -9432 2 22 -0.36151 -9432 2 23 0.75091 -9432 2 24 1.363 -9432 2 25 1.4297 -9432 2 26 2.0365 -9432 2 27 4.0194 -9432 2 28 3.7775 -9432 2 29 2.7367 -9432 2 30 3.48 -9432 2 31 1.9695 -9432 2 32 2.1749 -9432 2 33 2.8554 -9432 2 34 1.9881 -9432 2 35 2.7153 -9432 2 36 2.2726 -9432 2 37 2.3325 -9432 2 38 1.7846 -9432 2 39 2.4141 -9432 2 40 1.4338 -9432 2 41 -2.0406 -9432 2 42 -3.3874 -9432 2 43 -3.4597 -9432 2 44 -2.6996 -9432 2 45 0.038456 -9432 2 46 1.2738 -9432 2 47 1.1096 -9432 2 48 -2.8358 -9432 2 49 -3.4847 -9432 2 50 -2.2461 -9432 2 51 -2.6384 -9432 2 52 -1.3893 -9432 2 53 -1.3042 -9432 2 54 -0.43789 -9432 2 55 1.0225 -9432 2 56 2.2846 -9432 2 57 2.4933 -9432 2 58 4.0445 -17927 2 1 -4.2716 -17927 2 2 -4.3934 -17927 2 3 -3.7853 -17927 2 4 -4.0175 -17927 2 5 -3.5392 -17927 2 6 -3.3898 -17927 2 7 -3.3433 -17927 2 8 -3.5461 -17927 2 9 -3.6025 -17927 2 10 -3.4312 -17927 2 11 -3.5075 -17927 2 12 -3.2676 -17927 2 13 -2.7472 -17927 2 14 -3.0146 -17927 2 15 -2.6276 -17927 2 16 -3.2024 -17927 2 17 -1.5914 -17927 2 18 -0.44301 -17927 2 19 1.8315 -17927 2 20 1.2441 -17927 2 21 1.835 -17927 2 22 2.3267 -17927 2 23 2.6673 -17927 2 24 2.8035 -17927 2 25 3.2297 -17927 2 26 3.2743 -17927 2 27 3.4706 -17927 2 28 3.399 -17927 2 29 3.215 -17927 2 30 3.7177 -17927 2 31 2.0619 -17927 2 32 2.2402 -17927 2 33 2.7754 -17927 2 34 1.96 -17927 2 35 2.8816 -17927 2 36 2.427 -17927 2 37 4.0713 -17927 2 38 3.1269 -17927 2 39 3.6022 -17927 2 40 -0.40357 -17927 2 41 -1.6734 -17927 2 42 -4.1315 -17927 2 43 -4.0622 -17927 2 44 -3.9598 -17927 2 45 -3.2295 -17927 2 46 -3.4376 -17927 2 47 -3.1007 -17927 2 48 -4.2366 -17927 2 49 -4.4452 -17927 2 50 -2.7374 -17927 2 51 -4.0234 -17927 2 52 0.16725 -17927 2 53 -0.5718 -17927 2 54 0.84041 -17927 2 55 2.7774 -17927 2 56 4.1935 -17927 2 57 3.986 -17927 2 58 4.8334 -1826 2 1 -1.053 -1826 2 2 -0.85027 -1826 2 3 -0.81998 -1826 2 4 -0.53162 -1826 2 5 -0.30978 -1826 2 6 -0.22342 -1826 2 7 -0.80429 -1826 2 8 -0.94834 -1826 2 9 -1.0864 -1826 2 10 -1.3897 -1826 2 11 -1.3734 -1826 2 12 -1.2287 -1826 2 13 -1.5425 -1826 2 14 -1.2669 -1826 2 15 -1.1059 -1826 2 16 -1.2322 -1826 2 17 -1.123 -1826 2 18 -0.95899 -1826 2 19 0.40183 -1826 2 20 -0.11467 -1826 2 21 0.37883 -1826 2 22 0.83388 -1826 2 23 0.74308 -1826 2 24 0.68975 -1826 2 25 1.137 -1826 2 26 1.1322 -1826 2 27 1.3577 -1826 2 28 1.043 -1826 2 29 1.0162 -1826 2 30 1.3241 -1826 2 31 0.279 -1826 2 32 0.40651 -1826 2 33 0.86622 -1826 2 34 0.18417 -1826 2 35 0.73219 -1826 2 36 0.6233 -1826 2 37 1.5088 -1826 2 38 1.2358 -1826 2 39 1.4264 -1826 2 40 -0.82565 -1826 2 41 -0.96114 -1826 2 42 -1.5056 -1826 2 43 -1.7218 -1826 2 44 -2.0087 -1826 2 45 -1.8178 -1826 2 46 -1.2654 -1826 2 47 -1.5196 -1826 2 48 -1.717 -1826 2 49 -1.8463 -1826 2 50 -1.7929 -1826 2 51 -1.0914 -1826 2 52 -0.48956 -1826 2 53 -0.86869 -1826 2 54 -0.27297 -1826 2 55 0.91833 -1826 2 56 1.3114 -1826 2 57 1.5189 -1826 2 58 1.8675 -7106 3 1 -3.2335 -7106 3 2 -3.2497 -7106 3 3 -3.3629 -7106 3 4 -3.4514 -7106 3 5 -2.8834 -7106 3 6 -3.1661 -7106 3 7 -3.337 -7106 3 8 -3.5095 -7106 3 9 -3.5409 -7106 3 10 -3.3908 -7106 3 11 -3.5133 -7106 3 12 -4.0007 -7106 3 13 -2.5691 -7106 3 14 -3.1956 -7106 3 15 -2.1316 -7106 3 16 -2.8473 -7106 3 17 -2.6918 -7106 3 18 -2.7066 -7106 3 19 -3.1876 -7106 3 20 -3.0292 -7106 3 21 -2.7803 -7106 3 22 -3.1458 -7106 3 23 -2.5631 -7106 3 24 -2.3321 -7106 3 25 -2.1857 -7106 3 26 -2.2455 -7106 3 27 -2.7311 -7106 3 28 -2.6206 -7106 3 29 -2.3136 -7106 3 30 -2.5741 -7106 3 31 -3.3263 -7106 3 32 -2.8533 -7106 3 33 -3.2045 -7106 3 34 -3.0007 -7106 3 35 -2.9926 -7106 3 36 -2.8712 -7106 3 37 -2.6691 -7106 3 38 -1.793 -7106 3 39 -1.6475 -7106 3 40 -1.6395 -7106 3 41 -1.9024 -7106 3 42 -1.408 -7106 3 43 -1.4361 -7106 3 44 -1.0962 -7106 3 45 -1.1038 -7106 3 46 -0.97 -7106 3 47 -1.4769 -7106 3 48 -0.43247 -7106 3 49 -0.30805 -7106 3 50 -0.49236 -7106 3 51 -0.53756 -7106 3 52 -0.62158 -7106 3 53 -0.84938 -7106 3 54 -0.84645 -7106 3 55 -0.58705 -7106 3 56 0.65523 -7106 3 57 1.1847 -7106 3 58 0.19001 -4899 3 1 -2.0392 -4899 3 2 -2.1691 -4899 3 3 -2.0578 -4899 3 4 -2.075 -4899 3 5 -2.4869 -4899 3 6 -2.2936 -4899 3 7 -2.2224 -4899 3 8 -1.9854 -4899 3 9 -1.7529 -4899 3 10 -1.6047 -4899 3 11 -1.1403 -4899 3 12 -1.4723 -4899 3 13 -2.0383 -4899 3 14 -1.5284 -4899 3 15 -2.3009 -4899 3 16 -2.3348 -4899 3 17 -2.4768 -4899 3 18 -2.7808 -4899 3 19 -2.5272 -4899 3 20 -2.2327 -4899 3 21 -2.3782 -4899 3 22 -2.3185 -4899 3 23 -2.6027 -4899 3 24 -2.1189 -4899 3 25 -2.557 -4899 3 26 -3.0252 -4899 3 27 -2.7805 -4899 3 28 -2.8244 -4899 3 29 -2.5399 -4899 3 30 -2.5585 -4899 3 31 -1.6589 -4899 3 32 -2.0239 -4899 3 33 -2.0476 -4899 3 34 -1.8477 -4899 3 35 -2.2122 -4899 3 36 -1.5746 -4899 3 37 -1.6198 -4899 3 38 -1.5688 -4899 3 39 -1.7122 -4899 3 40 -2.5672 -4899 3 41 -2.1794 -4899 3 42 -3.0177 -4899 3 43 -2.6567 -4899 3 44 -2.442 -4899 3 45 -2.5096 -4899 3 46 -1.21 -4899 3 47 -0.94896 -4899 3 48 -1.5294 -4899 3 49 -1.1271 -4899 3 50 -1.3341 -4899 3 51 -1.6897 -4899 3 52 -1.5791 -4899 3 53 -1.5952 -4899 3 54 -0.04356 -4899 3 55 2.5817 -4899 3 56 2.5157 -4899 3 57 2.2601 -4899 3 58 1.6914 -9839 1 1 0.025197 -9839 1 2 0.11202 -9839 1 3 0.47555 -9839 1 4 0.44883 -9839 1 5 0.44042 -9839 1 6 1.478 -9839 1 7 1.3552 -9839 1 8 1.3188 -9839 1 9 1.7679 -9839 1 10 2.0945 -9839 1 11 1.2539 -9839 1 12 2.1788 -9839 1 13 2.5413 -9839 1 14 2.4165 -9839 1 15 0.88462 -9839 1 16 1.5853 -9839 1 17 0.57102 -9839 1 18 0.52045 -9839 1 19 -0.83179 -9839 1 20 -0.33901 -9839 1 21 -0.5707 -9839 1 22 -0.17024 -9839 1 23 -0.42449 -9839 1 24 -1.6711 -9839 1 25 -1.3631 -9839 1 26 -1.4299 -9839 1 27 -1.7042 -9839 1 28 -1.58 -9839 1 29 -1.6653 -9839 1 30 -2.0181 -9839 1 31 -0.61634 -9839 1 32 -0.89007 -9839 1 33 -1.544 -9839 1 34 -0.42811 -9839 1 35 -0.9804 -9839 1 36 -0.78747 -9839 1 37 -2.0881 -9839 1 38 -0.81021 -9839 1 39 -0.89544 -9839 1 40 -0.69954 -9839 1 41 -1.283 -9839 1 42 -1.739 -9839 1 43 -1.7536 -9839 1 44 -1.6337 -9839 1 45 -0.70943 -9839 1 46 -1.2875 -9839 1 47 -1.0047 -9839 1 48 -0.77491 -9839 1 49 -0.91674 -9839 1 50 -0.92904 -9839 1 51 -1.1199 -9839 1 52 -0.65612 -9839 1 53 -0.97015 -9839 1 54 -0.8954 -9839 1 55 -1.7192 -9839 1 56 -2.0214 -9839 1 57 -2.0713 -9839 1 58 -1.228 -11914 2 1 -0.79923 -11914 2 2 -0.74363 -11914 2 3 -0.81837 -11914 2 4 -0.4437 -11914 2 5 -0.25429 -11914 2 6 -0.5812 -11914 2 7 -0.60233 -11914 2 8 -0.5342 -11914 2 9 -0.42219 -11914 2 10 -0.85315 -11914 2 11 -0.71974 -11914 2 12 -0.92185 -11914 2 13 -1.0703 -11914 2 14 -1.2446 -11914 2 15 -0.87028 -11914 2 16 -0.37878 -11914 2 17 -0.99054 -11914 2 18 -0.32998 -11914 2 19 0.36489 -11914 2 20 -0.23087 -11914 2 21 0.17922 -11914 2 22 0.3855 -11914 2 23 0.55692 -11914 2 24 0.52552 -11914 2 25 0.63893 -11914 2 26 0.66148 -11914 2 27 0.65238 -11914 2 28 0.52749 -11914 2 29 0.50931 -11914 2 30 0.31145 -11914 2 31 0.1436 -11914 2 32 -0.17414 -11914 2 33 0.10909 -11914 2 34 -0.25276 -11914 2 35 -0.13092 -11914 2 36 -0.038859 -11914 2 37 0.040268 -11914 2 38 -0.069377 -11914 2 39 0.155 -11914 2 40 0.0088495 -11914 2 41 -0.68163 -11914 2 42 -1.1391 -11914 2 43 -0.57225 -11914 2 44 -0.84645 -11914 2 45 0.18858 -11914 2 46 0.1223 -11914 2 47 0.0091717 -11914 2 48 -0.99218 -11914 2 49 -1.0068 -11914 2 50 -1.0931 -11914 2 51 -1.3051 -11914 2 52 -0.10974 -11914 2 53 -0.66219 -11914 2 54 -0.34518 -11914 2 55 0.56173 -11914 2 56 0.97741 -11914 2 57 1.1391 -11914 2 58 1.2811 -5175 1 1 1.0239 -5175 1 2 1.2401 -5175 1 3 1.453 -5175 1 4 1.8113 -5175 1 5 2.3137 -5175 1 6 3.313 -5175 1 7 3.1167 -5175 1 8 3.1997 -5175 1 9 2.6293 -5175 1 10 2.3013 -5175 1 11 2.4541 -5175 1 12 2.3017 -5175 1 13 2.6378 -5175 1 14 2.2296 -5175 1 15 1.601 -5175 1 16 1.31 -5175 1 17 1.6575 -5175 1 18 0.71794 -5175 1 19 -0.55239 -5175 1 20 -0.34436 -5175 1 21 -0.47208 -5175 1 22 -0.59243 -5175 1 23 -0.97043 -5175 1 24 -1.8587 -5175 1 25 -1.4149 -5175 1 26 -1.7983 -5175 1 27 -2.316 -5175 1 28 -2.2465 -5175 1 29 -2.2343 -5175 1 30 -2.3988 -5175 1 31 -2.7557 -5175 1 32 -3.0756 -5175 1 33 -3.1678 -5175 1 34 -2.1588 -5175 1 35 -3.1167 -5175 1 36 -2.841 -5175 1 37 -3.7943 -5175 1 38 -2.6958 -5175 1 39 -2.2207 -5175 1 40 -1.2781 -5175 1 41 -0.51212 -5175 1 42 -0.72825 -5175 1 43 -0.76581 -5175 1 44 -1.0616 -5175 1 45 -1.4957 -5175 1 46 -0.35509 -5175 1 47 -0.82237 -5175 1 48 -0.34428 -5175 1 49 -0.043276 -5175 1 50 -0.56915 -5175 1 51 -0.38651 -5175 1 52 -0.21491 -5175 1 53 -0.15788 -5175 1 54 -0.4082 -5175 1 55 -1.497 -5175 1 56 -2.2965 -5175 1 57 -2.4047 -5175 1 58 -1.9422 -9506 1 1 0.98997 -9506 1 2 1.5709 -9506 1 3 1.6223 -9506 1 4 2.5249 -9506 1 5 2.6054 -9506 1 6 3.6676 -9506 1 7 3.0687 -9506 1 8 2.6426 -9506 1 9 0.14083 -9506 1 10 -0.075099 -9506 1 11 0.68627 -9506 1 12 0.045393 -9506 1 13 -0.83418 -9506 1 14 -0.49673 -9506 1 15 -0.33204 -9506 1 16 -0.83616 -9506 1 17 -1.3025 -9506 1 18 -1.671 -9506 1 19 -1.5832 -9506 1 20 -1.3332 -9506 1 21 -1.5965 -9506 1 22 -1.2317 -9506 1 23 -1.7676 -9506 1 24 -1.8897 -9506 1 25 -1.9718 -9506 1 26 -2.3162 -9506 1 27 -2.331 -9506 1 28 -2.3796 -9506 1 29 -2.1399 -9506 1 30 -2.1284 -9506 1 31 -1.3623 -9506 1 32 -1.8621 -9506 1 33 -2.2319 -9506 1 34 -1.5028 -9506 1 35 -2.0204 -9506 1 36 -1.5563 -9506 1 37 -1.5661 -9506 1 38 -1.6843 -9506 1 39 -1.1408 -9506 1 40 -1.9366 -9506 1 41 -0.93642 -9506 1 42 -2.1324 -9506 1 43 -2.0376 -9506 1 44 -1.4161 -9506 1 45 -1.9304 -9506 1 46 -2.0632 -9506 1 47 -2.1462 -9506 1 48 -2.3336 -9506 1 49 -2.2837 -9506 1 50 -1.5156 -9506 1 51 -2.3568 -9506 1 52 -1.8262 -9506 1 53 -1.9305 -9506 1 54 -1.827 -9506 1 55 -2.3452 -9506 1 56 -2.5024 -9506 1 57 -2.3992 -9506 1 58 -1.7664 -1677 1 1 0.49392 -1677 1 2 0.50748 -1677 1 3 1.0213 -1677 1 4 1.3177 -1677 1 5 1.4437 -1677 1 6 1.8346 -1677 1 7 1.9425 -1677 1 8 1.6761 -1677 1 9 1.4438 -1677 1 10 1.1832 -1677 1 11 1.481 -1677 1 12 1.0293 -1677 1 13 0.92333 -1677 1 14 1.3663 -1677 1 15 0.89126 -1677 1 16 0.79769 -1677 1 17 0.98061 -1677 1 18 0.030007 -1677 1 19 -0.053868 -1677 1 20 0.10333 -1677 1 21 -0.15901 -1677 1 22 -0.21221 -1677 1 23 -0.67295 -1677 1 24 -0.61341 -1677 1 25 -0.63164 -1677 1 26 -0.71547 -1677 1 27 -1.0346 -1677 1 28 -0.94349 -1677 1 29 -0.78858 -1677 1 30 -1.0334 -1677 1 31 -1.4511 -1677 1 32 -1.8427 -1677 1 33 -1.7253 -1677 1 34 -1.39 -1677 1 35 -1.4336 -1677 1 36 -1.3142 -1677 1 37 -1.2767 -1677 1 38 -1.3432 -1677 1 39 -0.90628 -1677 1 40 -0.78193 -1677 1 41 -0.67202 -1677 1 42 -0.49273 -1677 1 43 -0.87698 -1677 1 44 -0.55959 -1677 1 45 -0.82487 -1677 1 46 -0.61497 -1677 1 47 -0.66968 -1677 1 48 -0.53121 -1677 1 49 -0.1648 -1677 1 50 -0.36448 -1677 1 51 -0.095286 -1677 1 52 -0.6651 -1677 1 53 -0.39045 -1677 1 54 -0.77562 -1677 1 55 -1.3247 -1677 1 56 -1.1639 -1677 1 57 -1.3318 -1677 1 58 -1.2161 -7430 2 1 -0.47826 -7430 2 2 -0.53248 -7430 2 3 -0.64984 -7430 2 4 -1.9241 -7430 2 5 -0.71385 -7430 2 6 -0.89936 -7430 2 7 -0.97666 -7430 2 8 -1.1178 -7430 2 9 -1.6219 -7430 2 10 -1.5896 -7430 2 11 -1.3785 -7430 2 12 -0.55225 -7430 2 13 -1.4169 -7430 2 14 -1.4845 -7430 2 15 -1.0522 -7430 2 16 -0.63978 -7430 2 17 -0.52304 -7430 2 18 0.010697 -7430 2 19 -0.30595 -7430 2 20 -0.39137 -7430 2 21 -0.058812 -7430 2 22 -0.19731 -7430 2 23 0.087949 -7430 2 24 0.27921 -7430 2 25 0.41393 -7430 2 26 0.39551 -7430 2 27 0.69758 -7430 2 28 0.76925 -7430 2 29 0.26941 -7430 2 30 0.66833 -7430 2 31 0.71016 -7430 2 32 0.26457 -7430 2 33 0.41245 -7430 2 34 -0.20376 -7430 2 35 0.44032 -7430 2 36 -0.084359 -7430 2 37 0.47477 -7430 2 38 0.10467 -7430 2 39 -0.34477 -7430 2 40 -1.1296 -7430 2 41 -0.77298 -7430 2 42 -1.0072 -7430 2 43 -1.1183 -7430 2 44 -1.0175 -7430 2 45 -1.1824 -7430 2 46 -0.58034 -7430 2 47 -1.4363 -7430 2 48 -1.0394 -7430 2 49 -1.0452 -7430 2 50 -1.417 -7430 2 51 -1.2137 -7430 2 52 -1.0072 -7430 2 53 -0.89876 -7430 2 54 -0.53502 -7430 2 55 0.26613 -7430 2 56 0.93286 -7430 2 57 0.68914 -7430 2 58 1.4041 -8256 2 1 -2.1578 -8256 2 2 -2.4369 -8256 2 3 -2.4397 -8256 2 4 -2.882 -8256 2 5 -3.02 -8256 2 6 -2.5325 -8256 2 7 -2.3687 -8256 2 8 -2.1503 -8256 2 9 -2.3904 -8256 2 10 -2.0253 -8256 2 11 -2.0149 -8256 2 12 -2.4346 -8256 2 13 -1.9018 -8256 2 14 -2.6028 -8256 2 15 -2.4781 -8256 2 16 -2.6484 -8256 2 17 -1.7231 -8256 2 18 -1.5891 -8256 2 19 -1.6629 -8256 2 20 -1.747 -8256 2 21 -1.5241 -8256 2 22 -1.6891 -8256 2 23 -0.65261 -8256 2 24 -0.18204 -8256 2 25 0.34165 -8256 2 26 0.70719 -8256 2 27 2.2579 -8256 2 28 2.1696 -8256 2 29 1.0849 -8256 2 30 2.0468 -8256 2 31 1.2916 -8256 2 32 1.1105 -8256 2 33 0.9564 -8256 2 34 1.6266 -8256 2 35 1.2679 -8256 2 36 1.3741 -8256 2 37 0.40911 -8256 2 38 0.067718 -8256 2 39 0.092934 -8256 2 40 -1.1088 -8256 2 41 -0.60987 -8256 2 42 -2.6767 -8256 2 43 -1.9503 -8256 2 44 -2.8238 -8256 2 45 -1.7587 -8256 2 46 -1.9005 -8256 2 47 -1.7294 -8256 2 48 -2.6747 -8256 2 49 -2.5421 -8256 2 50 -2.111 -8256 2 51 -2.8308 -8256 2 52 -1.645 -8256 2 53 0.042504 -8256 2 54 -0.18821 -8256 2 55 0.79597 -8256 2 56 2.4264 -8256 2 57 1.4003 -8256 2 58 3.0803 -5433 3 1 -0.13425 -5433 3 2 -0.23329 -5433 3 3 -0.20175 -5433 3 4 -0.62691 -5433 3 5 -0.80816 -5433 3 6 -1.8992 -5433 3 7 -2.3735 -5433 3 8 -2.5239 -5433 3 9 -2.4828 -5433 3 10 -2.1844 -5433 3 11 -2.2455 -5433 3 12 -1.4901 -5433 3 13 -2.1304 -5433 3 14 -2.0703 -5433 3 15 -1.1428 -5433 3 16 -1.0724 -5433 3 17 -1.1313 -5433 3 18 -0.21036 -5433 3 19 -0.31316 -5433 3 20 -0.099941 -5433 3 21 -0.14913 -5433 3 22 -0.21452 -5433 3 23 -0.012223 -5433 3 24 -0.089673 -5433 3 25 -0.27305 -5433 3 26 -0.3253 -5433 3 27 -0.24045 -5433 3 28 -0.32318 -5433 3 29 -0.50836 -5433 3 30 -0.51695 -5433 3 31 -0.72729 -5433 3 32 -0.40319 -5433 3 33 -0.72877 -5433 3 34 -0.79741 -5433 3 35 -1.0287 -5433 3 36 -0.79627 -5433 3 37 -1.1574 -5433 3 38 -1.4649 -5433 3 39 -1.1678 -5433 3 40 -0.90867 -5433 3 41 -0.73269 -5433 3 42 -0.017765 -5433 3 43 -0.35069 -5433 3 44 -0.63305 -5433 3 45 -0.70216 -5433 3 46 -0.77182 -5433 3 47 -1.0831 -5433 3 48 -0.97779 -5433 3 49 -0.98144 -5433 3 50 -0.70151 -5433 3 51 -0.92983 -5433 3 52 -0.62219 -5433 3 53 -0.57214 -5433 3 54 -1.0818 -5433 3 55 -0.9223 -5433 3 56 0.16176 -5433 3 57 0.56869 -5433 3 58 -0.52284 -9098 2 1 -3.2072 -9098 2 2 -3.1093 -9098 2 3 -3.3515 -9098 2 4 -3.1328 -9098 2 5 -2.8916 -9098 2 6 -2.911 -9098 2 8 -2.5433 -9098 2 9 -2.2632 -9098 2 10 -2.0722 -9098 2 11 -1.616 -9098 2 12 -1.9665 -9098 2 13 -1.9428 -9098 2 14 -1.9284 -9098 2 15 -2.1191 -9098 2 16 -1.7945 -9098 2 17 -1.758 -9098 2 18 -1.2232 -9098 2 19 -0.5727 -9098 2 20 -0.94536 -9098 2 21 -0.89382 -9098 2 22 -0.7164 -9098 2 23 1.1023 -9098 2 24 1.4137 -9098 2 25 1.9329 -9098 2 26 2.4356 -9098 2 27 3.4934 -9098 2 28 3.1328 -9098 2 29 2.5395 -9098 2 30 3.1733 -9098 2 31 1.8839 -9098 2 32 1.959 -9098 2 33 1.8446 -9098 2 34 1.6232 -9098 2 35 1.9893 -9098 2 36 1.7864 -9098 2 38 1.7587 -9098 2 39 1.7208 -9098 2 40 0.69304 -9098 2 41 -0.43172 -9098 2 42 -2.3092 -9098 2 43 -2.5603 -9098 2 44 -1.8318 -9098 2 45 -0.80958 -9098 2 46 -0.70384 -9098 2 47 0.0025463 -9098 2 48 -1.6932 -9098 2 49 -1.363 -9098 2 50 -1.6496 -9098 2 51 -1.6445 -9098 2 52 -1.8138 -9098 2 53 -1.7163 -9098 2 54 -2.1999 -9098 2 56 1.2047 -9098 2 58 1.1636 -15131 2 1 -2.7902 -15131 2 2 -2.5524 -15131 2 3 -2.0425 -15131 2 4 -2.1045 -15131 2 5 -1.5762 -15131 2 6 -1.7247 -15131 2 7 -1.4946 -15131 2 8 -1.8115 -15131 2 9 -2.1901 -15131 2 10 -1.9568 -15131 2 11 -2.0513 -15131 2 12 0.15937 -15131 2 13 -0.96575 -15131 2 14 -1.5442 -15131 2 15 -0.93174 -15131 2 16 -1.4219 -15131 2 17 -1.08 -15131 2 18 -0.64003 -15131 2 19 1.2032 -15131 2 20 0.010765 -15131 2 21 0.76469 -15131 2 22 1.0427 -15131 2 23 1.9819 -15131 2 24 2.0584 -15131 2 25 2.0905 -15131 2 26 1.8881 -15131 2 27 1.2435 -15131 2 28 0.84331 -15131 2 29 1.4012 -15131 2 30 1.0293 -15131 2 31 -0.28936 -15131 2 32 -0.54818 -15131 2 33 0.48937 -15131 2 34 -0.18132 -15131 2 35 0.4834 -15131 2 36 0.28233 -15131 2 37 0.29678 -15131 2 38 0.57683 -15131 2 39 0.35394 -15131 2 40 -0.26434 -15131 2 41 -1.1934 -15131 2 42 -1.6172 -15131 2 43 -1.4672 -15131 2 44 -1.3209 -15131 2 45 -1.2147 -15131 2 46 -0.71576 -15131 2 47 -0.79475 -15131 2 48 -1.7755 -15131 2 49 -1.3593 -15131 2 50 -0.68891 -15131 2 51 -0.86412 -15131 2 52 -0.20407 -15131 2 53 -0.54233 -15131 2 54 -0.24714 -15131 2 55 2.0776 -15131 2 56 2.1261 -15131 2 57 1.7831 -15131 2 58 1.614 -10949 2 1 -1.5099 -10949 2 2 -1.5155 -10949 2 3 -1.87 -10949 2 4 -1.7792 -10949 2 5 -1.9429 -10949 2 6 -2.012 -10949 2 7 -1.197 -10949 2 8 -0.90152 -10949 2 9 -1.0713 -10949 2 10 -1.2163 -10949 2 11 -1.1657 -10949 2 12 -0.46713 -10949 2 13 -1.6654 -10949 2 14 -1.9698 -10949 2 15 -1.3536 -10949 2 16 -1.0744 -10949 2 17 -0.98049 -10949 2 18 -0.76706 -10949 2 19 -0.15464 -10949 2 20 -0.36091 -10949 2 21 0.36327 -10949 2 22 0.27185 -10949 2 23 0.53632 -10949 2 24 0.97095 -10949 2 25 1.0734 -10949 2 26 1.1096 -10949 2 27 1.7406 -10949 2 28 1.6457 -10949 2 29 1.0535 -10949 2 30 1.2861 -10949 2 31 0.88486 -10949 2 32 1.2849 -10949 2 33 1.6269 -10949 2 34 0.94397 -10949 2 35 1.9107 -10949 2 36 1.6124 -10949 2 37 2.1197 -10949 2 38 2.2532 -10949 2 39 1.8136 -10949 2 40 0.22014 -10949 2 41 -0.92087 -10949 2 42 -1.9369 -10949 2 43 -1.937 -10949 2 44 -2.1627 -10949 2 45 -1.5439 -10949 2 46 -1.2826 -10949 2 47 -1.8036 -10949 2 48 -2.2532 -10949 2 49 -2.3862 -10949 2 50 -1.984 -10949 2 51 -2.3265 -10949 2 52 -0.023233 -10949 2 53 -0.87743 -10949 2 54 -0.32979 -10949 2 55 1.6081 -10949 2 56 1.7863 -10949 2 57 3.4716 -10949 2 58 1.7669 -10693 2 1 -1.6706 -10693 2 2 -1.8633 -10693 2 3 -1.7941 -10693 2 4 -1.9005 -10693 2 5 -2.0288 -10693 2 6 -2.6508 -10693 2 7 -1.8789 -10693 2 8 -1.3332 -10693 2 9 -2.0486 -10693 2 10 -2.0754 -10693 2 11 -1.8191 -10693 2 12 -1.0318 -10693 2 13 -1.8848 -10693 2 14 -2.0822 -10693 2 15 -2.1328 -10693 2 16 -1.3562 -10693 2 17 -1.4967 -10693 2 18 -1.4228 -10693 2 19 -0.43553 -10693 2 20 -0.68684 -10693 2 21 -0.17186 -10693 2 22 -0.017898 -10693 2 23 0.24051 -10693 2 24 0.55692 -10693 2 25 0.62636 -10693 2 26 0.85765 -10693 2 27 1.1391 -10693 2 28 1.2505 -10693 2 29 0.83445 -10693 2 30 1.1686 -10693 2 31 0.54151 -10693 2 32 1.0714 -10693 2 33 0.76261 -10693 2 34 0.57714 -10693 2 35 0.89749 -10693 2 36 0.76769 -10693 2 37 0.70533 -10693 2 38 1.1794 -10693 2 39 0.95823 -10693 2 40 0.091374 -10693 2 41 -0.40309 -10693 2 42 -1.7602 -10693 2 43 -1.615 -10693 2 44 -1.5642 -10693 2 45 -1.2724 -10693 2 46 -1.3008 -10693 2 47 -1.258 -10693 2 48 -1.2735 -10693 2 49 -1.4076 -10693 2 50 -0.86137 -10693 2 51 -1.562 -10693 2 52 0.56904 -10693 2 53 0.20466 -10693 2 54 0.40973 -10693 2 55 1.8705 -10693 2 56 1.4415 -10693 2 57 2.4995 -1378 1 1 -0.30009 -1378 1 2 -0.0028192 -1378 1 3 0.01685 -1378 1 4 1.7111 -1378 1 5 2.5692 -1378 1 6 3.5631 -1378 1 7 2.6037 -1378 1 8 3.3339 -1378 1 9 2.0959 -1378 1 10 1.1893 -1378 1 11 1.2186 -1378 1 12 1.5457 -1378 1 13 1.5274 -1378 1 14 1.5534 -1378 1 15 1.6092 -1378 1 16 0.76756 -1378 1 17 1.1001 -1378 1 18 0.79854 -1378 1 19 0.17324 -1378 1 20 0.45146 -1378 1 21 -0.18215 -1378 1 22 -0.16527 -1378 1 23 -0.69817 -1378 1 24 -0.80132 -1378 1 25 -0.26416 -1378 1 26 -0.73839 -1378 1 27 -0.69653 -1378 1 28 -0.76767 -1378 1 29 -0.83233 -1378 1 30 -1.1554 -1378 1 31 -0.29379 -1378 1 32 -0.74948 -1378 1 34 -0.53187 -1378 1 35 -0.6071 -1378 1 36 -0.17858 -1378 1 37 -0.39755 -1378 1 38 -0.81972 -1378 1 39 -0.069527 -1378 1 40 -0.4296 -1378 1 41 -0.25986 -1378 1 42 -0.86598 -1378 1 43 -0.81184 -1378 1 44 -0.7176 -1378 1 45 -0.70874 -1378 1 46 -1.824 -1378 1 47 0.44805 -1378 1 48 -1.1588 -1378 1 49 -1.0474 -1378 1 50 -0.7128 -1378 1 51 -1.6046 -1378 1 52 -1.6127 -1378 1 53 -1.2834 -1378 1 54 -1.4646 -1378 1 55 -0.60561 -1378 1 56 -1.8979 -1378 1 57 -0.94163 -17800 2 1 -1.813 -17800 2 2 -1.5468 -17800 2 3 -1.8535 -17800 2 4 -1.6417 -17800 2 5 -1.518 -17800 2 6 -1.5876 -17800 2 7 -1.1776 -17800 2 8 -0.92776 -17800 2 9 -0.55519 -17800 2 10 -0.46922 -17800 2 11 -0.49639 -17800 2 12 -0.96518 -17800 2 13 -0.83886 -17800 2 14 -0.99835 -17800 2 15 -0.65509 -17800 2 16 -0.81314 -17800 2 17 -0.50154 -17800 2 18 -0.48024 -17800 2 19 0.085173 -17800 2 20 -0.14656 -17800 2 21 0.40238 -17800 2 22 0.30629 -17800 2 23 0.56055 -17800 2 24 0.69524 -17800 2 25 0.64815 -17800 2 26 0.81082 -17800 2 27 1.3061 -17800 2 28 1.2525 -17800 2 29 0.773 -17800 2 30 1.0251 -17800 2 31 0.58044 -17800 2 32 0.98263 -17800 2 33 1.0582 -17800 2 34 0.54784 -17800 2 35 1.2109 -17800 2 36 1.134 -17800 2 37 1.2546 -17800 2 38 1.6417 -17800 2 39 1.1376 -17800 2 40 0.083988 -17800 2 41 -0.067499 -17800 2 42 -0.78773 -17800 2 43 -1.1319 -17800 2 44 -1.5017 -17800 2 45 -0.93007 -17800 2 46 -0.4107 -17800 2 47 -0.56333 -17800 2 48 -1.0376 -17800 2 49 -1.2627 -17800 2 50 -1.1342 -17800 2 51 -1.3224 -17800 2 52 0.068414 -17800 2 53 -0.44102 -17800 2 54 -0.2047 -17800 2 55 1.238 -17800 2 56 0.97678 -17800 2 57 1.572 -17800 2 58 0.8015 -7565 2 1 -2.0649 -7565 2 2 -2.267 -7565 2 3 -2.3289 -7565 2 4 -2.736 -7565 2 5 -2.6242 -7565 2 6 -2.3911 -7565 2 7 -2.3438 -7565 2 8 -2.4359 -7565 2 9 -1.7199 -7565 2 10 -1.916 -7565 2 11 -1.907 -7565 2 12 -1.8135 -7565 2 13 -1.4666 -7565 2 14 -1.3587 -7565 2 15 -1.483 -7565 2 16 -1.258 -7565 2 17 -1.2419 -7565 2 18 -0.76389 -7565 2 19 0.27932 -7565 2 20 -0.38177 -7565 2 21 0.22691 -7565 2 22 0.6127 -7565 2 23 0.78523 -7565 2 24 0.73521 -7565 2 25 1.189 -7565 2 26 1.2331 -7565 2 27 1.2198 -7565 2 28 1.1854 -7565 2 29 0.82822 -7565 2 30 1.0845 -7565 2 31 0.64536 -7565 2 32 0.75396 -7565 2 33 1.0945 -7565 2 34 0.7805 -7565 2 35 1.465 -7565 2 36 1.3482 -7565 2 37 1.0696 -7565 2 38 1.6814 -7565 2 39 1.6881 -7565 2 40 -0.13959 -7565 2 41 0.1298 -7565 2 42 -1.7667 -7565 2 43 -1.4062 -7565 2 44 -2.0362 -7565 2 45 -1.5186 -7565 2 46 -1.2403 -7565 2 47 -0.98331 -7565 2 48 -2.2802 -7565 2 49 -2.0245 -7565 2 50 -1.8417 -7565 2 51 -2.2423 -7565 2 52 -0.10815 -7565 2 53 -0.94332 -7565 2 54 -0.43899 -7565 2 55 1.1745 -7565 2 56 1.281 -7565 2 57 1.9511 -7565 2 58 1.3293 -8723 3 1 0.38609 -8723 3 2 0.49621 -8723 3 3 0.27106 -8723 3 4 0.52798 -8723 3 5 0.64974 -8723 3 6 0.39951 -8723 3 7 0.35059 -8723 3 8 0.092336 -8723 3 9 0.34667 -8723 3 10 0.086345 -8723 3 11 -0.058399 -8723 3 12 0.1397 -8723 3 13 0.0046862 -8723 3 14 0.21375 -8723 3 15 0.43467 -8723 3 16 0.038462 -8723 3 17 0.17312 -8723 3 18 -0.70196 -8723 3 19 -1.2219 -8723 3 20 -1.164 -8723 3 21 -0.96399 -8723 3 22 -1.439 -8723 3 23 -1.1791 -8723 3 24 -0.80696 -8723 3 25 -1.2866 -8723 3 26 -1.275 -8723 3 27 -0.85485 -8723 3 28 -0.83844 -8723 3 29 -1.3278 -8723 3 30 -1.3487 -8723 3 31 -0.49621 -8723 3 32 -1.0378 -8723 3 33 -1.5265 -8723 3 34 -1.2573 -8723 3 35 -1.0738 -8723 3 36 -1.2892 -8723 3 37 -1.3397 -8723 3 38 -1.0056 -8723 3 39 -0.65868 -8723 3 40 -1.7747 -8723 3 41 -1.6357 -8723 3 42 -1.1527 -8723 3 43 -1.4047 -8723 3 44 -1.3668 -8723 3 45 -2.0062 -8723 3 46 -1.3933 -8723 3 47 -2.0862 -8723 3 48 -1.0876 -8723 3 49 -0.85722 -8723 3 50 -1.3112 -8723 3 51 -1.525 -8723 3 52 -1.3382 -8723 3 53 -1.072 -8723 3 54 -1.3831 -8723 3 55 -1.939 -8723 3 56 -0.59218 -8723 3 57 -1.0532 -8723 3 58 -0.16516 -4468 3 1 -2.5838 -4468 3 2 -2.764 -4468 3 3 -2.3922 -4468 3 4 -2.7309 -4468 3 5 -2.6163 -4468 3 6 -2.8835 -4468 3 7 -2.3395 -4468 3 8 -2.7239 -4468 3 9 -2.252 -4468 3 10 -2.6999 -4468 3 11 -1.9798 -4468 3 12 -1.8271 -4468 3 13 -3.0194 -4468 3 14 -2.4282 -4468 3 15 -2.6319 -4468 3 16 -2.0558 -4468 3 17 -2.5744 -4468 3 18 -2.9578 -4468 3 19 -2.2049 -4468 3 20 -2.2496 -4468 3 21 -2.3323 -4468 3 22 -2.1977 -4468 3 23 -1.8155 -4468 3 24 -1.5337 -4468 3 25 -1.1055 -4468 3 26 -1.8779 -4468 3 27 -1.9381 -4468 3 28 -1.9513 -4468 3 29 -1.5836 -4468 3 30 -1.4386 -4468 3 31 -0.64091 -4468 3 32 -0.74621 -4468 3 33 -1.0965 -4468 3 34 -0.92915 -4468 3 35 -1.4551 -4468 3 36 -0.81951 -4468 3 37 -1.4372 -4468 3 38 -0.64898 -4468 3 39 -0.55435 -4468 3 40 -1.5133 -4468 3 41 -1.7801 -4468 3 42 -2.8072 -4468 3 43 -2.1376 -4468 3 44 -2.228 -4468 3 45 -2.5776 -4468 3 46 -2.0375 -4468 3 47 -1.5044 -4468 3 48 -2.3069 -4468 3 49 -2.1376 -4468 3 50 -1.6664 -4468 3 51 -2.4527 -4468 3 52 -0.33095 -4468 3 53 -0.7711 -4468 3 54 1.1506 -4468 3 55 2.9691 -4468 3 56 3.5009 -4468 3 57 2.8835 -4468 3 58 0.81016 -3573 3 1 -0.6002 -3573 3 2 -0.85355 -3573 3 3 -0.59307 -3573 3 4 -0.96863 -3573 3 5 -1.2549 -3573 3 6 -1.2476 -3573 3 7 -1.2819 -3573 3 8 -1.2215 -3573 3 9 -1.1295 -3573 3 10 -1.1324 -3573 3 11 -1.0564 -3573 3 12 -0.96113 -3573 3 13 -1.1498 -3573 3 14 -0.59721 -3573 3 15 -0.97901 -3573 3 16 -1.0689 -3573 3 17 -1.125 -3573 3 18 -1.1842 -3573 3 19 -0.71227 -3573 3 20 -1.0388 -3573 3 21 -0.93141 -3573 3 22 -0.88634 -3573 3 23 -0.82168 -3573 3 24 -0.77656 -3573 3 25 -0.82573 -3573 3 26 -0.60789 -3573 3 27 -0.69569 -3573 3 28 -0.74296 -3573 3 29 -0.32223 -3573 3 30 -0.78054 -3573 3 31 -0.85635 -3573 3 32 -0.85452 -3573 3 33 -1.0228 -3573 3 34 -0.78708 -3573 3 35 -0.99687 -3573 3 36 -0.89283 -3573 3 37 -0.79915 -3573 3 38 -0.87398 -3573 3 39 -0.83541 -3573 3 40 -1.1011 -3573 3 41 -1.2227 -3573 3 42 -1.2293 -3573 3 43 -1.0708 -3573 3 44 -0.89701 -3573 3 45 -0.46645 -3573 3 46 -1.2829 -3573 3 47 -0.73478 -3573 3 48 -1.146 -3573 3 49 -0.67587 -3573 3 50 -0.60377 -3573 3 51 -0.57572 -3573 3 52 -0.98262 -3573 3 53 -0.71057 -3573 3 54 -0.73836 -3573 3 55 -1.0249 -3573 3 56 -0.68233 -3573 3 57 -0.14793 -3573 3 58 0.064206 -2457 3 1 -0.60649 -2457 3 2 -0.48247 -2457 3 3 -1.2019 -2457 3 4 -1.734 -2457 3 5 -0.3734 -2457 3 6 -0.8626 -2457 3 7 -0.79553 -2457 3 8 -0.93697 -2457 3 9 -1.5921 -2457 3 10 -1.1111 -2457 3 11 -1.5206 -2457 3 12 -1.6674 -2457 3 13 -1.8888 -2457 3 14 -2.0566 -2457 3 15 -2.729 -2457 3 16 -1.5131 -2457 3 17 -1.7839 -2457 3 18 -1.8843 -2457 3 19 -1.6295 -2457 3 20 -1.6142 -2457 3 21 -1.3707 -2457 3 22 -1.6143 -2457 3 23 -1.2832 -2457 3 24 -1.2093 -2457 3 25 -1.8257 -2457 3 26 -1.4968 -2457 3 27 -1.3344 -2457 3 28 -1.173 -2457 3 29 -1.6312 -2457 3 30 -1.1131 -2457 3 31 -0.62312 -2457 3 32 -0.70205 -2457 3 33 -1.0231 -2457 3 34 -0.79068 -2457 3 35 -0.79858 -2457 3 36 -0.71482 -2457 3 37 -0.68275 -2457 3 38 -0.67075 -2457 3 39 -0.60547 -2457 3 40 -1.2601 -2457 3 41 -0.80877 -2457 3 42 -1.8324 -2457 3 43 -1.4516 -2457 3 44 -1.4864 -2457 3 45 -1.7459 -2457 3 46 -1.6272 -2457 3 47 -1.5206 -2457 3 48 -1.6363 -2457 3 49 -1.5739 -2457 3 50 -1.4586 -2457 3 51 -1.6633 -2457 3 52 -1.1393 -2457 3 53 -0.5076 -2457 3 54 -0.30912 -2457 3 55 1.3953 -2457 3 56 1.8888 -2457 3 57 1.7916 -2457 3 58 1.9369 -9090 2 1 -2.6442 -9090 2 2 -2.7789 -9090 2 3 -2.5737 -9090 2 4 -2.8648 -9090 2 5 -2.2742 -9090 2 6 -2.5058 -9090 2 7 -2.5716 -9090 2 8 -2.4819 -9090 2 9 -2.0632 -9090 2 10 -2.2503 -9090 2 11 -2.6557 -9090 2 12 -2.0771 -9090 2 13 -2.2775 -9090 2 14 -2.1053 -9090 2 15 -2.61 -9090 2 16 -2.7219 -9090 2 17 -2.2947 -9090 2 18 -2.589 -9090 2 19 -2.1912 -9090 2 20 -2.3053 -9090 2 21 -1.7013 -9090 2 22 -1.649 -9090 2 23 -1.5332 -9090 2 24 -1.1913 -9090 2 25 -0.85137 -9090 2 26 -0.45222 -9090 2 27 0.75715 -9090 2 28 0.51396 -9090 2 29 -0.36522 -9090 2 30 0.52134 -9090 2 31 0.36923 -9090 2 32 -0.37695 -9090 2 33 0.26288 -9090 2 34 -0.17058 -9090 2 36 0.34689 -9090 2 37 0.93715 -9090 2 38 0.88018 -9090 2 39 1.0394 -9090 2 40 -2.4244 -9090 2 41 -1.907 -9090 2 42 -3.603 -9090 2 43 -4.1606 -9090 2 44 -2.887 -9090 2 45 -3.1615 -9090 2 46 -3.0522 -9090 2 47 -3.4183 -9090 2 48 -3.7764 -9090 2 49 -3.535 -9090 2 50 -2.9324 -9090 2 51 -3.3939 -9090 2 52 -2.4336 -9090 2 53 -1.7179 -9090 2 54 -1.4915 -9090 2 55 0.2099 -9090 2 56 1.2184 -9090 2 57 2.5413 -9090 2 58 3.603 diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/growth.dat b/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/growth.dat deleted file mode 100644 index 7c2a07b0..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/growth.dat +++ /dev/null @@ -1,2883 +0,0 @@ -1 1 1 81.3 -1 1 1.25 84.2 -1 1 1.5 86.4 -1 1 1.75 88.9 -1 1 2 91.4 -1 1 3 101.1 -1 1 4 109.5 -1 1 5 115.8 -1 1 6 121.9 -1 1 7 130 -1 1 8 138.2 -1 1 8.5 141.1 -1 1 9 144.3 -1 1 9.5 147.5 -1 1 10 150.5 -1 1 10.5 153.4 -1 1 11 156.2 -1 1 11.5 159.7 -1 1 12 163.8 -1 1 12.5 168.8 -1 1 13 174.9 -1 1 13.5 181.2 -1 1 14 186.3 -1 1 14.5 189.6 -1 1 15 191.3 -1 1 15.5 192.1 -1 1 16 192.8 -1 1 16.5 193.2 -1 1 17 193.8 -1 1 17.5 194.3 -1 1 18 195.1 -2 1 1 76.2 -2 1 1.25 80.4 -2 1 1.5 83.2 -2 1 1.75 85.4 -2 1 2 87.6 -2 1 3 97 -2 1 4 104.6 -2 1 5 112.3 -2 1 6 118.9 -2 1 7 125 -2 1 8 130.1 -2 1 8.5 133 -2 1 9 135.4 -2 1 9.5 137.5 -2 1 10 139.7 -2 1 10.5 142.2 -2 1 11 144.2 -2 1 11.5 146.2 -2 1 12 148.1 -2 1 12.5 149.8 -2 1 13 151.6 -2 1 13.5 153.8 -2 1 14 156.3 -2 1 14.5 159.2 -2 1 15 163.3 -2 1 15.5 167.7 -2 1 16 171.5 -2 1 16.5 174.3 -2 1 17 176.1 -2 1 17.5 177.4 -2 1 18 178.7 -3 1 1 76.8 -3 1 1.25 79.8 -3 1 1.5 82.6 -3 1 1.75 84.7 -3 1 2 86.7 -3 1 3 94.2 -3 1 4 100.4 -3 1 5 107.1 -3 1 6 112.3 -3 1 7 118.6 -3 1 8 124 -3 1 8.5 126.5 -3 1 9 128.9 -3 1 9.5 131.2 -3 1 10 133.4 -3 1 10.5 135.8 -3 1 11 138.4 -3 1 11.5 141 -3 1 12 143.6 -3 1 12.5 146.8 -3 1 13 150.8 -3 1 13.5 155.1 -3 1 14 159.5 -3 1 14.5 163.3 -3 1 15 166.8 -3 1 15.5 167.8 -3 1 16 168.8 -3 1 16.5 169.8 -3 1 17 170.9 -3 1 17.5 171.2 -3 1 18 171.5 -4 1 1 74.1 -4 1 1.25 78.4 -4 1 1.5 82.6 -4 1 1.75 85.4 -4 1 2 88.1 -4 1 3 98.6 -4 1 4 104.4 -4 1 5 111 -4 1 6 116.3 -4 1 7 123.2 -4 1 8 129.9 -4 1 8.5 133 -4 1 9 136 -4 1 9.5 138.7 -4 1 10 141.4 -4 1 10.5 144 -4 1 11 146.4 -4 1 11.5 148.8 -4 1 12 151.4 -4 1 12.5 154.5 -4 1 13 157.7 -4 1 13.5 162.2 -4 1 14 167.4 -4 1 14.5 172.5 -4 1 15 176.3 -4 1 15.5 178.5 -4 1 16 179.8 -4 1 16.5 180.7 -4 1 17 181.4 -4 1 17.5 181.6 -4 1 18 181.8 -5 1 1 74.2 -5 1 1.25 76.3 -5 1 1.5 78.3 -5 1 1.75 80.3 -5 1 2 82.2 -5 1 3 89.4 -5 1 4 96.9 -5 1 5 104.1 -5 1 6 110.7 -5 1 7 115.8 -5 1 8 121.7 -5 1 8.5 125.2 -5 1 9 128.5 -5 1 9.5 131.2 -5 1 10 134.2 -5 1 10.5 137.4 -5 1 11 140.5 -5 1 11.5 143.3 -5 1 12 145.9 -5 1 12.5 148.7 -5 1 13 152 -5 1 13.5 155.8 -5 1 14 160.4 -5 1 14.5 165.1 -5 1 15 168.5 -5 1 15.5 170.4 -5 1 16 171.6 -5 1 16.5 172.4 -5 1 17 172.5 -5 1 17.5 172.5 -5 1 18 172.5 -6 1 1 76.8 -6 1 1.25 79.1 -6 1 1.5 81.1 -6 1 1.75 84.4 -6 1 2 87.4 -6 1 3 94 -6 1 4 102.4 -6 1 5 109.2 -6 1 6 116.1 -6 1 7 121.9 -6 1 8 127.8 -6 1 8.5 129.8 -6 1 9 132.4 -6 1 9.5 135 -6 1 10 137.3 -6 1 10.5 139.7 -6 1 11 142 -6 1 11.5 144.1 -6 1 12 146.9 -6 1 12.5 150 -6 1 13 153.4 -6 1 13.5 157.3 -6 1 14 161.6 -6 1 14.5 165.2 -6 1 15 168.8 -6 1 15.5 170.1 -6 1 16 171.5 -6 1 16.5 172.1 -6 1 17 172.6 -6 1 17.5 173.2 -6 1 18 173.8 -7 1 1 72.4 -7 1 1.25 76 -7 1 1.5 79.4 -7 1 1.75 82 -7 1 2 84.2 -7 1 3 93.2 -7 1 4 101.6 -7 1 5 109 -7 1 6 117.3 -7 1 7 122.9 -7 1 8 128.3 -7 1 8.5 130.9 -7 1 9 133.7 -7 1 9.5 136 -7 1 10 138 -7 1 10.5 139.9 -7 1 11 141.6 -7 1 11.5 143.4 -7 1 12 145.5 -7 1 12.5 147.8 -7 1 13 150.3 -7 1 13.5 152.8 -7 1 14 155.8 -7 1 14.5 159.2 -7 1 15 163.1 -7 1 15.5 166.5 -7 1 16 168.9 -7 1 16.5 170.2 -7 1 17 171.1 -7 1 17.5 171.8 -7 1 18 172.6 -8 1 1 73.8 -8 1 1.25 78.7 -8 1 1.5 83 -8 1 1.75 85.8 -8 1 2 88.4 -8 1 3 97.3 -8 1 4 106.7 -8 1 5 112.8 -8 1 6 119.1 -8 1 7 125.7 -8 1 8 132.3 -8 1 8.5 135.4 -8 1 9 138.3 -8 1 9.5 141.3 -8 1 10 144.7 -8 1 10.5 147.9 -8 1 11 151.2 -8 1 11.5 154.5 -8 1 12 158.2 -8 1 12.5 162.3 -8 1 13 166.5 -8 1 13.5 171.1 -8 1 14 175.2 -8 1 14.5 178.4 -8 1 15 180.8 -8 1 15.5 182.2 -8 1 16 183.2 -8 1 16.5 184 -8 1 17 184.7 -8 1 17.5 185 -8 1 18 185.2 -9 1 1 75.4 -9 1 1.25 81 -9 1 1.5 84.9 -9 1 1.75 87.9 -9 1 2 90 -9 1 3 97.3 -9 1 4 102.8 -9 1 5 108.2 -9 1 6 113.5 -9 1 7 120.2 -9 1 8 125.7 -9 1 8.5 127.9 -9 1 9 130.3 -9 1 9.5 133.2 -9 1 10 135.9 -9 1 10.5 137.9 -9 1 11 139.6 -9 1 11.5 141.5 -9 1 12 143.7 -9 1 12.5 146 -9 1 13 148.6 -9 1 13.5 151.5 -9 1 14 154.3 -9 1 14.5 157.8 -9 1 15 161.8 -9 1 15.5 165.6 -9 1 16 168.7 -9 1 16.5 171 -9 1 17 171.6 -9 1 17.5 172.3 -9 1 18 172.9 -10 1 1 78.8 -10 1 1.25 83.3 -10 1 1.5 87 -10 1 1.75 89.6 -10 1 2 91.4 -10 1 3 100.4 -10 1 4 111 -10 1 5 118.5 -10 1 6 125.8 -10 1 7 131.1 -10 1 8 138.4 -10 1 8.5 141.5 -10 1 9 144.5 -10 1 9.5 147.5 -10 1 10 150.5 -10 1 10.5 153.6 -10 1 11 156.8 -10 1 11.5 160.5 -10 1 12 164.6 -10 1 12.5 169.2 -10 1 13 174.3 -10 1 13.5 178.8 -10 1 14 181.9 -10 1 14.5 184.2 -10 1 15 185.6 -10 1 15.5 186.6 -10 1 16 187.1 -10 1 16.5 187.4 -10 1 17 187.8 -10 1 17.5 188.2 -10 1 18 188.4 -11 1 1 76.9 -11 1 1.25 79.9 -11 1 1.5 84.1 -11 1 1.75 88.5 -11 1 2 90.6 -11 1 3 96.6 -11 1 4 104.8 -11 1 5 112 -11 1 6 118.6 -11 1 7 124.8 -11 1 8 130.3 -11 1 8.5 133.1 -11 1 9 135.8 -11 1 9.5 138.7 -11 1 10 141.7 -11 1 10.5 144.2 -11 1 11 146.6 -11 1 11.5 148.7 -11 1 12 150.5 -11 1 12.5 152.4 -11 1 13 154 -11 1 13.5 158.9 -11 1 14 161.7 -11 1 14.5 165.1 -11 1 15 169.6 -11 1 15.5 174 -11 1 16 176.6 -11 1 16.5 178.6 -11 1 17 179.6 -11 1 17.5 180.2 -11 1 18 181.6 -12 1 1 81.6 -12 1 1.25 83.7 -12 1 1.5 86.3 -12 1 1.75 88.8 -12 1 2 92.2 -12 1 3 99.3 -12 1 4 105.8 -12 1 5 112.6 -12 1 6 119.6 -12 1 7 126.9 -12 1 8 133.8 -12 1 8.5 136.4 -12 1 9 139.9 -12 1 9.5 143.2 -12 1 10 146 -12 1 10.5 149 -12 1 11 151.8 -12 1 11.5 154.8 -12 1 12 158 -12 1 12.5 161.5 -12 1 13 165.3 -12 1 13.5 169.6 -12 1 14 174.3 -12 1 14.5 178.8 -12 1 15 182.1 -12 1 15.5 184.6 -12 1 16 186.1 -12 1 16.5 187.5 -12 1 17 188 -12 1 17.5 188.6 -12 1 18 189 -13 1 1 78 -13 1 1.25 81.8 -13 1 1.5 85 -13 1 1.75 86.4 -13 1 2 87.1 -13 1 3 96.2 -13 1 4 104 -13 1 5 111 -13 1 6 117.3 -13 1 7 124.1 -13 1 8 130 -13 1 8.5 133.6 -13 1 9 136.8 -13 1 9.5 139.6 -13 1 10 142.2 -13 1 10.5 144.8 -13 1 11 147.4 -13 1 11.5 149.8 -13 1 12 151.9 -13 1 12.5 154.1 -13 1 13 158.2 -13 1 13.5 163.3 -13 1 14 168.1 -13 1 14.5 173 -13 1 15 175.2 -13 1 15.5 177.4 -13 1 16 179.2 -13 1 16.5 180.6 -13 1 17 181.4 -13 1 17.5 181.9 -13 1 18 182.4 -14 1 1 76.4 -14 1 1.25 79.4 -14 1 1.5 83.4 -14 1 1.75 87.6 -14 1 2 91.4 -14 1 3 101.2 -14 1 4 106.4 -14 1 5 113.3 -14 1 6 120.3 -14 1 7 128.8 -14 1 8 135 -14 1 8.5 137.8 -14 1 9 140.6 -14 1 9.5 143.4 -14 1 10 146.5 -14 1 10.5 149.6 -14 1 11 152.2 -14 1 11.5 155.3 -14 1 12 159.2 -14 1 12.5 163.9 -14 1 13 168.6 -14 1 13.5 172.8 -14 1 14 176.6 -14 1 14.5 179.4 -14 1 15 181.4 -14 1 15.5 182.6 -14 1 16 183.7 -14 1 16.5 184.4 -14 1 17 185 -14 1 17.5 185.7 -14 1 18 185.8 -15 1 1 76.4 -15 1 1.25 81.2 -15 1 1.5 86 -15 1 1.75 89.2 -15 1 2 92.2 -15 1 3 101.3 -15 1 4 110.3 -15 1 5 117.3 -15 1 6 122.5 -15 1 7 129.5 -15 1 8 134.8 -15 1 8.5 137.4 -15 1 9 140 -15 1 9.5 142.5 -15 1 10 145 -15 1 10.5 147.8 -15 1 11 150.5 -15 1 11.5 153.4 -15 1 12 157.4 -15 1 12.5 162 -15 1 13 166.6 -15 1 13.5 170.7 -15 1 14 174 -15 1 14.5 176.1 -15 1 15 177.3 -15 1 15.5 177.9 -15 1 16 178.2 -15 1 16.5 178.3 -15 1 17 178.5 -15 1 17.5 178.5 -15 1 18 178.7 -16 1 1 76.2 -16 1 1.25 79.2 -16 1 1.5 82.3 -16 1 1.75 85.4 -16 1 2 88.4 -16 1 3 101 -16 1 4 107.4 -16 1 5 114.8 -16 1 6 120.7 -16 1 7 128 -16 1 8 134.5 -16 1 8.5 137.4 -16 1 9 139.9 -16 1 9.5 142.5 -16 1 10 145.7 -16 1 10.5 148.7 -16 1 11 151.3 -16 1 11.5 154.3 -16 1 12 158.1 -16 1 12.5 162.8 -16 1 13 167.5 -16 1 13.5 171.5 -16 1 14 175.1 -16 1 14.5 178 -16 1 15 179.8 -16 1 15.5 181 -16 1 16 181.9 -16 1 16.5 182.7 -16 1 17 183.3 -16 1 17.5 183.4 -16 1 18 183.4 -17 1 1 75 -17 1 1.25 78.4 -17 1 1.5 82 -17 1 1.75 84 -17 1 2 85.9 -17 1 3 95.6 -17 1 4 102.1 -17 1 5 109.2 -17 1 6 117.5 -17 1 7 124.8 -17 1 8 131.5 -17 1 8.5 134.9 -17 1 9 137.8 -17 1 9.5 140.7 -17 1 10 143.8 -17 1 10.5 146.8 -17 1 11 149.5 -17 1 11.5 152.4 -17 1 12 155.3 -17 1 12.5 158.9 -17 1 13 163.6 -17 1 13.5 168.6 -17 1 14 173 -17 1 14.5 176.3 -17 1 15 178.5 -17 1 15.5 180 -17 1 16 181 -17 1 16.5 181.8 -17 1 17 182.2 -17 1 17.5 182.6 -17 1 18 183 -18 1 1 79.7 -18 1 1.25 81.3 -18 1 1.5 83.3 -18 1 1.75 86.5 -18 1 2 88.9 -18 1 3 99.4 -18 1 4 104.1 -18 1 5 112.5 -18 1 6 119 -18 1 7 128 -18 1 8 133.6 -18 1 8.5 136.6 -18 1 9 139.5 -18 1 9.5 141.9 -18 1 10 144.8 -18 1 10.5 148.5 -18 1 11 152.3 -18 1 11.5 156.3 -18 1 12 161.2 -18 1 12.5 165.9 -18 1 13 169.5 -18 1 13.5 172.1 -18 1 14 174.2 -18 1 14.5 175.6 -18 1 15 176.4 -18 1 15.5 177 -18 1 16 177.3 -18 1 16.5 177.6 -18 1 17 177.3 -18 1 17.5 177 -18 1 18 177 -19 1 1 70 -19 1 1.25 74.5 -19 1 1.5 78.7 -19 1 1.75 82.3 -19 1 2 85.1 -19 1 3 93.6 -19 1 4 101.9 -19 1 5 108.8 -19 1 6 115.3 -19 1 7 122 -19 1 8 127.9 -19 1 8.5 130.9 -19 1 9 134.1 -19 1 9.5 136.8 -19 1 10 139.3 -19 1 10.5 141.6 -19 1 11 144 -19 1 11.5 146.1 -19 1 12 148.6 -19 1 12.5 151.7 -19 1 13 155 -19 1 13.5 158.9 -19 1 14 163.3 -19 1 14.5 167.4 -19 1 15 170.4 -19 1 15.5 171.9 -19 1 16 173 -19 1 16.5 173.7 -19 1 17 174.2 -19 1 17.5 174.6 -19 1 18 175 -20 1 1 73.8 -20 1 1.25 76.7 -20 1 1.5 79.3 -20 1 1.75 82.8 -20 1 2 86.4 -20 1 3 95.3 -20 1 4 102.2 -20 1 5 109.5 -20 1 6 116.1 -20 1 7 121.7 -20 1 8 128.3 -20 1 8.5 131.4 -20 1 9 134.3 -20 1 9.5 137 -20 1 10 140 -20 1 10.5 143 -20 1 11 145.6 -20 1 11.5 148.7 -20 1 12 152.3 -20 1 12.5 157 -20 1 13 162 -20 1 13.5 166.4 -20 1 14 169.8 -20 1 14.5 172.1 -20 1 15 173.7 -20 1 15.5 174.7 -20 1 16 175.5 -20 1 16.5 176.1 -20 1 17 176.4 -20 1 17.5 176.5 -20 1 18 176.8 -21 1 1 75.3 -21 1 1.25 79.1 -21 1 1.5 82.6 -21 1 1.75 85.1 -21 1 2 87.2 -21 1 3 95.6 -21 1 4 102.6 -21 1 5 109.7 -21 1 6 116.8 -21 1 7 121.7 -21 1 8 127.1 -21 1 8.5 129.8 -21 1 9 132.5 -21 1 9.5 134.7 -21 1 10 136.7 -21 1 10.5 138.9 -21 1 11 141.5 -21 1 11.5 143.6 -21 1 12 145.8 -21 1 12.5 148 -21 1 13 150 -21 1 13.5 152.5 -21 1 14 155.4 -21 1 14.5 158.9 -21 1 15 163 -21 1 15.5 166.8 -21 1 16 169.8 -21 1 16.5 172 -21 1 17 173.5 -21 1 17.5 174.9 -21 1 18 176.4 -22 1 1 76.6 -22 1 1.25 79 -22 1 1.5 82.6 -22 1 1.75 86.6 -22 1 2 89 -22 1 3 95.3 -22 1 4 102.1 -22 1 5 108.5 -22 1 6 111.5 -22 1 7 119.4 -22 1 8 126.1 -22 1 8.5 128.8 -22 1 9 131.4 -22 1 9.5 134.3 -22 1 10 136.8 -22 1 10.5 139.7 -22 1 11 142.2 -22 1 11.5 144.1 -22 1 12 146.6 -22 1 12.5 150 -22 1 13 154 -22 1 13.5 158 -22 1 14 162.1 -22 1 14.5 166.5 -22 1 15 169.2 -22 1 15.5 170.7 -22 1 16 171.9 -22 1 16.5 172.8 -22 1 17 173.4 -22 1 17.5 173.8 -22 1 18 174 -23 1 1 73 -23 1 1.25 76 -23 1 1.5 78.7 -23 1 1.75 82.2 -23 1 2 84.6 -23 1 3 94.7 -23 1 4 104.9 -23 1 5 109 -23 1 6 115.3 -23 1 7 121.2 -23 1 8 126.5 -23 1 8.5 130.4 -23 1 9 134.3 -23 1 9.5 136.6 -23 1 10 139.1 -23 1 10.5 141.6 -23 1 11 143.8 -23 1 11.5 146.3 -23 1 12 149 -23 1 12.5 151.6 -23 1 13 154.2 -23 1 13.5 157.2 -23 1 14 160.6 -23 1 14.5 164.3 -23 1 15 168.6 -23 1 15.5 173 -23 1 16 176.2 -23 1 16.5 178 -23 1 17 179.1 -23 1 17.5 180.2 -23 1 18 181 -24 1 1 75.1 -24 1 1.25 78.6 -24 1 1.5 81.9 -24 1 1.75 84 -24 1 2 85.6 -24 1 3 92.8 -24 1 4 100.6 -24 1 5 106.7 -24 1 6 112.5 -24 1 7 118.6 -24 1 8 123.7 -24 1 8.5 126.4 -24 1 9 129.1 -24 1 9.5 131.8 -24 1 10 134.5 -24 1 10.5 136.8 -24 1 11 139 -24 1 11.5 141.8 -24 1 12 145.3 -24 1 12.5 149.7 -24 1 13 154.4 -24 1 13.5 158.8 -24 1 14 162.2 -24 1 14.5 164.8 -24 1 15 167 -24 1 15.5 168 -24 1 16 168.8 -24 1 16.5 169.4 -24 1 17 169.7 -24 1 17.5 169.8 -24 1 18 170.1 -25 1 1 77.4 -25 1 1.25 81.6 -25 1 1.5 84.8 -25 1 1.75 88 -25 1 2 89.6 -25 1 3 96.5 -25 1 4 103.3 -25 1 5 108.7 -25 1 6 113.8 -25 1 7 120.1 -25 1 8 125.8 -25 1 8.5 128.9 -25 1 9 132.1 -25 1 9.5 134.3 -25 1 10 136.9 -25 1 10.5 139.2 -25 1 11 141.6 -25 1 11.5 144.2 -25 1 12 146.7 -25 1 12.5 149.6 -25 1 13 153.3 -25 1 13.5 157.7 -25 1 14 162.3 -25 1 14.5 166.1 -25 1 15 168.6 -25 1 15.5 170.5 -25 1 16 172.2 -25 1 16.5 173.1 -25 1 17 173.8 -25 1 17.5 174.4 -25 1 18 175.2 -26 1 1 73.2 -26 1 1.25 76.2 -26 1 1.5 79 -26 1 1.75 81.8 -26 1 2 84.8 -26 1 3 95.3 -26 1 4 101.6 -26 1 5 109.3 -26 1 6 116 -26 1 7 122.7 -26 1 8 129.9 -26 1 8.5 133.1 -26 1 9 136.2 -26 1 9.5 139.4 -26 1 10 142.6 -26 1 10.5 144.7 -26 1 11 147.9 -26 1 11.5 150.8 -26 1 12 153.5 -26 1 12.5 156.1 -26 1 13 158.7 -26 1 13.5 161.1 -26 1 14 163.7 -26 1 14.5 166.8 -26 1 15 170.3 -26 1 15.5 174.3 -26 1 16 178.3 -26 1 16.5 181 -26 1 17 183.1 -26 1 17.5 184.6 -26 1 18 185.1 -27 1 1 78 -27 1 1.25 82.2 -27 1 1.5 86.1 -27 1 1.75 88.9 -27 1 2 91.4 -27 1 3 101.3 -27 1 4 108 -27 1 5 114.9 -27 1 6 121.5 -27 1 7 128.3 -27 1 8 134 -27 1 8.5 137 -27 1 9 140.1 -27 1 9.5 142.5 -27 1 10 145 -27 1 10.5 147.4 -27 1 11 149.5 -27 1 11.5 151.4 -27 1 12 153.2 -27 1 12.5 155.2 -27 1 13 157.1 -27 1 13.5 159.2 -27 1 14 161.4 -27 1 14.5 163.6 -27 1 15 166.6 -27 1 15.5 170.9 -27 1 16 175 -27 1 16.5 178.1 -27 1 17 180.5 -27 1 17.5 182 -27 1 18 182.7 -28 1 1 76.5 -28 1 1.25 80 -28 1 1.5 82.8 -28 1 1.75 85.4 -28 1 2 88.4 -28 1 3 95.2 -28 1 4 102 -28 1 5 107.5 -28 1 6 114 -28 1 7 119.4 -28 1 8 124.2 -28 1 8.5 126.6 -28 1 9 129.1 -28 1 9.5 131.6 -28 1 10 134 -28 1 10.5 136.5 -28 1 11 138.8 -28 1 11.5 141 -28 1 12 143.3 -28 1 12.5 145.7 -28 1 13 148.1 -28 1 13.5 150.7 -28 1 14 154.4 -28 1 14.5 158.9 -28 1 15 162.7 -28 1 15.5 165.2 -28 1 16 166.9 -28 1 16.5 168 -28 1 17 168.7 -28 1 17.5 169.1 -28 1 18 169.4 -29 1 1 78 -29 1 1.25 80.6 -29 1 1.5 85.4 -29 1 1.75 90.2 -29 1 2 93.5 -29 1 3 103.6 -29 1 4 111 -29 1 5 117.9 -29 1 6 126.7 -29 1 7 133.6 -29 1 8 140.3 -29 1 8.5 143.9 -29 1 9 147.4 -29 1 9.5 150.4 -29 1 10 153.4 -29 1 10.5 156.1 -29 1 11 159.1 -29 1 11.5 162.8 -29 1 12 167.1 -29 1 12.5 171.9 -29 1 13 177.1 -29 1 13.5 181.8 -29 1 14 185.7 -29 1 14.5 188.8 -29 1 15 190.8 -29 1 15.5 192.2 -29 1 16 193 -29 1 16.5 193.6 -29 1 17 194 -29 1 17.5 194.1 -29 1 18 194.3 -30 1 1 74.9 -30 1 1.25 78.7 -30 1 1.5 81 -30 1 1.75 84.9 -30 1 2 87.7 -30 1 3 93.2 -30 1 4 104.2 -30 1 5 110 -30 1 6 116 -30 1 7 123.8 -30 1 8 130.6 -30 1 8.5 133.3 -30 1 9 136 -30 1 9.5 138.9 -30 1 10 141.9 -30 1 10.5 144.1 -30 1 11 146.2 -30 1 11.5 148.1 -30 1 12 150.1 -30 1 12.5 152.5 -30 1 13 155.1 -30 1 13.5 158.3 -30 1 14 162.4 -30 1 14.5 167.3 -30 1 15 171.6 -30 1 15.5 174.9 -30 1 16 177.4 -30 1 16.5 179 -30 1 17 180 -30 1 17.5 180.7 -30 1 18 181.1 -31 1 1 74.2 -31 1 1.25 78.3 -31 1 1.5 82.3 -31 1 1.75 86 -31 1 2 89.1 -31 1 3 97.1 -31 1 4 104.9 -31 1 5 112 -31 1 6 118.6 -31 1 7 124.7 -31 1 8 131.8 -31 1 8.5 135 -31 1 9 138.2 -31 1 9.5 141.2 -31 1 10 143.9 -31 1 10.5 146.4 -31 1 11 149.5 -31 1 11.5 153.8 -31 1 12 158.4 -31 1 12.5 163.2 -31 1 13 168 -31 1 13.5 172.4 -31 1 14 175.7 -31 1 14.5 177.6 -31 1 15 178.7 -31 1 15.5 179.8 -31 1 16 180.4 -31 1 16.5 180.8 -31 1 17 180.9 -31 1 17.5 180.8 -31 1 18 181.3 -32 1 1 78.7 -32 1 1.25 83.3 -32 1 1.5 87 -32 1 1.75 90.4 -32 1 2 93.1 -32 1 3 103 -32 1 4 109.7 -32 1 5 118 -32 1 6 124.6 -32 1 7 132.3 -32 1 8 138.4 -32 1 8.5 141.6 -32 1 9 144.8 -32 1 9.5 147.4 -32 1 10 150.5 -32 1 10.5 153.4 -32 1 11 156.1 -32 1 11.5 159.3 -32 1 12 163.7 -32 1 12.5 168.8 -32 1 13 174.2 -32 1 13.5 179 -32 1 14 183.1 -32 1 14.5 186 -32 1 15 188 -32 1 15.5 189.6 -32 1 16 190.7 -32 1 16.5 191.3 -32 1 17 191.7 -32 1 17.5 192.2 -32 1 18 192.8 -33 1 1 78 -33 1 1.25 82.6 -33 1 1.5 85.8 -33 1 1.75 88.4 -33 1 2 90.9 -33 1 3 99.1 -33 1 4 105.8 -33 1 5 112.2 -33 1 6 117.6 -33 1 7 123.4 -33 1 8 129.6 -33 1 8.5 132.3 -33 1 9 135 -33 1 9.5 137.3 -33 1 10 139.7 -33 1 10.5 142 -33 1 11 144.4 -33 1 11.5 146.5 -33 1 12 148.6 -33 1 12.5 150.7 -33 1 13 153.1 -33 1 13.5 156 -33 1 14 159.6 -33 1 14.5 163.5 -33 1 15 167.8 -33 1 15.5 170.3 -33 1 16 172.8 -33 1 16.5 174.5 -33 1 17 175.5 -33 1 17.5 176 -33 1 18 176.4 -34 1 1 76 -34 1 1.25 81.2 -34 1 1.5 84.6 -34 1 1.75 87 -34 1 2 89.1 -34 1 3 94.6 -34 1 4 102 -34 1 5 107.4 -34 1 6 113 -34 1 7 119.4 -34 1 8 124.2 -34 1 8.5 127 -34 1 9 129.8 -34 1 9.5 132.9 -34 1 10 136.1 -34 1 10.5 139 -34 1 11 141.7 -34 1 11.5 144.4 -34 1 12 147.4 -34 1 12.5 150.9 -34 1 13 155.9 -34 1 13.5 161.5 -34 1 14 166.2 -34 1 14.5 169.6 -34 1 15 171.9 -34 1 15.5 172.9 -34 1 16 173.4 -34 1 16.5 173.8 -34 1 17 174.2 -34 1 17.5 174.2 -34 1 18 174.1 -35 1 1 76 -35 1 1.25 80.1 -35 1 1.5 85.9 -35 1 1.75 91.4 -35 1 2 95.2 -35 1 3 103.5 -35 1 4 111.6 -35 1 5 118.1 -35 1 6 126.3 -35 1 7 132.8 -35 1 8 139.1 -35 1 8.5 143.4 -35 1 9 147.5 -35 1 9.5 150.6 -35 1 10 154 -35 1 10.5 157.6 -35 1 11 160.9 -35 1 11.5 163.8 -35 1 12 166.3 -35 1 12.5 168.6 -35 1 13 171 -35 1 13.5 173.8 -35 1 14 177.3 -35 1 14.5 180.7 -35 1 15 183.4 -35 1 15.5 185.3 -35 1 16 186.2 -35 1 16.5 186.4 -35 1 17 186.7 -35 1 17.5 187.2 -35 1 18 188 -36 1 1 68.8 -36 1 1.25 73.5 -36 1 1.5 77.5 -36 1 1.75 80.8 -36 1 2 84 -36 1 3 95.2 -36 1 4 103.1 -36 1 5 111.1 -36 1 6 118.4 -36 1 7 124.9 -36 1 8 130.7 -36 1 8.5 134 -36 1 9 137.5 -36 1 9.5 140.3 -36 1 10 143 -36 1 10.5 145.5 -36 1 11 148 -36 1 11.5 150.8 -36 1 12 153.6 -36 1 12.5 157.3 -36 1 13 162.1 -36 1 13.5 167 -36 1 14 171.2 -36 1 14.5 174.4 -36 1 15 176.8 -36 1 15.5 178.4 -36 1 16 179.1 -36 1 16.5 179.7 -36 1 17 180.1 -36 1 17.5 180.5 -36 1 18 180.8 -37 1 1 82.2 -37 1 1.25 88.9 -37 1 1.5 90.9 -37 1 1.75 93 -37 1 2 95.3 -37 1 3 103.8 -37 1 4 111.8 -37 1 5 117.1 -37 1 6 123.7 -37 1 7 130.4 -37 1 8 136.4 -37 1 8.5 139.3 -37 1 9 142.2 -37 1 9.5 145.2 -37 1 10 148.3 -37 1 10.5 151.2 -37 1 11 154.2 -37 1 11.5 157.6 -37 1 12 161.8 -37 1 12.5 166.5 -37 1 13 171.1 -37 1 13.5 174.9 -37 1 14 177.9 -37 1 14.5 180.1 -37 1 15 181.3 -37 1 15.5 181.8 -37 1 16 182.2 -37 1 16.5 182.7 -37 1 17 183.1 -37 1 17.5 183.4 -37 1 18 183.7 -38 1 1 77 -38 1 1.25 82.5 -38 1 1.5 85.6 -38 1 1.75 87.9 -38 1 2 90.3 -38 1 3 98.3 -38 1 4 107.2 -38 1 5 114.6 -38 1 6 121.9 -38 1 7 129.2 -38 1 8 135.9 -38 1 8.5 139.1 -38 1 9 142.2 -38 1 9.5 145 -38 1 10 147.8 -38 1 10.5 150.5 -38 1 11 153.5 -38 1 11.5 157.5 -38 1 12 161.5 -38 1 12.5 165.5 -38 1 13 169.7 -38 1 13.5 173.1 -38 1 14 175.6 -38 1 14.5 177.2 -38 1 15 178.3 -38 1 15.5 179 -38 1 16 179.2 -38 1 16.5 179.3 -38 1 17 179.8 -38 1 17.5 180.3 -38 1 18 180.7 -39 1 1 75 -39 1 1.25 79.2 -39 1 1.5 82.2 -39 1 1.75 84.6 -39 1 2 87 -39 1 3 95.8 -39 1 4 103.1 -39 1 5 110.2 -39 1 6 116.1 -39 1 7 122.2 -39 1 8 127.7 -39 1 8.5 130.7 -39 1 9 133.7 -39 1 9.5 136.8 -39 1 10 139.8 -39 1 10.5 142.6 -39 1 11 145.1 -39 1 11.5 147.3 -39 1 12 150.2 -39 1 12.5 153.3 -39 1 13 156.7 -39 1 13.5 160.5 -39 1 14 164.1 -39 1 14.5 167.7 -39 1 15 171 -39 1 15.5 173.1 -39 1 16 174.7 -39 1 16.5 175.6 -39 1 17 176.1 -39 1 17.5 176.3 -39 1 18 176.4 -40 2 1 76.2 -40 2 1.25 80.4 -40 2 1.5 83.3 -40 2 1.75 85.7 -40 2 2 87.7 -40 2 3 96 -40 2 4 103.8 -40 2 5 110.7 -40 2 6 116.8 -40 2 7 122.2 -40 2 8 127.4 -40 2 8.5 130.6 -40 2 9 133.4 -40 2 9.5 135.9 -40 2 10 138.6 -40 2 10.5 142.4 -40 2 11 146.8 -40 2 11.5 150.3 -40 2 12 153.1 -40 2 12.5 155 -40 2 13 156.2 -40 2 13.5 157.1 -40 2 14 157.7 -40 2 14.5 158 -40 2 15 158.2 -40 2 15.5 158.4 -40 2 16 158.6 -40 2 16.5 158.7 -40 2 17 158.7 -40 2 17.5 158.8 -40 2 18 158.9 -41 2 1 74.6 -41 2 1.25 78 -41 2 1.5 82 -41 2 1.75 86.9 -41 2 2 90 -41 2 3 94.9 -41 2 4 102.1 -41 2 5 109.2 -41 2 6 115.6 -41 2 7 122.7 -41 2 8 128.2 -41 2 8.5 131.1 -41 2 9 134.8 -41 2 9.5 138.2 -41 2 10 140.9 -41 2 10.5 143.4 -41 2 11 146.1 -41 2 11.5 149.4 -41 2 12 152.9 -41 2 12.5 156.4 -41 2 13 159.5 -41 2 13.5 161.6 -41 2 14 162.6 -41 2 14.5 163.6 -41 2 15 165 -41 2 15.5 165.3 -41 2 16 165.6 -41 2 16.5 165.9 -41 2 17 166.1 -41 2 17.5 166 -41 2 18 166 -42 2 1 78.2 -42 2 1.25 81.8 -42 2 1.5 85.4 -42 2 1.75 87.9 -42 2 2 89.6 -42 2 3 97.1 -42 2 4 109.2 -42 2 5 116.2 -42 2 6 122.9 -42 2 7 128 -42 2 8 134.2 -42 2 8.5 138 -42 2 9 141.5 -42 2 9.5 145.2 -42 2 10 148.8 -42 2 10.5 152.3 -42 2 11 155.6 -42 2 11.5 158.2 -42 2 12 159.6 -42 2 12.5 160.1 -42 2 13 160.3 -42 2 13.5 160.8 -42 2 14 161.6 -42 2 14.5 161.8 -42 2 15 161.7 -42 2 15.5 161.8 -42 2 16 161.9 -42 2 16.5 161.9 -42 2 17 161.7 -42 2 17.5 161.9 -42 2 18 162.2 -43 2 1 77.7 -43 2 1.25 80.5 -43 2 1.5 83.3 -43 2 1.75 87 -43 2 2 90.3 -43 2 3 98.6 -43 2 4 106.3 -43 2 5 113.9 -43 2 6 120.7 -43 2 7 125.7 -43 2 8 131 -43 2 8.5 134.1 -43 2 9 137.1 -43 2 9.5 140.2 -43 2 10 143 -43 2 10.5 145.7 -43 2 11 148.5 -43 2 11.5 151.5 -43 2 12 154.8 -43 2 12.5 158.4 -43 2 13 161.2 -43 2 13.5 163.5 -43 2 14 165.2 -43 2 14.5 166 -43 2 15 166.5 -43 2 15.5 166.9 -43 2 16 167.2 -43 2 16.5 167.4 -43 2 17 167.4 -43 2 17.5 167.6 -43 2 18 167.8 -44 2 1 76 -44 2 1.25 80 -44 2 1.5 83 -44 2 1.75 86 -44 2 2 89 -44 2 3 96 -44 2 4 103 -44 2 5 110 -44 2 6 117 -44 2 7 123 -44 2 8 131 -44 2 8.5 133 -44 2 9 136 -44 2 9.5 139 -44 2 10 141 -44 2 10.5 144 -44 2 11 147 -44 2 11.5 150 -44 2 12 153 -44 2 12.5 157 -44 2 13 161 -44 2 13.5 164 -44 2 14 166 -44 2 14.5 167 -44 2 15 168 -44 2 15.5 168 -44 2 16 169 -44 2 16.5 169 -44 2 17 170 -44 2 17.5 170 -44 2 18 170 -45 2 1 73.5 -45 2 1.25 77 -45 2 1.5 81.5 -45 2 1.75 83.8 -45 2 2 85.5 -45 2 3 92.9 -45 2 4 99.6 -45 2 5 106.7 -45 2 6 113.3 -45 2 7 118.4 -45 2 8 124.2 -45 2 8.5 127.6 -45 2 9 130.6 -45 2 9.5 133.6 -45 2 10 136.4 -45 2 10.5 139.7 -45 2 11 143.7 -45 2 11.5 148 -45 2 12 152 -45 2 12.5 155.7 -45 2 13 158.9 -45 2 13.5 160.9 -45 2 14 162.2 -45 2 14.5 163.2 -45 2 15 163.8 -45 2 15.5 164 -45 2 16 164.2 -45 2 16.5 164.4 -45 2 17 164.4 -45 2 17.5 164.8 -45 2 18 164.9 -46 2 1 67.4 -46 2 1.25 72.3 -46 2 1.5 75.9 -46 2 1.75 79.4 -46 2 2 82.2 -46 2 3 91.6 -46 2 4 99.5 -46 2 5 105.7 -46 2 6 112.5 -46 2 7 117.2 -46 2 8 122.8 -46 2 8.5 125.5 -46 2 9 128 -46 2 9.5 130.3 -46 2 10 132.5 -46 2 10.5 134.9 -46 2 11 137.4 -46 2 11.5 139.9 -46 2 12 142.1 -46 2 12.5 144.2 -46 2 13 146.4 -46 2 13.5 148.9 -46 2 14 152.2 -46 2 14.5 155.3 -46 2 15 157.9 -46 2 15.5 160.1 -46 2 16 161.6 -46 2 16.5 162.4 -46 2 17 163 -46 2 17.5 163.4 -46 2 18 164 -47 2 1 80.5 -47 2 1.25 85.1 -47 2 1.5 89.7 -47 2 1.75 93.7 -47 2 2 97.3 -47 2 3 106.3 -47 2 4 114.4 -47 2 5 123.5 -47 2 6 130.6 -47 2 7 137.7 -47 2 8 144.4 -47 2 8.5 148.4 -47 2 9 152.5 -47 2 9.5 156.6 -47 2 10 161.5 -47 2 10.5 166.1 -47 2 11 170.2 -47 2 11.5 173.5 -47 2 12 176 -47 2 12.5 177.3 -47 2 13 178.3 -47 2 13.5 179.1 -47 2 14 180 -47 2 14.5 181 -47 2 15 181.6 -47 2 15.5 181.9 -47 2 16 182.3 -47 2 16.5 182.6 -47 2 17 182.8 -47 2 17.5 182.7 -47 2 18 183.2 -48 2 1 77 -48 2 1.25 80.7 -48 2 1.5 83.4 -48 2 1.75 85.6 -48 2 2 88.9 -48 2 3 96.5 -48 2 4 104.2 -48 2 5 111.4 -48 2 6 118.2 -48 2 7 124.2 -48 2 8 129.6 -48 2 8.5 132 -48 2 9 135.2 -48 2 9.5 138.5 -48 2 10 141.5 -48 2 10.5 144.9 -48 2 11 148.9 -48 2 11.5 152.6 -48 2 12 156.2 -48 2 12.5 159.6 -48 2 13 161.4 -48 2 13.5 162.4 -48 2 14 163.1 -48 2 14.5 163.6 -48 2 15 164.3 -48 2 15.5 164.5 -48 2 16 164.4 -48 2 16.5 164.3 -48 2 17 164.1 -48 2 17.5 164 -48 2 18 163.8 -49 2 1 74.7 -49 2 1.25 77.9 -49 2 1.5 81.3 -49 2 1.75 84.8 -49 2 2 87.6 -49 2 3 98.6 -49 2 4 107.8 -49 2 5 116.2 -49 2 6 124.6 -49 2 7 130.6 -49 2 8 136.2 -49 2 8.5 139.3 -49 2 9 142.3 -49 2 9.5 145.5 -49 2 10 148.7 -49 2 10.5 152.3 -49 2 11 156.6 -49 2 11.5 161 -49 2 12 164.7 -49 2 12.5 167.5 -49 2 13 169.1 -49 2 13.5 170.2 -49 2 14 171.3 -49 2 14.5 172.1 -49 2 15 172.6 -49 2 15.5 172.9 -49 2 16 173.1 -49 2 16.5 173.3 -49 2 17 173.6 -49 2 17.5 173.8 -49 2 18 174 -50 2 1 69.3 -50 2 1.25 76.1 -50 2 1.5 80.7 -50 2 1.75 84.4 -50 2 2 87.1 -50 2 3 94.6 -50 2 4 103.4 -50 2 5 110 -50 2 6 116.6 -50 2 7 122.6 -50 2 8 128.1 -50 2 8.5 130.4 -50 2 9 133.2 -50 2 9.5 135.8 -50 2 10 138.2 -50 2 10.5 140.7 -50 2 11 142.7 -50 2 11.5 144.4 -50 2 12 146.2 -50 2 12.5 148.5 -50 2 13 151.3 -50 2 13.5 154.6 -50 2 14 158.3 -50 2 14.5 161.4 -50 2 15 163.5 -50 2 15.5 165 -50 2 16 166 -50 2 16.5 166.5 -50 2 17 166.7 -50 2 17.5 166.9 -50 2 18 167.1 -51 2 1 72.4 -51 2 1.25 75.2 -51 2 1.5 77.8 -51 2 1.75 80.7 -51 2 2 83.6 -51 2 3 95.3 -51 2 4 102.4 -51 2 5 109.6 -51 2 6 116 -51 2 7 121.7 -51 2 8 127.7 -51 2 8.5 130.1 -51 2 9 133.1 -51 2 9.5 135.5 -51 2 10 137.5 -51 2 10.5 140 -51 2 11 143.1 -51 2 11.5 146.8 -51 2 12 150.7 -51 2 12.5 154.2 -51 2 13 157 -51 2 13.5 159 -51 2 14 160.5 -51 2 14.5 161.5 -51 2 15 162.1 -51 2 15.5 162.5 -51 2 16 162.7 -51 2 16.5 163 -51 2 17 163.4 -51 2 17.5 163.1 -51 2 18 163 -52 2 1 67.3 -52 2 1.25 73.7 -52 2 1.5 76.2 -52 2 1.75 79 -52 2 2 81.4 -52 2 3 90.2 -52 2 4 96.8 -52 2 5 102.4 -52 2 6 108.7 -52 2 7 113.8 -52 2 8 118.8 -52 2 8.5 121.1 -52 2 9 123.2 -52 2 9.5 125.4 -52 2 10 127.7 -52 2 10.5 129.9 -52 2 11 131.6 -52 2 11.5 133.5 -52 2 12 135.6 -52 2 12.5 137.6 -52 2 13 139.5 -52 2 13.5 141.8 -52 2 14 145 -52 2 14.5 148.2 -52 2 15 150.8 -52 2 15.5 152.2 -52 2 16 153 -52 2 16.5 153.6 -52 2 17 154.1 -52 2 17.5 154.4 -52 2 18 154.6 -53 2 1 76.7 -53 2 1.25 80 -53 2 1.5 83.8 -53 2 1.75 86.8 -53 2 2 89.7 -53 2 3 96.2 -53 2 4 104.5 -53 2 5 111.5 -53 2 6 118.6 -53 2 7 125 -53 2 8 130.5 -53 2 8.5 133 -53 2 9 135.8 -53 2 9.5 138.6 -53 2 10 141.4 -53 2 10.5 144.2 -53 2 11 146.6 -53 2 11.5 148.8 -53 2 12 151.4 -53 2 12.5 154.6 -53 2 13 157.8 -53 2 13.5 161.2 -53 2 14 164.5 -53 2 14.5 166.6 -53 2 15 167.8 -53 2 15.5 168.6 -53 2 16 169.2 -53 2 16.5 169.8 -53 2 17 169.8 -53 2 17.5 170 -53 2 18 170.3 -54 2 1 72.8 -54 2 1.25 78.2 -54 2 1.5 84.2 -54 2 1.75 87 -54 2 2 88.4 -54 2 3 94.4 -54 2 4 100.3 -54 2 5 106.6 -54 2 6 120.5 -54 2 7 127.3 -54 2 8 133.6 -54 2 8.5 136.4 -54 2 9 139.5 -54 2 9.5 142.5 -54 2 10 146 -54 2 10.5 150.2 -54 2 11 154.3 -54 2 11.5 158.6 -54 2 12 162.6 -54 2 12.5 164.7 -54 2 13 166 -54 2 13.5 167.1 -54 2 14 168.3 -54 2 14.5 168.7 -54 2 15 169.1 -54 2 15.5 169.5 -54 2 16 169.9 -54 2 16.5 170.1 -54 2 17 170.3 -54 2 17.5 170.3 -54 2 18 170.6 -55 2 1 72 -55 2 1.25 74.9 -55 2 1.5 80 -55 2 1.75 82.8 -55 2 2 83.8 -55 2 3 92.3 -55 2 4 98.2 -55 2 5 105.2 -55 2 6 110.4 -55 2 7 115.6 -55 2 8 119.4 -55 2 8.5 121.9 -55 2 9 124.2 -55 2 9.5 126.3 -55 2 10 128.5 -55 2 10.5 131.2 -55 2 11 134.3 -55 2 11.5 137.3 -55 2 12 140.5 -55 2 12.5 143.6 -55 2 13 146.8 -55 2 13.5 149 -55 2 14 150.2 -55 2 14.5 151.4 -55 2 15 152.6 -55 2 15.5 153.4 -55 2 16 154.1 -55 2 16.5 154.9 -55 2 17 155.7 -55 2 17.5 156.2 -55 2 18 156.5 -56 2 1 68.4 -56 2 1.25 75 -56 2 1.5 81.3 -56 2 1.75 85 -56 2 2 87.6 -56 2 3 94.6 -56 2 4 102.4 -56 2 5 109.2 -56 2 6 116.2 -56 2 7 122.7 -56 2 8 129.4 -56 2 8.5 132.4 -56 2 9 135.6 -56 2 9.5 139.4 -56 2 10 143.6 -56 2 10.5 147.9 -56 2 11 151.9 -56 2 11.5 155 -56 2 12 157 -56 2 12.5 158 -56 2 13 158.9 -56 2 13.5 159.4 -56 2 14 159.7 -56 2 14.5 159.9 -56 2 15 160.2 -56 2 15.5 160.2 -56 2 16 160.3 -56 2 16.5 160.4 -56 2 17 160.4 -56 2 17.5 160.3 -56 2 18 160.3 -57 2 1 76 -57 2 1.25 82.1 -57 2 1.5 87.5 -57 2 1.75 91.1 -57 2 2 94 -57 2 3 101.1 -57 2 4 108.8 -57 2 5 116.7 -57 2 6 124.7 -57 2 7 132.3 -57 2 8 138.2 -57 2 8.5 141.2 -57 2 9 144.1 -57 2 9.5 146.8 -57 2 10 150.2 -57 2 10.5 153.9 -57 2 11 157.3 -57 2 11.5 161 -57 2 12 164.5 -57 2 12.5 166.8 -57 2 13 168 -57 2 13.5 168.7 -57 2 14 169.3 -57 2 14.5 169.6 -57 2 15 169.8 -57 2 15.5 170.1 -57 2 16 170.3 -57 2 16.5 170.5 -57 2 17 170.6 -57 2 17.5 170.8 -57 2 18 170.8 -58 2 1 73.7 -58 2 1.25 78.2 -58 2 1.5 79.9 -58 2 1.75 82 -58 2 2 86.4 -58 2 3 95.7 -58 2 4 101.9 -58 2 5 110 -58 2 6 117.6 -58 2 7 122.7 -58 2 8 128.7 -58 2 8.5 131.6 -58 2 9 134.6 -58 2 9.5 137.6 -58 2 10 141.6 -58 2 10.5 146.9 -58 2 11 152.1 -58 2 11.5 156.3 -58 2 12 159.4 -58 2 12.5 161 -58 2 13 162 -58 2 13.5 162.8 -58 2 14 163.6 -58 2 14.5 164.2 -58 2 15 164.6 -58 2 15.5 164.9 -58 2 16 165 -58 2 16.5 165.1 -58 2 17 165.1 -58 2 17.5 165.1 -58 2 18 165.2 -59 2 1 73.7 -59 2 1.25 81.3 -59 2 1.5 83.8 -59 2 1.75 85.1 -59 2 2 88.9 -59 2 3 96.1 -59 2 4 106.1 -59 2 5 113 -59 2 6 119.1 -59 2 7 124.7 -59 2 8 130.7 -59 2 8.5 134 -59 2 9 137.2 -59 2 9.5 140.9 -59 2 10 144.2 -59 2 10.5 147.3 -59 2 11 150.2 -59 2 11.5 154.2 -59 2 12 158.4 -59 2 12.5 161.2 -59 2 13 163.9 -59 2 13.5 165.4 -59 2 14 166.8 -59 2 14.5 167.5 -59 2 15 168.2 -59 2 15.5 168.8 -59 2 16 169.5 -59 2 16.5 169.6 -59 2 17 169.6 -59 2 17.5 169.6 -59 2 18 169.8 -60 2 1 74.4 -60 2 1.25 77.5 -60 2 1.5 81.5 -60 2 1.75 84.5 -60 2 2 86.7 -60 2 3 95 -60 2 4 103.6 -60 2 5 112 -60 2 6 119.6 -60 2 7 127.5 -60 2 8 133.2 -60 2 8.5 136.6 -60 2 9 139.8 -60 2 9.5 142.7 -60 2 10 146 -60 2 10.5 150.3 -60 2 11 154.4 -60 2 11.5 158.3 -60 2 12 162.4 -60 2 12.5 165.5 -60 2 13 167.9 -60 2 13.5 169.4 -60 2 14 170.1 -60 2 14.5 170.2 -60 2 15 170.6 -60 2 15.5 171.1 -60 2 16 171.5 -60 2 16.5 171.5 -60 2 17 171.5 -60 2 17.5 171.4 -60 2 18 171.2 -61 2 1 74.9 -61 2 1.25 77.8 -61 2 1.5 81.2 -61 2 1.75 83.7 -61 2 2 86.4 -61 2 3 94.2 -61 2 4 98.6 -61 2 5 107.7 -61 2 6 114.8 -61 2 7 122.7 -61 2 8 128.3 -61 2 8.5 131 -61 2 9 134.2 -61 2 9.5 137.8 -61 2 10 141.4 -61 2 10.5 145.4 -61 2 11 149.7 -61 2 11.5 153.9 -61 2 12 157 -61 2 12.5 159.1 -61 2 13 160.4 -61 2 13.5 161.2 -61 2 14 161.8 -61 2 14.5 162.4 -61 2 15 163 -61 2 15.5 163.1 -61 2 16 163.1 -61 2 16.5 163.3 -61 2 17 163.6 -61 2 17.5 163.7 -61 2 18 163.8 -62 2 1 72 -62 2 1.25 77.1 -62 2 1.5 80.6 -62 2 1.75 83.4 -62 2 2 85.9 -62 2 3 94 -62 2 4 100.3 -62 2 5 108 -62 2 6 114.9 -62 2 7 121.2 -62 2 8 127 -62 2 8.5 129.6 -62 2 9 132.1 -62 2 9.5 134.8 -62 2 10 137.8 -62 2 10.5 141.6 -62 2 11 145.8 -62 2 11.5 150.2 -62 2 12 153.8 -62 2 12.5 156.7 -62 2 13 158.8 -62 2 13.5 159.7 -62 2 14 160.5 -62 2 14.5 161.1 -62 2 15 161.5 -62 2 15.5 161.7 -62 2 16 162.1 -62 2 16.5 162.3 -62 2 17 162.4 -62 2 17.5 162.4 -62 2 18 162.4 -63 2 1 72.6 -63 2 1.25 76.8 -63 2 1.5 80.4 -63 2 1.75 82.9 -63 2 2 85.1 -63 2 3 91.4 -63 2 4 96.8 -63 2 5 105.7 -63 2 6 114.8 -63 2 7 118.4 -63 2 8 122.6 -63 2 8.5 126.1 -63 2 9 129 -63 2 9.5 131.3 -63 2 10 133.9 -63 2 10.5 136.7 -63 2 11 140.1 -63 2 11.5 143.8 -63 2 12 147.3 -63 2 12.5 150.4 -63 2 13 153 -63 2 13.5 154.5 -63 2 14 155.6 -63 2 14.5 156.1 -63 2 15 156.4 -63 2 15.5 156.6 -63 2 16 156.8 -63 2 16.5 156.9 -63 2 17 157 -63 2 17.5 156.9 -63 2 18 157.1 -64 2 1 75.2 -64 2 1.25 80.2 -64 2 1.5 83.8 -64 2 1.75 86.4 -64 2 2 88.6 -64 2 3 97.5 -64 2 4 103.6 -64 2 5 110.7 -64 2 6 117.6 -64 2 7 126.5 -64 2 8 132.6 -64 2 8.5 136.1 -64 2 9 139.4 -64 2 9.5 142.4 -64 2 10 145.6 -64 2 10.5 148.8 -64 2 11 152.2 -64 2 11.5 155.7 -64 2 12 159 -64 2 12.5 162.1 -64 2 13 166 -64 2 13.5 170.3 -64 2 14 174.3 -64 2 14.5 177.2 -64 2 15 178.9 -64 2 15.5 179.7 -64 2 16 180.4 -64 2 16.5 180.4 -64 2 17 180.2 -64 2 17.5 180.5 -64 2 18 181.1 -65 2 1 70.9 -65 2 1.25 74.3 -65 2 1.5 76.8 -65 2 1.75 80 -65 2 2 83 -65 2 3 91.4 -65 2 4 96.5 -65 2 5 102.4 -65 2 6 108.7 -65 2 7 114.6 -65 2 8 120.4 -65 2 8.5 123 -65 2 9 125.6 -65 2 9.5 127.9 -65 2 10 130.1 -65 2 10.5 132.8 -65 2 11 135.5 -65 2 11.5 138.9 -65 2 12 142.9 -65 2 12.5 146.9 -65 2 13 150 -65 2 13.5 152.2 -65 2 14 153.6 -65 2 14.5 154.9 -65 2 15 155.9 -65 2 15.5 156.6 -65 2 16 157.1 -65 2 16.5 157.5 -65 2 17 157.7 -65 2 17.5 158 -65 2 18 158.4 -66 2 1 74.6 -66 2 1.25 79.4 -66 2 1.5 82 -66 2 1.75 84.3 -66 2 2 88.9 -66 2 3 98 -66 2 4 105 -66 2 5 113.5 -66 2 6 121 -66 2 7 126.2 -66 2 8 131.4 -66 2 8.5 134.2 -66 2 9 137.1 -66 2 9.5 139.5 -66 2 10 141.9 -66 2 10.5 145 -66 2 11 148.1 -66 2 11.5 151.8 -66 2 12 155.6 -66 2 12.5 158.3 -66 2 13 160.3 -66 2 13.5 161.8 -66 2 14 162.8 -66 2 14.5 163.5 -66 2 15 164 -66 2 15.5 164.3 -66 2 16 164.8 -66 2 16.5 165.2 -66 2 17 165.4 -66 2 17.5 165.5 -66 2 18 165.6 -67 2 1 71.1 -67 2 1.25 77.3 -67 2 1.5 81.7 -67 2 1.75 85.5 -67 2 2 89.7 -67 2 3 98.2 -67 2 4 106 -67 2 5 112.6 -67 2 6 118.6 -67 2 7 123.7 -67 2 8 128.6 -67 2 8.5 131.1 -67 2 9 133.6 -67 2 9.5 135.8 -67 2 10 138 -67 2 10.5 141.8 -67 2 11 145.8 -67 2 11.5 150.5 -67 2 12 155.2 -67 2 12.5 158.7 -67 2 13 161 -67 2 13.5 162.6 -67 2 14 163.9 -67 2 14.5 164.7 -67 2 15 165.5 -67 2 15.5 165.9 -67 2 16 166.3 -67 2 16.5 166.5 -67 2 17 166.6 -67 2 17.5 166.7 -67 2 18 166.7 -68 2 1 71 -68 2 1.25 72.3 -68 2 1.5 74.9 -68 2 1.75 78.4 -68 2 2 81.3 -68 2 3 88.1 -68 2 4 94.7 -68 2 5 100.1 -68 2 6 105.7 -68 2 7 112.5 -68 2 8 117 -68 2 8.5 119.2 -68 2 9 121.4 -68 2 9.5 124.5 -68 2 10 126.8 -68 2 10.5 129 -68 2 11 131.7 -68 2 11.5 134.4 -68 2 12 137 -68 2 12.5 140.3 -68 2 13 143.9 -68 2 13.5 147 -68 2 14 149.6 -68 2 14.5 151.8 -68 2 15 153.2 -68 2 15.5 154.3 -68 2 16 155.1 -68 2 16.5 155.6 -68 2 17 156 -68 2 17.5 156.1 -68 2 18 156.5 -69 2 1 74 -69 2 1.25 77.6 -69 2 1.5 82.3 -69 2 1.75 86.2 -69 2 2 88.7 -69 2 3 95.3 -69 2 4 103.6 -69 2 5 109.7 -69 2 6 116.6 -69 2 7 122.2 -69 2 8 127.2 -69 2 8.5 130.4 -69 2 9 133.6 -69 2 9.5 135.7 -69 2 10 137.8 -69 2 10.5 140.5 -69 2 11 143.5 -69 2 11.5 147.5 -69 2 12 151.7 -69 2 12.5 155.7 -69 2 13 159.2 -69 2 13.5 162 -69 2 14 163.8 -69 2 14.5 164.9 -69 2 15 165.8 -69 2 15.5 166.8 -69 2 16 167.5 -69 2 16.5 167.9 -69 2 17 168.2 -69 2 17.5 168.2 -69 2 18 168.1 -70 2 1 78.7 -70 2 1.25 82 -70 2 1.5 84.4 -70 2 1.75 86.4 -70 2 2 88.4 -70 2 3 96.8 -70 2 4 104.7 -70 2 5 111.3 -70 2 6 118.8 -70 2 7 124.3 -70 2 8 129 -70 2 8.5 131.6 -70 2 9 134.1 -70 2 9.5 136.3 -70 2 10 139 -70 2 10.5 141.9 -70 2 11 145.1 -70 2 11.5 148.3 -70 2 12 151.3 -70 2 12.5 154.6 -70 2 13 157.7 -70 2 13.5 160.3 -70 2 14 161.4 -70 2 14.5 162.4 -70 2 15 163.4 -70 2 15.5 164 -70 2 16 164.3 -70 2 16.5 164.7 -70 2 17 165.2 -70 2 17.5 165.3 -70 2 18 165.3 -71 2 1 69 -71 2 1.25 72.9 -71 2 1.5 76.7 -71 2 1.75 80.8 -71 2 2 85.1 -71 2 3 94.6 -71 2 4 104.1 -71 2 5 112.5 -71 2 6 120.7 -71 2 7 126.2 -71 2 8 133.3 -71 2 8.5 136.4 -71 2 9 139.4 -71 2 9.5 142.7 -71 2 10 146.1 -71 2 10.5 149.9 -71 2 11 154.1 -71 2 11.5 157.8 -71 2 12 160.4 -71 2 12.5 161.9 -71 2 13 162.6 -71 2 13.5 162.9 -71 2 14 163 -71 2 14.5 163.1 -71 2 15 163 -71 2 15.5 163.1 -71 2 16 163.1 -71 2 16.5 163.4 -71 2 17 163.7 -71 2 17.5 163.8 -71 2 18 163.7 -72 2 1 72.7 -72 2 1.25 78.3 -72 2 1.5 82.4 -72 2 1.75 87.2 -72 2 2 91.4 -72 2 3 98.3 -72 2 4 105.2 -72 2 5 113.3 -72 2 6 120.1 -72 2 7 126.2 -72 2 8 131.5 -72 2 8.5 134.9 -72 2 9 138.1 -72 2 9.5 140 -72 2 10 142.2 -72 2 10.5 145.2 -72 2 11 148.3 -72 2 11.5 151 -72 2 12 153.9 -72 2 12.5 156.9 -72 2 13 160.3 -72 2 13.5 163.9 -72 2 14 166.9 -72 2 14.5 169.1 -72 2 15 170.4 -72 2 15.5 171.3 -72 2 16 172 -72 2 16.5 172.7 -72 2 17 172.9 -72 2 17.5 173.1 -72 2 18 173.7 -73 2 1 72.6 -73 2 1.25 77.4 -73 2 1.5 81.8 -73 2 1.75 85.2 -73 2 2 87.6 -73 2 3 95.5 -73 2 4 103.7 -73 2 5 109.7 -73 2 6 115.8 -73 2 7 121.6 -73 2 8 127.6 -73 2 8.5 130.4 -73 2 9 133.2 -73 2 9.5 135.8 -73 2 10 138.4 -73 2 10.5 141.8 -73 2 11 145.8 -73 2 11.5 150.3 -73 2 12 154.3 -73 2 12.5 157 -73 2 13 158.7 -73 2 13.5 159.9 -73 2 14 160.9 -73 2 14.5 161.7 -73 2 15 162.4 -73 2 15.5 163 -73 2 16 163.3 -73 2 16.5 163.4 -73 2 17 163.5 -73 2 17.5 163.6 -73 2 18 163.9 -74 2 1 75.3 -74 2 1.25 79.7 -74 2 1.5 82 -74 2 1.75 84.2 -74 2 2 86.1 -74 2 3 96 -74 2 4 103.5 -74 2 5 111.4 -74 2 6 119.1 -74 2 7 126 -74 2 8 132.7 -74 2 8.5 135.6 -74 2 9 138.4 -74 2 9.5 141 -74 2 10 143.8 -74 2 10.5 146.9 -74 2 11 150.6 -74 2 11.5 154.4 -74 2 12 157.9 -74 2 12.5 161.1 -74 2 13 163.6 -74 2 13.5 165 -74 2 14 166.2 -74 2 14.5 167.3 -74 2 15 167.9 -74 2 15.5 168.1 -74 2 16 168.3 -74 2 16.5 168.5 -74 2 17 168.6 -74 2 17.5 168.8 -74 2 18 169.2 -75 2 1 73.1 -75 2 1.25 77.5 -75 2 1.5 80.4 -75 2 1.75 82.8 -75 2 2 85.9 -75 2 3 94.6 -75 2 4 102.4 -75 2 5 107.7 -75 2 6 114.6 -75 2 7 121.7 -75 2 8 126.8 -75 2 8.5 129.8 -75 2 9 132.8 -75 2 9.5 135.3 -75 2 10 137.6 -75 2 10.5 140.3 -75 2 11 143.7 -75 2 11.5 147.3 -75 2 12 150.6 -75 2 12.5 154.1 -75 2 13 157.5 -75 2 13.5 160.1 -75 2 14 162.2 -75 2 14.5 163.5 -75 2 15 164.2 -75 2 15.5 164.6 -75 2 16 164.8 -75 2 16.5 165.1 -75 2 17 165.4 -75 2 17.5 165.7 -75 2 18 166 -76 2 1 68.9 -76 2 1.25 72.7 -76 2 1.5 76.6 -76 2 1.75 79.6 -76 2 2 82.2 -76 2 3 91 -76 2 4 98.4 -76 2 5 106.2 -76 2 6 112.3 -76 2 7 118.1 -76 2 8 123.6 -76 2 8.5 126.7 -76 2 9 129.8 -76 2 9.5 132.3 -76 2 10 135 -76 2 10.5 137.4 -76 2 11 139.9 -76 2 11.5 142.4 -76 2 12 145 -76 2 12.5 148.1 -76 2 13 151.8 -76 2 13.5 155.5 -76 2 14 158.3 -76 2 14.5 160.1 -76 2 15 161.3 -76 2 15.5 162.3 -76 2 16 163 -76 2 16.5 163.3 -76 2 17 163.6 -76 2 17.5 163.8 -76 2 18 164.2 -77 2 1 75.9 -77 2 1.25 79.4 -77 2 1.5 82.1 -77 2 1.75 85.7 -77 2 2 88.2 -77 2 3 98 -77 2 4 107.4 -77 2 5 115.3 -77 2 6 124 -77 2 7 130.6 -77 2 8 137.6 -77 2 8.5 141.2 -77 2 9 144.8 -77 2 9.5 148 -77 2 10 151.8 -77 2 10.5 155.3 -77 2 11 158.7 -77 2 11.5 162.2 -77 2 12 165.5 -77 2 12.5 168.3 -77 2 13 170.7 -77 2 13.5 172.3 -77 2 14 173.4 -77 2 14.5 174.5 -77 2 15 175.1 -77 2 15.5 175.2 -77 2 16 175.2 -77 2 16.5 175.4 -77 2 17 175.8 -77 2 17.5 176.1 -77 2 18 176 -78 2 1 73 -78 2 1.25 77.3 -78 2 1.5 81 -78 2 1.75 85.1 -78 2 2 87.5 -78 2 3 97.3 -78 2 4 105.7 -78 2 5 112.7 -78 2 6 119.3 -78 2 7 124.7 -78 2 8 131.9 -78 2 8.5 135.4 -78 2 9 138.9 -78 2 9.5 142 -78 2 10 145 -78 2 10.5 148.2 -78 2 11 152 -78 2 11.5 156.5 -78 2 12 160.5 -78 2 12.5 163.6 -78 2 13 165.9 -78 2 13.5 167.6 -78 2 14 168.8 -78 2 14.5 169.5 -78 2 15 169.9 -78 2 15.5 170.2 -78 2 16 170.5 -78 2 16.5 170.5 -78 2 17 170.5 -78 2 17.5 170.7 -78 2 18 170.9 -79 2 1 80 -79 2 1.25 83.6 -79 2 1.5 85.1 -79 2 1.75 86.4 -79 2 2 88.6 -79 2 3 98 -79 2 4 105.7 -79 2 5 112.5 -79 2 6 119.6 -79 2 7 126.5 -79 2 8 133.6 -79 2 8.5 137 -79 2 9 140.3 -79 2 9.5 142.8 -79 2 10 146 -79 2 10.5 149.9 -79 2 11 154.3 -79 2 11.5 158.3 -79 2 12 161.2 -79 2 12.5 163.3 -79 2 13 165.1 -79 2 13.5 166.6 -79 2 14 167.4 -79 2 14.5 167.8 -79 2 15 168.2 -79 2 15.5 168.6 -79 2 16 168.8 -79 2 16.5 168.9 -79 2 17 168.9 -79 2 17.5 169 -79 2 18 169.2 -80 2 1 72.4 -80 2 1.25 75.8 -80 2 1.5 79 -80 2 1.75 83.1 -80 2 2 86.4 -80 2 3 94.5 -80 2 4 101.5 -80 2 5 108.7 -80 2 6 114.8 -80 2 7 120.4 -80 2 8 126.6 -80 2 8.5 130.1 -80 2 9 133.6 -80 2 9.5 136.3 -80 2 10 139.5 -80 2 10.5 143 -80 2 11 146.7 -80 2 11.5 150.5 -80 2 12 153.7 -80 2 12.5 156.1 -80 2 13 158 -80 2 13.5 159.7 -80 2 14 160.4 -80 2 14.5 160.8 -80 2 15 161.4 -80 2 15.5 162.1 -80 2 16 162.6 -80 2 16.5 162.6 -80 2 17 162.6 -80 2 17.5 162.8 -80 2 18 163 -81 2 1 69 -81 2 1.25 72.6 -81 2 1.5 76.2 -81 2 1.75 78.5 -81 2 2 80.9 -81 2 3 89.3 -81 2 4 94.7 -81 2 5 100.3 -81 2 6 106.9 -81 2 7 112.8 -81 2 8 117.8 -81 2 8.5 120.6 -81 2 9 123.5 -81 2 9.5 126 -81 2 10 128.4 -81 2 10.5 131.1 -81 2 11 134.2 -81 2 11.5 137.7 -81 2 12 141.3 -81 2 12.5 145 -81 2 13 147.7 -81 2 13.5 149.8 -81 2 14 151.5 -81 2 14.5 152.4 -81 2 15 152.9 -81 2 15.5 153.2 -81 2 16 153.6 -81 2 16.5 154.1 -81 2 17 154.4 -81 2 17.5 154.5 -81 2 18 154.5 -82 2 1 76 -82 2 1.25 80 -82 2 1.5 84.2 -82 2 1.75 87.4 -82 2 2 90 -82 2 3 101.2 -82 2 4 109.5 -82 2 5 116.3 -82 2 6 122.1 -82 2 7 128.8 -82 2 8 133.8 -82 2 8.5 136.9 -82 2 9 139.9 -82 2 9.5 143.6 -82 2 10 147 -82 2 10.5 151 -82 2 11 155.8 -82 2 11.5 160.7 -82 2 12 164.5 -82 2 12.5 166.9 -82 2 13 168.5 -82 2 13.5 169.4 -82 2 14 170.1 -82 2 14.5 170.8 -82 2 15 171.5 -82 2 15.5 172 -82 2 16 172.1 -82 2 16.5 172.2 -82 2 17 172.3 -82 2 17.5 172.2 -82 2 18 172.5 -83 2 1 78.4 -83 2 1.25 82.6 -83 2 1.5 85.1 -83 2 1.75 86.4 -83 2 2 89.7 -83 2 3 96.6 -83 2 4 105 -83 2 5 112.3 -83 2 6 119.6 -83 2 7 124.7 -83 2 8 131.2 -83 2 8.5 133.6 -83 2 9 135.8 -83 2 9.5 138.8 -83 2 10 141.2 -83 2 10.5 144.1 -83 2 11 147.4 -83 2 11.5 150.4 -83 2 12 153.8 -83 2 12.5 157.8 -83 2 13 161.1 -83 2 13.5 163.5 -83 2 14 165.2 -83 2 14.5 166.1 -83 2 15 166.6 -83 2 15.5 166.8 -83 2 16 167.1 -83 2 16.5 167.2 -83 2 17 167.3 -83 2 17.5 167.3 -83 2 18 167.2 -84 2 1 74.8 -84 2 1.25 78 -84 2 1.5 81.6 -84 2 1.75 84.2 -84 2 2 86.4 -84 2 3 94 -84 2 4 101.8 -84 2 5 110 -84 2 6 116.8 -84 2 7 121.9 -84 2 8 126.8 -84 2 8.5 129.3 -84 2 9 131.9 -84 2 9.5 134.9 -84 2 10 137.8 -84 2 10.5 141.3 -84 2 11 145 -84 2 11.5 149.5 -84 2 12 153.8 -84 2 12.5 157 -84 2 13 158.9 -84 2 13.5 160.3 -84 2 14 161.8 -84 2 14.5 162.4 -84 2 15 162.8 -84 2 15.5 163.2 -84 2 16 163.6 -84 2 16.5 163.9 -84 2 17 164.3 -84 2 17.5 164.2 -84 2 18 164 -85 2 1 71.3 -85 2 1.25 74.4 -85 2 1.5 77.4 -85 2 1.75 80 -85 2 2 82.6 -85 2 3 91.6 -85 2 4 100.6 -85 2 5 106.2 -85 2 6 114.3 -85 2 7 120.4 -85 2 8 126.7 -85 2 8.5 129.9 -85 2 9 133.1 -85 2 9.5 136 -85 2 10 138.8 -85 2 10.5 142.9 -85 2 11 146.8 -85 2 11.5 150.7 -85 2 12 154.6 -85 2 12.5 157.2 -85 2 13 158.6 -85 2 13.5 159.7 -85 2 14 160.5 -85 2 14.5 160.8 -85 2 15 161.1 -85 2 15.5 161.3 -85 2 16 161.6 -85 2 16.5 161.9 -85 2 17 162 -85 2 17.5 162.1 -85 2 18 162.1 -86 2 1 73 -86 2 1.25 75 -86 2 1.5 77.6 -86 2 1.75 81.7 -86 2 2 86.4 -86 2 3 92.9 -86 2 4 99.3 -86 2 5 105.6 -86 2 6 113.3 -86 2 7 118.6 -86 2 8 125.6 -86 2 8.5 128.2 -86 2 9 130.9 -86 2 9.5 134.4 -86 2 10 137.9 -86 2 10.5 141.6 -86 2 11 145.4 -86 2 11.5 149.4 -86 2 12 153.3 -86 2 12.5 156.2 -86 2 13 157.4 -86 2 13.5 158.1 -86 2 14 158.9 -86 2 14.5 159.6 -86 2 15 159.9 -86 2 15.5 160.2 -86 2 16 161 -86 2 16.5 161.5 -86 2 17 161.9 -86 2 17.5 161.8 -86 2 18 161.6 -87 2 1 71.1 -87 2 1.25 73.7 -87 2 1.5 76.2 -87 2 1.75 79.4 -87 2 2 81.8 -87 2 3 91.4 -87 2 4 95.3 -87 2 5 102.4 -87 2 6 110 -87 2 7 116.1 -87 2 8 120.9 -87 2 8.5 123.6 -87 2 9 126.3 -87 2 9.5 130.4 -87 2 10 134.4 -87 2 10.5 137.7 -87 2 11 141.3 -87 2 11.5 144.4 -87 2 12 147 -87 2 12.5 149.1 -87 2 13 150.3 -87 2 13.5 151 -87 2 14 151.4 -87 2 14.5 151.7 -87 2 15 152 -87 2 15.5 152.1 -87 2 16 152.3 -87 2 16.5 152.6 -87 2 17 153.2 -87 2 17.5 153.5 -87 2 18 153.6 -88 2 1 74.6 -88 2 1.25 78 -88 2 1.5 81 -88 2 1.75 83.6 -88 2 2 86.2 -88 2 3 96.5 -88 2 4 104.1 -88 2 5 110.7 -88 2 6 118.6 -88 2 7 125.2 -88 2 8 130.9 -88 2 8.5 133.4 -88 2 9 135.9 -88 2 9.5 138.8 -88 2 10 141.7 -88 2 10.5 144.8 -88 2 11 148.1 -88 2 11.5 151.8 -88 2 12 155.8 -88 2 12.5 160.4 -88 2 13 164.8 -88 2 13.5 168.6 -88 2 14 171.7 -88 2 14.5 173.8 -88 2 15 175 -88 2 15.5 175.7 -88 2 16 176.1 -88 2 16.5 176.5 -88 2 17 176.9 -88 2 17.5 177.2 -88 2 18 177.5 -89 2 1 74.9 -89 2 1.25 78.1 -89 2 1.5 80.6 -89 2 1.75 83.4 -89 2 2 86 -89 2 3 96.5 -89 2 4 104.6 -89 2 5 111.8 -89 2 6 117.9 -89 2 7 124.1 -89 2 8 130.3 -89 2 8.5 132.7 -89 2 9 135 -89 2 9.5 138.5 -89 2 10 141.8 -89 2 10.5 145.1 -89 2 11 148.1 -89 2 11.5 150.8 -89 2 12 153.9 -89 2 12.5 157.5 -89 2 13 161.3 -89 2 13.5 164.5 -89 2 14 166 -89 2 14.5 166.7 -89 2 15 167.4 -89 2 15.5 167.9 -89 2 16 168.1 -89 2 16.5 168.5 -89 2 17 168.9 -89 2 17.5 169.4 -89 2 18 169.8 -90 2 1 77.6 -90 2 1.25 81.1 -90 2 1.5 84 -90 2 1.75 87.2 -90 2 2 91.4 -90 2 3 98 -90 2 4 105.6 -90 2 5 112.2 -90 2 6 118.6 -90 2 7 124.2 -90 2 8 130.3 -90 2 8.5 132.9 -90 2 9 135.5 -90 2 9.5 138.5 -90 2 10 141.4 -90 2 10.5 144.4 -90 2 11 147.6 -90 2 11.5 151.2 -90 2 12 154.9 -90 2 12.5 159 -90 2 13 163.2 -90 2 13.5 166 -90 2 14 168.3 -90 2 14.5 169.8 -90 2 15 170.7 -90 2 15.5 171.5 -90 2 16 172.1 -90 2 16.5 172.5 -90 2 17 172.7 -90 2 17.5 173.1 -90 2 18 173.5 -91 2 1 68.6 -91 2 1.25 73.6 -91 2 1.5 78.6 -91 2 1.75 83.6 -91 2 2 88.9 -91 2 3 96.8 -91 2 4 104.1 -91 2 5 111.8 -91 2 6 118.6 -91 2 7 124.7 -91 2 8 129.2 -91 2 8.5 132.8 -91 2 9 136.5 -91 2 9.5 138.1 -91 2 10 139.4 -91 2 10.5 142.5 -91 2 11 145.4 -91 2 11.5 148.6 -91 2 12 152.2 -91 2 12.5 155.8 -91 2 13 158.7 -91 2 13.5 160.8 -91 2 14 162.2 -91 2 14.5 163.1 -91 2 15 163.7 -91 2 15.5 164.3 -91 2 16 164.8 -91 2 16.5 165.4 -91 2 17 166 -91 2 17.5 166.3 -91 2 18 166.8 -92 2 1 79.9 -92 2 1.25 82.6 -92 2 1.5 84.8 -92 2 1.75 88.6 -92 2 2 94 -92 2 3 99.6 -92 2 4 108.2 -92 2 5 116.2 -92 2 6 124 -92 2 7 131.1 -92 2 8 136.8 -92 2 8.5 139.4 -92 2 9 142 -92 2 9.5 145 -92 2 10 148.1 -92 2 10.5 151.3 -92 2 11 154.8 -92 2 11.5 158.5 -92 2 12 161.6 -92 2 12.5 163.8 -92 2 13 165.3 -92 2 13.5 166.2 -92 2 14 166.4 -92 2 14.5 166.6 -92 2 15 167 -92 2 15.5 167.5 -92 2 16 167.7 -92 2 16.5 168 -92 2 17 168.3 -92 2 17.5 168.4 -92 2 18 168.6 -93 2 1 76.1 -93 2 1.25 78.4 -93 2 1.5 82.3 -93 2 1.75 86 -93 2 2 89.2 -93 2 3 98.2 -93 2 4 106.7 -93 2 5 114.4 -93 2 6 121.9 -93 2 7 129.5 -93 2 8 135.2 -93 2 8.5 138.1 -93 2 9 140.8 -93 2 9.5 144.8 -93 2 10 148 -93 2 10.5 151.3 -93 2 11 154.7 -93 2 11.5 158.4 -93 2 12 161.7 -93 2 12.5 164.2 -93 2 13 165.6 -93 2 13.5 166.4 -93 2 14 167 -93 2 14.5 167.7 -93 2 15 168.1 -93 2 15.5 168.4 -93 2 16 168.5 -93 2 16.5 168.5 -93 2 17 168.6 -93 2 17.5 168.9 -93 2 18 169.2 diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/xcovForGetEigens1.csv b/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/xcovForGetEigens1.csv deleted file mode 100644 index 589459a4..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/inst/testdata/xcovForGetEigens1.csv +++ /dev/null @@ -1,51 +0,0 @@ -2.196581948531575,2.076931258989656,1.96344757103288,1.834551136914922,1.677578760649516,1.49451922688197,1.288360645392482,1.06375819094216,0.8251494398698923,0.5771242563594348,0.3263093881605101,0.07816220580427111,-0.1628159585023043,-0.3913629900835455,-0.6043638927081098,-0.7994590030749275,-0.9735958757053726,-1.126987380186377,-1.258424771331905,-1.36801943843945,-1.457318080509322,-1.526016472494825,-1.576205167802788,-1.608500710666972,-1.623555086749174,-1.622713381714698,-1.605375376056851,-1.572305197342081,-1.522683934732187,-1.455824480828267,-1.371569959974707,-1.268050267408234,-1.145641208383941,-1.003219523845558,-0.8406544715872185,-0.6593604183357822,-0.4593067851915705,-0.2434921440080302,-0.01443939166154169,0.2247246076205895,0.4688613025283423,0.7134299108638597,0.9532052221883486,1.181588133208385,1.393364959841405,1.582976943378781,1.743870426695676,1.87408487465457,1.970990520524553,2.039095819596253,2.092567599164061 -2.076931258989656,1.964152029292803,1.870927104832209,1.77921369002819,1.67069804735291,1.518527057697731,1.326890092684052,1.114487698054388,0.8887889822690588,0.6538682812491917,0.4154029096758077,0.1781221681083856,-0.0537304374151505,-0.2752128301702714,-0.4832541557695138,-0.6754886643672217,-0.8489735971533842,-1.003750792997704,-1.138571521583171,-1.253458226032369,-1.349694383225492,-1.426906149269471,-1.486934190510564,-1.530156695911947,-1.55711541162892,-1.568838648811716,-1.564591390318759,-1.544962337821656,-1.508871442980711,-1.455578357510948,-1.38469108197778,-1.294218955086662,-1.184462692389932,-1.05408257859212,-0.902927123991598,-0.7322520623267648,-0.5418981944063453,-0.3348283019025669,-0.1133666419881855,0.1194094682449066,0.3584691222211702,0.5994393921187656,0.8371093341929213,1.065047581705824,1.278130031258654,1.470827152451351,1.636767919389945,1.773902248336061,1.879411166420336,1.957188195455262,2.020136882485865 -1.96344757103288,1.870927104832209,1.790155852664927,1.711659898225139,1.62952601973897,1.518359996241484,1.35540983601808,1.159749577608371,0.9476845223946639,0.7265029313201425,0.5016285972297128,0.2767574292659861,0.05559294782682382,-0.1573720271015575,-0.3591916203753782,-0.5474916431043321,-0.7194569229238241,-0.8749281579697477,-1.012604313365416,-1.132376939121983,-1.235238608858119,-1.320709353974431,-1.390333200619776,-1.444250593206629,-1.48283232103938,-1.506816486515968,-1.515314989179543,-1.508738675717987,-1.485810986164786,-1.445712265463261,-1.387899137207259,-1.310288884772402,-1.213127691068787,-1.094950962162116,-0.955573484389816,-0.796150898774759,-0.6164165735646361,-0.4192764190325796,-0.2068812929649356,0.01778659004546372,0.2498369249206041,0.4851077971165025,0.7184707244910046,0.9437360158024505,1.155930979797696,1.349643688594423,1.518765683731005,1.66120880014246,1.774129943014849,1.860970456539077,1.933554633088178 -1.834551136914922,1.77921369002819,1.711659898225139,1.6399233025689,1.563869217045773,1.474218614382659,1.353795769868471,1.189460762199055,0.9962047497523544,0.7914497226360557,0.5826799150130716,0.3728635952102736,0.1651171696394314,-0.03672584054961386,-0.2300077900343916,-0.4123889745268263,-0.581214100742272,-0.7360759312789213,-0.8755906315354136,-0.9994634120181929,-1.108328109707288,-1.20154198183609,-1.280285818438973,-1.344423287447343,-1.3941008010019,-1.429767432148694,-1.450368120239277,-1.456152492460297,-1.44570873298758,-1.418159093077068,-1.372902977534885,-1.307837970125427,-1.22321048675447,-1.117544900039605,-0.9906571354795007,-0.8436608312507918,-0.67623698121466,-0.4912069119485782,-0.290562832774647,-0.07714161154364142,0.144389433852144,0.3701484533702665,0.5952125414479953,0.8137662754157884,1.02110522929494,1.212083896447424,1.380999703628017,1.52580857646116,1.643789894549947,1.737982532282852,1.819072810761579 -1.677578760649516,1.67069804735291,1.62952601973897,1.563869217045773,1.485830503073071,1.39790487735936,1.304011409057108,1.186243587367401,1.028397360504296,0.8473163576544028,0.6578202945503694,0.4655496196115508,0.2740016606427089,0.08615793384988951,-0.09590084216370279,-0.2699917654256677,-0.4336813947582469,-0.586277842604524,-0.7262851067770745,-0.8531724311549407,-0.9671409442855775,-1.067331197378675,-1.15449569531223,-1.228173257017434,-1.288244698267463,-1.334860773830848,-1.366792336264028,-1.384150095077346,-1.385440346110597,-1.369767043527982,-1.33655744254908,-1.283772998845796,-1.211720272035971,-1.119021278734226,-1.005542088345189,-0.8724020567114695,-0.7192909620780565,-0.5489134722336927,-0.3631102954681699,-0.1645206961897797,0.04250642374292533,0.2544456053022845,0.4667160386362373,0.6740186286491913,0.8720501534947205,1.056086329756335,1.22098636622757,1.36483406302102,1.48514482173639,1.584544184079703,1.672410526309645 -1.49451922688197,1.518527057697731,1.518359996241484,1.474218614382659,1.39790487735936,1.313867574079101,1.228628024044623,1.14113767698943,1.034556738635836,0.8921141836782051,0.7263292639134248,0.5535226575861644,0.3803941449186669,0.2090367532719925,0.04073113492893905,-0.1226611869568793,-0.279046413586079,-0.427463126370966,-0.5663011530912104,-0.694767944650541,-0.8125825193548412,-0.9186388369682331,-1.013217763173726,-1.095500853678379,-1.165083358102521,-1.221807713977819,-1.264275114314833,-1.292475098803316,-1.304870931573355,-1.300587156559478,-1.279133948631109,-1.23860583675565,-1.179410550934284,-1.100342802708988,-1.001359242683429,-0.883606435020634,-0.7468281735791592,-0.5935791612848488,-0.4255404942160529,-0.245111096328505,-0.05623217715141245,0.1379933440131066,0.3334397896626932,0.5254459705456546,0.7102162094552658,0.8835719963580849,1.041057984183762,1.18094638443661,1.301058590259976,1.403565232453774,1.496353520972957 -1.288360645392482,1.326890092684052,1.35540983601808,1.353795769868471,1.304011409057108,1.228628024044623,1.151590243238945,1.077328410443308,1.004247437204516,0.9117269043655392,0.7823585115787173,0.6345336320875555,0.482660524765977,0.3298960403919151,0.1775844881186941,0.02731637757562215,-0.1193653223573913,-0.2613486531033572,-0.3969571068206993,-0.5251384630539978,-0.6451088229893273,-0.7555096908749703,-0.856126179451306,-0.9457726464296082,-1.023752227772971,-1.089595620822435,-1.141748597887976,-1.180089707303302,-1.203072722333651,-1.209871270020154,-1.200112107087469,-1.172075761357768,-1.126290079333339,-1.061772557251636,-0.9785928401071181,-0.8779269034173076,-0.7595991830479415,-0.6259759275762146,-0.4785607127830181,-0.3194700320710195,-0.1521576639360356,0.02075600678356754,0.1956936055162004,0.3687328483648921,0.5366704441208263,0.6959692155114628,0.8429545242131601,0.9761269030555721,1.09366016735579,1.19723150018581,1.293088322393743 -1.06375819094216,1.114487698054388,1.159749577608371,1.189460762199055,1.186243587367401,1.14113767698943,1.077328410443308,1.014278176103843,0.9533441667428759,0.8914834905873973,0.812896836914439,0.7058025555888283,0.5803000626200331,0.4474124620991716,0.3124478430390818,0.1772149515556978,0.04242075918044336,-0.09089579548416146,-0.2211117422391841,-0.346965938116525,-0.4671918561929019,-0.580201425566536,-0.6852849648429518,-0.7809068300855433,-0.8660865756616716,-0.940048636191926,-1.00110608579781,-1.04902653298864,-1.082278116863063,-1.100094857236414,-1.102226332367948,-1.087165537127025,-1.055551616582666,-1.006641328116582,-0.9406145376056468,-0.8586589854434381,-0.7606813078356109,-0.6488204050973646,-0.5243786187011401,-0.389152869526847,-0.2460548184384497,-0.09717785049054169,0.05450663894142993,0.2058763335367475,0.3543710250383134,0.4971435156351443,0.6313513819551788,0.7557366477908498,0.868841962009532,0.9718257849573425,1.06920982980226 -0.8251494398698923,0.8887889822690588,0.9476845223946639,0.9962047497523544,1.028397360504296,1.034556738635836,1.004247437204516,0.9533441667428759,0.901354951776723,0.8533085171405598,0.8113650670547148,0.7573082326369496,0.6689632328721832,0.5589203652316524,0.4428073778494788,0.3242473538450905,0.2033137692527203,0.0809445737385445,-0.04146886387021704,-0.1626016335909377,-0.2807959768467269,-0.3942967237243326,-0.5019305094533602,-0.601860003366167,-0.6928492163176253,-0.7738308961319734,-0.8430202838461667,-0.9000639390046261,-0.9434568768634795,-0.9724899344929075,-0.9870087050362222,-0.9857187232686455,-0.9693313783367622,-0.937318735295379,-0.8899451256712522,-0.8283640874014374,-0.7525399022830541,-0.6643442061298346,-0.5648398039910014,-0.4554777475378426,-0.3385900116790593,-0.2157152309961073,-0.08919889068038937,0.03866434766802867,0.1659663481557867,0.2905564049685193,0.4104295589616929,0.5245547852898437,0.631831147322358,0.7328788940052804,0.8304659339052675 -0.5771242563594348,0.6538682812491917,0.7265029313201425,0.7914497226360557,0.8473163576544028,0.8921141836782051,0.9117269043655392,0.8914834905873973,0.8533085171405598,0.8210845342784994,0.7970432934140642,0.7747662488204365,0.7333224263960066,0.6591543878505999,0.567092783246823,0.4669437573020565,0.3612614109227883,0.2517970027146081,0.1395607264558187,0.02566479482682701,-0.08802723578667877,-0.1997029609563722,-0.3077843169555349,-0.410205477167488,-0.5055150126670991,-0.5923776082680433,-0.6689526820303822,-0.7347471690944815,-0.7882901298212009,-0.8289095603190296,-0.8565004640677748,-0.8699591366734057,-0.8700064512592401,-0.856281969188044,-0.8290842868456918,-0.7894741955832827,-0.7374276787431964,-0.6745069521168721,-0.6014971483997735,-0.5194753681589666,-0.4301815145033743,-0.3345826991358162,-0.234405266423862,-0.1311254772932486,-0.02601218806518277,0.07944580435484004,0.184053362097657,0.286971850764634,0.3874203634472713,0.4854775971109467,0.5821823916645664 -0.3263093881605101,0.4154029096758077,0.5016285972297128,0.5826799150130716,0.6578202945503694,0.7263292639134248,0.7823585115787173,0.812896836914439,0.8113650670547148,0.7970432934140642,0.7839506410745704,0.7727955495129635,0.7621210894276238,0.737674241012969,0.6822758236225802,0.6036642750203103,0.5141907562133247,0.4191181110214762,0.3191207753973115,0.2148554754014056,0.1081470897794961,0.0006842490697803076,-0.1056585935140404,-0.2086888397028367,-0.3067942546607491,-0.3984021544896216,-0.4816644932288999,-0.5559241867828444,-0.6197413416197858,-0.6724512263191099,-0.7139284012698401,-0.7432178054797746,-0.7609682657046926,-0.766908947691042,-0.7613090329848407,-0.7450599240211934,-0.7180865018524932,-0.6816042855583828,-0.6360745986669494,-0.5821869747222557,-0.5210938338267354,-0.453192311601653,-0.3796297055989915,-0.30110218350769,-0.218288463152278,-0.1320822892013725,-0.04293429727927838,0.04845620685625606,0.1415735845301307,0.2359595998965585,0.3310005788345231 -0.07816220580427111,0.1781221681083856,0.2767574292659861,0.3728635952102736,0.4655496196115508,0.5535226575861644,0.6345336320875555,0.7058025555888283,0.7573082326369496,0.7747662488204365,0.7727955495129635,0.7717344760844868,0.7762966331755872,0.784195443644097,0.7745917260891079,0.7284162097938012,0.6593958167663763,0.5808166137382489,0.4948923572865333,0.4024758357867005,0.3052849689819562,0.2046042026634123,0.1023976405534909,0.0008310508384042761,-0.09839776752790008,-0.1935200711225981,-0.2827369951651822,-0.3651965213770112,-0.4394810429283555,-0.50489043390704,-0.561188865744783,-0.6075080721306604,-0.6443218489097472,-0.6713462421265547,-0.6887375164155047,-0.6971265315943287,-0.696305435415757,-0.6871053574379685,-0.6696149059885569,-0.6441260123990673,-0.611228998704459,-0.5707656590406636,-0.5233716242470005,-0.4690338505629583,-0.4079156295947561,-0.3404183175961,-0.2663463322238984,-0.1863306209516415,-0.1006970767287641,-0.01042356204669721,0.08235054973309421 --0.1628159585023043,-0.0537304374151505,0.05559294782682382,0.1651171696394314,0.2740016606427089,0.3803941449186669,0.482660524765977,0.5803000626200331,0.6689632328721832,0.7333224263960066,0.7621210894276238,0.7762966331755872,0.7932300436919421,0.8124995322639731,0.8301900562956804,0.8286176420348194,0.7936553911521611,0.7360759976164966,0.6655489174807626,0.5864417261533931,0.5007926983105081,0.4091596542251164,0.3133058741667021,0.2151618469318835,0.1164083172888479,0.01895836379426603,-0.07549568711452943,-0.1658765810661449,-0.250777893073283,-0.3294179306563285,-0.4013587386715819,-0.4657507676015644,-0.5227880717503403,-0.5720673394560832,-0.6135445428551027,-0.6475019219927211,-0.6735147141686456,-0.6919975198545566,-0.7026239375057244,-0.7052827419616964,-0.7000418519755662,-0.68621184889897,-0.6639964660533572,-0.6327616375377689,-0.5922399290509378,-0.5424571650781215,-0.4826828610476568,-0.4135538861204283,-0.3352878096548572,-0.2493563968252812,-0.1592736103059046 --0.3913629900835455,-0.2752128301702714,-0.1573720271015575,-0.03672584054961386,0.08615793384988951,0.2090367532719925,0.3298960403919151,0.4474124620991716,0.5589203652316524,0.6591543878505999,0.737674241012969,0.784195443644097,0.8124995322639731,0.8392606279143001,0.8672594236356657,0.894983651178348,0.9055619498645852,0.8801008852610411,0.8283609204903961,0.7642028831624024,0.691807780451394,0.6111649787468222,0.523732415407797,0.4309539912159394,0.3343183808379069,0.2357934488918405,0.1368973656698441,0.03896046444849693,-0.0566066538480748,-0.1488932263749962,-0.2371586853509433,-0.3204966572245201,-0.3987129447738551,-0.471164947575958,-0.5375212330281901,-0.5976202344881812,-0.6507328816906551,-0.6968324862463545,-0.7351330983884832,-0.7651290980421207,-0.786414614682993,-0.7978077381455695,-0.799178902088194,-0.7893769006534761,-0.767810314445757,-0.7342602331896279,-0.6875935777131684,-0.628533356704355,-0.5572750219483565,-0.475748942426002,-0.3886542355772091 --0.6043638927081098,-0.4832541557695138,-0.3591916203753782,-0.2300077900343916,-0.09590084216370279,0.04073113492893905,0.1775844881186941,0.3124478430390818,0.4428073778494788,0.567092783246823,0.6822758236225802,0.7745917260891079,0.8301900562956804,0.8672594236356657,0.9043945256724276,0.9433770455745741,0.9812245103802951,0.9984932971023853,0.9782960810228822,0.9340552269186345,0.8766457763477579,0.8082506658295302,0.730815666921256,0.6451127227974134,0.5521594579421499,0.4538195945719809,0.3513458083887394,0.246338437574135,0.1402234072923724,0.03408851126509472,-0.07093100910910413,-0.1737969255272899,-0.2738227601702782,-0.3700165559849659,-0.4616704343113523,-0.5480969329606818,-0.6281783401986447,-0.701425967941033,-0.7665636926091542,-0.8226978502091173,-0.8690106134654463,-0.9038708325047929,-0.9269160526661708,-0.9365939419812942,-0.9320929029863431,-0.9130864059455024,-0.8781730663326828,-0.828238971202229,-0.7635455231311183,-0.6864391672491849,-0.6026043896198112 --0.7994590030749275,-0.6754886643672217,-0.5474916431043321,-0.4123889745268263,-0.2699917654256677,-0.1226611869568793,0.02731637757562215,0.1772149515556978,0.3242473538450905,0.4669437573020565,0.6036642750203103,0.7284162097938012,0.8286176420348194,0.894983651178348,0.9433770455745741,0.9898824355820989,1.036482767100107,1.080403400441543,1.104319542472835,1.092376151602233,1.053235800726808,0.9978002852437308,0.9312482383327152,0.8538169769692071,0.7658351151689594,0.6688649835309209,0.5637553360793611,0.4523541210613503,0.3361030439550652,0.216300924065733,0.09455317009650868,-0.02790830651286007,-0.1498232724832999,-0.2697561080393997,-0.3865561204095528,-0.4989423445917525,-0.6053434494321601,-0.7048004690516073,-0.7955247694390727,-0.8762538235932179,-0.9458153617895916,-1.002178559927616,-1.044842352363278,-1.071960118705918,-1.082600381626548,-1.076447807193796,-1.051957293059409,-1.010240450852863,-0.9516961305374536,-0.8790396603807578,-0.7987402621552301 --0.9735958757053726,-0.8489735971533842,-0.7194569229238241,-0.581214100742272,-0.4336813947582469,-0.279046413586079,-0.1193653223573913,0.04242075918044336,0.2033137692527203,0.3612614109227883,0.5141907562133247,0.6593958167663763,0.7936553911521611,0.9055619498645852,0.9812245103802951,1.036482767100107,1.089910590814557,1.143106935817213,1.193992423001647,1.224677011762736,1.215163943947025,1.176322232218588,1.121805473038195,1.053389724146518,0.9713133978982759,0.8768215048339577,0.7701503359437598,0.6532898509211246,0.5276634978678341,0.3948000107487292,0.2568326369535825,0.1152392174693982,-0.02808066978907398,-0.1711709561640439,-0.3123830510101073,-0.4497924742299668,-0.5813229384659309,-0.7055454412405496,-0.8201510835089457,-0.9235318413990115,-1.014223902124331,-1.089852052650089,-1.149866554370813,-1.192235146551837,-1.216001069515598,-1.220971468607224,-1.205576813275131,-1.171205390956874,-1.118456573499926,-1.050359904106027,-0.9739618300541202 --1.126987380186377,-1.003750792997704,-0.8749281579697477,-0.7360759312789213,-0.586277842604524,-0.427463126370966,-0.2613486531033572,-0.09089579548416146,0.0809445737385445,0.2517970027146081,0.4191181110214762,0.5808166137382489,0.7360759976164966,0.8801008852610411,0.9984932971023853,1.080403400441543,1.143106935817213,1.202946443655761,1.262304407420063,1.3180989086903,1.349661038618072,1.339588976826632,1.300599531726741,1.241574525249882,1.165659365564104,1.074370372525882,0.9671462310904541,0.8459247415591681,0.7120095395224224,0.5671362883137636,0.4139855651646749,0.2543101570373905,0.09068352799786901,-0.07437579753652175,-0.2386903771703006,-0.3996713437526983,-0.554712200817977,-0.7019239529998953,-0.8384875831849751,-0.9624744871139419,-1.072185677907624,-1.16495396784827,-1.240249077055553,-1.29594306180195,-1.331125397525408,-1.345806629509722,-1.338484628705475,-1.310852501913245,-1.263751567030194,-1.200472531225408,-1.128460232758837 --1.258424771331905,-1.138571521583171,-1.012604313365416,-0.8755906315354136,-0.7262851067770745,-0.5663011530912104,-0.3969571068206993,-0.2211117422391841,-0.04146886387021704,0.1395607264558187,0.3191207753973115,0.4948923572865333,0.6655489174807626,0.8283609204903961,0.9782960810228822,1.104319542472835,1.193992423001647,1.262304407420063,1.327162858036912,1.389605384437612,1.443681907253722,1.472835614164773,1.460811814070409,1.414100518762193,1.344691155245649,1.257041889080253,1.150174747535347,1.025904674800505,0.8852542065487766,0.7300558742921212,0.5634953123645735,0.3875956573177531,0.2056000619462868,0.02059792227058025,-0.1647083179566376,-0.3470717703046446,-0.5233629812536992,-0.6912578594460124,-0.8474534833804966,-0.9897368378011498,-1.116220112494531,-1.223999255989695,-1.312611318833265,-1.379902405247605,-1.425061468946576,-1.448348925564733,-1.448396525886481,-1.427204055093069,-1.385867883653638,-1.327879850797552,-1.260915115278834 --1.36801943843945,-1.253458226032369,-1.132376939121983,-0.9994634120181929,-0.8531724311549407,-0.694767944650541,-0.5251384630539978,-0.346965938116525,-0.1626016335909377,0.02566479482682701,0.2148554754014056,0.4024758357867005,0.5864417261533931,0.7642028831624024,0.9340552269186345,1.092376151602233,1.224677011762736,1.3180989086903,1.389605384437612,1.453351058158818,1.510572428395762,1.562211886257802,1.588656048167294,1.565660971953849,1.505711499128104,1.422267208592051,1.316355099621084,1.190270117032486,1.044672533381063,0.8812825620551414,0.7036485804165776,0.5140097907262855,0.316237057942201,0.1139589852432254,-0.08962168339925777,-0.290639101470216,-0.4854735268563553,-0.6713990640968887,-0.8446766401307731,-1.002842662654511,-1.14386309899117,-1.264648323301987,-1.364827500093692,-1.442273907555741,-1.496303615150052,-1.527444477139891,-1.53450079509997,-1.519757752957068,-1.48456143315114,-1.432549100489184,-1.371491700815888 --1.457318080509322,-1.349694383225492,-1.235238608858119,-1.108328109707288,-0.9671409442855775,-0.8125825193548412,-0.6451088229893273,-0.4671918561929019,-0.2807959768467269,-0.08802723578667877,0.1081470897794961,0.3052849689819562,0.5007926983105081,0.691807780451394,0.8766457763477579,1.053235800726808,1.215163943947025,1.349661038618072,1.443681907253722,1.510572428395762,1.5707010385303,1.627326458270351,1.673369833119714,1.68267338237172,1.643163356807821,1.567458337427997,1.46336834218711,1.336547813934928,1.187861190758488,1.01876671623061,0.8329399736449395,0.632690582784576,0.4224063551937622,0.2061772307846126,-0.01235635414963934,-0.2287779049119097,-0.4390441605746406,-0.640072979926531,-0.8277514738601562,-0.9994058873966964,-1.152882093228206,-1.284951775375912,-1.395332488908235,-1.481947453014602,-1.544240441156104,-1.582981589083662,-1.597150816036555,-1.589268985706333,-1.560894290320387,-1.515752099114576,-1.461604458886611 --1.526016472494825,-1.426906149269471,-1.320709353974431,-1.20154198183609,-1.067331197378675,-0.9186388369682331,-0.7555096908749703,-0.580201425566536,-0.3942967237243326,-0.1997029609563722,0.0006842490697803076,0.2046042026634123,0.4091596542251164,0.6111649787468222,0.8082506658295302,0.9978002852437308,1.176322232218588,1.339588976826632,1.472835614164773,1.562211886257802,1.627326458270351,1.683594132662236,1.723750999750213,1.745750106134899,1.740054979203788,1.685822869093944,1.587557409167356,1.461568834312414,1.311765264102701,1.139763439421487,0.9492147559406835,0.742252465286534,0.5235602326932558,0.2975390826361667,0.06816589165033181,-0.1596977406743725,-0.3816852469223183,-0.5944163432319011,-0.7934891169842015,-0.9760633375456114,-1.139882935073157,-1.281625874358467,-1.401068020576098,-1.496183441748665,-1.566517234072063,-1.613019823554749,-1.634818158870693,-1.634590713357197,-1.614044089004695,-1.57693425926725,-1.530938242763822 --1.576205167802788,-1.486934190510564,-1.390333200619776,-1.280285818438973,-1.15449569531223,-1.013217763173726,-0.856126179451306,-0.6852849648429518,-0.5019305094533602,-0.3077843169555349,-0.1056585935140404,0.1023976405534909,0.3133058741667021,0.523732415407797,0.730815666921256,0.9312482383327152,1.121805473038195,1.300599531726741,1.460811814070409,1.588656048167294,1.673369833119714,1.723750999750213,1.754441624765642,1.776480531378703,1.7898928668081,1.767846101124055,1.686247979582056,1.565142080862171,1.416394725006177,1.244011682074144,1.05211162225834,0.8424443066240438,0.6196680088093598,0.3882578335344304,0.1523799926327661,-0.08279151856039436,-0.3126870307328359,-0.533691317896742,-0.7412076440280204,-0.9322717253087951,-1.104533894401289,-1.254616579474864,-1.382304014054225,-1.485602172992685,-1.564110295484679,-1.618871612562059,-1.64910674758459,-1.657557957756417,-1.646002277813081,-1.618177519669673,-1.581637267089573 --1.608500710666972,-1.530156695911947,-1.444250593206629,-1.344423287447343,-1.228173257017434,-1.095500853678379,-0.9457726464296082,-0.7809068300855433,-0.601860003366167,-0.410205477167488,-0.2086888397028367,0.0008310508384042761,0.2151618469318835,0.4309539912159394,0.6451127227974134,0.8538169769692071,1.053389724146518,1.241574525249882,1.414100518762193,1.565660971953849,1.68267338237172,1.745750106134899,1.776480531378703,1.798715633466098,1.810298183281173,1.796512338564159,1.742576176192661,1.641141281727444,1.499528106184534,1.330020724467579,1.140328080196867,0.9322370502586769,0.7101662069178485,0.478340818257681,0.2408691637812552,0.003044149131710419,-0.2305187977550991,-0.4560454372797791,-0.6688540587327428,-0.8659036555850116,-1.044748281191279,-1.201990211089783,-1.33734904526579,-1.448820069093776,-1.535987605229372,-1.599865225810252,-1.639685377319654,-1.658136355012032,-1.65695786668636,-1.639813042301823,-1.614106416277518 --1.623555086749174,-1.55711541162892,-1.48283232103938,-1.3941008010019,-1.288244698267463,-1.165083358102521,-1.023752227772971,-0.8660865756616716,-0.6928492163176253,-0.5055150126670991,-0.3067942546607491,-0.09839776752790008,0.1164083172888479,0.3343183808379069,0.5521594579421499,0.7658351151689594,0.9713133978982759,1.165659365564104,1.344691155245649,1.505711499128104,1.643163356807821,1.740054979203788,1.7898928668081,1.810298183281173,1.807007574696656,1.781398287901345,1.74360694376803,1.677905890451085,1.558207577462066,1.397684199548108,1.21400568971646,1.011460989547269,0.7947309443848395,0.5675237535491084,0.3335245922676343,0.09786509786650381,-0.1349905650534889,-0.3611970679570589,-0.5761073101938001,-0.7766502090351746,-0.9602768860398536,-1.123601196700728,-1.266192608727546,-1.385983046213454,-1.482458257283868,-1.556465696251326,-1.6071523687479,-1.637025295008533,-1.647677458028875,-1.642655239859988,-1.629227177721697 --1.622713381714698,-1.568838648811716,-1.506816486515968,-1.429767432148694,-1.334860773830848,-1.221807713977819,-1.089595620822435,-0.940048636191926,-0.7738308961319734,-0.5923776082680433,-0.3984021544896216,-0.1935200711225981,0.01895836379426603,0.2357934488918405,0.4538195945719809,0.6688649835309209,0.8768215048339577,1.074370372525882,1.257041889080253,1.422267208592051,1.567458337427997,1.685822869093944,1.767846101124055,1.796512338564159,1.781398287901345,1.752010571337521,1.716566046013577,1.669002041482883,1.582386897183283,1.445107922282278,1.273704475559531,1.080506317515994,0.8732278187186681,0.6552440897058228,0.4295088408858441,0.2006645647489741,-0.02723285339432716,-0.250387291350096,-0.4643137779320202,-0.6659587310136696,-0.8526602748084073,-1.021072058328587,-1.17052508619323,-1.29882807861655,-1.405282454640475,-1.490427506919096,-1.553222679900581,-1.595866115939828,-1.619686084672453,-1.628064688505048,-1.628142737159064 --1.605375376056851,-1.564591390318759,-1.515314989179543,-1.450368120239277,-1.366792336264028,-1.264275114314833,-1.141748597887976,-1.00110608579781,-0.8430202838461667,-0.6689526820303822,-0.4816644932288999,-0.2827369951651822,-0.07549568711452943,0.1368973656698441,0.3513458083887394,0.5637553360793611,0.7701503359437598,0.9671462310904541,1.150174747535347,1.316355099621084,1.46336834218711,1.587557409167356,1.686247979582056,1.742576176192661,1.74360694376803,1.716566046013577,1.679368640297466,1.625865626450973,1.555137727915484,1.457293364188737,1.314589338911802,1.13831058084949,0.9453286659604105,0.7409814518148364,0.5281164336170375,0.3107666450838087,0.09222601057694303,-0.1239732400107073,-0.3336751974508325,-0.5339013468368218,-0.7218677001301741,-0.8942959540407965,-1.05018463204605,-1.187154611070973,-1.304230446961033,-1.401493391684869,-1.477605607988248,-1.534323197288535,-1.572589008587955,-1.595577748164532,-1.610325001493058 --1.572305197342081,-1.544962337821656,-1.508738675717987,-1.456152492460297,-1.384150095077346,-1.292475098803316,-1.180089707303302,-1.04902653298864,-0.9000639390046261,-0.7347471690944815,-0.5559241867828444,-0.3651965213770112,-0.1658765810661449,0.03896046444849693,0.246338437574135,0.4523541210613503,0.6532898509211246,0.8459247415591681,1.025904674800505,1.190270117032486,1.336547813934928,1.461568834312414,1.565142080862171,1.641141281727444,1.677905890451085,1.669002041482883,1.625865626450973,1.564814675154797,1.497230649336885,1.424309297476177,1.325776178703697,1.183275961342534,1.011744661283559,0.8245291256793582,0.6279645744690309,0.425935736220243,0.2205739791267615,0.01484158260837099,-0.1876475798247244,-0.3840723680896965,-0.5715305394456907,-0.746840418333835,-0.9085884795403782,-1.054154058083649,-1.182205080775809,-1.292236774456778,-1.382520029133118,-1.454254340635895,-1.50789743178286,-1.546383794198234,-1.576669975631651 --1.522683934732187,-1.508871442980711,-1.485810986164786,-1.44570873298758,-1.385440346110597,-1.304870931573355,-1.203072722333651,-1.082278116863063,-0.9434568768634795,-0.7882901298212009,-0.6197413416197858,-0.4394810429283555,-0.250777893073283,-0.0566066538480748,0.1402234072923724,0.3361030439550652,0.5276634978678341,0.7120095395224224,0.8852542065487766,1.044672533381063,1.187861190758488,1.311765264102701,1.416394725006177,1.499528106184534,1.558207577462066,1.582386897183283,1.555137727915484,1.497230649336885,1.433793854049214,1.368415891252809,1.297881737945696,1.204291487691277,1.06878301829449,0.9041919813566154,0.727369107309905,0.5439741681957606,0.3551011006740634,0.163077672605618,-0.02926633573541124,-0.2194270946453752,-0.4044337877547543,-0.5812405326228179,-0.7479585781173689,-0.9016826468711591,-1.040659485954919,-1.163687267010718,-1.268567618716059,-1.355843162433708,-1.425390663906782,-1.479859889106477,-1.526119320594565 --1.455824480828267,-1.455578357510948,-1.445712265463261,-1.418159093077068,-1.369767043527982,-1.300587156559478,-1.209871270020154,-1.100094857236414,-0.9724899344929075,-0.8289095603190296,-0.6724512263191099,-0.50489043390704,-0.3294179306563285,-0.1488932263749962,0.03408851126509472,0.216300924065733,0.3948000107487292,0.5671362883137636,0.7300558742921212,0.8812825620551414,1.01876671623061,1.139763439421487,1.244011682074144,1.330020724467579,1.397684199548108,1.445107922282278,1.457293364188737,1.424309297476177,1.368415891252809,1.308717606055288,1.248039112875462,1.185357947166302,1.099831997807311,0.9743761825314017,0.8247976797685118,0.6632526012944667,0.4932050174728423,0.3174622110905366,0.1379057990585341,-0.04357506294936243,-0.2240810627606508,-0.4007732045723849,-0.5712519253403849,-0.7323039754233158,-0.881707103964279,-1.017481206120953,-1.136902450336969,-1.239778471984554,-1.325342822979885,-1.395935288072031,-1.458341050552745 --1.371569959974707,-1.38469108197778,-1.387899137207259,-1.372902977534885,-1.33655744254908,-1.279133948631109,-1.200112107087469,-1.102226332367948,-0.9870087050362222,-0.8565004640677748,-0.7139284012698401,-0.561188865744783,-0.4013587386715819,-0.2371586853509433,-0.07093100910910413,0.09455317009650868,0.2568326369535825,0.4139855651646749,0.5634953123645735,0.7036485804165776,0.8329399736449395,0.9492147559406835,1.05211162225834,1.140328080196867,1.21400568971646,1.273704475559531,1.314589338911802,1.325776178703697,1.297881737945696,1.248039112875462,1.195454769166777,1.143658681237793,1.091654222710285,1.022752858083911,0.9164458572260646,0.7811221998749009,0.6312363036487253,0.4734309710839605,0.3087024335003921,0.1380658289827434,-0.03585068379242084,-0.2105511424831243,-0.383156133127678,-0.5501563854695786,-0.708847091002949,-0.8564316055761709,-0.9896413470101395,-1.107504969676655,-1.208573040019088,-1.294840388585202,-1.372963047372872 --1.268050267408234,-1.294218955086662,-1.310288884772402,-1.307837970125427,-1.283772998845796,-1.23860583675565,-1.172075761357768,-1.087165537127025,-0.9857187232686455,-0.8699591366734057,-0.7432178054797746,-0.6075080721306604,-0.4657507676015644,-0.3204966572245201,-0.1737969255272899,-0.02790830651286007,0.1152392174693982,0.2543101570373905,0.3875956573177531,0.5140097907262855,0.632690582784576,0.742252465286534,0.8424443066240438,0.9322370502586769,1.011460989547269,1.080506317515994,1.13831058084949,1.183275961342534,1.204291487691277,1.185357947166302,1.143658681237793,1.102464850889022,1.067773261320527,1.037303850654181,0.9859944878979832,0.8899426044851405,0.7650770811445891,0.627331252654866,0.479004605434581,0.321067886513318,0.1559135987115843,-0.01454349926368794,-0.1870994539064058,-0.3580230270288615,-0.5241497971994912,-0.681870826087359,-0.8273873257198372,-0.9589349923816278,-1.074374863459171,-1.175328233661977,-1.268256616987861 --1.145641208383941,-1.184462692389932,-1.213127691068787,-1.22321048675447,-1.211720272035971,-1.179410550934284,-1.126290079333339,-1.055551616582666,-0.9693313783367622,-0.8700064512592401,-0.7609682657046926,-0.6443218489097472,-0.5227880717503403,-0.3987129447738551,-0.2738227601702782,-0.1498232724832999,-0.02808066978907398,0.09068352799786901,0.2056000619462868,0.316237057942201,0.4224063551937622,0.5235602326932558,0.6196680088093598,0.7101662069178485,0.7947309443848395,0.8732278187186681,0.9453286659604105,1.011744661283559,1.06878301829449,1.099831997807311,1.091654222710285,1.067773261320527,1.04821083263276,1.031911898794425,1.013844951924266,0.9720491467450998,0.8886646557706201,0.7761062074202764,0.6451840689462899,0.5009887119877879,0.3463848485100639,0.1824279854272743,0.01235858658445159,-0.1600385689652377,-0.3312226938620905,-0.4968293726080785,-0.6525807679750517,-0.7959397682937837,-0.92410660235876,-1.038309326613148,-1.144733403670856 --1.003219523845558,-1.05408257859212,-1.094950962162116,-1.117544900039605,-1.119021278734226,-1.100342802708988,-1.061772557251636,-1.006641328116582,-0.937318735295379,-0.856281969188044,-0.766908947691042,-0.6713462421265547,-0.5720673394560832,-0.471164947575958,-0.3700165559849659,-0.2697561080393997,-0.1711709561640439,-0.07437579753652175,0.02059792227058025,0.1139589852432254,0.2061772307846126,0.2975390826361667,0.3882578335344304,0.478340818257681,0.5675237535491084,0.6552440897058228,0.7409814518148364,0.8245291256793582,0.9041919813566154,0.9743761825314017,1.022752858083911,1.037303850654181,1.031911898794425,1.024914985621963,1.0194832057603,1.013423340717722,0.9856376342848744,0.9118094773764315,0.8019364167821293,0.6727933541636456,0.530379952236015,0.3752163295575027,0.2104597834600315,0.0396926502129478,-0.1333725438278771,-0.3037627413400545,-0.4668255217845716,-0.619312174000296,-0.7578213040390631,-0.8831592304323449,-1.001098904189317 --0.8406544715872185,-0.902927123991598,-0.955573484389816,-0.9906571354795007,-1.005542088345189,-1.001359242683429,-0.9785928401071181,-0.9406145376056468,-0.8899451256712522,-0.8290842868456918,-0.7613090329848407,-0.6887375164155047,-0.6135445428551027,-0.5375212330281901,-0.4616704343113523,-0.3865561204095528,-0.3123830510101073,-0.2386903771703006,-0.1647083179566376,-0.08962168339925777,-0.01235635414963934,0.06816589165033181,0.1523799926327661,0.2408691637812552,0.3335245922676343,0.4295088408858441,0.5281164336170375,0.6279645744690309,0.727369107309905,0.8247976797685118,0.9164458572260646,0.9859944878979832,1.013844951924266,1.0194832057603,1.025019737400045,1.032349958949168,1.037638290744175,1.015628688182379,0.9418711004670041,0.833103991464842,0.704800803112018,0.5603022640142954,0.4035672910453186,0.2377754418631571,0.06645143458046203,-0.1050929277559529,-0.2719973734420862,-0.4304014732147535,-0.5764000559821706,-0.7103660198049384,-0.8375235546358062 --0.6593604183357822,-0.7322520623267648,-0.796150898774759,-0.8436608312507918,-0.8724020567114695,-0.883606435020634,-0.8779269034173076,-0.8586589854434381,-0.8283640874014374,-0.7894741955832827,-0.7450599240211934,-0.6971265315943287,-0.6475019219927211,-0.5976202344881812,-0.5480969329606818,-0.4989423445917525,-0.4497924742299668,-0.3996713437526983,-0.3470717703046446,-0.290639101470216,-0.2287779049119097,-0.1596977406743725,-0.08279151856039436,0.003044149131710419,0.09786509786650381,0.2006645647489741,0.3107666450838087,0.425935736220243,0.5439741681957606,0.6632526012944667,0.7811221998749009,0.8899426044851405,0.9720491467450998,1.013423340717722,1.032349958949168,1.048389861451141,1.063525431778003,1.072216554778578,1.048977377717959,0.975832462946482,0.8663497073672587,0.7343555387234093,0.5880464301407081,0.4304828097852407,0.2646898979639674,0.09595645158059476,-0.07091375055280089,-0.2316120039574983,-0.381857160123826,-0.5215744395830392,-0.6552722769418625 --0.4593067851915705,-0.5418981944063453,-0.6164165735646361,-0.67623698121466,-0.7192909620780565,-0.7468281735791592,-0.7595991830479415,-0.7606813078356109,-0.7525399022830541,-0.7374276787431964,-0.7180865018524932,-0.696305435415757,-0.6735147141686456,-0.6507328816906551,-0.6281783401986447,-0.6053434494321601,-0.5813229384659309,-0.554712200817977,-0.5233629812536992,-0.4854735268563553,-0.4390441605746406,-0.3816852469223183,-0.3126870307328359,-0.2305187977550991,-0.1349905650534889,-0.02723285339432716,0.09222601057694303,0.2205739791267615,0.3551011006740634,0.4932050174728423,0.6312363036487253,0.7650770811445891,0.8886646557706201,0.9856376342848744,1.037638290744175,1.063525431778003,1.084487379611168,1.09885406623115,1.104084461947188,1.081366051853653,1.006715276848601,0.8933150632452252,0.7606964869648157,0.614605305936731,0.4582451704621212,0.296689674185794,0.1342860395885648,-0.02450033922680474,-0.1752078967404617,-0.3173166059396022,-0.4544380090861086 --0.2434921440080302,-0.3348283019025669,-0.4192764190325796,-0.4912069119485782,-0.5489134722336927,-0.5935791612848488,-0.6259759275762146,-0.6488204050973646,-0.6643442061298346,-0.6745069521168721,-0.6816042855583828,-0.6871053574379685,-0.6919975198545566,-0.6968324862463545,-0.701425967941033,-0.7048004690516073,-0.7055454412405496,-0.7019239529998953,-0.6912578594460124,-0.6713990640968887,-0.640072979926531,-0.5944163432319011,-0.533691317896742,-0.4560454372797791,-0.3611970679570589,-0.250387291350096,-0.1239732400107073,0.01484158260837099,0.163077672605618,0.3174622110905366,0.4734309710839605,0.627331252654866,0.7761062074202764,0.9118094773764315,1.015628688182379,1.072216554778578,1.09885406623115,1.115315807909582,1.12829366999729,1.13568243994732,1.111387723055858,1.033366047128118,0.9206955501886388,0.7888826448358599,0.6450565705390739,0.4945323914894086,0.3407649406612809,0.1879748309206409,0.04053610819799629,-0.1006257302345008,-0.2380629388114306 --0.01443939166154169,-0.1133666419881855,-0.2068812929649356,-0.290562832774647,-0.3631102954681699,-0.4255404942160529,-0.4785607127830181,-0.5243786187011401,-0.5648398039910014,-0.6014971483997735,-0.6360745986669494,-0.6696149059885569,-0.7026239375057244,-0.7351330983884832,-0.7665636926091542,-0.7955247694390727,-0.8201510835089457,-0.8384875831849751,-0.8474534833804966,-0.8446766401307731,-0.8277514738601562,-0.7934891169842015,-0.7412076440280204,-0.6688540587327428,-0.5761073101938001,-0.4643137779320202,-0.3336751974508325,-0.1876475798247244,-0.02926633573541124,0.1379057990585341,0.3087024335003921,0.479004605434581,0.6451840689462899,0.8019364167821293,0.9418711004670041,1.048977377717959,1.104084461947188,1.12829366999729,1.146948394096685,1.161826272048723,1.165642048007838,1.138230608286254,1.061669015462932,0.9502074913936421,0.8225009729419391,0.6866632582451603,0.545493090182685,0.4027842997566603,0.2624877912926999,0.1258037926437437,-0.008638303463538919 -0.2247246076205895,0.1194094682449066,0.01778659004546372,-0.07714161154364142,-0.1645206961897797,-0.245111096328505,-0.3194700320710195,-0.389152869526847,-0.4554777475378426,-0.5194753681589666,-0.5821869747222557,-0.6441260123990673,-0.7052827419616964,-0.7651290980421207,-0.8226978502091173,-0.8762538235932179,-0.9235318413990115,-0.9624744871139419,-0.9897368378011498,-1.002842662654511,-0.9994058873966964,-0.9760633375456114,-0.9322717253087951,-0.8659036555850116,-0.7766502090351746,-0.6659587310136696,-0.5339013468368218,-0.3840723680896965,-0.2194270946453752,-0.04357506294936243,0.1380658289827434,0.321067886513318,0.5009887119877879,0.6727933541636456,0.833103991464842,0.975832462946482,1.081366051853653,1.13568243994732,1.161826272048723,1.178121440864834,1.187020477839741,1.1904350447095,1.166232567350383,1.093062518988194,0.9892235061633282,0.8717282705042284,0.7462724011756637,0.6171472348887218,0.487595251096343,0.3588146951063373,0.2306408756006825 -0.4688613025283423,0.3584691222211702,0.2498369249206041,0.144389433852144,0.04250642374292533,-0.05623217715141245,-0.1521576639360356,-0.2460548184384497,-0.3385900116790593,-0.4301815145033743,-0.5210938338267354,-0.611228998704459,-0.7000418519755662,-0.786414614682993,-0.8690106134654463,-0.9458153617895916,-1.014223902124331,-1.072185677907624,-1.116220112494531,-1.14386309899117,-1.152882093228206,-1.139882935073157,-1.104533894401289,-1.044748281191279,-0.9602768860398536,-0.8526602748084073,-0.7218677001301741,-0.5715305394456907,-0.4044337877547543,-0.2240810627606508,-0.03585068379242084,0.1559135987115843,0.3463848485100639,0.530379952236015,0.704800803112018,0.8663497073672587,1.006715276848601,1.111387723055858,1.165642048007838,1.187020477839741,1.201426126662356,1.21439859097974,1.222977793331382,1.205080697477705,1.141982301734878,1.048123882858254,0.9406549280181765,0.827647728386633,0.7116585160026079,0.5936607750738606,0.4746346800507757 -0.7134299108638597,0.5994393921187656,0.4851077971165025,0.3701484533702665,0.2544456053022845,0.1379933440131066,0.02075600678356754,-0.09717785049054169,-0.2157152309961073,-0.3345826991358162,-0.453192311601653,-0.5707656590406636,-0.68621184889897,-0.7978077381455695,-0.9038708325047929,-1.002178559927616,-1.089852052650089,-1.16495396784827,-1.223999255989695,-1.264648323301987,-1.284951775375912,-1.281625874358467,-1.254616579474864,-1.201990211089783,-1.123601196700728,-1.021072058328587,-0.8942959540407965,-0.746840418333835,-0.5812405326228179,-0.4007732045723849,-0.2105511424831243,-0.01454349926368794,0.1824279854272743,0.3752163295575027,0.5603022640142954,0.7343555387234093,0.8933150632452252,1.033366047128118,1.138230608286254,1.1904350447095,1.21439859097974,1.23508469514905,1.254823997002006,1.271557275448947,1.263382628075485,1.208519533893126,1.125192597003616,1.031246937904552,0.9309645277309482,0.8260262784463567,0.7187238228099528 -0.9532052221883486,0.8371093341929213,0.7184707244910046,0.5952125414479953,0.4667160386362373,0.3334397896626932,0.1956936055162004,0.05450663894142993,-0.08919889068038937,-0.234405266423862,-0.3796297055989915,-0.5233716242470005,-0.6639964660533572,-0.799178902088194,-0.9269160526661708,-1.044842352363278,-1.149866554370813,-1.240249077055553,-1.312611318833265,-1.364827500093692,-1.395332488908235,-1.401068020576098,-1.382304014054225,-1.33734904526579,-1.266192608727546,-1.17052508619323,-1.05018463204605,-0.9085884795403782,-0.7479585781173689,-0.5712519253403849,-0.383156133127678,-0.1870994539064058,0.01235858658445159,0.2104597834600315,0.4035672910453186,0.5880464301407081,0.7606964869648157,0.9206955501886388,1.061669015462932,1.166232567350383,1.222977793331382,1.254823997002006,1.283128395117309,1.311494111630675,1.336822429695276,1.337226612733067,1.295396081367083,1.226010533215299,1.142556119734235,1.051664217634811,0.9576893253505121 -1.181588133208385,1.065047581705824,0.9437360158024505,0.8137662754157884,0.6740186286491913,0.5254459705456546,0.3687328483648921,0.2058763335367475,0.03866434766802867,-0.1311254772932486,-0.30110218350769,-0.4690338505629583,-0.6327616375377689,-0.7893769006534761,-0.9365939419812942,-1.071960118705918,-1.192235146551837,-1.29594306180195,-1.379902405247605,-1.442273907555741,-1.481947453014602,-1.496183441748665,-1.485602172992685,-1.448820069093776,-1.385983046213454,-1.29882807861655,-1.187154611070973,-1.054154058083649,-0.9016826468711591,-0.7323039754233158,-0.5501563854695786,-0.3580230270288615,-0.1600385689652377,0.0396926502129478,0.2377754418631571,0.4304828097852407,0.614605305936731,0.7888826448358599,0.9502074913936421,1.093062518988194,1.205080697477705,1.271557275448947,1.311494111630675,1.348324533288745,1.385964134909181,1.422208967100557,1.436020431249564,1.404683408423746,1.341401466317659,1.265199041227745,1.184983628039832 -1.393364959841405,1.278130031258654,1.155930979797696,1.02110522929494,0.8720501534947205,0.7102162094552658,0.5366704441208263,0.3543710250383134,0.1659663481557867,-0.02601218806518277,-0.218288463152278,-0.4079156295947561,-0.5922399290509378,-0.767810314445757,-0.9320929029863431,-1.082600381626548,-1.216001069515598,-1.331125397525408,-1.425061468946576,-1.496303615150052,-1.544240441156104,-1.566517234072063,-1.564110295484679,-1.535987605229372,-1.482458257283868,-1.405282454640475,-1.304230446961033,-1.182205080775809,-1.040659485954919,-0.881707103964279,-0.708847091002949,-0.5241497971994912,-0.3312226938620905,-0.1333725438278771,0.06645143458046203,0.2646898979639674,0.4582451704621212,0.6450565705390739,0.8225009729419391,0.9892235061633282,1.141982301734878,1.263382628075485,1.336822429695276,1.385964134909181,1.43400233277751,1.483102525858923,1.529769546361846,1.54933517225623,1.520529366958461,1.46298533306482,1.396214773798216 -1.582976943378781,1.470827152451351,1.349643688594423,1.212083896447424,1.056086329756335,0.8835719963580849,0.6959692155114628,0.4971435156351443,0.2905564049685193,0.07944580435484004,-0.1320822892013725,-0.3404183175961,-0.5424571650781215,-0.7342602331896279,-0.9130864059455024,-1.076447807193796,-1.220971468607224,-1.345806629509722,-1.448348925564733,-1.527444477139891,-1.582981589083662,-1.613019823554749,-1.618871612562059,-1.599865225810252,-1.556465696251326,-1.490427506919096,-1.401493391684869,-1.292236774456778,-1.163687267010718,-1.017481206120953,-0.8564316055761709,-0.681870826087359,-0.4968293726080785,-0.3037627413400545,-0.1050929277559529,0.09595645158059476,0.296689674185794,0.4945323914894086,0.6866632582451603,0.8717282705042284,1.048123882858254,1.208519533893126,1.337226612733067,1.422208967100557,1.483102525858923,1.540595964084905,1.596918628184413,1.646192280936752,1.664263388749891,1.638121965712958,1.587270871824451 -1.743870426695676,1.636767919389945,1.518765683731005,1.380999703628017,1.22098636622757,1.041057984183762,0.8429545242131601,0.6313513819551788,0.4104295589616929,0.184053362097657,-0.04293429727927838,-0.2663463322238984,-0.4826828610476568,-0.6875935777131684,-0.8781730663326828,-1.051957293059409,-1.205576813275131,-1.338484628705475,-1.448396525886481,-1.53450079509997,-1.597150816036555,-1.634818158870693,-1.64910674758459,-1.639685377319654,-1.6071523687479,-1.553222679900581,-1.477605607988248,-1.382520029133118,-1.268567618716059,-1.136902450336969,-0.9896413470101395,-0.8273873257198372,-0.6525807679750517,-0.4668255217845716,-0.2719973734420862,-0.07091375055280089,0.1342860395885648,0.3407649406612809,0.545493090182685,0.7462724011756637,0.9406549280181765,1.125192597003616,1.295396081367083,1.436020431249564,1.529769546361846,1.596918628184413,1.658504691619521,1.711838311521636,1.754209584976092,1.771731317857723,1.753613935866981 -1.87408487465457,1.773902248336061,1.66120880014246,1.52580857646116,1.36483406302102,1.18094638443661,0.9761269030555721,0.7557366477908498,0.5245547852898437,0.286971850764634,0.04845620685625606,-0.1863306209516415,-0.4135538861204283,-0.628533356704355,-0.828238971202229,-1.010240450852863,-1.171205390956874,-1.310852501913245,-1.427204055093069,-1.519757752957068,-1.589268985706333,-1.634590713357197,-1.657557957756417,-1.658136355012032,-1.637025295008533,-1.595866115939828,-1.534323197288535,-1.454254340635895,-1.355843162433708,-1.239778471984554,-1.107504969676655,-0.9589349923816278,-0.7959397682937837,-0.619312174000296,-0.4304014732147535,-0.2316120039574983,-0.02450033922680474,0.1879748309206409,0.4027842997566603,0.6171472348887218,0.827647728386633,1.031246937904552,1.226010533215299,1.404683408423746,1.54933517225623,1.646192280936752,1.711838311521636,1.765040155656111,1.814475472469039,1.859771168086809,1.89240104848936 -1.970990520524553,1.879411166420336,1.774129943014849,1.643789894549947,1.48514482173639,1.301058590259976,1.09366016735579,0.868841962009532,0.631831147322358,0.3874203634472713,0.1415735845301307,-0.1006970767287641,-0.3352878096548572,-0.5572750219483565,-0.7635455231311183,-0.9516961305374536,-1.118456573499926,-1.263751567030194,-1.385867883653638,-1.48456143315114,-1.560894290320387,-1.614044089004695,-1.646002277813081,-1.65695786668636,-1.647677458028875,-1.619686084672453,-1.572589008587955,-1.50789743178286,-1.425390663906782,-1.325342822979885,-1.208573040019088,-1.074374863459171,-0.92410660235876,-0.7578213040390631,-0.5764000559821706,-0.381857160123826,-0.1752078967404617,0.04053610819799629,0.2624877912926999,0.487595251096343,0.7116585160026079,0.9309645277309482,1.142556119734235,1.341401466317659,1.520529366958461,1.664263388749891,1.754209584976092,1.814475472469039,1.871181885361223,1.930343376125727,2.001788331644366 -2.039095819596253,1.957188195455262,1.860970456539077,1.737982532282852,1.584544184079703,1.403565232453774,1.19723150018581,0.9718257849573425,0.7328788940052804,0.4854775971109467,0.2359595998965585,-0.01042356204669721,-0.2493563968252812,-0.475748942426002,-0.6864391672491849,-0.8790396603807578,-1.050359904106027,-1.200472531225408,-1.327879850797552,-1.432549100489184,-1.515752099114576,-1.57693425926725,-1.618177519669673,-1.639813042301823,-1.642655239859988,-1.628064688505048,-1.595577748164532,-1.546383794198234,-1.479859889106477,-1.395935288072031,-1.294840388585202,-1.175328233661977,-1.038309326613148,-0.8831592304323449,-0.7103660198049384,-0.5215744395830392,-0.3173166059396022,-0.1006257302345008,0.1258037926437437,0.3588146951063373,0.5936607750738606,0.8260262784463567,1.051664217634811,1.265199041227745,1.46298533306482,1.638121965712958,1.771731317857723,1.859771168086809,1.930343376125727,2.002517888975621,2.095084048891293 -2.092567599164061,2.020136882485865,1.933554633088178,1.819072810761579,1.672410526309645,1.496353520972957,1.293088322393743,1.06920982980226,0.8304659339052675,0.5821823916645664,0.3310005788345231,0.08235054973309421,-0.1592736103059046,-0.3886542355772091,-0.6026043896198112,-0.7987402621552301,-0.9739618300541202,-1.128460232758837,-1.260915115278834,-1.371491700815888,-1.461604458886611,-1.530938242763822,-1.581637267089573,-1.614106416277518,-1.629227177721697,-1.628142737159064,-1.610325001493058,-1.576669975631651,-1.526119320594565,-1.458341050552745,-1.372963047372872,-1.268256616987861,-1.144733403670856,-1.001098904189317,-0.8375235546358062,-0.6552722769418625,-0.4544380090861086,-0.2380629388114306,-0.008638303463538919,0.2306408756006825,0.4746346800507757,0.7187238228099528,0.9576893253505121,1.184983628039832,1.396214773798216,1.587270871824451,1.753613935866981,1.89240104848936,2.001788331644366,2.095084048891293,2.19480499731987 diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/BwNN.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/BwNN.Rd deleted file mode 100644 index 81b6f9e9..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/BwNN.Rd +++ /dev/null @@ -1,24 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/BwNN.R -\name{BwNN} -\alias{BwNN} -\title{Minimum bandwidth based on kNN criterion.} -\usage{ -BwNN(Lt, k = 3, onlyMean = FALSE, onlyCov = FALSE) -} -\arguments{ -\item{Lt}{n-by-1 list of vectors} - -\item{k}{number of unique neighbors for cov and mu (default = 3)} - -\item{onlyMean}{Indicator to return only the minimum bandwidth for the mean} - -\item{onlyCov}{Indicator to return only the minium bandwidth for the covariance} -} -\description{ -Input a list of time points Lt, and the number of unique neighbors k and get the minimum bandwidth garanteeing k unique neighbours. -} -\examples{ -tinyGrid = list(c(1,7), c(2,3), 6, c(2,4), c(4,5)) -BwNN(tinyGrid, k = 2) # c(3,2) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/CheckData.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/CheckData.Rd deleted file mode 100644 index 6c759562..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/CheckData.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/CheckData.R -\name{CheckData} -\alias{CheckData} -\title{Check data format} -\usage{ -CheckData(y, t) -} -\arguments{ -\item{y}{is a n-by-1 list of vectors} - -\item{t}{is a n-by-1 list of vectors} -} -\description{ -Check if there are problems with the form and basic structure of the functional data 'y' and the recorded times 't'. -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/CheckOptions.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/CheckOptions.Rd deleted file mode 100644 index c38f4e43..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/CheckOptions.Rd +++ /dev/null @@ -1,18 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/CheckOptions.R -\name{CheckOptions} -\alias{CheckOptions} -\title{Check option format} -\usage{ -CheckOptions(t, optns, n) -} -\arguments{ -\item{t}{is a n-by-1 list of vectors} - -\item{optns}{is an initialized option list} - -\item{n}{is a total number of sample curves} -} -\description{ -Check if the options structure is valid and set the ones that are NULL -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/ConvertSupport.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/ConvertSupport.Rd deleted file mode 100644 index 9db37397..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/ConvertSupport.Rd +++ /dev/null @@ -1,26 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/ConvertSupport.R -\name{ConvertSupport} -\alias{ConvertSupport} -\title{Convert support of a mu/phi/cov etc. to and from obsGrid and workGrid} -\usage{ -ConvertSupport(fromGrid, toGrid, mu = NULL, Cov = NULL, phi = NULL, - isCrossCov = FALSE) -} -\arguments{ -\item{fromGrid}{vector of points with input grid to interpolate from} - -\item{toGrid}{vector of points with the target grid to interpolate on} - -\item{mu}{any vector of function to be interpolated} - -\item{Cov}{a square matrix supported on fromGrid * fromGrid, to be interpolated to toGrid * toGrid.} - -\item{phi}{any matrix, each column containing a function to be interpolated} - -\item{isCrossCov}{logical, indicating whether the input covariance is a cross-covariance. If so then the output is not made symmetric.} -} -\description{ -Convert the support of a given function 1-D or 2-D function from 'fromGrd' to 'toGrid'. -Both grids need to be sorted. This is a interpolation/convenience function. -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateBWPlot.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateBWPlot.Rd deleted file mode 100644 index f8f4e77a..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateBWPlot.Rd +++ /dev/null @@ -1,32 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/CreateBWPlot.R -\name{CreateBWPlot} -\alias{CreateBWPlot} -\title{Functional Principal Component Analysis Bandwidth Diagnostics plot} -\usage{ -CreateBWPlot(fpcaObj, derOptns = NULL, bwMultipliers = NULL) -} -\arguments{ -\item{fpcaObj}{An FPCA class object returned by FPCA().} - -\item{derOptns}{A list of options to control the derivation parameters; see ?FPCAder. If NULL standard diagnostics are returned} - -\item{bwMultipliers}{A vector of multipliers that the original 'bwMu' and 'bwCov' will be multiplied by. (default: c(0.50, 0.75, 1.00, 1.25, 1.50)) -- default: NULL} -} -\description{ -This function by default creates the mean and first principal modes of variation plots for -50%, 75%, 100%, 125% and 150% of the defined bandwidth choices in the fpcaObj provided as input. -If provided with a derivative options object (?FPCAder) it will return the -differentiated mean and first two principal modes of variations for 50%, 75%, 100%, 125% and 150% of the defined bandwidth choice. -} -\examples{ -set.seed(1) -n <- 25 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- Sparsify(sampWiener, pts, 10) -res1 <- FPCA(sampWiener$Ly, sampWiener$Lt, - list(dataType='Sparse', error=FALSE, kernel='epan', verbose=FALSE)) -CreateBWPlot(res1) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateBasis.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateBasis.Rd deleted file mode 100644 index 4c4bb235..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateBasis.Rd +++ /dev/null @@ -1,27 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/CreateBasis.R -\name{CreateBasis} -\alias{CreateBasis} -\title{Create an orthogonal basis of K functions in [0, 1], with nGrid points.} -\usage{ -CreateBasis(K, pts = seq(0, 1, length.out = 50), type = c("cos", "sin", - "fourier", "legendre01", "poly")) -} -\arguments{ -\item{K}{A positive integer specifying the number of eigenfunctions to generate.} - -\item{pts}{A vector specifying the time points to evaluate the basis functions.} - -\item{type}{A string for the type of orthogonal basis.} -} -\value{ -A K by nGrid matrix, each column containing an basis function. -} -\description{ -Create an orthogonal basis of K functions in [0, 1], with nGrid points. -} -\examples{ -basis <- CreateBasis(3, type='fourier') -head(basis) - -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateCovPlot.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateCovPlot.Rd deleted file mode 100644 index 76e0d00c..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateCovPlot.Rd +++ /dev/null @@ -1,36 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/CreateCovPlot.R -\name{CreateCovPlot} -\alias{CreateCovPlot} -\title{Create the covariance surface plot based on the results from FPCA() or FPCder().} -\usage{ -CreateCovPlot(fpcaObj, covPlotType = "Fitted", isInteractive = FALSE, - colSpectrum = NULL, ...) -} -\arguments{ -\item{fpcaObj}{returned object from FPCA().} - -\item{covPlotType}{a string specifying the type of covariance surface to be plotted: -'Smoothed': plot the smoothed cov surface -'Fitted': plot the fitted cov surface} - -\item{isInteractive}{an option for interactive plot: -TRUE: interactive plot; FALSE: printable plot} - -\item{colSpectrum}{character vector to be use as input in the 'colorRampPalette' function defining the colouring scheme (default: c('blue','red'))} - -\item{...}{other arguments passed into persp3d, persp3D, plot3d or points3D for plotting options} -} -\description{ -This function will open a new device if not instructed otherwise. -} -\examples{ -set.seed(1) -n <- 20 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- Sparsify(sampWiener, pts, 10) -res <- FPCA(sampWiener$Ly, sampWiener$Lt, - list(dataType='Sparse', error=FALSE, kernel='epan', verbose=TRUE)) -CreateCovPlot(res) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateDesignPlot.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateDesignPlot.Rd deleted file mode 100644 index 1720ab50..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateDesignPlot.Rd +++ /dev/null @@ -1,41 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/CreateDesignPlot.R -\name{CreateDesignPlot} -\alias{CreateDesignPlot} -\title{Create the design plot of the functional data.} -\usage{ -CreateDesignPlot(Lt, obsGrid = NULL, isColorPlot = TRUE, - noDiagonal = TRUE, addLegend = TRUE, ...) -} -\arguments{ -\item{Lt}{a list of observed time points for functional data} - -\item{obsGrid}{a vector of sorted observed time points. Default to the -unique time points in Lt.} - -\item{isColorPlot}{an option for colorful plot: -TRUE: create color plot with color indicating counts -FALSE: create black and white plot with dots indicating observed time pairs} - -\item{noDiagonal}{an option specifying plotting the diagonal design points: -TRUE: remove diagonal time pairs -FALSE: do not remove diagonal time pairs} - -\item{addLegend}{Logical, default TRUE} - -\item{...}{Other arguments passed into \code{plot()}.} -} -\description{ -Display the scatter plot of \eqn{\{(T_{ij}, T_{il}\}_{i \le n,\, j,l \le n_i }}{{(T_{ij}, T_{il}}}, which is used to diagnose whether the design time points are sufficiently dense in the domain of interest so that the 2D smoothed covariance estimate is feasible. See Figure 2 of Yao et al (2005). This function will open a new device if not instructed otherwise. -} -\examples{ -set.seed(1) -n <- 20 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- Sparsify(sampWiener, pts, 10) -CreateDesignPlot(sampWiener$Lt, sort(unique(unlist(sampWiener$Lt)))) -} -\references{ -\cite{Yao, Fang, Hans-Georg Mueller, and Jane-Ling Wang. "Functional data analysis for sparse longitudinal data." Journal of the American Statistical Association 100, no. 470 (2005): 577-590.} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateFuncBoxPlot.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateFuncBoxPlot.Rd deleted file mode 100644 index 7d11e6f8..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateFuncBoxPlot.Rd +++ /dev/null @@ -1,44 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/CreateFuncBoxPlot.R -\name{CreateFuncBoxPlot} -\alias{CreateFuncBoxPlot} -\title{Create functional boxplot using 'bagplot', 'KDE' or 'pointwise' methodology} -\usage{ -CreateFuncBoxPlot(fpcaObj, optns = list(), ...) -} -\arguments{ -\item{fpcaObj}{An object of class FPCA returned by the function FPCA().} - -\item{optns}{A list of options control parameters specified by \code{list(name=value)}. See `Details'.} - -\item{...}{Additional arguments for the 'plot' function.} -} -\description{ -Using an FPCA object create a functional box-plot based on the function scores. -The green line corresponds to the functional median, the dark grey area to the area spanned -by the curves within the 25th and 75-th percentile and the light gret to the area spanned -by the curves within the 2.5th and 97.5-th percentile. -} -\details{ -Available control options are -\describe{ -\item{ifactor}{inflation ifactor for the bag-plot defining the loop of bag-plot or multiplying ifactor the KDE pilot bandwidth matrix. (see ?aplpack::compute.bagplot; ?ks::Hpi respectively; default: 2.58; 2 respectively).} -\item{variant}{string defining the method used ('KDE', 'pointwise' or 'bagplot') (default: 'bagplot')} -\item{unimodal}{logical specifying if the KDE estimate should be unimodal (default: FALSE, relavant only for variant='KDE')} -\item{addIndx}{vector of indeces corresponding to which samples one should overlay (Default: NULL)} -\item{K}{integer number of the first K components used for the representation. (default: length(fpcaObj$lambda ))} -} -} -\examples{ -set.seed(1) -n <- 20 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- Sparsify(sampWiener, pts, 10) -res <- FPCA(sampWiener$Ly, sampWiener$Lt, - list(dataType='Sparse', error=FALSE, kernel='epan', verbose=TRUE)) -CreateFuncBoxPlot(res, list(addIndx=c(1:3)) ) -} -\references{ -\cite{P. J. Rousseeuw, I. Ruts, J. W. Tukey (1999): The bagplot: a bivariate boxplot, The American Statistician, vol. 53, no. 4, 382-387} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateModeOfVarPlot.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateModeOfVarPlot.Rd deleted file mode 100644 index 147112fa..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateModeOfVarPlot.Rd +++ /dev/null @@ -1,38 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/CreateModeOfVarPlot.R -\name{CreateModeOfVarPlot} -\alias{CreateModeOfVarPlot} -\title{Functional Principal Component Analysis mode of variation plot} -\usage{ -CreateModeOfVarPlot(fpcaObj, k = 1, plotType = "standard", - colSpectrum = NULL, ...) -} -\arguments{ -\item{fpcaObj}{An FPCA class object returned by FPCA().} - -\item{k}{The k-th mode of variation to plot (default k = 1)} - -\item{plotType}{Character indicating the creation of "standard" shaded plot, a "rainbow"-plot or a "minimal" sketch plot (default: "standard")} - -\item{colSpectrum}{Character vector to be use as input in the 'colorRampPalette' function defining the outliers colours (default: c("blue","red", "green"), relavant only for rainbowPlot=TRUE)} - -\item{...}{Additional arguments for the \code{plot} function.} -} -\description{ -Create the k-th mode of variation plot around the mean. The red-line is -the functional mean, the grey shaded areas show the range of variations -around the mean: \eqn{ \pm Q \sqrt{\lambda_k} \phi_k}{+/- Q sqrt{lambda_k} phi_k} -for the dark grey area Q = 1, and for the light grey are Q = 2. In the case of 'rainbow' plot -the blue edge corresponds to Q = -3, the green edge to Q = +3 and the red-line to Q = 0 (the mean). -In the case of 'minimal' the blue line corresponds to Q = -2 and green line to Q = 2. -} -\examples{ -set.seed(1) -n <- 20 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- Sparsify(sampWiener, pts, 10) -res <- FPCA(sampWiener$Ly, sampWiener$Lt, - list(dataType='Sparse', error=FALSE, kernel='epan', verbose=TRUE)) -CreateModeOfVarPlot(res) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateOutliersPlot.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateOutliersPlot.Rd deleted file mode 100644 index 34dc931e..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateOutliersPlot.Rd +++ /dev/null @@ -1,51 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/CreateOutliersPlot.R -\name{CreateOutliersPlot} -\alias{CreateOutliersPlot} -\title{Functional Principal Component or Functional Singular Value Decomposition Scores Plot using 'bagplot' or 'KDE' methodology} -\usage{ -CreateOutliersPlot(fObj, optns = NULL, ...) -} -\arguments{ -\item{fObj}{A class object returned by FPCA() or FSVD().} - -\item{optns}{A list of options control parameters specified by \code{list(name=value)}. See `Details'.} - -\item{...}{Additional arguments for the 'plot' function.} -} -\value{ -An (temporarily) invisible copy of a list containing the labels associated with each of sample curves. -} -\description{ -This function will create, using the first components scores, a set of convex hulls of the scores based on 'bagplot' or 'KDE' methodology. -} -\details{ -Available control options are -\describe{ -\item{ifactor}{inflation ifactor for the bag-plot defining the loop of bag-plot or multiplying ifactor the KDE pilot bandwidth matrix. (see ?aplpack::compute.bagplot; ?ks::Hpi respectively; default: 2.58; 2 respectively).} -\item{variant}{string defining the outlier method used ('KDE', 'NN' or 'bagplot') (default: 'KDE')} -\item{unimodal}{logical specifying if the KDE estimate should be unimodal (default: FALSE, relavant only for variant='KDE')} -\item{maxVar}{logical specifying if during slicing we should used the directions of maximum variance (default: FALSE for FPCA, TRUE for FSVD)} -\item{nSlices}{integer between 3 and 16, denoting the number of slices to be used (default: 4, relavant only for groupingType='slice') } -\item{showSlices}{logical specifying if during slicing we should show the outline of the slice (default: FALSE)} -\item{colSpectrum}{character vector to be use as input in the 'colorRampPalette' function defining the outliers colours (default: c("red", "yellow", 'blue'), relavant only for groupingType='slice') } -\item{groupingType}{string specifying if a slice grouping ('slice') or a standard percentile/bagplot grouping ('standard') should be returned (default: 'standard')} -\item{fIndeces}{a two-component vector with the index of the mode of variation to consider (default: c(1,2) for FPCA and c(1,1) for FSVD)} -} -} -\examples{ -\dontrun{ -set.seed(1) -n <- 420 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- Sparsify(sampWiener, pts, 10) -res <- FPCA(sampWiener$Ly, sampWiener$Lt, - list(dataType='Sparse', error=FALSE, kernel='epan', verbose=TRUE)) -CreateOutliersPlot(res) -} -} -\references{ -\cite{P. J. Rousseeuw, I. Ruts, J. W. Tukey (1999): The bagplot: a bivariate boxplot, The American Statistician, vol. 53, no. 4, 382-387} -\cite{R. J. Hyndman and H. L. Shang. (2010) Rainbow plots, bagplots, and boxplots for functional data, Journal of Computational and Graphical Statistics, 19(1), 29-45} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/CreatePathPlot.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/CreatePathPlot.Rd deleted file mode 100644 index 8081f364..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/CreatePathPlot.Rd +++ /dev/null @@ -1,58 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/CreatePathPlot.R -\name{CreatePathPlot} -\alias{CreatePathPlot} -\title{Create the fitted sample path plot based on the results from FPCA().} -\usage{ -CreatePathPlot(fpcaObj, subset, K = NULL, - inputData = fpcaObj[["inputData"]], showObs = !is.null(inputData), - obsOnly = FALSE, showMean = FALSE, derOptns = list(p = 0), ...) -} -\arguments{ -\item{fpcaObj}{Returned object from FPCA().} - -\item{subset}{A vector of indices or a logical vector for subsetting the -observations.} - -\item{K}{The number of components to reconstruct the fitted sample paths.} - -\item{inputData}{A list of length 2 containing the sparse/dense -(unsupported yet) observations. \code{inputData} needs to contain two -fields: \code{Lt} for a list of time points and \code{Ly} for a list of -observations. Default to the `inputData` field within `fpcaObj`.} - -\item{showObs}{Whether to plot the original observations for each subject.} - -\item{obsOnly}{Whether to show only the original curves.} - -\item{showMean}{Whether to plot the mean function as a bold solid curve.} - -\item{derOptns}{A list of options to control derivation parameters; see `fitted.FPCA'. (default = NULL)} - -\item{...}{other arguments passed into matplot for plotting options} -} -\description{ -Create the fitted sample path plot based on the results from FPCA(). -} -\examples{ -set.seed(1) -n <- 20 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- Sparsify(sampWiener, pts, 10) -res <- FPCA(sampWiener$Ly, sampWiener$Lt, - list(dataType='Sparse', error=FALSE, kernel='epan', - verbose=TRUE)) -CreatePathPlot(res, subset=1:5) - -# CreatePathPlot has a lot of usages: -\dontrun{ -CreatePathPlot(res) -CreatePathPlot(res, 1:20) -CreatePathPlot(res, 1:20, showObs=FALSE) -CreatePathPlot(res, 1:20, showMean=TRUE, showObs=FALSE) -CreatePathPlot(res, 1:20, obsOnly=TRUE) -CreatePathPlot(res, 1:20, obsOnly=TRUE, showObs=FALSE) -CreatePathPlot(inputData=sampWiener, subset=1:20, obsOnly=TRUE)} - -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateScreePlot.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateScreePlot.Rd deleted file mode 100644 index 856804b4..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateScreePlot.Rd +++ /dev/null @@ -1,26 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/CreateScreePlot.R -\name{CreateScreePlot} -\alias{CreateScreePlot} -\title{Create the scree plot for the fitted eigenvalues} -\usage{ -CreateScreePlot(fpcaObj, ...) -} -\arguments{ -\item{fpcaObj}{A object of class FPCA returned by the function FPCA().} - -\item{...}{Additional arguments for the 'plot' function.} -} -\description{ -This function will open a new device if not instructed otherwise. -} -\examples{ -set.seed(1) -n <- 20 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- Sparsify(sampWiener, pts, 10) -res <- FPCA(sampWiener$Ly, sampWiener$Lt, - list(dataType='Sparse', error=FALSE, kernel='epan', verbose=TRUE)) -CreateScreePlot(res) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateStringingPlot.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateStringingPlot.Rd deleted file mode 100644 index f3b079b4..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/CreateStringingPlot.Rd +++ /dev/null @@ -1,37 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/CreateStringingPlot.R -\name{CreateStringingPlot} -\alias{CreateStringingPlot} -\title{Create plots for observed and stringed high dimensional data} -\usage{ -CreateStringingPlot(stringingObj, subset, ...) -} -\arguments{ -\item{stringingObj}{A stringing object of class "Stringing", returned by the function Stringing.} - -\item{subset}{A vector of indices or a logical vector for subsetting the observations. If missing, first min(n,50) observations will be plotted where n is the sample size.} - -\item{...}{Other arguments passed into matplot for plotting options} -} -\description{ -The function produces the following three plots: -1) A plot of predictors (standardized if specified so during stringing) in original order for a subset of observations; -2) A plot of predictors in stringed order for the same subset of observations; -3) A plot of the stringing function, which is the stringed order vs. the original order. -} -\examples{ -set.seed(1) -n <- 50 -wiener = Wiener(n = n)[,-1] -p = ncol(wiener) -rdmorder = sample(size = p, x=1:p, replace = FALSE) -stringingfit = Stringing(X = wiener[,rdmorder], disOptns = "correlation") -diff_norev = sum(abs(rdmorder[stringingfit$StringingOrder] - 1:p)) -diff_rev = sum(abs(rdmorder[stringingfit$StringingOrder] - p:1)) -if(diff_rev <= diff_norev){ - stringingfit$StringingOrder = rev(stringingfit$StringingOrder) - stringingfit$Ly = lapply(stringingfit$Ly, rev) -} -CreateStringingPlot(stringingfit, 1:20) - -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/DynCorr.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/DynCorr.Rd deleted file mode 100644 index 8ebb3bac..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/DynCorr.Rd +++ /dev/null @@ -1,43 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/DynCorr.R -\name{DynCorr} -\alias{DynCorr} -\title{Dynamical Correlation} -\usage{ -DynCorr(x, y, t) -} -\arguments{ -\item{x}{a n by m matrix where rows representing subjects and columns representing measurements, missings are allowed.} - -\item{y}{a n by m matrix where rows representing subjects and columns representing measurements, missings are allowed.} - -\item{t}{a length m vector of time points where x,y are observed.} -} -\value{ -A length m vector of individual dynamic correlations -} -\description{ -Calculate Dynamical Correlation for 2 paired dense regular functional data observed on the same grid. -} -\examples{ -set.seed(10) -n=200 # sample size -t=seq(0,1,length.out=100) # length of data -mu_quad_x=8*t^2-4*t+5 -mu_quad_y=8*t^2-12*t+6 -fun=rbind(rep(1,length(t)),-t,t^2) -z1=matrix(0,n,3) -z1[,1]=rnorm(n,0,2) -z1[,2]=rnorm(n,0,16/3) -z1[,3]=rnorm(n,0,4) -x1_quad_error=y1_quad_error=matrix(0,nrow=n,ncol=length(t)) -for (i in 1:n){ - x1_quad_error[i,]=mu_quad_x+z1[i,]\%*\%fun+rnorm(length(t),0,0.01) - y1_quad_error[i,]=mu_quad_y+2*z1[i,]\%*\%fun +rnorm(length(t),0,0.01) -} -dyn1_quad=DynCorr(x1_quad_error,y1_quad_error,t) -} -\references{ -\cite{Dubin J A, M\"uller H G. Dynamical correlation for multivariate longitudinal data[J]. Journal of the American Statistical Association, 2005, 100(471): 872-881.} -\cite{Liu S, Zhou Y, Palumbo R, et al. Dynamical correlation: A new method for quantifying synchrony with multivariate intensive longitudinal data[J]. Psychological methods, 2016, 21(3): 291.} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/Dyn_test.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/Dyn_test.Rd deleted file mode 100644 index f77b4e82..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/Dyn_test.Rd +++ /dev/null @@ -1,54 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/Dyn_test.R -\name{Dyn_test} -\alias{Dyn_test} -\title{Bootstrap test of Dynamic correlation} -\usage{ -Dyn_test(x1, y1, t1, x2, y2, t2, B = 1000) -} -\arguments{ -\item{x1}{a n by m matrix where rows representing subjects and columns representing measurements, missings are allowed.} - -\item{y1}{a n by m matrix where rows representing subjects and columns representing measurements, missings are allowed.} - -\item{t1}{a vector of time points where x1,y1 are observed.} - -\item{x2}{(optional if missing will be one sample test) a n by m matrix where rows representing subjects and columns representing measurements, missings are allowed.} - -\item{y2}{(optional if missing will be one sample test) a n by m matrix where rows representing subjects and columns representing measurements, missings are allowed.} - -\item{t2}{(optional if missing will be one sample test) a vector of time points where x2,y2 are observed.} - -\item{B}{number of bootstrap samples.} -} -\value{ -a list of the following -\item{stats: test statistics.} -\item{pval: p-value of the test.} -} -\description{ -Perform one sample (H0: Dynamic correlation = 0) or two sample (H0:Dynamic_correlation_1 = Dynamic_correlation_2) bootstrap test of Dynamical Correlation. -} -\examples{ -n=200 # sample size -t=seq(0,1,length.out=100) # length of data -mu_quad_x=8*t^2-4*t+5 -mu_quad_y=8*t^2-12*t+6 -fun=rbind(rep(1,length(t)),-t,t^2) -z1=matrix(0,n,3) -z1[,1]=rnorm(n,0,2) -z1[,2]=rnorm(n,0,16/3) -z1[,3]=rnorm(n,0,4) # covariance matrix of random effects -x1_quad_error=y1_quad_error=matrix(0,nrow=n,ncol=length(t)) -for (i in 1:n){ - x1_quad_error[i,]=mu_quad_x+z1[i,]\%*\%fun+rnorm(length(t),0,0.01) - y1_quad_error[i,]=mu_quad_y+2*z1[i,]\%*\%fun +rnorm(length(t),0,0.01) -} -bt_DC=Dyn_test(x1_quad_error,y1_quad_error,t,B=1000) - -} -\references{ -\cite{Dubin J A, M\"uller H G. Dynamical correlation for multivariate longitudinal data[J]. Journal of the American Statistical Association, 2005, 100(471): 872-881.} - -\cite{Liu S, Zhou Y, Palumbo R, et al. Dynamical correlation: A new method for quantifying synchrony with multivariate intensive longitudinal data[J]. Psychological methods, 2016, 21(3): 291.} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/FAM.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/FAM.Rd deleted file mode 100644 index 41cffd70..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/FAM.Rd +++ /dev/null @@ -1,143 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/FAM.R -\name{FAM} -\alias{FAM} -\title{Functional Additive Models} -\usage{ -FAM(Y, Lx, Lt, nEval = 51, newLx = NULL, newLt = NULL, - bwMethod = 0, alpha = 0.7, supp = c(-2, 2), optns = NULL) -} -\arguments{ -\item{Y}{An \emph{n}-dimensional vector whose elements consist of scalar responses.} - -\item{Lx}{A list of \emph{n} vectors containing the observed values for each individual. See \code{FPCA} for detail.} - -\item{Lt}{A list of \emph{n} vectors containing the observation time points for each individual. Each vector should be sorted in ascending order. See \code{FPCA} for detail.} - -\item{nEval}{The number of evaluation grid points for kernel smoothing (default is 51. If it is specified as 0, then estimated FPC scores in the training set are used for evaluation grid instead of equal grid).} - -\item{newLx}{A list of the observed values for test set. See \code{predict.FPCA} for detail.} - -\item{newLt}{A list of the observed time points for test set. See \code{predict.FPCA} for detail.} - -\item{bwMethod}{The method of bandwidth selection for kernel smoothing, a positive value for designating K-fold cross-validtaion and zero for GCV (default is 50)} - -\item{alpha}{The shrinkage factor (positive number) for bandwidth selection. See Han et al. (2016) (default is 0.7).} - -\item{supp}{The lower and upper limits of kernel smoothing domain for studentized FPC scores, which FPC scores are divided by the square roots of eigenvalues (default is [-2,2]).} - -\item{optns}{A list of options control parameters specified by list(name=value). See \code{FPCA}.} -} -\value{ -A list containing the following fields: -\item{mu}{Mean estimator of \eqn{EY}} -\item{fam}{A \emph{N} by \emph{K} matrix whose column vectors consist of the component function estimators at the given estimation points.} -\item{xi}{An \emph{N} by \emph{K} matrix whose column vectors consist of \emph{N} vectors of estimation points for each component function.} -\item{bw}{A \emph{K}-dimensional bandwidth vector.} -\item{lambda}{A \emph{K}-dimensional vector containing eigenvalues.} -\item{phi}{An \emph{nWorkGrid} by \emph{K} matrix containing eigenfunctions, supported by \code{WorkGrid}. See \code{FPCA}.} -\item{workGrid}{An \emph{nWorkGrid} by \emph{K_j} working grid, the internal regular grid on which the eigen analysis is carried on. See \code{FPCA}.} -} -\description{ -Functional additive models with a single predictor process -} -\details{ -\code{FAM} fits functional additive models for a scalar response and single predictor process proposed by Mueller and Yao (2007) that \deqn{E(Y | \mathbf{X}) = \sum_{k=1}^K g_{k}(\xi_{k}),} where \eqn{\xi_{k}} stand for the k-th FPC score of the the predictor process. -} -\examples{ -set.seed(1000) - -library(MASS) - -f1 <- function(t) 0.5*t -f2 <- function(t) 2*cos(2*pi*t/4) -f3 <- function(t) 1.5*sin(2*pi*t/4) -f4 <- function(t) 2*atan(2*pi*t/4) - -n<-250 -N<-500 - -sig <- diag(c(4.0,2.0,1.5,1.2)) - -scoreX <- mvrnorm(n,mu=rep(0,4),Sigma=sig) -scoreXTest <- mvrnorm(N,mu=rep(0,4),Sigma=sig) - -Y <- f1(scoreX[,1]) + f2(scoreX[,2]) + f3(scoreX[,3]) + f4(scoreX[,4]) + rnorm(n,0,0.1) -YTest <- f1(scoreXTest[,1]) + f2(scoreXTest[,2]) + - f3(scoreXTest[,3]) + f4(scoreXTest[,4]) + rnorm(N,0,0.1) - -phi1 <- function(t) sqrt(2)*sin(2*pi*t) -phi2 <- function(t) sqrt(2)*sin(4*pi*t) -phi3 <- function(t) sqrt(2)*cos(2*pi*t) -phi4 <- function(t) sqrt(2)*cos(4*pi*t) - -grid <- seq(0,1,length.out=21) -Lt <- Lx <- list() -for (i in 1:n) { - Lt[[i]] <- grid - Lx[[i]] <- scoreX[i,1]*phi1(grid) + scoreX[i,2]*phi2(grid) + - scoreX[i,3]*phi3(grid) + scoreX[i,4]*phi4(grid) + rnorm(1,0,0.01) -} - -LtTest <- LxTest <- list() -for (i in 1:N) { - LtTest[[i]] <- grid - LxTest[[i]] <- scoreXTest[i,1]*phi1(grid) + scoreXTest[i,2]*phi2(grid) + - scoreXTest[i,3]*phi3(grid) + scoreXTest[i,4]*phi4(grid) + rnorm(1,0,0.01) -} - - -# estimation -fit <- FAM(Y=Y,Lx=Lx,Lt=Lt) - -xi <- fit$xi - -par(mfrow=c(2,2)) -j <- 1 -g1 <- f1(sort(xi[,j])) -tmpSgn <- sign(sum(g1*fit$fam[,j])) -plot(sort(xi[,j]),g1,type='l',col=2,ylim=c(-2.5,2.5),xlab='xi1') -points(sort(xi[,j]),tmpSgn*fit$fam[order(xi[,j]),j],type='l') - -j <- 2 -g2 <- f2(sort(xi[,j])) -tmpSgn <- sign(sum(g2*fit$fam[,j])) -plot(sort(xi[,j]),g2,type='l',col=2,ylim=c(-2.5,2.5),xlab='xi2') -points(sort(xi[,j]),tmpSgn*fit$fam[order(xi[,j]),j],type='l') - -j <- 3 -g3 <- f3(sort(xi[,j])) -tmpSgn <- sign(sum(g3*fit$fam[,j])) -plot(sort(xi[,j]),g3,type='l',col=2,ylim=c(-2.5,2.5),xlab='xi3') -points(sort(xi[,j]),tmpSgn*fit$fam[order(xi[,j]),j],type='l') - -j <- 4 -g4 <- f4(sort(xi[,j])) -tmpSgn <- sign(sum(g4*fit$fam[,j])) -plot(sort(xi[,j]),g4,type='l',col=2,ylim=c(-2.5,2.5),xlab='xi4') -points(sort(xi[,j]),tmpSgn*fit$fam[order(xi[,j]),j],type='l') - - -# fitting -fit <- FAM(Y=Y,Lx=Lx,Lt=Lt,nEval=0) -yHat <- fit$mu+apply(fit$fam,1,'sum') -par(mfrow=c(1,1)) -plot(yHat,Y) -abline(coef=c(0,1),col=2) - - -# R^2 -R2 <- 1-sum((Y-yHat)^2)/sum((Y-mean(Y))^2) -R2 - - -# prediction -fit <- FAM(Y=Y,Lx=Lx,Lt=Lt,newLx=LxTest,newLt=LtTest) -yHat <- fit$mu+apply(fit$fam,1,'sum') -par(mfrow=c(1,1)) -plot(yHat,YTest,xlim=c(-10,10)) -abline(coef=c(0,1),col=2) -} -\references{ -\cite{Mueller, H.-G. and Yao, F. (2005), "Functional additive models", JASA, Vol.103, No.484, p.1534-1544.} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/FCCor.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/FCCor.Rd deleted file mode 100644 index 712d5aa3..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/FCCor.Rd +++ /dev/null @@ -1,57 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/FCCor.R -\name{FCCor} -\alias{FCCor} -\title{Calculate functional correlation between two simultaneously observed processes.} -\usage{ -FCCor(x, y, Lt, bw = stop("bw missing"), kern = "epan", - Tout = sort(unique(unlist(Lt)))) -} -\arguments{ -\item{x}{A list of function values corresponding to the first process.} - -\item{y}{A list of function values corresponding to the second process.} - -\item{Lt}{A list of time points for both \code{x} and \code{y}.} - -\item{bw}{A numeric vector for bandwidth of length either 5 or 1, specifying the bandwidths for E(X), E(Y), var(X), var(Y), and cov(X, Y). If \code{bw} is a scalar then all five bandwidths are chosen to be the same.} - -\item{kern}{Smoothing kernel for mu and covariance; "rect", "gauss", "epan", "gausvar", "quar" (default: "gauss")} - -\item{Tout}{Output time points. Default to the sorted unique time points.} -} -\value{ -A list with the following components: -\item{corr}{A vector of the correlation corr(X(t), Y(t)) evaluated at \code{Tout}.} -\item{Tout}{Same as the input Tout.} -\item{bw}{The bandwidths used for E(X), E(Y), var(X), var(Y), and cov(X, Y).} -} -\description{ -Calculate functional correlation between two simultaneously observed processes. -} -\details{ -\code{FCCor} calculate only the concurrent correlation corr(X(t), Y(t)) (note that the time points t are the same). It assumes no measurement error in the observed values. -} -\examples{ -set.seed(1) -n <- 200 -nGridIn <- 50 -sparsity <- 1:5 # must have length > 1 -bw <- 0.2 -kern <- 'epan' -T <- matrix(seq(0.5, 1, length.out=nGridIn)) - -## Corr(X(t), Y(t)) = 1/2 -A <- Wiener(n, T) -B <- Wiener(n, T) -C <- Wiener(n, T) + matrix((1:nGridIn) , n, nGridIn, byrow=TRUE) -X <- A + B -Y <- A + C -indEach <- lapply(1:n, function(x) sort(sample(nGridIn, sample(sparsity, 1)))) -tAll <- lapply(1:n, function(i) T[indEach[[i]]]) -Xsp <- lapply(1:n, function(i) X[i, indEach[[i]]]) -Ysp <- lapply(1:n, function(i) Y[i, indEach[[i]]]) - -plot(T, FCCor(Xsp, Ysp, tAll, bw)[['corr']], ylim=c(-1, 1)) -abline(h=0.5) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/FCReg.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/FCReg.Rd deleted file mode 100644 index a4803a0f..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/FCReg.Rd +++ /dev/null @@ -1,80 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/FCReg.R -\name{FCReg} -\alias{FCReg} -\title{Functional Concurrent Regression by 2D smoothing method.} -\usage{ -FCReg(vars, userBwMu, userBwCov, outGrid, kern = "gauss", - measurementError = TRUE, diag1D = "none", useGAM = FALSE, - returnCov = TRUE) -} -\arguments{ -\item{vars}{A list of input functional/scalar covariates. Each field corresponds to a functional (a list) or scalar (a vector) covariate. The last entry is assumed to be the response if no entry is names 'Y'. If a field corresponds to a functional covariate, it should have two fields: 'Lt', a list of time points, and 'Ly', a list of function values.} - -\item{userBwMu}{A scalar with bandwidth used for smoothing the mean} - -\item{userBwCov}{A scalar with bandwidth used for smoothing the auto- and cross-covariances} - -\item{outGrid}{A vector with the output time points} - -\item{kern}{Smoothing kernel choice, common for mu and covariance; "rect", "gauss", "epan", "gausvar", "quar" (default: "gauss")} - -\item{measurementError}{Indicator measurement errors on the functional observations should be assumed. If TRUE the diagonal raw covariance will be removed when smoothing. (default: TRUE)} - -\item{diag1D}{A string specifying whether to use 1D smoothing for the diagonal line of the covariance. -'none': don't use 1D smoothing; 'cross': use 1D only for cross-covariances; 'all': use 1D for both auto- and cross-covariances. (default : 'none')} - -\item{useGAM}{Indicator to use gam smoothing instead of local-linear smoothing (semi-parametric option) (default: FALSE)} - -\item{returnCov}{Indicator to return the covariance surfaces, which is a four dimensional array. The first two dimensions correspond to outGrid -and the last two correspond to the covariates and the response, i.e. (i, j, k, l) entry being Cov(X_k(t_i), X_l(t_j)) (default: FALSE)} - -\item{...}{Additional arguments} -} -\description{ -Functional concurrent regression with dense or sparse functional data for scalar or functional dependent variable. -} -\details{ -If measurement error is assumed, the diagonal elements of the raw covariance will be removed. This could result in highly unstable estimate if the design is very sparse, or strong seasonality presents. -} -\examples{ -# Y(t) = \\beta_0(t) + \\beta_1(t) X_1(t) + \\beta_2(t) Z_2 + \\epsilon - -# Settings -set.seed(1) -n <- 75 -nGridIn <- 150 -sparsity <- 5:10 # Sparse data sparsity -T <- round(seq(0, 1, length.out=nGridIn), 4) # Functional data support -bw <- 0.1 -outGrid <- round(seq(min(T), 1, by=0.05), 2) - -# Simulate functional data -mu <- T * 2 # mean function for X_1 -sigma <- 1 - -beta_0 <- 0 -beta_1 <- 1 -beta_2 <- 1 - -Z <- MASS::mvrnorm(n, rep(0, 2), diag(2)) -X_1 <- Z[, 1, drop=FALSE] \%*\% matrix(1, 1, nGridIn) + matrix(mu, n, nGridIn, byrow=TRUE) -epsilon <- rnorm(n, sd=sigma) -Y <- matrix(NA, n, nGridIn) -for (i in seq_len(n)) { - Y[i, ] <- beta_0 + beta_1 * X_1[i, ] + beta_2 * Z[i, 2] + epsilon[i] -} - -# Sparsify functional data -set.seed(1) -X_1sp <- Sparsify(X_1, T, sparsity) -set.seed(1) -Ysp <- Sparsify(Y, T, sparsity) -vars <- list(X_1=X_1sp, Z_2=Z[, 2], Y=Ysp) -withError2D <- FCReg(vars, bw, bw, outGrid) -} -\references{ -\cite{Yao, F., Mueller, H.G., Wang, J.L. "Functional Linear Regression Analysis for Longitudinal Data." Annals of Statistics 33, (2005): 2873-2903.(Dense data)} - -\cite{Senturk, D., Nguyen, D.V. "Varying Coefficient Models for Sparse Noise-contaminated Longitudinal Data", Statistica Sinica 21(4), (2011): 1831-1856. (Sparse data)} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/FClust.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/FClust.Rd deleted file mode 100644 index 26d8235a..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/FClust.Rd +++ /dev/null @@ -1,61 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/FClust.R -\name{FClust} -\alias{FClust} -\title{Functional clustering and identifying substructures of longitudinal data} -\usage{ -FClust(Ly, Lt, k = 3, cmethod = "EMCluster", optnsFPCA = NULL, - optnsCS = NULL) -} -\arguments{ -\item{Ly}{A list of \emph{n} vectors containing the observed values for each individual. Missing values specified by \code{NA}s are supported for dense case (\code{dataType='dense'}).} - -\item{Lt}{A list of \emph{n} vectors containing the observation time points for each individual corresponding to y.} - -\item{k}{A scalar defining the number of clusters to define; default 3.} - -\item{cmethod}{A string specifying the clusterig method to use ('EMCluster' or 'kCFC'); default: 'EMCluster'.} - -\item{optnsFPCA}{A list of options control parameters specified by \code{list(name=value)} to be used for by FPCA on the sample y; by default: -"list( methodMuCovEst ='smooth', FVEthreshold= 0.90, methodBwCov = 'GCV', methodBwMu = 'GCV' )". See `Details in ?FPCA'.} - -\item{optnsCS}{A list of options control parameters specified by \code{list(name=value)} to be used for cluster-specific FPCA from kCFC; by default: -"list( methodMuCovEst ='smooth', FVEthreshold= 0.70, methodBwCov = 'GCV', methodBwMu = 'GCV' )". See `Details in ?FPCA' and '?kCFC'.} -} -\value{ -A list containing the following fields: -\item{cluster}{A vector of levels 1:k, indicating the cluster to which each curve is allocated.} -\item{fpca}{An FPCA object derived from the sample used by Rmixmod, otherwise NULL.} -\item{clusterObj}{Either a EMCluster object or kCFC object.} -} -\description{ -By default the function will cluster the data using the functional principal component (FPC) scores from the data's -FPC analysis using EMCluster (Chen and Maitra, 2015) or directly clustering the functional data using kCFC (Chiou and Li, 2007). -} -\details{ -Within EMCluster we examine the model initiated "EMCluster::em.EM" and return the optimal model based on 'EMCluster::emcluster'. -See ?EMCluster::emcluster for details. -} -\examples{ -\dontrun{ -data(medfly25) -Flies <- MakeFPCAInputs(medfly25$ID, medfly25$Days, medfly25$nEggs) -newClust <- FClust(Flies$Ly, Flies$Lt, k = 2, optnsFPCA = - list(methodMuCovEst = 'smooth', userBwCov = 2, FVEthreshold = 0.90)) - -# We denote as 'veryLowCount' the group of flies that lay less -# than twenty-five eggs during the 25-day period examined. - -veryLowCount = ifelse( sapply( unique(medfly25$ID), function(u) - sum( medfly25$nEggs[medfly25$ID == u] )) < 25, 0, 1) -N <- length(unique(medfly25$ID)) -(correctRate <- sum( (1 + veryLowCount) == newClust$cluster) / N) # 99.6\% -} -} -\references{ -\cite{Wei-Chen Chen and Ranjan Maitra, "EMCluster: EM Algorithm for Model-Based Clusttering of Finite Mixture Gaussian Distribution". (2015)} - -\cite{Julien Jacques and Cristian Preda, "Funclust: A curves clustering method using functional random variables density approximation". Neurocomputing 112 (2013): 164-171} - -\cite{Jeng-Min Chiou and Pai-Ling Li, "Functional clustering and identifying substructures of longitudinal data". Journal of the Royal Statistical Society B 69 (2007): 679-699} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/FOptDes.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/FOptDes.Rd deleted file mode 100644 index 08f1732c..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/FOptDes.Rd +++ /dev/null @@ -1,56 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/FOptDes.R -\name{FOptDes} -\alias{FOptDes} -\title{Optimal Designs for Functional and Longitudinal Data -for Trajectory Recovery or Scalar Response Prediction} -\usage{ -FOptDes(Ly, Lt, Resp, p = 3, optns = list(), - isRegression = !missing(Resp), isSequential = FALSE, - RidgeCand = NULL) -} -\arguments{ -\item{Ly}{A list of \emph{n} vectors containing the observed values for each individual. Missing values specified by \code{NA}s are supported for dense case (\code{dataType='dense'}).} - -\item{Lt}{A list of \emph{n} vectors containing the observation time points for each individual corresponding to y. Each vector should be sorted in ascending order.} - -\item{Resp}{A vector of response values, keep void for trajectory recovery, only necessary for scalar response prediction task.} - -\item{p}{A fixed positive integer indicating the number of optimal design points requested, with default: 3.} - -\item{optns}{A list of options control parameters specified by \code{list(name=value)} for FPCA, with default: list().} - -\item{isRegression}{A logical argument, indicating the purpose of the optimal designs: TRUE for scalar response prediction, FALSE for trajectory recovery, with default value !missing(Resp).} - -\item{isSequential}{A logical argument, indicating whether to use the sequential optimization procedure for faster computation, recommended for relatively large p (default: FALSE).} - -\item{RidgeCand}{A vector of positive numbers as ridge penalty candidates for regularization. The final value is selected via cross validation. If only 1 ridge parameter is specified, CV procedure is skipped.} -} -\value{ -A list containing the following fields: -\item{OptDes}{The vector of optimal design points of the regular time grid of the observed data.} -\item{R2}{Coefficient of determination. (Check the paper for details.)} -\item{R2adj}{Adjusted coefficient of determination.} -\item{OptRidge}{The selected ridge parameter.} -} -\description{ -Optimal Designs for Functional and Longitudinal Data -for Trajectory Recovery or Scalar Response Prediction -} -\details{ -To select a proper RidgeCand, check with the returned optimal ridge parameter. If the selected parameter is the maximum/minimum values in the candidates, it is possible that the selected one is too small/big. -} -\examples{ -set.seed(1) -n <- 50 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- MakeFPCAInputs(IDs = rep(1:n, each=length(pts)), - tVec = rep(pts, times = n), - yVec = t(sampWiener)) -res <- FOptDes(Ly=sampWiener$Ly, Lt=sampWiener$Lt, p=2, - isSequential=FALSE, RidgeCand = seq(0.02,0.2,0.02)) -} -\references{ -\cite{Ji, H., Mueller, H.G. (2016) "Optimal Designs for Longitudinal and Functional Data" Journal of the Royal Statistical Society: Series B (Statistical Methodology)} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/FPCA.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/FPCA.Rd deleted file mode 100644 index e7a4d69e..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/FPCA.Rd +++ /dev/null @@ -1,98 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/FPCA.R -\name{FPCA} -\alias{FPCA} -\title{Functional Principal Component Analysis} -\usage{ -FPCA(Ly, Lt, optns = list()) -} -\arguments{ -\item{Ly}{A list of \emph{n} vectors containing the observed values for each individual. Missing values specified by \code{NA}s are supported for dense case (\code{dataType='dense'}).} - -\item{Lt}{A list of \emph{n} vectors containing the observation time points for each individual corresponding to y. Each vector should be sorted in ascending order.} - -\item{optns}{A list of options control parameters specified by \code{list(name=value)}. See `Details'.} -} -\value{ -A list containing the following fields: -\item{sigma2}{Variance for measure error.} -\item{lambda}{A vector of length \emph{K} containing eigenvalues.} -\item{phi}{An nWorkGrid by \emph{K} matrix containing eigenfunctions, supported on workGrid.} -\item{xiEst}{A \emph{n} by \emph{K} matrix containing the FPC estimates.} -\item{xiVar}{A list of length \emph{n}, each entry containing the variance estimates for the FPC estimates.} -\item{obsGrid}{The (sorted) grid points where all observation points are pooled.} -\item{mu}{A vector of length nWorkGrid containing the mean function estimate.} -\item{workGrid}{A vector of length nWorkGrid. The internal regular grid on which the eigen analysis is carried on.} -\item{smoothedCov}{A nWorkGrid by nWorkGrid matrix of the smoothed covariance surface.} -\item{fittedCov}{A nWorkGrid by nWorkGrid matrix of the fitted covariance surface, which is guaranteed to be non-negative definite.} -\item{optns}{A list of actually used options.} -\item{timings}{A vector with execution times for the basic parts of the FPCA call.} -\item{bwMu}{The selected (or user specified) bandwidth for smoothing the mean function.} -\item{bwCov}{The selected (or user specified) bandwidth for smoothing the covariance function.} -\item{rho}{A regularizing scalar for the measurement error variance estimate.} -\item{cumFVE}{A vector with the percentages of the total variance explained by each FPC. Increase to almost 1.} -\item{FVE}{A percentage indicating the total variance explained by chosen FPCs with corresponding 'FVEthreshold'.} -\item{criterionValue}{A scalar specifying the criterion value obtained by the selected number of components with specific methodSelectK: FVE,AIC,BIC values or NULL for fixedK.} -\item{inputData}{A list containting the original 'Ly' and 'Lt' lists used as inputs to FPCA. NULL if 'lean' was specified to be TRUE.} -} -\description{ -FPCA for dense or sparse functional data. -} -\details{ -If the input is sparse data, make sure you check the design plot is dense and the 2D domain is well covered, using \code{plot} or \code{CreateDesignPlot}. Some study design such as snippet data (each subject is observed only on a sub-interval of the period of study) will have an ill-covered design plot, for which the covariance estimate will be unreliable. - -Available control options are -\describe{ -\item{userBwCov}{The bandwidth value for the smoothed covariance function; positive numeric - default: determine automatically based on 'methodBwCov'} -\item{methodBwCov}{The bandwidth choice method for the smoothed covariance function; 'GMeanAndGCV' (the geometric mean of the GCV bandwidth and the minimum bandwidth),'CV','GCV' - default: 10\% of the support} -\item{userBwMu}{The bandwidth value for the smoothed mean function (using 'CV' or 'GCV'); positive numeric - default: determine automatically based on 'methodBwMu'} -\item{methodBwMu}{The bandwidth choice method for the mean function; 'GMeanAndGCV' (the geometric mean of the GCV bandwidth and the minimum bandwidth),'CV','GCV' - default: 5\% of the support} -\item{dataType}{The type of design we have (usually distinguishing between sparse or dense functional data); 'Sparse', 'Dense', 'DenseWithMV', 'p>>n' - default: determine automatically based on 'IsRegular'} -\item{diagnosticsPlot}{Deprecated. Same as the option 'plot'} -\item{plot}{Plot FPCA results (design plot, mean, scree plot and first K (<=3) eigenfunctions); logical - default: FALSE} -\item{error}{Assume measurement error in the dataset; logical - default: TRUE} -\item{fitEigenValues}{Whether also to obtain a regression fit of the eigenvalues - default: FALSE} -\item{FVEthreshold}{Fraction-of-Variance-Explained threshold used during the SVD of the fitted covar. function; numeric (0,1] - default: 0.9999} -\item{kernel}{Smoothing kernel choice, common for mu and covariance; "rect", "gauss", "epan", "gausvar", "quar" - default: "gauss"; dense data are assumed noise-less so no smoothing is performed. } -\item{kFoldMuCov}{The number of folds to be used for mean and covariance smoothing. Default: 10} -\item{lean}{If TRUE the 'inputData' field in the output list is empty. Default: FALSE} -\item{maxK}{The maximum number of principal components to consider - default: min(20, N-1), N:# of curves} -\item{methodXi}{The method to estimate the PC scores; 'CE' (Condit. Expectation), 'IN' (Numerical Integration) - default: 'CE' for sparse data and dense data with missing values, 'IN' for dense data.} -\item{methodMuCovEst}{The method to estimate the mean and covariance in the case of dense functional data; 'cross-sectional', 'smooth' - default: 'cross-sectional'} -\item{nRegGrid}{The number of support points in each direction of covariance surface; numeric - default: 51} -\item{numBins}{The number of bins to bin the data into; positive integer > 10, default: NULL} -\item{methodSelectK}{The method of choosing the number of principal components K; 'FVE','AIC','BIC', or a positive integer as specified number of components: default 'FVE')} -\item{shrink}{Whether to use shrinkage method to estimate the scores in the dense case (see Yao et al 2003) - default FALSE} -\item{outPercent}{A 2-element vector in [0,1] indicating the outPercent data in the boundary - default (0,1)} -\item{rho}{The truncation threshold for the iterative residual. 'cv': choose rho by leave-one-observation out cross-validation; 'no': no regularization - default "cv" if error == TRUE, and "no" if error == FALSE.} -\item{rotationCut}{The 2-element vector in [0,1] indicating the percent of data truncated during sigma^2 estimation; default (0.25, 0.75))} -\item{useBinnedData}{Should the data be binned? 'FORCE' (Enforce the # of bins), 'AUTO' (Select the # of bins automatically), 'OFF' (Do not bin) - default: 'AUTO'} -\item{useBinnedCov}{Whether to use the binned raw covariance for smoothing; logical - default:TRUE} -\item{userCov}{The user-defined smoothed covariance function; list of two elements: numerical vector 't' and matrix 'cov', 't' must cover the support defined by 'Ly' - default: NULL} -\item{userMu}{The user-defined smoothed mean function; list of two numerical vector 't' and 'mu' of equal size, 't' must cover the support defined 'Ly' - default: NULL} -\item{userSigma2}{The user-defined measurement error variance. A positive scalar. If specified then no regularization is used (rho is set to 'no', unless specified otherwise). Default to `NULL`} -\item{userRho}{The user-defined measurement truncation threshold used for the calculation of functional principal components scores. A positive scalar. Default to `NULL`} -\item{useBW1SE}{Pick the largest bandwidth such that CV-error is within one Standard Error from the minimum CV-error, relevant only if methodBwMu ='CV' and/or methodBwCov ='CV'; logical - default: FALSE} -\item{verbose}{Display diagnostic messages; logical - default: FALSE} -} -} -\examples{ -set.seed(1) -n <- 20 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- Sparsify(sampWiener, pts, 10) -res <- FPCA(sampWiener$Ly, sampWiener$Lt, - list(dataType='Sparse', error=FALSE, kernel='epan', verbose=TRUE)) -plot(res) # The design plot covers [0, 1] * [0, 1] well. -CreateCovPlot(res, 'Fitted') -} -\references{ -\cite{Yao, F., Mueller, H.G., Clifford, A.J., Dueker, S.R., Follett, J., Lin, Y., Buchholz, B., Vogel, J.S. (2003). "Shrinkage estimation for functional principal component scores, with application to the population kinetics of plasma folate." Biometrics 59, 676-685. (Shrinkage estimates for dense data)} - -\cite{Yao, Fang, Hans-Georg Mueller, and Jane-Ling Wang. "Functional data analysis for sparse longitudinal data." Journal of the American Statistical Association 100, no. 470 (2005): 577-590. (Sparse data FPCA)} - -\cite{Liu, Bitao, and Hans-Georg Mueller. "Estimating derivatives for samples of sparsely observed functions, with application to online auction dynamics." Journal of the American Statistical Association 104, no. 486 (2009): 704-717. (Sparse data FPCA)} - -\cite{Castro, P. E., W. H. Lawton, and E. A. Sylvestre. "Principal modes of variation for processes with continuous sample curves." Technometrics 28, no. 4 (1986): 329-337. (Dense data FPCA)} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/FPCAder.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/FPCAder.Rd deleted file mode 100644 index 3398771d..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/FPCAder.Rd +++ /dev/null @@ -1,67 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/FPCAder.R -\name{FPCAder} -\alias{FPCAder} -\title{Take derivative of an FPCA object} -\usage{ -FPCAder(fpcaObj, derOptns = list(p = 1)) -} -\arguments{ -\item{fpcaObj}{A object of class FPCA returned by the function FPCA().} - -\item{derOptns}{A list of options to control the derivation parameters specified by \code{list(name=value)}. See `Details'. (default = NULL)} -} -\description{ -Take derivative of an FPCA object -} -\details{ -Available derivation control options are -\describe{ -\item{method}{The method used for obtaining the derivatives (default: 'FPC'). 'DPC': derivatives principal component, with G^(1,1) estimated by first kernel local smoothing G^(1,0), and then apply a 1D smoother on the second direction; 'FPC': functional principal component, based on smoothing the eigenfunctions; 'FPC1': functional principal component, based on smoothing G^(1,0). May produce better estimate than 'FPC' but is slower.} -\item{p}{The order of the derivatives returned (default: 1, max: 2). } -\item{bw}{Bandwidth for the 1D and the 2D smoothers (default: p * 0.1 * S).} -\item{kernelType}{Smoothing kernel choice; same available types are FPCA(). default('epan')} -} -} -\examples{ - -bw <- 0.2 -kern <- 'epan' -set.seed(1) -n <- 100 -M <- 40 -pts <- seq(0, 1, length.out=M) -lambdaTrue <- c(1, 0.8, 0.1)^2 -sigma2 <- 0.1 - -samp2 <- MakeGPFunctionalData(n, M, pts, K=length(lambdaTrue), - lambda=lambdaTrue, sigma=sqrt(sigma2), basisType='legendre01') -samp2 <- c(samp2, MakeFPCAInputs(tVec=pts, yVec=samp2$Yn)) -fpcaObj <- FPCA(samp2$Ly, samp2$Lt, list(methodMuCovEst='smooth', - userBwCov=bw, userBwMu=bw, kernel=kern, error=TRUE)) -CreatePathPlot(fpcaObj, showObs=FALSE) - -FPCoptn <- list(bw=bw, kernelType=kern, method='FPC') -DPCoptn <- list(bw=bw, kernelType=kern, method='DPC') -FPC <- FPCAder(fpcaObj, FPCoptn) -DPC <- FPCAder(fpcaObj, DPCoptn) - -CreatePathPlot(FPC, ylim=c(-5, 10)) -CreatePathPlot(DPC, ylim=c(-5, 10)) - -# Get the true derivatives -phi <- CreateBasis(K=3, type='legendre01', pts=pts) -basisDerMat <- apply(phi, 2, function(x) - ConvertSupport(seq(0, 1, length.out=M - 1), pts, diff(x) * (M - 1))) -trueDer <- matrix(1, n, M, byrow=TRUE) + tcrossprod(samp2$xi, basisDerMat) -matplot(t(trueDer), type='l', ylim=c(-5, 10)) - -# DPC is slightly better in terms of RMSE -mean((fitted(FPC) - trueDer)^2) -mean((fitted(DPC) - trueDer)^2) - -} -\references{ -\cite{Dai, Xiongtao, Hans-Georg Mueller, and Wenwen Tao. "Derivative Principal Component Analysis for Representing the Time Dynamics of Longitudinal and Functional Data." Submitted (DPC)} -\cite{Liu, Bitao, and Hans-Georg Mueller. "Estimating derivatives for samples of sparsely observed functions, with application to online auction dynamics." Journal of the American Statistical Association 104, no. 486 (2009): 704-717. (FPC)} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/FPCReg.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/FPCReg.Rd deleted file mode 100644 index a291cce0..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/FPCReg.Rd +++ /dev/null @@ -1,152 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/FPCReg.R -\name{FPCReg} -\alias{FPCReg} -\title{Function for performing functonal linear regression where the covariates are functions X1(t1),X2(t2),.. and the response is a function Y(t_y).} -\usage{ -FPCReg(vars, varsOptns = NULL, isNewSub = NULL, method = "AIC", - FVEthreshold = 0.99, alpha = 0.05, Kx = NULL) -} -\arguments{ -\item{vars}{A list of input functional covariates with name of "X1", "X2",.. and a functional response with name "Y". Each field should have two fields: 'Lt', a list (sparse) or a matrix (Dense) specifying the time of observations, and 'Ly', a list (Sparse) or a matrix (Dense) of the observations.} - -\item{varsOptns}{A list of options named by "X1", "X2",..."Y". Each filed specify the paramaters that control the corresponding variables. (default: see details of FPCA())} - -\item{isNewSub}{A 1*n vector of 0s or 1s, where n is the total count of subjects. 0 denotes the corresponding subject is only used for estimation and 1 denotes the corresponding subject is only used for prediction. (default: 0's)} - -\item{method}{The method used for selecting the number of principal components of functional predictors X's used in functional regression , including 'AIC', 'BIC' and 'FVE'. (default: "AIC")} - -\item{FVEthreshold}{A scalar specifying the proportion used for 'FVE'. (default: 0.99)} - -\item{alpha}{A scalar specifying the level of the confidence bands. (default: 0.05)} - -\item{Kx}{The number of principal components of functional predictors X's used in functional regression.} -} -\value{ -A list containing the following fields: -\item{estiBeta}{A list with fields of estimated beta_XiY(s,t) defiend on [range(Xi),range(Y)]} -\item{predictY}{A list containing fitted or predicted (when is NewSub is true) functions for E(Y|X).} -\item{cbandY}{A list with confidence bands of E(Y|X).} -\item{Q}{Quasi R-square} -\item{r2}{Functional R-square.} -\item{varsMean}{A list with mean function of covariates and response.} -\item{Kx}{The number of principal components of functional predictors X's used in functional regression.} -} -\description{ -Function for performing functonal linear regression where the covariates are functions X1(t1),X2(t2),.. and the response is a function Y(t_y). -} -\examples{ -set.seed(1000) -#Model: E(Y(t)|X) = int(beta(s,t)*X(s)) -n <- 200 #number of subjects -ngrids <- 51 #number of grids in [0,1] for X(s) -ngridt <- 101 #number of grids in [0,1] for Y(t) -grids <- seq(0, 1, length.out=ngrids) #regular grids in [0,1] for X(s) -gridt <- seq(0, 1, length.out=ngridt) #regular grids in [0,1] for Y(t) - -#generate X -#{1, sqrt(2)*sin(2*pi*s), sqrt(2)*cos(2*pi*t)} are used to generate X. -eigenFun <- list( function(s){1 + 0 * s}, - function(s){sqrt(2) * sin(2*pi*s)}, - function(s){sqrt(2) * cos(2*pi*s)}) - -sig <- matrix(c(1.5, 0.0, 0.0, 0.9, -.5, 0.1, - 0.0, 1.2, 0.0, -.3, 0.8, 0.4, - 0.0, 0.0, 1.0, 0.4, -.3, 0.7, - 0.9, -.3, 0.4, 2.0, 0.0, 0.0, - -.5, 0.8, -.3, 0.0, 1.5, 0.0, - 0.1, 0.4, 0.7, 0.0, 0.0, 1.0), - nrow=6,ncol=6) - -scoreX <- MASS::mvrnorm(n,mu=rep(0,6),Sigma=sig) -scoreX1 <- scoreX[,1:3] -scoreX2 <- scoreX[,4:6] - -basisX1 <- sapply(eigenFun,function(x){x(grids)}) -latentX1 <- scoreX1 \%*\% t(basisX1) -measErrX1 <- sqrt(0.03) * matrix(rnorm(n * ngrids), n, ngrids) #0.01 is sigma^2. -denseX1 <- latentX1 + measErrX1 - -basisX2 <- sapply(eigenFun,function(x){x(grids)}) -latentX2 <- scoreX2 \%*\% t(basisX2) -measErrX2 <- sqrt(0.03) * matrix(rnorm(n * ngrids), n, ngrids) #0.01 is sigma^2. -denseX2 <- latentX2 + measErrX2 - -#generate Y -#beta(s, t) <- sin(2 * pi * s)*cos(2 * pi * t) -betaEigen1 <- function(t){f <- function(s){ - sin(2*pi*s) * cos(2*pi*t) * (1+0*s)}; return(f)} -betaEigen2 <- function(t){f <- function(s){ - sin(2*pi*s) * cos(2*pi*t) * (sqrt(2)*sin(2*pi*s))}; return(f)} -betaEigen3 <- function(t){f <- function(s){ - sin(2*pi*s) * cos(2*pi*t) * (sqrt(2)*cos(2*pi*s))}; return(f)} -betaEigen <- list(betaEigen1, betaEigen2, betaEigen3) -basisY <- array(0,c(ngridt, 3)) -for(i in 1:3){ - intbetaEigen <- function (t) {integrate(betaEigen[[i]](t), lower = 0, upper = 1)$value} - basisY[, i] <- sapply(1:ngridt, function(x){intbetaEigen(gridt[x])}) - } -latentY <- scoreX1 \%*\% t(basisY) - scoreX2 \%*\% t(basisY) -measErrY <- sqrt(0.01) * matrix(rnorm(n*ngridt), n, ngridt) #0.01 is sigma^2 -denseY <- latentY + measErrY - -#======Dense data=============================================== -timeX <- t(matrix(rep(grids, n),length(grids), n)) -timeY <- t(matrix(rep(gridt, n),length(gridt), n)) -denseVars <- list(X1 = list(Ly = denseX1, Lt = timeX), - X2 = list(Ly = denseX2, Lt = timeX), - Y=list(Ly = denseY,Lt = timeY)) - -resuDense <- FPCReg(denseVars, method="FVE") - -par(mfrow=c(1,2)) -estiBetaX1Y_Dense <- resuDense$estiBeta$betaX1Y -args1 <- list(xlab = 's', ylab = 't', zlab = 'estiBetaX1Y_Dense(s, t)', - lighting = FALSE, phi = 45, theta = 45) -args2 <- list(x = 1:ngrids, y = 1:ngridt, z = estiBetaX1Y_Dense[1:ngrids, 1:ngridt]) -do.call(plot3D::persp3D,c(args2, args1)) - -estiBetaX2Y_Dense <- resuDense$estiBeta$betaX2Y -args1 <- list(xlab = 's', ylab = 't', zlab = 'estiBetaX2Y_Dense(s, t)', - lighting = FALSE, phi = 45, theta = 45) -args2 <- list(x = 1:ngrids, y = 1:ngridt, z = estiBetaX2Y_Dense[1:ngrids, 1:ngridt]) - # do.call(plot3D::persp3D,c(args2, args1)) - -#======Sparse data=============================================== -\dontrun{ -sparsity = 5:8 -sparseX1 <- Sparsify(denseX1, grids, sparsity) -sparseX2 <- Sparsify(denseX2, grids, sparsity) -sparseY <- Sparsify(denseY, gridt, sparsity) -sparseVars <- list(X1 = sparseX1, X2 = sparseX2, Y = sparseY) - -resuSparse <- FPCReg(sparseVars, method="FVE", FVEthreshold=0.98) -#or resuSparse <- FPCReg(vars = sparseVars, -# varsOptns = list(X1=list(userBwCov = 0.03))) - -par(mfrow=c(1,2)) -estiBetaX1Y_Sparse = resuSparse$estiBeta$betaX1Y -args1 = list(xlab = 's', ylab = 't', zlab = 'estiBetaX1Y_Sparse(s,t)', - lighting = FALSE, phi = 45,theta = 45) -args2 = list(x = 1:51, y = 1:51, z = estiBetaX1Y_Sparse[1:51, 1:51]) -do.call(plot3D::persp3D, c(args2, args1)) - -estiBetaX2Y_Sparse = resuSparse$estiBeta$betaX2Y -args1 = list(xlab = 's', ylab = 't', zlab = 'estiBetaX2Y_Sparse(s,t)', - lighting = FALSE, phi = 45,theta = 45) -args2 = list(x = 1:51, y = 1:51, z = estiBetaX2Y_Sparse[1:51, 1:51]) -do.call(plot3D::persp3D, c(args2, args1)) - -par(mfrow=c(2,3)) -for(i in 1:6){ - plot(sparseVars[['Y']]$Lt[[i]], sparseVars[['Y']]$Ly[[i]], - xlab = 'time', ylab = 'observations', ylim = c(-1.5, 1.5)) - lines(seq(0, 1, length.out = 51), resuSparse$predictY[[i]]) - lines(seq(0, 1, length.out = 51), resuSparse$cbandY[[i]][,2], lty = 2) - lines(seq(0, 1, length.out = 51), resuSparse$cbandY[[i]][,1], lty = 2) - } - } -} -\references{ -\cite{Yao, F., Mueller, H.G., Wang, J.L. "Functional Linear Regression Analysis for Longitudinal Data." Annals of Statistics 33, (2005): 2873-2903.} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/FPCquantile.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/FPCquantile.Rd deleted file mode 100644 index 4f75d927..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/FPCquantile.Rd +++ /dev/null @@ -1,59 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/FPCquantile.R -\name{FPCquantile} -\alias{FPCquantile} -\title{Conditional Quantile estimation with functional covariates} -\usage{ -FPCquantile(Lx, Lt_x, y, outQ = c(0.1, 0.25, 0.5, 0.75, 0.9), - optns_x = NULL, isNewsub = NULL) -} -\arguments{ -\item{Lx}{A length n list of predictor function where x[[i]] is the row vector of measurements for ith subject, i=1,...,n} - -\item{Lt_x}{A length n list where the observations of x are taken, t_x[[i]] is a row vector of time points where x[[i]] are observed, i=1,...,n} - -\item{y}{A 1*n vector for scalar response y. y[i] is the response value for the ith subject, i = 1,...,n.} - -\item{outQ}{A vector of desired quantile levels with default value outQ = c(0.1, 0.25, 0.5, 0.75, 0.9).} - -\item{optns_x}{A list of options for predictor x with control parameters specified by list(name=value) with default NA. See function FPCA for details.} - -\item{isNewSub}{A 1*n vector of 0s or 1s, where n is the total count of subjects. 0 denotes the corresponding subject is only used for training and 1 denotes the corresponding subject is only used for prediction. (default: 0's)} -} -\value{ -A list of the following -\item{pred_quantile: a matrix of n*length(outQ) where the the first nn (number of 0s in isNewSub) rows containing fitted conditional quantiles of Y corresponding to the trainning subjects, and the last n-nn rows containing predicted conditional quantiles of Y corresponding to the subjects isNewSub ==1.} -\item{pred_CDF: a matrix of n*100. The ith row contains the fitted or predicted conditional distribution function \eqn{F(y|X_i)}, evaluated at an equally spaced grid of 100 points.} -\item{b: a matrix of 50*(K+1) contains the coefficient functions, defined as \eqn{F(y|X) = g(\sum_(k=0)^K b_k(y)\xi_k)}, see equation (5) in the paper for details, where K is the number of components selected to expand the predictor functions X, and \eqn{\xi_k} is the kth principal component score.} -} -\description{ -Main function to implement conditional Quantile estimation with functional covariates and scalar response. The method includes 3 steps: -1) FPCA using the PACE method for X(t_x) -2) Computation of the conditional distribution function through a functional generalized linear model. -3) Prediction of quantiles for given predictor values -} -\examples{ -set.seed(10) - -n = 200 -npred = 50 -m = 50 -xi <- Wiener(n, 0:m/m) - -x=list() -t_x=list() -y=numeric(n) -for(i in 1:n){ - t_x = c(t_x,list(0:m/m)) - x = c(x,list(xi[i,])) - y[i] = 5*rnorm(1)+2*sum(xi[i,]) -} - -outQ = c(0.1,0.25,0.5,0.75,0.9,0.95) -isNewsub = c(rep(0,150),rep(1,50)) -qtreg = FPCquantile(x, t_x, y, outQ,optns_x = NULL,isNewsub) - -} -\references{ -\cite{Chen, K., M\"uller, H.G. (2011). Conditional quantile analysis when covariates are functions, with application to growth data. J. Royal Statistical Society B.} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/FSVD.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/FSVD.Rd deleted file mode 100644 index 984779e9..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/FSVD.Rd +++ /dev/null @@ -1,64 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/FSVD.R -\name{FSVD} -\alias{FSVD} -\title{Functional Singular Value Decomposition} -\usage{ -FSVD(Ly1, Lt1, Ly2, Lt2, FPCAoptns1 = NULL, FPCAoptns2 = NULL, - SVDoptns = list()) -} -\arguments{ -\item{Ly1}{A list of \emph{n} vectors containing the observed values for each individual. Missing values specified by \code{NA}s are supported for dense case (\code{dataType='dense'}).} - -\item{Lt1}{A list of \emph{n} vectors containing the observation time points for each individual corresponding to y. Each vector should be sorted in ascending order.} - -\item{Ly2}{A list of \emph{n} vectors containing the observed values for each individual. Missing values specified by \code{NA}s are supported for dense case (\code{dataType='dense'}).} - -\item{Lt2}{A list of \emph{n} vectors containing the observation time points for each individual corresponding to y. Each vector should be sorted in ascending order.} - -\item{FPCAoptns1}{A list of options control parameters specified by \code{list(name=value)} for the FPC analysis of sample 1. See `?FPCA'.} - -\item{FPCAoptns2}{A list of options control parameters specified by \code{list(name=value)} for the FPC analysis of sample 2. See `?FPCA'.} - -\item{SVDoptns}{A list of options control parameters specified by \code{list(name=value)} for the FSVD analysis of samples 1 & 2. See `Details`.} -} -\value{ -A list containing the following fields: -\item{bw1}{The selected (or user specified) bandwidth for smoothing the cross-covariance function across the support of sample 1.} -\item{bw2}{The selected (or user specified) bandwidth for smoothing the cross-covariance function across the support of sample 2.} -\item{CrCov}{The smoothed cross-covariance between samples 1 & 2.} -\item{sValues}{A list of length \emph{nsvd}, each entry containing the singuar value estimates for the FSC estimates.} -\item{nsvd}{The number of singular componentes used.} -\item{canCorr}{The canonical correlations for each dimension.} -\item{FVE}{A percentage indicating the total variance explained by chosen FSCs with corresponding 'FVEthreshold'.} -\item{sFun1}{An nWorkGrid by \emph{K} matrix containing the estimated singular functions for sample 1.} -\item{sFun2}{An nWorkGrid by \emph{K} matrix containing the estimated singular functions for sample 2.} -\item{grid1}{A vector of length nWorkGrid1. The internal regular grid on which the singular analysis is carried on the support of sample 1.} -\item{grid2}{A vector of length nWorkGrid2. The internal regular grid on which the singular analysis is carried on the support of sample 2.} -\item{sScores1}{A \emph{n} by \emph{K} matrix containing the singular scores for sample 1.} -\item{sScores2}{A \emph{n} by \emph{K} matrix containing the singular scores for sample 2.} -\item{optns}{A list of options used by the SVD and the FPCA's procedures.} -} -\description{ -FSVD for a pair of dense or sparse functional data. -} -\details{ -Available control options for SVDoptns are: -\describe{ -\item{bw1}{The bandwidth value for the smoothed cross-covariance function across the direction of sample 1; positive numeric - default: determine automatically based on 'methodBwCov'} -\item{bw2}{The bandwidth value for the smoothed cross-covariance function across the direction of sample 2; positive numeric - default: determine automatically based on 'methodBwCov'} -\item{methodBwCov}{The bandwidth choice method for the smoothed covariance function; 'GMeanAndGCV' (the geometric mean of the GCV bandwidth and the minimum bandwidth),'CV','GCV' - default: 10\% of the support} -\item{userMu1}{The user defined mean of sample 1 used to centre it prior to the cross-covariance estimation. - default: determine automatically based by the FPCA of sample 1} -\item{userMu2}{The user defined mean of sample 2 used to centre it prior to the cross-covariance estimation. - default: determine automatically based by the FPCA of sample 2} -\item{maxK}{The maximum number of singular components to consider; default: min(20, N-1), N:# of curves.} -\item{kernel}{Smoothing kernel choice, common for mu and covariance; "rect", "gauss", "epan", "gausvar", "quar" - default: "gauss"; dense data are assumed noise-less so no smoothing is performed.} -\item{rmDiag}{Logical describing if the routine should remove diagonal raw cov for cross cov estimation (default: FALSE) } -\item{noScores}{Logical describing if the routine should return functional singular scores or not (default: TRUE) } -\item{regulRS}{String describing if the regularisation of the compositie cross-covariance matrix should be done using 'sigma1' or 'rho' (see ?FPCA for details) (default: 'sigma2') } -\item{bwRoutine}{String specifying the routine used to find the optimal bandwidth 'grid-search', 'bobyqa', 'l-bfgs-b' (default: 'l-bfgs-b')} -\item{flip}{Logical describing if the routine should flip the sign of the singular components functions or not after the SVD of the cross-covariance matrix. (default: FALSE)} -\item{useGAM}{Indicator to use gam smoothing instead of local-linear smoothing (semi-parametric option) (default: FALSE)} -\item{dataType1}{The type of design we have for sample 1 (usually distinguishing between sparse or dense functional data); 'Sparse', 'Dense', 'DenseWithMV' - default: determine automatically based on 'IsRegular'} -\item{dataType2}{The type of design we have for sample 2 (usually distinguishing between sparse or dense functional data); 'Sparse', 'Dense', 'DenseWithMV' - default: determine automatically based on 'IsRegular'} -} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/FVPA.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/FVPA.Rd deleted file mode 100644 index 68c669a2..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/FVPA.Rd +++ /dev/null @@ -1,38 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/FVPA.R -\name{FVPA} -\alias{FVPA} -\title{Functional Variance Process Analysis for dense functional data} -\usage{ -FVPA(y, t, q = 0.1, optns = list(error = TRUE, FVEthreshold = 0.9)) -} -\arguments{ -\item{y}{A list of \emph{n} vectors containing the observed values for each individual. Missing values specified by \code{NA}s are supported for dense case (\code{dataType='dense'}).} - -\item{t}{A list of \emph{n} vectors containing the observation time points for each individual corresponding to y.} - -\item{q}{A scalar defining the percentile of the pooled sample residual sample used for adjustment before taking log (default: 0.1).} - -\item{optns}{A list of options control parameters specified by \code{list(name=value)}; by default: 'error' has to be TRUE, 'FVEthreshold' is set to 0.90. See `Details in ?FPCA'.} -} -\value{ -A list containing the following fields: -\item{sigma2}{Variance estimator of the functional variance process.} -\item{fpcaObjY}{FPCA object for the original data.} -\item{fpcaObjR}{FPCA object for the functional variance process associated with the original data.} -} -\description{ -Functional Variance Process Analysis for dense functional data -} -\examples{ -set.seed(1) -n <- 25 -pts <- seq(0, 1, by=0.01) -sampWiener <- Wiener(n, pts) -# Data have to dense for FVPA to be relevant! -sampWiener <- Sparsify(sampWiener, pts, 101) -fvpaObj <- FVPA(sampWiener$Ly, sampWiener$Lt) -} -\references{ -\cite{Hans-Georg Mueller, Ulrich Stadtmuller and Fang Yao, "Functional variance processes." Journal of the American Statistical Association 101 (2006): 1007-1018} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/GetCrCorYX.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/GetCrCorYX.Rd deleted file mode 100644 index 51356d42..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/GetCrCorYX.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/GetCrCorYX.R -\name{GetCrCorYX} -\alias{GetCrCorYX} -\title{Make cross-correlation matrix from auto- and cross-covariance matrix} -\usage{ -GetCrCorYX(ccXY, ccXX, ccYY) -} -\arguments{ -\item{ccXY}{The cross-covariance matrix between variables X and Y.} - -\item{ccXX}{The auto-covariance matrix of variable X or the diagonal of that matrix.} - -\item{ccYY}{The auto-covariance matrix of variable Y or the diagonal of that matrix.} -} -\value{ -A cross-correlation matrix between variables X and Y. -} -\description{ -Make cross-correlation matrix from auto- andcross-covariance matrix -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/GetCrCorYZ.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/GetCrCorYZ.Rd deleted file mode 100644 index c12ef8e8..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/GetCrCorYZ.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/GetCrCorYZ.R -\name{GetCrCorYZ} -\alias{GetCrCorYZ} -\title{Make cross-correlation matrix from auto- and cross-covariance matrix} -\usage{ -GetCrCorYZ(ccYZ, acYY, covZ) -} -\arguments{ -\item{ccYZ}{The cross-covariance vector between variables Y and Z (n-by-1).} - -\item{acYY}{The auto-covariance n-by-n matrix of variable Y or the (n-by-1) diagonal of that matrix.} - -\item{covZ}{The (scalar) covariance of variable Z.} -} -\value{ -A cross-correlation matrix between variables Y (functional) and Z (scalar). -} -\description{ -Make cross-correlation matrix from auto- andcross-covariance matrix -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/GetCrCovYX.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/GetCrCovYX.Rd deleted file mode 100644 index a159c567..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/GetCrCovYX.Rd +++ /dev/null @@ -1,62 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/GetCrCovYX.R -\name{GetCrCovYX} -\alias{GetCrCovYX} -\title{Functional Cross Covariance between longitudinal variable Y and longitudinal variable X} -\usage{ -GetCrCovYX(bw1 = NULL, bw2 = NULL, Ly1, Lt1 = NULL, Ymu1 = NULL, - Ly2, Lt2 = NULL, Ymu2 = NULL, useGAM = FALSE, rmDiag = FALSE, - kern = "gauss", bwRoutine = "l-bfgs-b") -} -\arguments{ -\item{bw1}{Scalar bandwidth for smoothing the cross-covariance function (if NULL it will be automatically estimated) (Y)} - -\item{bw2}{Scalar bandwidth for smoothing the cross-covariance function (if NULL it will be automatically estimated) (X)} - -\item{Ly1}{List of N vectors with amplitude information (Y)} - -\item{Lt1}{List of N vectors with timing information (Y)} - -\item{Ymu1}{Vector Q-1 Vector of length nObsGrid containing the mean function estimate (Y)} - -\item{Ly2}{List of N vectors with amplitude information (X)} - -\item{Lt2}{List of N vectors with timing information (X)} - -\item{Ymu2}{Vector Q-1 Vector of length nObsGrid containing the mean function estimate (X)} - -\item{useGAM}{Indicator to use gam smoothing instead of local-linear smoothing (semi-parametric option) (default: FALSE)} - -\item{rmDiag}{Indicator to remove the diagonal element when smoothing (default: FALSE)} - -\item{kern}{String specifying the kernel type (default: FALSE; see ?FPCA for details)} - -\item{bwRoutine}{String specifying the routine used to find the optimal bandwidth 'grid-search', 'bobyqa', 'l-bfgs-b' (default: 'l-bfgs-b') -If the variables Ly1 and Ly2 are in matrix form the data are assumed dense -and only the raw cross-covariance is returned. One can obtain Ymu1 and Ymu2 -from \code{FPCA} and \code{ConvertSupport}.} -} -\value{ -A list containing: -\item{smoothedCC}{The smoothed cross-covariance as a matrix (currently only 51 by 51)} -\item{rawCC}{The raw cross-covariance as a list} -\item{bw}{The bandwidth used for smoohting as a vector of lengh 2} -\item{score}{The GCV score associated with the scalar used} -\item{smoothGrid}{The grid over which the smoothed cross-covariance is evaluated} -} -\description{ -Calculate the raw and the smoothed cross-covariance between functional predictors using bandwidth bw or estimate that bw using GCV. -} -\examples{ -Ly1= list( rep(2.1,7), rep(2.1,3),2.1 ); -Lt1 = list(1:7,1:3, 1); -Ly2 = list( rep(1.1,7), rep(1.1,3),1.1); -Lt2 = list(1:7,1:3, 1); -Ymu1 = rep(55,7); -Ymu2 = rep(1.1,7); -AA<-GetCrCovYX(Ly1 = Ly1, Ly2= Ly2, Lt1=Lt1, Lt2=Lt2, Ymu1=Ymu1, Ymu2=Ymu2) - -} -\references{ -\cite{Yang, Wenjing, Hans-Georg Mueller, and Ulrich Stadtmueller. "Functional singular component analysis." Journal of the Royal Statistical Society: Series B (Statistical Methodology) 73.3 (2011): 303-324} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/GetCrCovYZ.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/GetCrCovYZ.Rd deleted file mode 100644 index b8839e1a..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/GetCrCovYZ.Rd +++ /dev/null @@ -1,49 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/GetCrCovYZ.R -\name{GetCrCovYZ} -\alias{GetCrCovYZ} -\title{Functional Cross Covariance between longitudinal variable Y and scalar variable Z} -\usage{ -GetCrCovYZ(bw = NULL, Z, Zmu = NULL, Ly, Lt = NULL, Ymu = NULL, - support = NULL, kern = "gauss") -} -\arguments{ -\item{bw}{Scalar bandwidth for smoothing the cross-covariance function (if NULL it will be automatically estimated)} - -\item{Z}{Vector N-1 Vector of length N with the scalar function values} - -\item{Zmu}{Scalar with the mean of Z (if NULL it will be automaticall estimated)} - -\item{Ly}{List of N vectors with amplitude information} - -\item{Lt}{List of N vectors with timing information} - -\item{Ymu}{Vector Q-1 Vector of length nObsGrid containing the mean function estimate} - -\item{support}{Vector of unique and sorted values for the support of the smoothed cross-covariance function (if NULL it will be automatically estimated)} - -\item{kern}{Kernel type to be used. See ?FPCA for more details. (defult: 'gauss') -If the variables Ly1 is in matrix form the data are assumed dense and only -the raw cross-covariance is returned. One can obtain Ymu1 -from \code{FPCA} and \code{ConvertSupport}.} -} -\value{ -A list containing: -\item{smoothedCC}{The smoothed cross-covariance as a vector} -\item{rawCC}{The raw cross-covariance as a vector } -\item{bw}{The bandwidth used for smoohting as a scalar} -\item{score}{The GCV score associated with the scalar used} -} -\description{ -Calculate the raw and the smoothed cross-covariance between functional -and scalar predictors using bandwidth bw or estimate that bw using GCV -} -\examples{ -Ly <- list( runif(5), c(1:3), c(2:4), c(4)) -Lt <- list( c(1:5), c(1:3), c(1:3), 4) -Z = rep(4,4) # Constant vector so the covariance has to be zero. -sccObj = GetCrCovYZ(bw=1, Z= Z, Ly=Ly, Lt=Lt, Ymu=rep(4,5)) -} -\references{ -\cite{Yang, Wenjing, Hans-Georg Mueller, and Ulrich Stadtmueller. "Functional singular component analysis." Journal of the Royal Statistical Society: Series B (Statistical Methodology) 73.3 (2011): 303-324} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/GetNormalisedSample.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/GetNormalisedSample.Rd deleted file mode 100644 index 80e6fd6f..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/GetNormalisedSample.Rd +++ /dev/null @@ -1,41 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/GetNormalisedSample.R -\name{GetNormalisedSample} -\alias{GetNormalisedSample} -\alias{GetNormalizedSample} -\title{Normalise sparse functional sample} -\usage{ -GetNormalisedSample(fpcaObj, errorSigma = FALSE) - -GetNormalizedSample(...) -} -\arguments{ -\item{fpcaObj}{An FPCA object.} - -\item{errorSigma}{Indicator to use sigma^2 error variance when normalising the data (default: FALSE)} - -\item{...}{Passed into GetNormalisedSample} -} -\value{ -A list containing the normalised sample 'y' at times 't' -} -\description{ -Normalise sparse functional sample given in an FPCA object -} -\examples{ -set.seed(1) -n <- 100 -M <- 51 -pts <- seq(0, 1, length.out=M) -mu <- rep(0, length(pts)) -sampDense <- MakeGPFunctionalData(n, M, mu, K=1, basisType='sin', sigma=0.01) -samp4 <- MakeFPCAInputs(tVec=sampDense$pts, yVec=sampDense$Yn) -res4E <- FPCA(samp4$Ly, samp4$Lt, list(error=TRUE)) -sampN <- GetNormalisedSample(res4E, errorSigma=TRUE) - -CreatePathPlot(subset=1:20, inputData=samp4, obsOnly=TRUE, showObs=FALSE) -CreatePathPlot(subset=1:20, inputData=sampN, obsOnly=TRUE, showObs=FALSE) -} -\references{ -\cite{Chiou, Jeng-Min and Chen, Yu-Ting and Yang, Ya-Fang. "Multivariate Functional Principal Component Analysis: A Normalization Approach" Statistica Sinica 24 (2014): 1571-1596} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/Lwls1D.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/Lwls1D.Rd deleted file mode 100644 index 36e695a3..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/Lwls1D.Rd +++ /dev/null @@ -1,32 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/Lwls1D.R -\name{Lwls1D} -\alias{Lwls1D} -\title{One dimensional local linear kernel smoother} -\usage{ -Lwls1D(bw, kernel_type, win = rep(1L, length(xin)), xin, yin, xout, - npoly = 1L, nder = 0L) -} -\arguments{ -\item{bw}{Scalar holding the bandwidth} - -\item{kernel_type}{Character holding the kernel type (see ?FPCA for supported kernels)} - -\item{win}{Vector of length N with weights} - -\item{xin}{Vector of length N with measurement points} - -\item{yin}{Vector of length N with measurement values} - -\item{xout}{Vector of length M with output measurement points} - -\item{npoly}{Scalar (integer) degree of polynomial fitted (default 1)} - -\item{nder}{Scalar (integer) degree of derivative fitted (default 0)} -} -\value{ -Vector of length M with measurement values at the the point speficied by 'xout' -} -\description{ -One dimensional local linear kernel smoother for longitudinal data. -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/Lwls2D.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/Lwls2D.Rd deleted file mode 100644 index 25006713..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/Lwls2D.Rd +++ /dev/null @@ -1,39 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/Lwls2D.R -\name{Lwls2D} -\alias{Lwls2D} -\title{Two dimensional local linear kernel smoother.} -\usage{ -Lwls2D(bw, kern = "epan", xin, yin, win = NULL, xout1 = NULL, - xout2 = NULL, xout = NULL, subset = NULL, crosscov = FALSE, - method = ifelse(kern == "gauss", "plain", "sort2")) -} -\arguments{ -\item{bw}{A scalar or a vector of length 2 specifying the bandwidth.} - -\item{kern}{Kernel used: 'gauss', 'rect', 'gausvar', 'epan' (default), 'quar'.} - -\item{xin}{An n by 2 data frame or matrix of x-coordinate.} - -\item{yin}{A vector of y-coordinate.} - -\item{win}{A vector of weights on the observations.} - -\item{xout1}{a p1-vector of first output coordinate grid. Defaults to the input gridpoints if left unspecified.} - -\item{xout2}{a p2-vector of second output coordinate grid. Defaults to the input gridpoints if left unspecified.} - -\item{xout}{alternative to xout1 and xout2. A matrix of p by 2 specifying the output points (may be inefficient if the size of \code{xout} is small).} - -\item{subset}{a vector with the indices of x-/y-/w-in to be used (Default: NULL)} - -\item{crosscov}{using function for cross-covariance estimation (Default: FALSE)} - -\item{method}{should one try to sort the values xin and yin before using the lwls smoother? if yes ('sort2' - default for non-Gaussian kernels), if no ('plain' - fully stable; de)} -} -\value{ -a p1 by p2 matrix of fitted values if xout is not specified. Otherwise a vector of length p corresponding to the rows of xout. -} -\description{ -Two dimensional local weighted least squares smoother. Only local linear smoother for estimating the original curve is available (no higher order, no derivative). -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/Lwls2DDeriv.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/Lwls2DDeriv.Rd deleted file mode 100644 index e605e0c7..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/Lwls2DDeriv.Rd +++ /dev/null @@ -1,45 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/Lwls2DDeriv.R -\name{Lwls2DDeriv} -\alias{Lwls2DDeriv} -\title{Two dimensional local linear kernel smoother with derivatives.} -\usage{ -Lwls2DDeriv(bw, kern = "epan", xin, yin, win = NULL, xout1 = NULL, - xout2 = NULL, xout = NULL, npoly = 1L, nder1 = 0L, nder2 = 0L, - subset = NULL, crosscov = TRUE, method = "sort2") -} -\arguments{ -\item{bw}{A scalar or a vector of length 2 specifying the bandwidth.} - -\item{kern}{Kernel used: 'gauss', 'rect', 'gausvar', 'epan' (default), 'quar'.} - -\item{xin}{An n by 2 data frame or matrix of x-coordinate.} - -\item{yin}{A vector of y-coordinate.} - -\item{win}{A vector of weights on the observations.} - -\item{xout1}{a p1-vector of first output coordinate grid. Defaults to the input gridpoints if left unspecified.} - -\item{xout2}{a p2-vector of second output coordinate grid. Defaults to the input gridpoints if left unspecified.} - -\item{xout}{alternative to xout1 and xout2. A matrix of p by 2 specifying the output points (may be inefficient if the size of \code{xout} is small).} - -\item{npoly}{The degree of polynomials (include all \eqn{x^a y^b} terms where \eqn{a + b <= npoly})} - -\item{nder1}{Order of derivative in the first direction} - -\item{nder2}{Order of derivative in the second direction} - -\item{subset}{a vector with the indices of x-/y-/w-in to be used (Default: NULL)} - -\item{crosscov}{using function for cross-covariance estimation (Default: TRUE)} - -\item{method}{should one try to sort the values xin and yin before using the lwls smoother? if yes ('sort2' - default for non-Gaussian kernels), if no ('plain' - fully stable; de)} -} -\value{ -a p1 by p2 matrix of fitted values if xout is not specified. Otherwise a vector of length p corresponding to the rows of xout. -} -\description{ -Two dimensional local weighted least squares smoother. Only local linear smoother for estimating the original curve is available (no higher order, no derivative). -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/MakeBWtoZscore02y.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/MakeBWtoZscore02y.Rd deleted file mode 100644 index 5007f78d..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/MakeBWtoZscore02y.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/MakeBWtoZscore02y.R -\name{MakeBWtoZscore02y} -\alias{MakeBWtoZscore02y} -\title{Z-score body-weight for age 0 to 24 months based on WHO standards} -\usage{ -MakeBWtoZscore02y(sex, age, bw) -} -\arguments{ -\item{sex}{A character 'M' or 'F' indicating the sex of the child.} - -\item{age}{A vector of time points of size Q.} - -\item{bw}{A vector of body-weight readings of size Q.} -} -\value{ -A vector of Z-scores of size Q. -} -\description{ -Make vector of age and body-weight to z-scores based on WHO standards using LMS -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/MakeFPCAInputs.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/MakeFPCAInputs.Rd deleted file mode 100644 index 5e5f61f3..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/MakeFPCAInputs.Rd +++ /dev/null @@ -1,25 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/MakeFPCAInputs.R -\name{MakeFPCAInputs} -\alias{MakeFPCAInputs} -\title{Format FPCA input} -\usage{ -MakeFPCAInputs(IDs = NULL, tVec, yVec, na.rm = FALSE, sort = FALSE) -} -\arguments{ -\item{IDs}{n-by-1 vector of subject IDs (Default: NULL)} - -\item{tVec}{Either an n-by-1 vector of measurement times, or a p-by-1 vector corresponding to the common time support} - -\item{yVec}{n-by-1 vector of measurements from the variable of interest, or a n-by-p matrix with each row corresponding to the dense observations.} - -\item{na.rm}{logical indicating if NA should be omitted (Default: FALSE)} - -\item{sort}{logical indicating if the returned lists Lt and Ly should be ensured to be sorted (Default: FALSE)} -} -\value{ -L list containing 3 lists each of length 'm', 'm' being the number of unique subject IDs -} -\description{ -Turn vector inputs to the list so they can be used in FPCA -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/MakeGPFunctionalData.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/MakeGPFunctionalData.Rd deleted file mode 100644 index d9cbb861..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/MakeGPFunctionalData.Rd +++ /dev/null @@ -1,30 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/MakeGPFunctionalData.R -\name{MakeGPFunctionalData} -\alias{MakeGPFunctionalData} -\title{Make Gaussian Process Dense Functional Data sample} -\usage{ -MakeGPFunctionalData(n, M = 100, mu = rep(0, M), K = 2, - lambda = rep(1, K), sigma = 0, basisType = "cos") -} -\arguments{ -\item{n}{number of samples to generate} - -\item{M}{number of equidistant readings per sample (default: 100)} - -\item{mu}{vector of size M specifying the mean (default: rep(0,M))} - -\item{K}{scalar specifying the number of basis to be used (default: 2)} - -\item{lambda}{vector of size K specifying the variance of each components (default: rep(1,K))} - -\item{sigma}{The standard deviation of the Gaussian noise added to each observation points.} - -\item{basisType}{string specifiying the basis type used; possible options are: 'sin', 'cos' and 'fourier' (default: 'cos') (See code of 'CreateBasis' for implementation details.)} -} -\value{ -Y: X(t_{j}), Yn: noisy observations -} -\description{ -Make a Gaussian process dense functional data sample of size n over a [0,1] support. -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/MakeHCtoZscore02y.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/MakeHCtoZscore02y.Rd deleted file mode 100644 index 5622f581..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/MakeHCtoZscore02y.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/MakeHCtoZscore02y.R -\name{MakeHCtoZscore02y} -\alias{MakeHCtoZscore02y} -\title{Z-score head-circumference for age 0 to 24 months based on WHO standards} -\usage{ -MakeHCtoZscore02y(sex, age, hc) -} -\arguments{ -\item{sex}{A character 'M' or 'F' indicating the sex of the child.} - -\item{age}{A vector of time points of size Q.} - -\item{hc}{A vector of head circumference readings of size Q (in cm).} -} -\value{ -A vector of Z-scores of size Q. -} -\description{ -Make vector of age and height measurement to z-scores based on WHO standards using mu and sigma (not LMS) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/MakeLNtoZscore02y.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/MakeLNtoZscore02y.Rd deleted file mode 100644 index dd76e079..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/MakeLNtoZscore02y.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/MakeLNtoZscore02y.R -\name{MakeLNtoZscore02y} -\alias{MakeLNtoZscore02y} -\title{Z-score height for age 0 to 24 months based on WHO standards} -\usage{ -MakeLNtoZscore02y(sex, age, ln) -} -\arguments{ -\item{sex}{A character 'M' or 'F' indicating the sex of the child.} - -\item{age}{A vector of time points of size Q.} - -\item{ln}{A vector of body-length readings of size Q (in cm).} -} -\value{ -A vector of Z-scores of size Q. -} -\description{ -Make vector of age and height measurement to z-scores based on WHO standards using mu and sigma (not LMS) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/MakeSparseGP.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/MakeSparseGP.Rd deleted file mode 100644 index 59da6971..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/MakeSparseGP.Rd +++ /dev/null @@ -1,35 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/MakeSparseGP.R -\name{MakeSparseGP} -\alias{MakeSparseGP} -\title{Make Gaussian Process Sparse Functional Data sample} -\usage{ -MakeSparseGP(n, rdist = runif, sparsity = 2:9, muFun = function(x) - rep(0, length(x)), K = 2, lambda = rep(1, K), sigma = 0, - basisType = "cos", CovFun = NULL) -} -\arguments{ -\item{n}{number of samples to generate.} - -\item{rdist}{a sampler for generating the random design time points within [0, 1].} - -\item{sparsity}{A vector of integers. The number of observation per sample is chosen to be one of the elements in sparsity with equal chance.} - -\item{muFun}{a function that takes a vector input and output a vector of the corresponding mean (default: zero function).} - -\item{K}{scalar specifying the number of basis to be used (default: 2).} - -\item{lambda}{vector of size K specifying the variance of each components (default: rep(1,K)).} - -\item{sigma}{The standard deviation of the Gaussian noise added to each observation points.} - -\item{basisType}{string specifiying the basis type used; possible options are: 'sin', 'cos' and 'fourier' (default: 'cos') (See code of 'CreateBasis' for implementation details.)} - -\item{CovFun}{an alternative specification of the covariance structure.} -} -\value{ -TODO -} -\description{ -Make a Gaussian process sparse functional data sample of size n -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/MultiFAM.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/MultiFAM.Rd deleted file mode 100644 index 8f0750a9..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/MultiFAM.Rd +++ /dev/null @@ -1,172 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/MultiFAM.R -\name{MultiFAM} -\alias{MultiFAM} -\title{Functional Additive Models with Multiple Predictor Processes} -\usage{ -MultiFAM(Y, X, ker = "epan", nEval = 51, XTest = NULL, - bwMethod = 0, alpha = 0.7, supp = c(-2, 2), optnsList = NULL) -} -\arguments{ -\item{Y}{An \emph{n}-dimensional vector whose elements consist of scalar responses.} - -\item{X}{A \emph{d}-dimensional list whose components consist of two lists of \emph{Ly} and \emph{Lt} containing obervation times and functional covariate values for each predictor component, respectively. For details of \emph{Ly} and \emph{Lt}, see \code{FPCA} for detail.} - -\item{ker}{A \code{function} object representing the base kernel to be used in the smooth backfitting algorithm (default is 'epan' which is the only option supported currently).} - -\item{nEval}{The number of evaluation grid points for kernel smoothing (default is 51. If it is specified as 0, then estimated FPC scores in the training set are used for evaluation grid instead of equal grid).} - -\item{XTest}{A \emph{d}-dimensional list for test set of functional predictors (default is NULL). If \code{XTest} is specified, then estimated FPC scores in the test set are used for evalution grid.} - -\item{bwMethod}{The method of initial bandwidth selection for kernel smoothing, a positive value for designating K-fold cross-validtaion and zero for GCV (default is 0)} - -\item{alpha}{The shrinkage factor (positive number) for bandwidth selection. See Han et al. (2016) (default is 0.7).} - -\item{supp}{The lower and upper limits of kernel smoothing domain for studentized FPC scores, which FPC scores are divided by the square roots of eigenvalues (default is [-2,2]).} - -\item{optnsList}{A \emph{d}-dimensional list whose components consist of \code{optns} for each predictor component, respectively. (default is NULL which assigns the same default \code{optns} for all components as in \code{FPCA}).} -} -\value{ -A list containing the following fields: -\item{mu}{A scalar of centered part of the regression model.} -\item{SBFit}{An \emph{N} by \eqn{(K_1 + ... + K_d)} matrix whose column vectors consist of the smooth backfitting component function estimators at the given \emph{N} estimation points.} -\item{xi}{An \emph{N} by \eqn{(K_1 + ... + K_d)} matrix whose column vectors consist of FPC score grid vectors that each additive component functional is evluated.} -\item{bw}{A \eqn{(K_1 + ... + K_d)}-dimensional bandwidth vector.} -\item{lambda}{A \eqn{(K_1 + ... + K_d)}-dimensional vector containing eigenvalues.} -\item{phi}{A \emph{d}-dimensional list whose components consist of an \emph{nWorkGrid} by \emph{K_j} matrix containing eigenfunctions, supported by \code{WorkGrid}. See \code{FPCA}.} -\item{workGrid}{A \emph{d}-dimensional list whose components consist of an \emph{nWorkGrid} by \emph{K_j} working grid, the internal regular grid on which the eigen analysis is carried on. See \code{FPCA}.} -} -\description{ -Smooth backfitting procedure for functional additive models with multiple predictor processes -} -\details{ -\code{MultiFAM} fits functional additive models for a scalar response and multiple predictor processes based on the smooth backfitting algorithm proposed by Han et al. (2016) that \deqn{E(Y | \mathbf{X}) = \sum_{j=1}^d \sum_{k=1}^{K_j} g_{jk}(\xi_{jk}),} where \eqn{\xi_{jk}} stand for the k-th FPC score of the j-th predictor process. \code{MultiFAM} only focuses on mutiple predictor processes case. In fact, the case of univariate predictor is the same with functional additive model proposed by Mueller and Yao (2008). Especially in this development, one can designate an estimation support of additive models when the additive modeling is only allowed over restricted intervals or one is interested in the modeling over the support (see Han et al., 2016). -} -\examples{ -set.seed(1000) - -library(MASS) - -f11 <- function(t) t -f12 <- function(t) 2*cos(2*pi*t/4) -f21 <- function(t) 1.5*sin(2*pi*t/4) -f22 <- function(t) 1.5*atan(2*pi*t/4) - -n<-100 -N<-200 - -sig <- matrix(c(2.0, 0.0, 0.5, -.2, - 0.0, 1.2, -.2, 0.3, - 0.5, -.2, 1.7, 0.0, - -.2, 0.3, 0.0, 1.0), - nrow=4,ncol=4) - -scoreX <- mvrnorm(n,mu=rep(0,4),Sigma=sig) -scoreXTest <- mvrnorm(N,mu=rep(0,4),Sigma=sig) - -Y <- f11(scoreX[,1]) + f12(scoreX[,2]) + f21(scoreX[,3]) + f22(scoreX[,4]) + rnorm(n,0,0.5) -YTest <- f11(scoreXTest[,1]) + f12(scoreXTest[,2]) + -f21(scoreXTest[,3]) + f22(scoreXTest[,4]) + rnorm(N,0,0.5) - -phi11 <- function(t) sqrt(2)*sin(2*pi*t) -phi12 <- function(t) sqrt(2)*sin(4*pi*t) -phi21 <- function(t) sqrt(2)*cos(2*pi*t) -phi22 <- function(t) sqrt(2)*cos(4*pi*t) - -grid <- seq(0,1,length.out=21) -Lt <- Lx1 <- Lx2 <- list() -for (i in 1:n) { - Lt[[i]] <- grid - Lx1[[i]] <- scoreX[i,1]*phi11(grid) + scoreX[i,2]*phi12(grid) + rnorm(1,0,0.01) - Lx2[[i]] <- scoreX[i,3]*phi21(grid) + scoreX[i,4]*phi22(grid) + rnorm(1,0,0.01) -} - -LtTest <- Lx1Test <- Lx2Test <- list() -for (i in 1:N) { - LtTest[[i]] <- grid - Lx1Test[[i]] <- scoreXTest[i,1]*phi11(grid) + scoreXTest[i,2]*phi12(grid) + rnorm(1,0,0.01) - Lx2Test[[i]] <- scoreXTest[i,3]*phi21(grid) + scoreXTest[i,4]*phi22(grid) + rnorm(1,0,0.01) -} - -X1 <- list(Ly=Lx1, Lt=Lt) -X2 <- list(Ly=Lx2, Lt=Lt) - -X1Test <- list(Ly=Lx1Test, Lt=LtTest) -X2Test <- list(Ly=Lx2Test, Lt=LtTest) - -X <- list(X1, X2) -XTest <- list(X1Test, X2Test) - -# estimation -sbf <- MultiFAM(Y=Y,X=X) - -xi <- sbf$xi - -par(mfrow=c(2,2)) -j <- 1 -p0 <- trapzRcpp(sort(xi[,j]),dnorm(sort(xi[,j]),0,sqrt(sig[j,j]))) -g11 <- f11(sort(xi[,j])) - -trapzRcpp(sort(xi[,j]),f11(sort(xi[,j]))*dnorm(sort(xi[,j]),0,sqrt(sig[j,j])))/p0 -tmpSgn <- sign(sum(g11*sbf$SBFit[,j])) -plot(sort(xi[,j]),g11,type='l',col=2,ylim=c(-2.5,2.5),xlab='xi11') -points(sort(xi[,j]),tmpSgn*sbf$SBFit[order(xi[,j]),j],type='l') -legend('top',c('true','SBF'),col=c(2,1),lwd=2,bty='n',horiz=TRUE) - -j <- 2 -p0 <- trapzRcpp(sort(xi[,j]),dnorm(sort(xi[,j]),0,sqrt(sig[j,j]))) -g12 <- f12(sort(xi[,j])) - -trapzRcpp(sort(xi[,j]),f12(sort(xi[,j]))*dnorm(sort(xi[,j]),0,sqrt(sig[j,j])))/p0 -tmpSgn <- sign(sum(g12*sbf$SBFit[,j])) -plot(sort(xi[,j]),g12,type='l',col=2,ylim=c(-2.5,2.5),xlab='xi12') -points(sort(xi[,j]),tmpSgn*sbf$SBFit[order(xi[,j]),j],type='l') -legend('top',c('true','SBF'),col=c(2,1),lwd=2,bty='n',horiz=TRUE) - -j <- 3 -p0 <- trapzRcpp(sort(xi[,j]),dnorm(sort(xi[,j]),0,sqrt(sig[j,j]))) -g21 <- f21(sort(xi[,j])) - -trapzRcpp(sort(xi[,j]),f21(sort(xi[,j]))*dnorm(sort(xi[,j]),0,sqrt(sig[j,j])))/p0 -tmpSgn <- sign(sum(g21*sbf$SBFit[,j])) -plot(sort(xi[,j]),g21,type='l',col=2,ylim=c(-2.5,2.5),xlab='xi21') -points(sort(xi[,j]),tmpSgn*sbf$SBFit[order(xi[,j]),j],type='l') -legend('top',c('true','SBF'),col=c(2,1),lwd=2,bty='n',horiz=TRUE) - -j <- 4 -p0 <- trapzRcpp(sort(xi[,j]),dnorm(sort(xi[,j]),0,sqrt(sig[j,j]))) -g22 <- f22(sort(xi[,j])) - -trapzRcpp(sort(xi[,j]),f22(sort(xi[,j]))*dnorm(sort(xi[,j]),0,sqrt(sig[j,j])))/p0 -tmpSgn <- sign(sum(g22*sbf$SBFit[,j])) -plot(sort(xi[,j]),g22,type='l',col=2,ylim=c(-2.5,2.5),xlab='xi22') -points(sort(xi[,j]),tmpSgn*sbf$SBFit[order(xi[,j]),j],type='l') -legend('top',c('true','SBF'),col=c(2,1),lwd=2,bty='n',horiz=TRUE) - -\dontrun{ -# fitting -sbf <- MultiFAM(Y=Y,X=X,nEval=0) -yHat <- sbf$mu+apply(sbf$SBFit,1,'sum') -par(mfrow=c(1,1)) -plot(yHat,Y) -abline(coef=c(0,1),col=2) - - -# R^2 -R2 <- 1-sum((Y-yHat)^2)/sum((Y-mean(Y))^2) -R2 - - -# prediction -sbf <- MultiFAM(Y=Y,X=X,XTest=XTest) -yHat <- sbf$mu+apply(sbf$SBFit,1,'sum') -par(mfrow=c(1,1)) -plot(yHat,YTest) -abline(coef=c(0,1),col=2) -} -} -\references{ -\cite{Mammen, E., Linton, O. and Nielsen, J. (1999), "The existence and asymptotic properties of a backfitting projection algorithm under weak conditions", Annals of Statistics, Vol.27, No.5, p.1443-1490.} - -\cite{Mammen, E. and Park, B. U. (2006), "A simple smooth backfitting method for additive models", Annals of Statistics, Vol.34, No.5, p.2252-2271.} - -\cite{Mueller, H.-G. and Yao, F. (2008), "Functional additive models", Journal of the Americal Statistical Association, Vol.103, No.484, p.1534-1544.} - -\cite{Han, K., Mueller, H.-G. and Park, B. U. (2016), "Smooth backfitting for additive modeling with small errors-in-variables, with an application to additive functional regression for multiple predictor functions", Bernoulli (accepted).} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/NormCurvToArea.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/NormCurvToArea.Rd deleted file mode 100644 index 42454d1b..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/NormCurvToArea.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/NormCurveToArea.R -\name{NormCurvToArea} -\alias{NormCurvToArea} -\title{Normalise a curve to a particular area.} -\usage{ -NormCurvToArea(y, x = seq(0, 1, length.out = length(y)), area = 1) -} -\arguments{ -\item{y}{values of curve at time-points x} - -\item{x}{design time-points (default: seq(0,1, length.out=length(y)))} - -\item{area}{value to normalise the curve onto (default: 1)} -} -\value{ -yNew values of curve at times x such that [\\int{yNew}dx = area] -} -\description{ -Normalise a curve such that \\int{yNew}dx = area (according to trapezoid integration) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/SBFitting.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/SBFitting.Rd deleted file mode 100644 index d23762d3..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/SBFitting.Rd +++ /dev/null @@ -1,94 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/SBFitting.R -\name{SBFitting} -\alias{SBFitting} -\title{Iterative Smooth Backfitting Algorithm} -\usage{ -SBFitting(Y, x, X, h = NULL, K = "epan", supp = NULL) -} -\arguments{ -\item{Y}{An \emph{n}-dimensional vector whose elements consist of scalar responses.} - -\item{x}{An \emph{N} by \emph{d} matrix whose column vectors consist of \emph{N} vectors of estimation points for each component function.} - -\item{X}{An \emph{n} by \emph{d} matrix whose row vectors consist of multivariate predictors.} - -\item{h}{A \emph{d} vector of bandwidths for kernel smoothing to estimate each component function.} - -\item{K}{A \code{function} object representing the kernel to be used in the smooth backfitting (default is 'epan', the the Epanechnikov kernel.).} - -\item{supp}{A \emph{d} by 2 matrix whose row vectors consist of the lower and upper limits of estimation intervals for each component function (default is the \emph{d}-dimensional unit rectangle of \emph{[0,1]}).} -} -\value{ -A list containing the following fields: -\item{SBFit}{An \emph{N} by \emph{d} matrix whose column vectors consist of the smooth backfitting component function estimators at the given estimation points.} -\item{mY}{A scalar of centered part of the regression model.} -\item{NW}{An \emph{N} by \emph{d} matrix whose column vectors consist of the Nadaraya-Watson marginal regression function estimators for each predictor component at the given estimation points.} -\item{mgnDens}{An \emph{N} by \emph{d} matrix whose column vectors consist of the marginal kernel density estimators for each predictor component at the given estimation points.} -\item{jntDens}{An \emph{N} by \emph{N} by \emph{d} by \emph{d} array representing the 2-dimensional joint kernel density estimators for all pairs of predictor components at the given estimation grid. For example, \code{[,,j,k]} of the object provides the 2-dimensional joint kernel density estimator of the \code{(j,k)}-component of predictor components at the corresponding \emph{N} by \emph{N} matrix of estimation grid.} -\item{itemNum}{The iteration number that the smooth backfitting algorithm has stopped.} -\item{itemErr}{The iteration error of the smooth backfitting algorithm that represents the maximum L2 distance among component functions in the last successive updates.} -} -\description{ -Smooth backfitting procedure for nonparametric additive models -} -\details{ -\code{SBFitting} fits component functions of additive models for a scalar response and a multivariate predictor based on the smooth backfitting algorithm proposed by Mammen et al. (1999) and intensively studied by Mammen and Park (2006), Yu et al. (2008), Lee et al. (2010, 2012) and so on. \code{SBFitting} only focuses on the local constant smooth backfitting estimator with multivariate predictor case. In fact, the case of univariate predictor is the same with the local constant kernel regression estimator (Nadaraya-Watson estimator) and the local polynomial version can be extended similarly, so that those are omitted in the development. Support of the multivariate predictor is assumed to be a product of closed intervals. Especially in this development, one can designate an estimation support of additive models when the additive modeling is only allowed over restricted intervals or one is interested in the modeling over the support (see Han et al., 2016). If one puts \code{X} on the argument of estimation points \code{x}, \code{SBFitting} returns estimated values of conditional mean responses given observed predictors. -} -\examples{ -set.seed(100) - -n <- 100 -d <- 2 -X <- pnorm(matrix(rnorm(n*d),nrow=n,ncol=d)\%*\%matrix(c(1,0.6,0.6,1),nrow=2,ncol=2)) - -f1 <- function(t) 2*(t-0.5) -f2 <- function(t) sin(2*pi*t) - -Y <- f1(X[,1])+f2(X[,2])+rnorm(n,0,0.1) - -# component function estimation -N <- 101 -x <- matrix(rep(seq(0,1,length.out=N),d),nrow=N,ncol=d) -h <- c(0.12,0.08) - -sbfEst <- SBFitting(Y,x,X,h) -fFit <- sbfEst$SBFit - -par(mfrow=c(1,2)) -plot(x[,1],f1(x[,1]),type='l',lwd=2,col=2,lty=4,xlab='X1',ylab='Y') -points(x[,1],fFit[,1],type='l',lwd=2,col=1) -points(X[,1],Y,cex=0.3,col=8) -legend('topleft',legend=c('SBF','true'),col=c(1,2),lwd=2,lty=c(1,4),horiz=FALSE,bty='n') -abline(h=0,col=8) - -plot(x[,2],f2(x[,2]),type='l',lwd=2,col=2,lty=4,xlab='X2',ylab='Y') -points(x[,2],fFit[,2],type='l',lwd=2,col=1) -points(X[,2],Y,cex=0.3,col=8) -legend('topright',legend=c('SBF','true'),col=c(1,2),lwd=2,lty=c(1,4),horiz=FALSE,bty='n') -abline(h=0,col=8) - -# prediction -x <- X -h <- c(0.12,0.08) - -sbfPred <- SBFitting(Y,X,X,h) -fPred <- sbfPred$mY+apply(sbfPred$SBFit,1,'sum') - -par(mfrow=c(1,1)) -plot(fPred,Y,cex=0.5,xlab='SBFitted values',ylab='Y') -abline(coef=c(0,1),col=8) -} -\references{ -\cite{Mammen, E., Linton, O. and Nielsen, J. (1999), "The existence and asymptotic properties of a backfitting projection algorithm under weak conditions", Annals of Statistics, Vol.27, No.5, p.1443-1490.} - -\cite{Mammen, E. and Park, B. U. (2006), "A simple smooth backfitting method for additive models", Annals of Statistics, Vol.34, No.5, p.2252-2271.} - -\cite{Yu, K., Park, B. U. and Mammen, E. (2008), "Smooth backfitting in generalized additive models", Annals of Statistics, Vol.36, No.1, p.228-260.} - -\cite{Lee, Y. K., Mammen, E. and Park., B. U. (2010), "backfitting and smooth backfitting for additive quantile models", Vol.38, No.5, p.2857-2883.} - -\cite{Lee, Y. K., Mammen, E. and Park., B. U. (2012), "Flexible generalized varying coefficient regression models", Annals of Statistics, Vol.40, No.3, p.1906-1933.} - -\cite{Han, K., Mueller, H.-G. and Park, B. U. (2016), "Smooth backfitting for additive modeling with small errors-in-variables, with an application to additive functional regression for multiple predictor functions", Bernoulli (accepted).} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/SelectK.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/SelectK.Rd deleted file mode 100644 index 07df6e83..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/SelectK.Rd +++ /dev/null @@ -1,30 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/SelectK.R -\name{SelectK} -\alias{SelectK} -\title{Selects number of functional principal components for -given FPCA output and selection criteria} -\usage{ -SelectK(fpcaObj, criterion = "FVE", FVEthreshold = 0.95, Ly = NULL, - Lt = NULL) -} -\arguments{ -\item{fpcaObj}{A list containing FPCA related subjects returned by MakeFPCAResults().} - -\item{criterion}{A string or positive integer specifying selection criterion for number of functional principal components, available options: 'FVE', 'AIC', 'BIC', or the specified number of components - default: 'FVE'} - -\item{FVEthreshold}{A threshold percentage specified by user when using "FVE" as selection criterion: (0,1] - default: NULL} - -\item{Ly}{A list of \emph{n} vectors containing the observed values for each individual - default: NULL} - -\item{Lt}{A list of \emph{n} vectors containing the observation time points for each individual corresponding to Ly - default: NULL} -} -\value{ -A list including the following two fields: -\item{K}{An integer indicating the selected number of components based on given criterion.} -\item{criterion}{The calculated criterion value for the selected number of components, i.e. FVE, AIC or BIC value, NULL for fixedK criterion.} -} -\description{ -Selects number of functional principal components for -given FPCA output and selection criteria -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/SetOptions.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/SetOptions.Rd deleted file mode 100644 index f1bd130f..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/SetOptions.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/SetOptions.R -\name{SetOptions} -\alias{SetOptions} -\title{Set the PCA option list} -\usage{ -SetOptions(y, t, optns) -} -\arguments{ -\item{y}{A list of \emph{n} vectors containing the observed values for each individual.} - -\item{t}{A list of \emph{n} vectors containing the observation time points for each individual corresponding to y.} - -\item{optns}{A list of options control parameters specified by \code{list(name=value)}. See `Details'. - -See '?FPCAfor more details. Usually users are not supposed to use this function directly.} -} -\description{ -Set the PCA option list -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/Sparsify.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/Sparsify.Rd deleted file mode 100644 index b05e3b1c..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/Sparsify.Rd +++ /dev/null @@ -1,27 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/Sparsify.R -\name{Sparsify} -\alias{Sparsify} -\title{Sparsify densely observed functional data} -\usage{ -Sparsify(samp, pts, sparsity, aggressive = FALSE, fragment = FALSE) -} -\arguments{ -\item{samp}{A matrix of densely observed functional data, with each row containing one sample.} - -\item{pts}{A vector of grid points corresponding to the columns of \code{samp}.} - -\item{sparsity}{A vector of integers. The number of observation per sample is chosen to be one of the elements in sparsity with equal chance.} - -\item{aggressive}{Sparsify in an "aggressive" manner making sure that near-by readings are excluded.} - -\item{fragment}{Sparsify the observations into fragments, which are (almost) uniformly distributed in the time domain. Default to FALSE as not fragmenting. Otherwise a positive number specifying the approximate length of each fragment.} -} -\value{ -A list of length 2, containing the following fields: -\item{Lt}{A list of observation time points for each sample.} -\item{Ly}{A list of values for each sample, corresponding to the time points.} -} -\description{ -Given a matrix of densely observed functional data, make a sparsified sample. -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/Stringing.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/Stringing.Rd deleted file mode 100644 index e79a93e2..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/Stringing.Rd +++ /dev/null @@ -1,50 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/Stringing.R -\name{Stringing} -\alias{Stringing} -\title{Stringing for High-Dimensional data} -\usage{ -Stringing(X, Y = NULL, standardize = FALSE, disOptns = "euclidean", - disMat = NA) -} -\arguments{ -\item{X}{A matrix (n by p) of data, where X[i,] is the row vector of measurements for the ith subject.} - -\item{Y}{A vector (n by 1), where Y[i] is the reponse associated with X[i,]} - -\item{standardize}{A logical variable indicating whether standardization of the input data matrix is required, with default: FALSE.} - -\item{disOptns}{A distance metric to be used, one of the following: "euclidean" (default), "maximum", "manhattan", "canberra", "binary", "minkowski", "correlation", "spearman", "hamming", "xycor", or "user". If specified as "xycor", the absolute difference of correlation between predictor and response is used. If specified as "user", a dissimilarity matrix for the argument "disMat" must be provided.} - -\item{disMat}{A user-specified dissimilarity matrix, only necessary when "disOptns" is "user".} -} -\value{ -A list containing the following fields: -\item{Ly}{A list of n vectors, which are the random trajectories for all subjects identified by the Stringing method.} -\item{Lt}{A list of n time points vectors, at which corresponding measurements Ly are taken.} -\item{StringingOrder}{A vector representing the order of the stringing, s.t. using as column index on \code{X} yields recovery of the underlying process.} -\item{Xin}{A matrix, corresponding to the input data matrix.} -\item{Xstd}{A matrix, corresponding to the standardized input data matrix. It is NULL if standardize is FALSE.} -} -\description{ -Stringing for High-Dimensional data -} -\examples{ -set.seed(1) -n <- 50 -wiener = Wiener(n = n)[,-1] -p = ncol(wiener) -rdmorder = sample(size = p, x=1:p, replace = FALSE) -stringingfit = Stringing(X = wiener[,rdmorder], disOptns = "correlation") -diff_norev = sum(abs(rdmorder[stringingfit$StringingOrder] - 1:p)) -diff_rev = sum(abs(rdmorder[stringingfit$StringedOrder] - p:1)) -if(diff_rev <= diff_norev){ - stringingfit$StringingOrder = rev(stringingfit$StringingOrder) - stringingfit$Ly = lapply(stringingfit$Ly, rev) -} -plot(1:p, rdmorder[stringingfit$StringingOrder], pch=18); abline(a=0,b=1) - -} -\references{ -\cite{Chen, K., Chen, K., Mueller, H. G., and Wang, J. L. (2011). "Stringing high-dimensional data for functional analysis." Journal of the American Statistical Association, 106(493), 275-284.} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/TVAM.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/TVAM.Rd deleted file mode 100755 index 1ba9e659..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/TVAM.Rd +++ /dev/null @@ -1,88 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/TVAM.R -\name{TVAM} -\alias{TVAM} -\title{Iterative Smooth Backfitting Algorithm} -\usage{ -TVAM(Lt, Ly, LLx, gridT = NULL, x = NULL, ht = NULL, hx = NULL, - K = "epan", suppT = NULL, suppX = NULL) -} -\arguments{ -\item{Lt}{An \emph{n}-dimensional list of \emph{N_i}-dimensional vector whose elements consist of longitudial time points for each \emph{i}-th subject.} - -\item{Ly}{An \emph{n}-dimensional list of \emph{N_i}-dimensional vector whose elements consist of longitudial response observations of each \emph{i}-subject corresponding to \emph{Lt}.} - -\item{LLx}{A tuple of \emph{d}-lists, where each list respresents longitudinal covariate observations of the \emph{j}-th component corresponding to \emph{Lt} and \emph{Ly}.} - -\item{gridT}{An \emph{M}-dimensional sequence of evaluation time points for additive surface estimators. (Must be sorted in increasing orders.)} - -\item{x}{An \emph{N} by \emph{d} matrix whose column vectors consist of \emph{N} vectors of evaluation points for additive surface component estimators at each covariate value.} - -\item{ht}{A bandwidth for kernel smoothing in time component.} - -\item{hx}{A \emph{d} vector of bandwidths for kernel smoothing covariate components, respectively.} - -\item{K}{A \code{function} object representing the kernel to be used in the smooth backfitting (default is 'epan', the the Epanechnikov kernel.).} - -\item{suppT}{A 2-dimensional vector consists of the lower and upper limits of estimation intervals for time component (default is \emph{[0,1]}).} - -\item{suppX}{A \emph{d} by 2 matrix whose row vectors consist of the lower and upper limits of estimation intervals for each component function (default is the \emph{d}-dimensional unit rectangle of \emph{[0,1]}).} -} -\value{ -A list containing the following fields: -\item{tvamComp}{A tuple of \emph{d}-lists, where each list is given by \emph{M} by \emph{N} matrix whose elements represents the smooth backfitting surface estimator of the \emph{j}-component evaluated at \code{gridT} and the \emph{j}-th column of \code{x}.} -\item{tvamMean}{An \emph{M}-dimensional vector whose elelments consist of the marginal time regression function estimated at \code{gridT}.} -} -\description{ -Smooth backfitting procedure for time-varying additive models -} -\details{ -\code{TVAM} estimates component surfaces of time-varying additive models for londitudinal observations based on the smooth backfitting algorithm proposed by Zhang et al. (2013). \code{TVAM} only focuses on the local constant smooth backfitting in contrast to the original development as in Zhang et al. (2013). However, the local polynomial version can be extended similarly, so that those are omitted in the development. Especially in this development, one can designate an estimation support of additive surfaces when the additive modeling is only allowed over restricted intervals or one is interested in the modeling over the support (see Han et al., 2016). -} -\examples{ - -set.seed(1000) - -n <- 100 -Lt <- list() -Ly <- list() -Lx1 <- list() -Lx2 <- list() - -for (i in 1:n) { - Ni <- sample(10:15,1) - - Lt[[i]] <- sort(runif(Ni,0,1)) - Lx1[[i]] <- runif(Ni,0,1) - Lx2[[i]] <- runif(Ni,0,1) - Ly[[i]] <- Lt[[i]]*(cos(2*pi*Lx1[[i]]) + sin(2*pi*Lx2[[i]])) + rnorm(Ni,0,0.1) - -} - -LLx <- list(Lx1,Lx2) - -gridT <- seq(0,1,length.out=41) -x0 <- seq(0,1,length.out=51) -x <- cbind(x0,x0) - -ht <- 0.1 -hx <- c(0.1,0.1) - -tvam <- TVAM(Lt,Ly,LLx,gridT=gridT,x=x,ht=ht,hx=hx,K='epan') - -g0Sbf <- tvam$tvamMean -gjSbf <- tvam$tvamComp - -par(mfrow=c(1,2)) -par(mar=c(1,1,1,1)+0.1) -persp(gridT,x0,gjSbf[[1]],theta=60,phi=30, - xlab='time',ylab='x1',zlab='g1(t, x1)') -persp(gridT,x0,gjSbf[[2]],theta=60,phi=30, - xlab='time',ylab='x2',zlab='g1(t, x2)') - -} -\references{ -\cite{Zhang, X., Park, B. U. and Wang, J.-L. (2013), "Time-varying additive models for longitudinal data", Journal of the American Statistical Association, Vol.108, No.503, p.983-998.} - -\cite{Han, K., Mueller, H.-G. and Park, B. U. (2018), "Smooth backfitting for additive modeling with small errors-in-variables, with an application to additive functional regression for multiple predictor functions", Bernoulli, Vol.24, No.2, p.1233-1265.} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/VCAM.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/VCAM.Rd deleted file mode 100644 index a5638c85..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/VCAM.Rd +++ /dev/null @@ -1,112 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/VCAM.R -\name{VCAM} -\alias{VCAM} -\title{Sieve estimation} -\usage{ -VCAM(Lt, Ly, X, optnAdd = list(), optnVc = list()) -} -\arguments{ -\item{Lt}{An \emph{n}-dimensional list of \emph{N_i}-dimensional vectors whose elements consist of longitudial time points for each \emph{i}-th subject.} - -\item{Ly}{An \emph{n}-dimensional list of \emph{N_i}-dimensional vectors whose elements consist of longitudial response observations of each \emph{i}-subject corresponding to \emph{Lt}.} - -\item{X}{An \emph{n} by \emph{d} matrix whose row vectors consist of covariate vector of additive components for each subject.} - -\item{optnAdd}{A list of options controls B-spline parameters for additive components, specified by list(name=value). See 'Details'.} - -\item{optnVc}{A list of options controls B-spline parameters for varying-coefficient components, specified by list(name=value). See 'Details'.} -} -\value{ -A list containing the following fields: -\item{Lt}{The same with input given by \emph{Lt}} -\item{LyHat}{Fitted values corresponding to \emph{Ly}} -\item{phiEst}{An \emph{N} by \emph{d} matrix whose column vectors consist of esimates for each additive component function evaluated at \emph{gridX}.} -\item{beta0Est}{An \emph{M}-dimensional vector for overall mean function estimates evalueated at \emph{gridT}.} -\item{betaEst}{An \emph{M} by \emph{d} matrix whose column vectors consist of esimates for each varying-coefficient components evalueated at \emph{gridT}.} -\item{gridX}{The same with input given by \emph{optnAdd$grid}} -\item{gridT}{The same with input given by \emph{optnVc$grid}} -} -\description{ -B-spline based estimation procedure for time-varying additive models. -} -\details{ -\code{VCAM} provides a simple algorithm based on B-spline basis to estimate its nonparametric additive and varying-coefficient components. - -Available control options for \emph{optnAdd} are -\describe{ -\item{nKnot}{A \emph{d}-dimensional vector which designates the number of knots for each additive component function estimation (default=10).} -\item{order}{A \emph{d}-dimensional vector which designates the order of B-spline basis for each additive component function estimation (default=3).} -\item{grid}{A \emph{N} by \emph{d} matrix whose column vector consist of evaluation grid points for each component function estimation.} -} -and control options for \emph{optnVc} are -\describe{ -\item{nKnot}{A \emph{(d+1)}-dimensional vector which designates the number of knots for overall mean function and each varying-coefficient component function estimation (default=10).} -\item{order}{A \emph{(d+1)}-dimensional vector which designates the order of B-spline basis for overall mean function and each varying-coefficient component function estimation (default=3).} -\item{grid}{A \emph{M} by \emph{(d+1)} matrix whose column vectors consist of evaluation grid points for overall mean function and each varying-coefficient component function estimation.} -} -} -\examples{ - -library(MASS) - -set.seed(100) - -n <- 100 -d <- 2 - -Lt <- list() -Ly <- list() - -m <- rep(0,2) -S <- matrix(c(1,0.5,0.5,1),nrow=2,ncol=2) -X <- pnorm(mvrnorm(n,m,S)) - -beta0 <- function(t) 1.5*sin(3*pi*(t+0.5)) -beta1 <- function(t) 3*(1-t)^2 -beta2 <- function(t) 4*t^3 - -phi1 <- function(x) sin(2*pi*x) -phi2 <- function(x) 4*x^3-1 - -for (i in 1:n) { - Ni <- sample(10:20,1) - - Lt[[i]] <- sort(runif(Ni,0,1)) - Ly[[i]] <- beta0(Lt[[i]]) + beta1(Lt[[i]])*phi1(X[i,1]) + beta2(Lt[[i]])*phi2(X[i,2]) + rnorm(Ni,0,0.1) - -} - - -vcam <- VCAM(Lt,Ly,X) - -par(mfrow=c(1,1)) -plot(unlist(vcam$LyHat),unlist(Ly),xlab='observed Y',ylab='fitted Y') -abline(coef=c(0,1),col=8) - -par(mfrow=c(1,2)) -plot(vcam$gridX[,1],vcam$phiEst[,1],type='l',ylim=c(-1,1),xlab='x1',ylab='phi1') -points(vcam$gridX[,1],phi1(vcam$gridX[,1]),col=2,type='l',lty=2,lwd=2) -legend('topright',c('true','est'),lwd=2,lty=c(1,2),col=c(1,2)) - -plot(vcam$gridX[,2],vcam$phiEst[,2],type='l',ylim=c(-1,3),xlab='x2',ylab='phi2') -points(vcam$gridX[,2],phi2(vcam$gridX[,2]),col=2,type='l',lty=2,lwd=2) -legend('topleft',c('true','est'),lwd=2,lty=c(1,2),col=c(1,2)) - -par(mfrow=c(1,3)) -plot(vcam$gridT,vcam$beta0Est,type='l',xlab='t',ylab='beta0') -points(vcam$gridT,beta0(vcam$gridT),col=2,type='l',lty=2,lwd=2) -legend('topright',c('true','est'),lwd=2,lty=c(1,2),col=c(1,2)) - -plot(vcam$gridT,vcam$betaEst[,1],type='l',xlab='t',ylab='beta1') -points(vcam$gridT,beta1(vcam$gridT),col=2,type='l',lty=2,lwd=2) -legend('topright',c('true','est'),lwd=2,lty=c(1,2),col=c(1,2)) - -plot(vcam$gridT,vcam$betaEst[,2],type='l',xlab='t',ylab='beta2') -points(vcam$gridT,beta2(vcam$gridT),col=2,type='l',lty=2,lwd=2) -legend('topright',c('true','est'),lwd=2,lty=c(1,2),col=c(1,2)) - -} -\references{ -\cite{Zhang, X. and Wang, J.-L. (2015), "Varying-coefficient additive models for functional data", Biometrika, Vol.102, No.1, p.15-32.} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/WFDA.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/WFDA.Rd deleted file mode 100644 index 26a899db..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/WFDA.Rd +++ /dev/null @@ -1,75 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/WFDA.R -\name{WFDA} -\alias{WFDA} -\title{Warped Functional Data Analysis} -\usage{ -WFDA(Ly, Lt, optns = list()) -} -\arguments{ -\item{Ly}{A list of \emph{n} vectors containing the observed values for each individual.} - -\item{Lt}{A list of \emph{n} vectors containing the observation time points for each individual corresponding to y. Each vector should be sorted in ascending order.} - -\item{optns}{A list of options control parameters specified by \code{list(name=value)}. See 'Details'.} -} -\value{ -A list containing the following fields: -\item{optns}{Control options used.} -\item{lambda}{Penalty parameter used.} -\item{aligned}{Aligned curves evaluated at time 't'} -\item{h}{Warping functions for 't'} -\item{hInv}{Inverse warping functions evaluated at 't'} -\item{costs}{The mean cost associated with each curve} -\item{timing}{The time required by time-warping.} -} -\description{ -Pairwise curve synchronization for functional data -} -\details{ -WFDA uses a pairwise warping method to obtain the desired alignment (registration) of the random trajectories. -The data has to be regular. The routine returns the aligned curves and the associated warping function. - -Available control options are -\describe{ -\item{choice}{Choice of estimating the warping functions ('weighted' or 'truncated'). If 'weighted' then weighted averages of pairwise warping functions are computed; the weighting is based on the inverse pairwise distances. If 'truncated' the pairs with the top 10\% largest distances are truncated and the simple average of the remaining pairwise distances are used - default: 'truncated'} -\item{subsetProp}{Pairwise warping functions are determined by using a subset of the whole sample; numeric (0,1] - default: 0.50} -\item{lambda}{Penalty parameter used for estimating pairwise warping functions; numeric - default : V*10^-4, where V is the average L2 norm of y-mean(y).} -\item{nknots}{Number of knots used for estimating the piece-wise linear pairwise warping functions; numeric - default: 2} -\item{isPWL}{Indicator if the resulting warping functions should piece-wise linear, if FALSE 'nknots' is ignored and the resulting warping functions are simply monotonic; logical - default: TRUE (significantly larger computation time.)} -\item{seed}{Random seed for the selection of the subset of warping functions; numeric - default: 666} -\item{verbose}{Indicator if the progress of the pairwise warping procedure should be displayed; logical - default: FALSE} -} -} -\examples{ -N = 44; -eps = 0.123; -M = 41; -set.seed(123) -Tfinal = 3 -me <- function(t) exp(-Tfinal*(((t/Tfinal^2)-0.5))^2); -T = seq(0,Tfinal,length.out = M) -recondingTimesMat = matrix(nrow = N, ncol = M) -yMat = matrix(nrow = N, ncol = M) - -for (i in 1:N){ - peak = runif(min = 0.2,max = 0.8,1) * Tfinal - recondingTimesMat[i,] = sort( unique(c( seq(0.0 , peak, length.out = round((M+1)/2)), - seq( peak, Tfinal, length.out = round((M+1)/2))))) * Tfinal - yMat[i,] = me(recondingTimesMat[i,]) * rnorm(1, mean=4.0, sd= eps) - + rnorm(M, mean=0.0, sd= eps) -} - -Y = as.list(as.data.frame(t(yMat))) -X = rep(list(T),N) - -sss = WFDA(Ly = Y, Lt = X, list( choice = 'weighted' )) -par(mfrow=c(1,2)) -matplot(x= T, t(yMat), t='l', main = 'Raw', ylab = 'Y'); grid() -matplot(x= T, t(sss$aligned), t='l', main = 'Aligned', ylab='Y'); grid() -} -\references{ -\cite{Tang, R. and Mueller, H.G. (2008). "Pairwise curve synchronization for functional data." Biometrika 95, 875-889} - -\cite{Tang, R. and Mueller, H.G. (2009) "Time-synchronized clustering of gene expression trajectories." Biostatistics 10, 32-45} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/Wiener.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/Wiener.Rd deleted file mode 100644 index 6c1c13d3..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/Wiener.Rd +++ /dev/null @@ -1,31 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/Wiener.R -\name{Wiener} -\alias{Wiener} -\title{Simulate standard Wiener processes (Brownian motions)} -\usage{ -Wiener(n = 1, pts = seq(0, 1, length = 50), sparsify = NULL, - K = 50) -} -\arguments{ -\item{n}{Sample size.} - -\item{pts}{A vector of points in [0, 1] specifying the support of the processes.} - -\item{sparsify}{A vector of integers. The number of observations per curve will be uniform distribution on sparsify.} - -\item{K}{The number of components.} -} -\value{ -If \code{sparsify} is not specified, a matrix with \code{n} rows corresponding to the samples are returned. Otherwise the sparsified sample is returned. -} -\description{ -Simulate \code{n} standard Wiener processes on [0, 1], possibly -sparsifying the results. -} -\details{ -The algorithm is based on Karhunen-Loeve expansion. -} -\seealso{ -Sparsify -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/cumtrapzRcpp.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/cumtrapzRcpp.Rd deleted file mode 100644 index c0cbef20..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/cumtrapzRcpp.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/RcppExports.R -\name{cumtrapzRcpp} -\alias{cumtrapzRcpp} -\title{Cumulative Trapezoid Rule Numerical Integration} -\usage{ -cumtrapzRcpp(X, Y) -} -\arguments{ -\item{X}{Sorted vector of X values} - -\item{Y}{Vector of Y values.} -} -\description{ -Cumulative Trapezoid Rule Numerical Integration using Rcpp -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/fdapace.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/fdapace.Rd deleted file mode 100644 index e8c2fe3b..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/fdapace.Rd +++ /dev/null @@ -1,34 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/pkgname.R -\docType{package} -\name{fdapace} -\alias{fdapace} -\alias{fdapace-package} -\title{PACE: Principal Analysis by Conditional Expectation} -\description{ -PACE package for Functional Data Analysis and Empirical Dynamics. -} -\details{ -PACE is a versatile package that provides implementation of various methods -of Functional Data Analysis (FDA) and Empirical Dynamics. The core of this -package is Functional Principal Component Analysis (FPCA), a key technique -for functional data analysis, for sparsely or densely sampled random -trajectories and time courses, via the Principal Analysis by Conditional -Estimation (PACE) algorithm. PACE is useful for the analysis of data that -have been generated by a sample of underlying (but usually not fully -observed) random trajectories. It does not rely on pre-smoothing of -trajectories, which is problematic if functional data are sparsely sampled. -PACE provides options for functional regression and correlation, for -Longitudinal Data Analysis, the analysis of stochastic processes from -samples of realized trajectories, and for the analysis of underlying -dynamics. -} -\author{ -Xiongtao Dai \email{dai@ucdavis.edu}, -Pantelis Z. Hadjipantelis \email{pantelis@ucdavis.edu}, -Hao Ji \email{haoji@ucdavis.edu} -Hans-Georg Mueller \email{hgmueller@ucdavis.edu} -Jane-Ling Wang \email{janelwang@ucdavis.edu} - -Maintainer: Pantelis Z. Hadjipantelis \email{pantelis@ucdavis.edu} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/fitted.FPCA.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/fitted.FPCA.Rd deleted file mode 100644 index 194052ec..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/fitted.FPCA.Rd +++ /dev/null @@ -1,76 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/fitted.FPCA.R -\name{fitted.FPCA} -\alias{fitted.FPCA} -\title{Fitted functional sample from FPCA object} -\usage{ -\method{fitted}{FPCA}(object, K = NULL, derOptns = list(p = 0), - ciOptns = list(alpha = NULL, cvgMethod = NULL), ...) -} -\arguments{ -\item{object}{A object of class FPCA returned by the function FPCA().} - -\item{K}{The integer number of the first K components used for the representation. (default: length(fpcaObj$lambda ))} - -\item{derOptns}{A list of options to control the derivation parameters specified by \code{list(name=value)}. See `Details'. (default = NULL)} - -\item{ciOptns}{A list of options to control the confidence interval/band specified by \code{list(name=value)}. See `Details'. (default = NULL)} - -\item{...}{Additional arguments} -} -\value{ -If \code{alpha} is \code{NULL}, \code{p>1} or functional observations are dense, an \code{n} by \code{length(workGrid)} matrix, each row of which contains a sample. Otherwise, it returns a list which consists of the following items: -\item{workGrid}{An evaluation grid for fitted values.} -\item{fitted}{An n by length(workGrid) matrix, each row of which contains a sample.} -\item{cvgUpper}{An n by length(workGrid) matrix, each row of which contains the upper \code{alpha}-coverage limit} -\item{cvgLower}{An n by length(workGrid) matrix, each row of which contains the lower \code{alpha}-coverage limit} -} -\description{ -Combine the zero-meaned fitted values and the interpolated mean to get the fitted values for the trajectories or the derivatives of these trajectories. -Estimates are given on the work-grid, not on the observation grid. Use ConvertSupport to map the estimates to your desired domain. \code{100*(1-alpha)}-percentage coverage intervals, or bands, for trajectory estimates (not derivatives) are provided. See details in example. -} -\details{ -Available derivation control options are -\describe{ -\item{p}{The order of the derivatives returned (default: 0, max: 2)} -\item{method}{The method used to produce the sample of derivatives ('FPC' (default) or 'QUO'). See Liu and Mueller (2009) for more details} -\item{bw}{Bandwidth for smoothing the derivatives (default: p * 0.10 * S)} -\item{kernelType}{Smoothing kernel choice; same available types are FPCA(). default('epan')} -} - -Available confidence interval/band control options are -\describe{ -\item{alpha}{Significant level for confidence interval/band for trajectory coverage. default=0.05 (currently only work when p=0)} -\item{cvgMethod}{Option for trajectory coverage method beween 'interval' and 'band'. default='band'} -} -} -\examples{ -set.seed(1) -n <- 100 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- Sparsify(sampWiener, pts, 5:10) -res <- FPCA(sampWiener$Ly, sampWiener$Lt, - list(dataType='Sparse', error=FALSE, kernel='epan', verbose=TRUE)) -fittedY <- fitted(res, ciOptns = list(alpha=0.05)) - -workGrid <- res$workGrid -cvgUpper <- fittedY$cvgUpper -cvgLower <- fittedY$cvgLower - -par(mfrow=c(2,3)) -ind <- sample(1:n,6) -for (i in 1:6) { - j <- ind[i] - plot(workGrid,cvgUpper[j,],type='l',ylim=c(min(cvgLower[j,]),max(cvgUpper[j,])),col=4,lty=2, - xlab='t', ylab='X(t)', main=paste(j,'-th subject',sep='')) - points(workGrid,cvgLower[j,],type='l',col=4,lty=2) - points(res$inputData$Lt[[j]],res$inputData$Ly[[j]]) -} - -} -\references{ -\cite{Yao, F., Mueller, H.-G. and Wang, J.-L. "Functional data analysis for sparse longitudinal data", Journal of the American Statistical Association, vol.100, No. 470 (2005): 577-590.} - -\cite{Liu, Bitao, and Hans-Georg Mueller. "Estimating derivatives for samples of sparsely observed functions, with application to online auction dynamics." Journal of the American Statistical Association 104, no. 486 (2009): 704-717. (Sparse data FPCA)} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/fitted.FPCAder.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/fitted.FPCAder.Rd deleted file mode 100644 index 29e906da..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/fitted.FPCAder.Rd +++ /dev/null @@ -1,32 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/fitted.FPCAder.R -\name{fitted.FPCAder} -\alias{fitted.FPCAder} -\title{Fitted functional sample from FPCAder object} -\usage{ -\method{fitted}{FPCAder}(object, K = NULL, ...) -} -\arguments{ -\item{object}{A object of class FPCA returned by the function FPCA().} - -\item{K}{The integer number of the first K components used for the representation. (default: length(derObj$lambda ))} - -\item{...}{Additional arguments} -} -\value{ -An \code{n} by \code{length(workGrid)} matrix, each row of which contains a sample. -} -\description{ -Combine the zero-meaned fitted values and the mean derivative to get the fitted values for the derivatives trajectories -Estimates are given on the work-grid, not on the observation grid. Use ConvertSupport to map the estimates to your desired domain. -} -\examples{ -set.seed(1) -n <- 20 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- Sparsify(sampWiener, pts, 10) -} -\references{ -\cite{Liu, Bitao, and Hans-Georg Mueller. "Estimating derivatives for samples of sparsely observed functions, with application to online auction dynamics." Journal of the American Statistical Association 104, no. 486 (2009): 704-717. (Sparse data FPCA)} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/kCFC.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/kCFC.Rd deleted file mode 100644 index 9896a039..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/kCFC.Rd +++ /dev/null @@ -1,45 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/kCFC.R -\name{kCFC} -\alias{kCFC} -\title{Functional clustering and identifying substructures of longitudinal data using kCFC.} -\usage{ -kCFC(y, t, k = 3, kSeed = 123, maxIter = 125, - optnsSW = list(methodMuCovEst = "smooth", FVEthreshold = 0.9, - methodBwCov = "GCV", methodBwMu = "GCV"), optnsCS = list(methodMuCovEst - = "smooth", FVEthreshold = 0.7, methodBwCov = "GCV", methodBwMu = "GCV")) -} -\arguments{ -\item{y}{A list of \emph{n} vectors containing the observed values for each individual. Missing values specified by \code{NA}s are supported for dense case (\code{dataType='dense'}).} - -\item{t}{A list of \emph{n} vectors containing the observation time points for each individual corresponding to y.} - -\item{k}{A scalar defining the number of clusters to define; default 3. Values that define very small clusters (eg.cluster size <=3) will potentiall err.} - -\item{kSeed}{A scalar valid seed number to ensure replication; default: 123} - -\item{maxIter}{A scalar defining the maximum number of iterations allowed; default 20, common for both the simple kmeans initially and the subsequent k-centres} - -\item{optnsSW}{A list of options control parameters specified by \code{list(name=value)} to be used for sample-wide FPCA; by default: "list( methodMuCovEst ='smooth', FVEthreshold= 0.90, methodBwCov = 'GCV', methodBwMu = 'GCV' )". See `Details in ?FPCA'.} - -\item{optnsCS}{A list of options control parameters specified by \code{list(name=value)} to be used for cluster-specific FPCA; by default: "list( methodMuCovEst ='smooth', FVEthreshold= 0.70, methodBwCov = 'GCV', methodBwMu = 'GCV' )". See `Details in ?FPCA'.} -} -\value{ -A list containing the following fields: -\item{cluster}{A vector of levels 1:k, indicating the cluster to which each curve is allocated.} -\item{fpcaList}{A list with the fpcaObj for each separate cluster.} -\item{iterToConv}{A number indicating how many iterations where required until convergence.} -} -\description{ -Functional clustering and identifying substructures of longitudinal data using kCFC. -} -\examples{ -data(medfly25) -Flies <- MakeFPCAInputs(medfly25$ID, medfly25$Days, medfly25$nEggs) -kcfcObj <- kCFC(Flies$Ly[1:250], Flies$Lt[1:250], # using only 250 for speed consideration - optnsSW = list(methodMuCovEst = 'smooth', userBwCov = 2, FVEthreshold = 0.90), - optnsCS = list(methodMuCovEst = 'smooth', userBwCov = 2, FVEthreshold = 0.70)) -} -\references{ -\cite{Jeng-Min Chiou, Pai-Ling Li, "Functional clustering and identifying substructures of longitudinal data." Journal of the Royal Statistical Society 69 (2007): 679-699} -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/medfly25.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/medfly25.Rd deleted file mode 100644 index 4197802b..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/medfly25.Rd +++ /dev/null @@ -1,25 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/medfly25.R -\docType{data} -\name{medfly25} -\alias{medfly25} -\title{Number of eggs laid daily from medflies} -\format{A data frame with 19725 rows and 3 variables: -\describe{ -\item{ID}{: Medfly ID according to the orignal dataset} -\item{Days}{: Day of measurement} -\item{nEggs}{: Number of eggs laid at that particular day} -\item{nEggsRemain}{: Remaining total number of eggs laid} -}} -\source{ -\url{http://anson.ucdavis.edu/~mueller/data/medfly1000.html} -} -\description{ -A dataset containing the eggs laid from 789 medflies (Mediterranean fruit flies, - Ceratitis capitata) during the first 25 days of their lives. This is a subset of -the dataset used by Carey at al. (1998); only flies having lived at least 25 days -are shown. At the end of the recording period all flies were still alive. -} -\references{ -{Carey, J.R., Liedo, P., Mueller, H.G., Wang, J.L., Chiou, J.M. (1998). Relationship of age patterns of fecundity to mortality, longevity, and lifetime reproduction in a large cohort of Mediterranean fruit fly females. J. of Gerontology --Biological Sciences 53, 245-251. } -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/plot.FPCA.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/plot.FPCA.Rd deleted file mode 100644 index 73b19faa..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/plot.FPCA.Rd +++ /dev/null @@ -1,41 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/CreateDiagnosticsPlot.R, R/plot.FPCA.R -\name{CreateDiagnosticsPlot} -\alias{CreateDiagnosticsPlot} -\alias{plot.FPCA} -\title{Functional Principal Component Analysis Diagnostics plot} -\usage{ -CreateDiagnosticsPlot(...) - -\method{plot}{FPCA}(x, openNewDev = FALSE, addLegend = TRUE, ...) -} -\arguments{ -\item{...}{passed into \code{plot.FPCA}.} - -\item{x}{An FPCA class object returned by FPCA().} - -\item{openNewDev}{A logical specifying if a new device should be opened - default: FALSE} - -\item{addLegend}{A logical specifying whether to add legend.} -} -\description{ -Deprecated. Use \code{plot.FPCA} instead. - -This function plot the results for an FPCA. It prints the design plot, mean function, scree-plot -and the first three eigenfunctions of a sample. If provided with a derivative options object (?FPCAder) it will return the -differentiated mean and first two principal modes of variations for 50\%, 75\%, 100\%, 125\% and 150\% of the defined bandwidth choice. -} -\details{ -The black, red, and green curves stand for the first, second, and third eigenfunctions, respectively. -\code{plot.FPCA} is currently implemented only for the original function, but not a derivative FPCA object. -} -\examples{ -set.seed(1) -n <- 20 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- Sparsify(sampWiener, pts, 10) -res1 <- FPCA(sampWiener$Ly, sampWiener$Lt, - list(dataType='Sparse', error=FALSE, kernel='epan', verbose=FALSE)) -plot(res1) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/predict.FPCA.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/predict.FPCA.Rd deleted file mode 100644 index cd432d0b..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/predict.FPCA.Rd +++ /dev/null @@ -1,44 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/predict.FPCA.R -\name{predict.FPCA} -\alias{predict.FPCA} -\title{Predict FPC scores for a new sample given an FPCA object} -\usage{ -\method{predict}{FPCA}(object, newLy, newLt, sigma2 = NULL, K = 1, - xiMethod = "CE", ...) -} -\arguments{ -\item{object}{An FPCA object.} - -\item{newLy}{A list of \emph{n} vectors containing the observed values for each individual.} - -\item{newLt}{A list of \emph{n} vectors containing the observation time points for each individual corresponding to y.} - -\item{sigma2}{The user-defined measurement error variance. A positive scalar. (default: rho if applicable, otherwise sigma2 if applicable, otherwise 0 if no error. )} - -\item{K}{The scalar defining the number of clusters to define; (default: 1).} - -\item{xiMethod}{The integration method used to calculate the functional principal component scores ( standard numerical integration 'IN' or conditional expectation 'CE'); default: 'CE'.} - -\item{...}{Not used.} -} -\value{ -A matrix of size n-by-K -} -\description{ -Return a matrix with the first K FPC scores according to conditional expectation or numerical integration. -} -\examples{ -set.seed(1) -n <- 50 -pts <- seq(0, 1, by=0.05) -# The first n samples are for training and the rest testing -sampWiener <- Wiener(2 * n, pts) -sparsity <- 2:5 -train <- Sparsify(sampWiener[seq_len(n), , drop=FALSE], pts, sparsity) -test <- Sparsify(sampWiener[seq(n + 1, 2 * n), , drop=FALSE], pts, sparsity) -res <- FPCA(train$Ly, train$Lt) -pred <- predict(res, test$Ly, test$Lt, K=5) -plot(pred[, 1], pred[, 2]) - -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/print.FPCA.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/print.FPCA.Rd deleted file mode 100644 index 971aaba4..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/print.FPCA.Rd +++ /dev/null @@ -1,26 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/print.FPCA.R -\name{print.FPCA} -\alias{print.FPCA} -\title{Print an FPCA object} -\usage{ -\method{print}{FPCA}(x, ...) -} -\arguments{ -\item{x}{An FPCA object.} - -\item{...}{Not used.} -} -\description{ -Print a simple description of an FPCA object -} -\examples{ -set.seed(1) -n <- 20 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- Sparsify(sampWiener, pts, 10) -res <- FPCA(sampWiener$Ly, sampWiener$Lt) -res - -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/print.FSVD.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/print.FSVD.Rd deleted file mode 100644 index 93a7411c..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/print.FSVD.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/print.FSVD.R -\name{print.FSVD} -\alias{print.FSVD} -\title{Print an FSVD object} -\usage{ -\method{print}{FSVD}(x, ...) -} -\arguments{ -\item{x}{An FSVD object.} - -\item{...}{Not used.} -} -\description{ -Print a simple description of an FSVD object -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/print.WFDA.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/print.WFDA.Rd deleted file mode 100644 index 145b9f34..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/print.WFDA.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/print.WFDA.R -\name{print.WFDA} -\alias{print.WFDA} -\title{Print a WFDA object} -\usage{ -\method{print}{WFDA}(x, ...) -} -\arguments{ -\item{x}{A WFDA object.} - -\item{...}{Not used.} -} -\description{ -Print a simple description of a WFDA object -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/str.FPCA.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/str.FPCA.Rd deleted file mode 100644 index 29803efe..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/str.FPCA.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/str.FPCA.R -\name{str.FPCA} -\alias{str.FPCA} -\title{Compactly display the structure of an FPCA object} -\usage{ -\method{str}{FPCA}(object, ...) -} -\arguments{ -\item{object}{An FPCA object} - -\item{...}{Not used} -} -\description{ -Compactly display the structure of an FPCA object -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/man/trapzRcpp.Rd b/fdapace.Rcheck/00_pkg_src/fdapace/man/trapzRcpp.Rd deleted file mode 100644 index 59be0a9e..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/man/trapzRcpp.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/RcppExports.R -\name{trapzRcpp} -\alias{trapzRcpp} -\title{Trapezoid Rule Numerical Integration} -\usage{ -trapzRcpp(X, Y) -} -\arguments{ -\item{X}{Sorted vector of X values} - -\item{Y}{Vector of Y values.} -} -\description{ -Trapezoid Rule Numerical Integration using Rcpp -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/src/CPPlwls1d.cpp b/fdapace.Rcheck/00_pkg_src/fdapace/src/CPPlwls1d.cpp deleted file mode 100644 index d2ab975a..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/src/CPPlwls1d.cpp +++ /dev/null @@ -1,172 +0,0 @@ -#include -#include // to map kernels to integers for the switch -#include // to read in the kernel name -#include // to use vectors -#include // to get the intersect and sort - -// [[Rcpp::depends(RcppEigen)]] -// [[Rcpp::export]] - -Eigen::VectorXd CPPlwls1d( const double & bw, const std::string kernel_type, const Eigen::Map & win, const Eigen::Map & xin, const Eigen::Map & yin, const Eigen::Map & xout, const unsigned int & npoly = 1, const unsigned int & nder = 0){ - - - // Convenient constants - const double invSqrt2pi= 1./(sqrt(2.*M_PI)); - const double factorials[] = {1,1,2,6,24,120,720,5040,40320,362880,3628800}; - - const unsigned int nXGrid = xin.size(); - const unsigned int nUnknownPoints = xout.size(); - Eigen::VectorXd result(nUnknownPoints); - - // ======================== - // The checks start here: - - if(nXGrid == 0) { - Rcpp::stop("The input X-grid has length zero."); - } - - // Check that we have equal number of readings - if( nXGrid != yin.size()){ - Rcpp::stop("The input Y-grid does not have the same number of points as input X-grid."); - } - - if( nXGrid != win.size()){ - Rcpp::stop("The input weight vector does not have the same number of points as input X-grid."); - } - - // Check that bandwidth is greater than zero - if( bw <= 0.){ - Rcpp::stop("The bandwidth supplied for 1-D smoothing is not positive."); - } - - // Check that the degreee of polynomial used and the order of the derivative are reasonable - if (npoly < nder){ - Rcpp::stop("The degree of polynomial supplied for 1-D smoothing is less than the order of derivative"); - } - - // Map the kernel name so we can use switches - std::map possibleKernels; - possibleKernels["epan"] = 1; possibleKernels["rect"] = 2; - possibleKernels["gauss"] = 3; possibleKernels["gausvar"] = 4; - possibleKernels["quar"] = 5; - - // If the kernel_type key exists set KernelName appropriately - int KernelName = 0; - if ( possibleKernels.count( kernel_type ) != 0){ - KernelName = possibleKernels.find( kernel_type )->second; //Set kernel choice - } else { - // otherwise use "epan"as the kernel_type - Rcpp::warning("Kernel_type argument was not set correctly; Epanechnikov kernel used."); - KernelName = possibleKernels.find( "epan" )->second;; - } - - // Check that we do not have zero weights // Should do a try-catch here - if ( !(win.all()) ){ // - Rcpp::warning("Cases with zero-valued windows maybe not be too safe."); - } - // Check if the first 5 elements are sorted // Very rough check // Will use issorted in the future - if ( (xin[0]> xin[1]) || (xin[1]> xin[2]) || (xin[2]> xin[3]) || (xin[3]> xin[4]) || (xin[4]> xin[5]) ){ - Rcpp::stop("The X-grid used is not sorted. (or you have less than 6 points)"); - } - - // The checks end here. - // =================== - - for (unsigned int i = 0; i != nUnknownPoints; ++i){ - //locating local window (LOL) (bad joke) - std::vector indx; - const double* lower ; - const double* upper ; - - //if the kernel is not Gaussian - if ( KernelName != 3 && KernelName != 4) { - //construct listX as vectors / size is unknown originally - // for (unsigned int y = 0; y != nXGrid; ++y){ if ( std::fabs( xout(i) - xin(y) ) <= bw ) { indx.push_back(y); } } - // Get iterator pointing to the first element which is not less than xou(u) - lower = std::lower_bound(xin.data(), xin.data() + nXGrid, xout(i) - bw); - upper = std::lower_bound(xin.data(), xin.data() + nXGrid, xout(i) + bw); - // const unsigned int firstElement = lower - &xin[0]; - // for (unsigned int xx1 =0; xx1 != upper-lower; ++xx1){ - // indx.push_back( firstElement+ xx1 ); - // } - } else { - lower = xin.data(); - upper = xin.data() + nXGrid; - } - - const unsigned int firstElement = lower - &xin[0]; - for (unsigned int xx1 =0; xx1 != upper-lower; ++xx1){ - indx.push_back( firstElement+ xx1 ); - } - - // for(unsigned int r4=0; r4 != indx.size(); r4++){ Rcpp::Rcout << indx.at(r4) << ", "; } Rcpp::Rcout << "\n"; - - unsigned int indxSize = indx.size(); - Eigen::VectorXd temp(indxSize); - Eigen::VectorXd lw(indxSize); - Eigen::VectorXd ly(indxSize); - Eigen::VectorXd lx(indxSize); - - for (unsigned int y = 0; y != indxSize; ++y){ - lx(y) = xin(indx[y]); - lw(y) = win(indx[y]); - ly(y) = yin(indx[y]); - } - - - Eigen::VectorXd llx = (lx.array() -xout(i)) * (1./bw) ; - - //define the kernel used - switch (KernelName){ - case 1: // Epan - temp = (1-llx.array().pow(2))*0.75*(lw.array()); - break; - case 2 : // Rect - temp = lw ; - break; - case 3 : // Gauss - temp = ((-.5*(llx.array().pow(2))).exp()) * invSqrt2pi * (lw.array()); - break; - case 4 : // GausVar - temp = (lw.array()) * - ((-0.5 * llx.array().pow(2)).array().exp() * invSqrt2pi).array() * - (1.25 - (0.25 * (llx.array().pow(2))).array()); - break; - case 5 : // Quar - temp = (lw.array()) * - ((1.-llx.array().pow(2)).array().pow(2)).array() * (15./16.); - break; - } - - if(nder >= indxSize){ - Rcpp::warning("Cannot estimate derivatives of order p with less than p+1 points."); - result(i) = std::numeric_limits::quiet_NaN(); - } else { - // make the design matrix - Eigen::MatrixXd X(indxSize, npoly+1); - X.setOnes(); - for (unsigned int y = 1; y <= npoly; ++y){ - X.col(y) = (xout(i) - lx.array()).array().pow(y); - } - - Eigen::LDLT ldlt_XTWX(X.transpose() * temp.asDiagonal() *X); - // The solver should stop if the value is NaN. See the HOLE example in gcvlwls2dV2. - Eigen::VectorXd beta = ldlt_XTWX.solve(X.transpose() * temp.asDiagonal() * ly); - - // Rcpp::Rcout << "lx: " << lx.transpose() << std::endl; - // Rcpp::Rcout << "ly: " << ly.transpose() << std::endl; - // Rcpp::Rcout << "temp: " << temp.transpose() << std::endl; - // Rcpp::Rcout << "llx: " << llx.transpose() << std::endl; - // Rcpp::Rcout << "xin: " << xin.transpose() << std::endl; - // Rcpp::Rcout << "yin: " << yin.transpose() << std::endl; - // Rcpp::Rcout << "xout: " << xout.transpose() << std::endl; - // Rcpp::Rcout << "X: " << X.transpose() << std::endl; - // Rcpp::Rcout << "beta: " << beta.transpose() << std::endl; - // Rcpp::Rcout << "factorials[nder]: " << factorials[nder] << std::endl; - // Rcpp::Rcout << "pow (-1.0, nder): " << pow (-1.0, nder) << std::endl; - - result(i) = beta(nder+0) * factorials[nder] * std::pow(-1.0, int(nder)); - } - } - return result; -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/src/GetIndCEScoresCPP.cpp b/fdapace.Rcheck/00_pkg_src/fdapace/src/GetIndCEScoresCPP.cpp deleted file mode 100644 index 96a7df55..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/src/GetIndCEScoresCPP.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include // to get std::lower_bound -#include // to get std::iterator -#include // to get NaN - -// [[Rcpp::depends(RcppEigen)]] -// [[Rcpp::export]] - - -Rcpp::List GetIndCEScoresCPP( const Eigen::Map & yVec, const Eigen::Map & muVec, const Eigen::Map & lamVec, const Eigen::Map & phiMat, const Eigen::Map & SigmaYi){ - - // Setting up initial values - - const unsigned int lenlamVec = lamVec.size(); - - Eigen::MatrixXd xiVar = Eigen::MatrixXd::Constant(lenlamVec,lenlamVec,std::numeric_limits::quiet_NaN()); - Eigen::MatrixXd xiEst = Eigen::MatrixXd::Constant(lenlamVec,1,std::numeric_limits::quiet_NaN()); - Eigen::MatrixXd fittedY = Eigen::MatrixXd::Constant(lenlamVec,1,std::numeric_limits::quiet_NaN()); - - Eigen::MatrixXd LamPhi = lamVec.asDiagonal() * phiMat.transpose(); - Eigen::LDLT ldlt_SigmaYi(SigmaYi); - xiEst = LamPhi * ldlt_SigmaYi.solve(yVec - muVec) ; // LamPhiSig * (yVec - muVec); - xiVar = -LamPhi * ldlt_SigmaYi.solve(LamPhi.transpose()); // LamPhiSig.transpose(); - - xiVar.diagonal() += lamVec; - fittedY = muVec + phiMat * xiEst; - - return Rcpp::List::create(Rcpp::Named("xiEst") = xiEst, - Rcpp::Named("xiVar") = xiVar, - Rcpp::Named("fittedY") = fittedY); -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/src/GetIndCEScoresCPPnewInd.cpp b/fdapace.Rcheck/00_pkg_src/fdapace/src/GetIndCEScoresCPPnewInd.cpp deleted file mode 100644 index 76dd3132..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/src/GetIndCEScoresCPPnewInd.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include -#include // to get std::lower_bound -#include // to get std::iterator -#include // to get NaN - -// [[Rcpp::depends(RcppEigen)]] -// Be carefu; not to export this guy!! -Eigen::MatrixXd pinv( const Eigen::MatrixXd& Mat){ - // This is a slow puppy - const double pinvtol = 1.e-9; // Tolerance! - Eigen::JacobiSVD svdMat(Mat, Eigen::ComputeThinU | Eigen::ComputeThinV); - Eigen::VectorXd S = svdMat.singularValues(); - Eigen::VectorXd Sinv = S; - - for ( int i=0; i pinvtol ){ - Sinv(i)=1.0/S(i); - } else { - Sinv(i)=0; - } - } - return(svdMat.matrixV()*Sinv.asDiagonal()*svdMat.matrixU().transpose()); -} - -// [[Rcpp::export]] -Rcpp::List GetIndCEScoresCPPnewInd( const Eigen::Map & yVec, const Eigen::Map & muVec, const Eigen::Map & lamVec, const Eigen::Map & phiMat, const Eigen::Map & SigmaYi, const Eigen::Map & newPhi, const Eigen::Map & newMu ){ - - // Setting up initial values - // const unsigned int lenyVec = yVec.size(); - const unsigned int lenlamVec = lamVec.size(); - - Eigen::MatrixXd xiVar = Eigen::MatrixXd::Constant(lenlamVec,lenlamVec,std::numeric_limits::quiet_NaN()); - Eigen::MatrixXd xiEst = Eigen::MatrixXd::Constant(lenlamVec,1,std::numeric_limits::quiet_NaN()); - Eigen::MatrixXd fittedY = Eigen::MatrixXd::Constant(lenlamVec,1,std::numeric_limits::quiet_NaN()); - - Eigen::MatrixXd LamPhi = lamVec.asDiagonal() * phiMat.transpose(); - // Eigen::MatrixXd LamPhiSig = LamPhi * SigmaYi.inverse(); // LamPhi * pinv(SigmaYi); // // Original code. - Eigen::LDLT ldlt_SigmaYi(SigmaYi); - - xiEst = LamPhi * ldlt_SigmaYi.solve(yVec - muVec) ;// LamPhiSig * (yVec - muVec); - xiVar = -LamPhi * ldlt_SigmaYi.solve(LamPhi.transpose()); // LamPhiSig.transpose(); - xiVar.diagonal() += lamVec; - fittedY = newMu + newPhi * xiEst; - - return Rcpp::List::create(Rcpp::Named("xiEst") = xiEst, - Rcpp::Named("xiVar") = xiVar, - Rcpp::Named("fittedY") = fittedY); -} - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/src/RCPPmean.cpp b/fdapace.Rcheck/00_pkg_src/fdapace/src/RCPPmean.cpp deleted file mode 100644 index 9f9dba8c..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/src/RCPPmean.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include -using namespace Rcpp; - -// [[Rcpp::export]] -double RCPPmean(const Rcpp::NumericVector X){ - return ( mean(X) ) ; -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/src/RCPPvar.cpp b/fdapace.Rcheck/00_pkg_src/fdapace/src/RCPPvar.cpp deleted file mode 100644 index 48574ede..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/src/RCPPvar.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include -using namespace Rcpp; - -// [[Rcpp::export]] -double RCPPvar(const Rcpp::NumericVector X){ - return ( var(X) ) ; -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/src/RcppExports.cpp b/fdapace.Rcheck/00_pkg_src/fdapace/src/RcppExports.cpp deleted file mode 100644 index 047fcc60..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/src/RcppExports.cpp +++ /dev/null @@ -1,296 +0,0 @@ -// Generated by using Rcpp::compileAttributes() -> do not edit by hand -// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 - -#include -#include - -using namespace Rcpp; - -// CPPlwls1d -Eigen::VectorXd CPPlwls1d(const double& bw, const std::string kernel_type, const Eigen::Map& win, const Eigen::Map& xin, const Eigen::Map& yin, const Eigen::Map& xout, const unsigned int& npoly, const unsigned int& nder); -RcppExport SEXP _fdapace_CPPlwls1d(SEXP bwSEXP, SEXP kernel_typeSEXP, SEXP winSEXP, SEXP xinSEXP, SEXP yinSEXP, SEXP xoutSEXP, SEXP npolySEXP, SEXP nderSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< const double& >::type bw(bwSEXP); - Rcpp::traits::input_parameter< const std::string >::type kernel_type(kernel_typeSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type win(winSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type xin(xinSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type yin(yinSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type xout(xoutSEXP); - Rcpp::traits::input_parameter< const unsigned int& >::type npoly(npolySEXP); - Rcpp::traits::input_parameter< const unsigned int& >::type nder(nderSEXP); - rcpp_result_gen = Rcpp::wrap(CPPlwls1d(bw, kernel_type, win, xin, yin, xout, npoly, nder)); - return rcpp_result_gen; -END_RCPP -} -// GetIndCEScoresCPP -Rcpp::List GetIndCEScoresCPP(const Eigen::Map& yVec, const Eigen::Map& muVec, const Eigen::Map& lamVec, const Eigen::Map& phiMat, const Eigen::Map& SigmaYi); -RcppExport SEXP _fdapace_GetIndCEScoresCPP(SEXP yVecSEXP, SEXP muVecSEXP, SEXP lamVecSEXP, SEXP phiMatSEXP, SEXP SigmaYiSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< const Eigen::Map& >::type yVec(yVecSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type muVec(muVecSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type lamVec(lamVecSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type phiMat(phiMatSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type SigmaYi(SigmaYiSEXP); - rcpp_result_gen = Rcpp::wrap(GetIndCEScoresCPP(yVec, muVec, lamVec, phiMat, SigmaYi)); - return rcpp_result_gen; -END_RCPP -} -// GetIndCEScoresCPPnewInd -Rcpp::List GetIndCEScoresCPPnewInd(const Eigen::Map& yVec, const Eigen::Map& muVec, const Eigen::Map& lamVec, const Eigen::Map& phiMat, const Eigen::Map& SigmaYi, const Eigen::Map& newPhi, const Eigen::Map& newMu); -RcppExport SEXP _fdapace_GetIndCEScoresCPPnewInd(SEXP yVecSEXP, SEXP muVecSEXP, SEXP lamVecSEXP, SEXP phiMatSEXP, SEXP SigmaYiSEXP, SEXP newPhiSEXP, SEXP newMuSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< const Eigen::Map& >::type yVec(yVecSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type muVec(muVecSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type lamVec(lamVecSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type phiMat(phiMatSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type SigmaYi(SigmaYiSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type newPhi(newPhiSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type newMu(newMuSEXP); - rcpp_result_gen = Rcpp::wrap(GetIndCEScoresCPPnewInd(yVec, muVec, lamVec, phiMat, SigmaYi, newPhi, newMu)); - return rcpp_result_gen; -END_RCPP -} -// RCPPmean -double RCPPmean(const Rcpp::NumericVector X); -RcppExport SEXP _fdapace_RCPPmean(SEXP XSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< const Rcpp::NumericVector >::type X(XSEXP); - rcpp_result_gen = Rcpp::wrap(RCPPmean(X)); - return rcpp_result_gen; -END_RCPP -} -// RCPPvar -double RCPPvar(const Rcpp::NumericVector X); -RcppExport SEXP _fdapace_RCPPvar(SEXP XSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< const Rcpp::NumericVector >::type X(XSEXP); - rcpp_result_gen = Rcpp::wrap(RCPPvar(X)); - return rcpp_result_gen; -END_RCPP -} -// RcppPseudoApprox -Eigen::VectorXd RcppPseudoApprox(const Eigen::Map& X, const Eigen::Map& Y, const Eigen::Map& X_target); -RcppExport SEXP _fdapace_RcppPseudoApprox(SEXP XSEXP, SEXP YSEXP, SEXP X_targetSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< const Eigen::Map& >::type X(XSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type Y(YSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type X_target(X_targetSEXP); - rcpp_result_gen = Rcpp::wrap(RcppPseudoApprox(X, Y, X_target)); - return rcpp_result_gen; -END_RCPP -} -// Rcppsort -NumericVector Rcppsort(NumericVector v); -RcppExport SEXP _fdapace_Rcppsort(SEXP vSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< NumericVector >::type v(vSEXP); - rcpp_result_gen = Rcpp::wrap(Rcppsort(v)); - return rcpp_result_gen; -END_RCPP -} -// Rmullwlsk -Eigen::MatrixXd Rmullwlsk(const Eigen::Map& bw, const std::string kernel_type, const Eigen::Map& tPairs, const Eigen::Map& cxxn, const Eigen::Map& win, const Eigen::Map& xgrid, const Eigen::Map& ygrid, const bool& bwCheck, const bool& transp); -RcppExport SEXP _fdapace_Rmullwlsk(SEXP bwSEXP, SEXP kernel_typeSEXP, SEXP tPairsSEXP, SEXP cxxnSEXP, SEXP winSEXP, SEXP xgridSEXP, SEXP ygridSEXP, SEXP bwCheckSEXP, SEXP transpSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< const Eigen::Map& >::type bw(bwSEXP); - Rcpp::traits::input_parameter< const std::string >::type kernel_type(kernel_typeSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type tPairs(tPairsSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type cxxn(cxxnSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type win(winSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type xgrid(xgridSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type ygrid(ygridSEXP); - Rcpp::traits::input_parameter< const bool& >::type bwCheck(bwCheckSEXP); - Rcpp::traits::input_parameter< const bool& >::type transp(transpSEXP); - rcpp_result_gen = Rcpp::wrap(Rmullwlsk(bw, kernel_type, tPairs, cxxn, win, xgrid, ygrid, bwCheck, transp)); - return rcpp_result_gen; -END_RCPP -} -// RmullwlskCC -Eigen::MatrixXd RmullwlskCC(const Eigen::Map& bw, const std::string kernel_type, const Eigen::Map& tPairs, const Eigen::Map& cxxn, const Eigen::Map& win, const Eigen::Map& xgrid, const Eigen::Map& ygrid, const bool& bwCheck); -RcppExport SEXP _fdapace_RmullwlskCC(SEXP bwSEXP, SEXP kernel_typeSEXP, SEXP tPairsSEXP, SEXP cxxnSEXP, SEXP winSEXP, SEXP xgridSEXP, SEXP ygridSEXP, SEXP bwCheckSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< const Eigen::Map& >::type bw(bwSEXP); - Rcpp::traits::input_parameter< const std::string >::type kernel_type(kernel_typeSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type tPairs(tPairsSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type cxxn(cxxnSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type win(winSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type xgrid(xgridSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type ygrid(ygridSEXP); - Rcpp::traits::input_parameter< const bool& >::type bwCheck(bwCheckSEXP); - rcpp_result_gen = Rcpp::wrap(RmullwlskCC(bw, kernel_type, tPairs, cxxn, win, xgrid, ygrid, bwCheck)); - return rcpp_result_gen; -END_RCPP -} -// RmullwlskCCsort2 -Eigen::MatrixXd RmullwlskCCsort2(const Eigen::Map& bw, const std::string kernel_type, const Eigen::Map& tPairs, const Eigen::Map& cxxn, const Eigen::Map& win, const Eigen::Map& xgrid, const Eigen::Map& ygrid, const bool& bwCheck); -RcppExport SEXP _fdapace_RmullwlskCCsort2(SEXP bwSEXP, SEXP kernel_typeSEXP, SEXP tPairsSEXP, SEXP cxxnSEXP, SEXP winSEXP, SEXP xgridSEXP, SEXP ygridSEXP, SEXP bwCheckSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< const Eigen::Map& >::type bw(bwSEXP); - Rcpp::traits::input_parameter< const std::string >::type kernel_type(kernel_typeSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type tPairs(tPairsSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type cxxn(cxxnSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type win(winSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type xgrid(xgridSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type ygrid(ygridSEXP); - Rcpp::traits::input_parameter< const bool& >::type bwCheck(bwCheckSEXP); - rcpp_result_gen = Rcpp::wrap(RmullwlskCCsort2(bw, kernel_type, tPairs, cxxn, win, xgrid, ygrid, bwCheck)); - return rcpp_result_gen; -END_RCPP -} -// RmullwlskUniversal -Eigen::MatrixXd RmullwlskUniversal(const Eigen::Map& bw, const std::string kernel_type, const Eigen::Map& tPairs, const Eigen::Map& cxxn, const Eigen::Map& win, const Eigen::Map& xgrid, const Eigen::Map& ygrid, const bool& bwCheck, const bool& autoCov); -RcppExport SEXP _fdapace_RmullwlskUniversal(SEXP bwSEXP, SEXP kernel_typeSEXP, SEXP tPairsSEXP, SEXP cxxnSEXP, SEXP winSEXP, SEXP xgridSEXP, SEXP ygridSEXP, SEXP bwCheckSEXP, SEXP autoCovSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< const Eigen::Map& >::type bw(bwSEXP); - Rcpp::traits::input_parameter< const std::string >::type kernel_type(kernel_typeSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type tPairs(tPairsSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type cxxn(cxxnSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type win(winSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type xgrid(xgridSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type ygrid(ygridSEXP); - Rcpp::traits::input_parameter< const bool& >::type bwCheck(bwCheckSEXP); - Rcpp::traits::input_parameter< const bool& >::type autoCov(autoCovSEXP); - rcpp_result_gen = Rcpp::wrap(RmullwlskUniversal(bw, kernel_type, tPairs, cxxn, win, xgrid, ygrid, bwCheck, autoCov)); - return rcpp_result_gen; -END_RCPP -} -// RmullwlskUniversalDeriv -Eigen::MatrixXd RmullwlskUniversalDeriv(const Eigen::Map& bw, const std::string kernel_type, const Eigen::Map& tPairs, const Eigen::Map& cxxn, const Eigen::Map& win, const Eigen::Map& xgrid, const Eigen::Map& ygrid, const int& npoly, const int& nder1, const int& nder2, const bool& bwCheck, const bool& autoCov); -RcppExport SEXP _fdapace_RmullwlskUniversalDeriv(SEXP bwSEXP, SEXP kernel_typeSEXP, SEXP tPairsSEXP, SEXP cxxnSEXP, SEXP winSEXP, SEXP xgridSEXP, SEXP ygridSEXP, SEXP npolySEXP, SEXP nder1SEXP, SEXP nder2SEXP, SEXP bwCheckSEXP, SEXP autoCovSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< const Eigen::Map& >::type bw(bwSEXP); - Rcpp::traits::input_parameter< const std::string >::type kernel_type(kernel_typeSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type tPairs(tPairsSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type cxxn(cxxnSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type win(winSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type xgrid(xgridSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type ygrid(ygridSEXP); - Rcpp::traits::input_parameter< const int& >::type npoly(npolySEXP); - Rcpp::traits::input_parameter< const int& >::type nder1(nder1SEXP); - Rcpp::traits::input_parameter< const int& >::type nder2(nder2SEXP); - Rcpp::traits::input_parameter< const bool& >::type bwCheck(bwCheckSEXP); - Rcpp::traits::input_parameter< const bool& >::type autoCov(autoCovSEXP); - rcpp_result_gen = Rcpp::wrap(RmullwlskUniversalDeriv(bw, kernel_type, tPairs, cxxn, win, xgrid, ygrid, npoly, nder1, nder2, bwCheck, autoCov)); - return rcpp_result_gen; -END_RCPP -} -// Rrotatedmullwlsk -Eigen::VectorXd Rrotatedmullwlsk(const Eigen::Map& bw, const std::string kernel_type, const Eigen::Map& tPairs, const Eigen::Map& cxxn, const Eigen::Map& win, const Eigen::Map& xygrid, const unsigned int npoly, const bool& bwCheck); -RcppExport SEXP _fdapace_Rrotatedmullwlsk(SEXP bwSEXP, SEXP kernel_typeSEXP, SEXP tPairsSEXP, SEXP cxxnSEXP, SEXP winSEXP, SEXP xygridSEXP, SEXP npolySEXP, SEXP bwCheckSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< const Eigen::Map& >::type bw(bwSEXP); - Rcpp::traits::input_parameter< const std::string >::type kernel_type(kernel_typeSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type tPairs(tPairsSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type cxxn(cxxnSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type win(winSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type xygrid(xygridSEXP); - Rcpp::traits::input_parameter< const unsigned int >::type npoly(npolySEXP); - Rcpp::traits::input_parameter< const bool& >::type bwCheck(bwCheckSEXP); - rcpp_result_gen = Rcpp::wrap(Rrotatedmullwlsk(bw, kernel_type, tPairs, cxxn, win, xygrid, npoly, bwCheck)); - return rcpp_result_gen; -END_RCPP -} -// cumtrapzRcpp -Rcpp::NumericVector cumtrapzRcpp(const Rcpp::NumericVector X, const Rcpp::NumericVector Y); -RcppExport SEXP _fdapace_cumtrapzRcpp(SEXP XSEXP, SEXP YSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< const Rcpp::NumericVector >::type X(XSEXP); - Rcpp::traits::input_parameter< const Rcpp::NumericVector >::type Y(YSEXP); - rcpp_result_gen = Rcpp::wrap(cumtrapzRcpp(X, Y)); - return rcpp_result_gen; -END_RCPP -} -// dropZeroElementsXYWin -Eigen::MatrixXd dropZeroElementsXYWin(const Eigen::Map& win, const Eigen::Map& xin, const Eigen::Map& yin); -RcppExport SEXP _fdapace_dropZeroElementsXYWin(SEXP winSEXP, SEXP xinSEXP, SEXP yinSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< const Eigen::Map& >::type win(winSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type xin(xinSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type yin(yinSEXP); - rcpp_result_gen = Rcpp::wrap(dropZeroElementsXYWin(win, xin, yin)); - return rcpp_result_gen; -END_RCPP -} -// interp2lin -Eigen::VectorXd interp2lin(const Eigen::Map& xin, const Eigen::Map& yin, const Eigen::Map& zin, const Eigen::Map& xou, const Eigen::Map& you); -RcppExport SEXP _fdapace_interp2lin(SEXP xinSEXP, SEXP yinSEXP, SEXP zinSEXP, SEXP xouSEXP, SEXP youSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< const Eigen::Map& >::type xin(xinSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type yin(yinSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type zin(zinSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type xou(xouSEXP); - Rcpp::traits::input_parameter< const Eigen::Map& >::type you(youSEXP); - rcpp_result_gen = Rcpp::wrap(interp2lin(xin, yin, zin, xou, you)); - return rcpp_result_gen; -END_RCPP -} -// trapzRcpp -double trapzRcpp(const Rcpp::NumericVector X, const Rcpp::NumericVector Y); -RcppExport SEXP _fdapace_trapzRcpp(SEXP XSEXP, SEXP YSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< const Rcpp::NumericVector >::type X(XSEXP); - Rcpp::traits::input_parameter< const Rcpp::NumericVector >::type Y(YSEXP); - rcpp_result_gen = Rcpp::wrap(trapzRcpp(X, Y)); - return rcpp_result_gen; -END_RCPP -} - -static const R_CallMethodDef CallEntries[] = { - {"_fdapace_CPPlwls1d", (DL_FUNC) &_fdapace_CPPlwls1d, 8}, - {"_fdapace_GetIndCEScoresCPP", (DL_FUNC) &_fdapace_GetIndCEScoresCPP, 5}, - {"_fdapace_GetIndCEScoresCPPnewInd", (DL_FUNC) &_fdapace_GetIndCEScoresCPPnewInd, 7}, - {"_fdapace_RCPPmean", (DL_FUNC) &_fdapace_RCPPmean, 1}, - {"_fdapace_RCPPvar", (DL_FUNC) &_fdapace_RCPPvar, 1}, - {"_fdapace_RcppPseudoApprox", (DL_FUNC) &_fdapace_RcppPseudoApprox, 3}, - {"_fdapace_Rcppsort", (DL_FUNC) &_fdapace_Rcppsort, 1}, - {"_fdapace_Rmullwlsk", (DL_FUNC) &_fdapace_Rmullwlsk, 9}, - {"_fdapace_RmullwlskCC", (DL_FUNC) &_fdapace_RmullwlskCC, 8}, - {"_fdapace_RmullwlskCCsort2", (DL_FUNC) &_fdapace_RmullwlskCCsort2, 8}, - {"_fdapace_RmullwlskUniversal", (DL_FUNC) &_fdapace_RmullwlskUniversal, 9}, - {"_fdapace_RmullwlskUniversalDeriv", (DL_FUNC) &_fdapace_RmullwlskUniversalDeriv, 12}, - {"_fdapace_Rrotatedmullwlsk", (DL_FUNC) &_fdapace_Rrotatedmullwlsk, 8}, - {"_fdapace_cumtrapzRcpp", (DL_FUNC) &_fdapace_cumtrapzRcpp, 2}, - {"_fdapace_dropZeroElementsXYWin", (DL_FUNC) &_fdapace_dropZeroElementsXYWin, 3}, - {"_fdapace_interp2lin", (DL_FUNC) &_fdapace_interp2lin, 5}, - {"_fdapace_trapzRcpp", (DL_FUNC) &_fdapace_trapzRcpp, 2}, - {NULL, NULL, 0} -}; - -RcppExport void R_init_fdapace(DllInfo *dll) { - R_registerRoutines(dll, NULL, CallEntries, NULL, NULL); - R_useDynamicSymbols(dll, FALSE); -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/src/RcppPseudoApprox.cpp b/fdapace.Rcheck/00_pkg_src/fdapace/src/RcppPseudoApprox.cpp deleted file mode 100644 index fd877bc4..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/src/RcppPseudoApprox.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include -#include - -// [[Rcpp::depends(RcppEigen)]] - -float LinearInterpolation ( const Eigen::Map & X , const Eigen::Map & Y, float X_PointOfInterest){ - //Produce Y_point_of_interest given X,Y and target X_point_of_interest - //X : vector containing the X variables of the interpolant - //Y : vector containing the Y variables of the interpolant - //PointOfInterest : Point of X to estimate the new point of Y - - float xk, xkp1, yk, ykp1 = 0; //Points adjecent to the point of interpolation - if ( X.size() != Y.size() ){ - Rcpp::stop("Problem with unequal vector sizes when doing linear interpolation.");} - //cout << " X(0): " << X(0) <<" X(Y.size()-1): " < X(Y.size()-1) ){Rcpp::warning("You interpolate out of the curve boundaries"); return(-1);} - //Find the points right before and right after the point of interest - for (int i=1; i= X_PointOfInterest){ - xkp1 = X(i); - xk = X(i-1); - ykp1 = Y(i); - yk = Y(i-1); - break;} - } - //point-slope form for a line formula - float t = (X_PointOfInterest -xk)/(xkp1 -xk); - float yPOI = (1-t) * yk + t * ykp1; // estimate point of interest - // cout << "(" << xk << ", " << X_PointOfInterest << " , " << xkp1 << ") & (" << yk << ", " << yPOI << ", " << ykp1 << ")"<< endl; - return (yPOI); -} - -// [[Rcpp::export]] -Eigen::VectorXd RcppPseudoApprox( const Eigen::Map & X, const Eigen::Map & Y, const Eigen::Map & X_target){ - //evaluate Y_target for X_target given X and Y - - int N = X_target.size(); - Eigen::VectorXd rr(N); - for (int i=0; i -using namespace Rcpp; -// [[Rcpp::export]] -NumericVector Rcppsort(NumericVector v) { - NumericVector sv(clone(v)); - std::sort(sv.begin(), sv.end()); - return sv; -} - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/src/Rmullwlsk.cpp b/fdapace.Rcheck/00_pkg_src/fdapace/src/Rmullwlsk.cpp deleted file mode 100644 index bb4c5f56..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/src/Rmullwlsk.cpp +++ /dev/null @@ -1,176 +0,0 @@ -#include -#include // to map kernels to integers for the switch -#include // to read in the kernel name -#include // to use vectors -#include // to get the intersect and sort - -// [[Rcpp::depends(RcppEigen)]] -// [[Rcpp::export]] - - -Eigen::MatrixXd Rmullwlsk( const Eigen::Map & bw, const std::string kernel_type, const Eigen::Map & tPairs, const Eigen::Map & cxxn, const Eigen::Map & win, const Eigen::Map & xgrid, const Eigen::Map & ygrid, const bool & bwCheck, const bool & transp = true){ - - // tPairs : xin (in MATLAB code) - // cxxn : yin (in MATLAB code) - // xgrid: out1 (in MATLAB code) - // ygrid: out2 (in MATLAB code) - // bwCheck : boolean/ cause the function to simply run the bandwidth check. - - const double invSqrt2pi= 1./(sqrt(2.*M_PI)); - - // Map the kernel name so we can use switches - std::map possibleKernels; - possibleKernels["epan"] = 1; possibleKernels["rect"] = 2; - possibleKernels["gauss"] = 3; possibleKernels["gausvar"] = 4; - possibleKernels["quar"] = 5; - - // The following test is here for completeness, we mightwant to move it up a - // level (in the wrapper) in the future. - - // If the kernel_type key exists set KernelName appropriately - int KernelName = 0; - if ( possibleKernels.count( kernel_type ) != 0){ - KernelName = possibleKernels.find( kernel_type )->second; //Set kernel choice - } else { - // otherwise use "epan"as the kernel_type - //Rcpp::Rcout << "Kernel_type argument was not set correctly; Epanechnikov kernel used." << std::endl; - Rcpp::warning("Kernel_type argument was not set correctly; Epanechnikov kernel used."); - KernelName = possibleKernels.find( "epan" )->second;; - } - - // Check that we do not have zero weights // Should do a try-catch here - // Again this might be best moved a level-up. - if ( !(win.all()) ){ // - Rcpp::Rcout << "Cases with zero-valued windows are not yet implemented" << std::endl; - return (tPairs); - } - - // Start the actual smoother here - unsigned int xgridN = xgrid.size(); - unsigned int ygridN = ygrid.size(); - - Eigen::MatrixXd mu(ygrid.size(),xgrid.size()); - mu.setZero(); - const double bufSmall = 1.0e-6; // pow(double(10),-6); - - for (unsigned int i = 0; i != ygridN; ++i){ - for (unsigned int j = i; j < xgridN ; ++j){ - - //locating local window (LOL) (bad joke) - std::vector indx; - //if the kernel is not Gaussian - if ( KernelName != 3) { - //construct listX as vectors / size is unknown originally - for (unsigned int y = 0; y != tPairs.cols(); y++){ - if ( std::abs( tPairs(0,y) - xgrid(j) ) <= (bw(0)+ bufSmall) && std::abs( tPairs(1,y) - ygrid(i) ) <= (bw(1)+ bufSmall) ) { - // legacy MATLAB equivalent form : - // if ( (tPairs(0,y) >= (xgrid(j) -(bw(0)+ pow(double(10),-6)))) & (tPairs(0,y) <= (xgrid(j) + (bw(0)+ pow(double(10),-6))))) { - indx.push_back(y); - } - } - } else{ // just get the whole deal - for (unsigned int y = 0; y != tPairs.cols(); ++y){ - indx.push_back(y); - } - } - - unsigned int indxSize = indx.size(); - Eigen::VectorXd lw(indxSize); - Eigen::VectorXd ly(indxSize); - Eigen::MatrixXd lx(2,indxSize); - - for (unsigned int u = 0; u !=indxSize; ++u){ - lx.col(u) = tPairs.col(indx[u]); - lw(u) = win(indx[u]); - ly(u) = cxxn(indx[u]); - } - - // check enough points are in the local window - unsigned int meter=1; - for (unsigned int u =0; u< indxSize; ++u) { - for (unsigned int t = u + 1; t < indxSize; ++t) { - if ( (lx(0,u) != lx(0,t) ) || (lx(1,u) != lx(1,t) ) ) { - meter++; - } - } - if (meter >= 3) { - break; - } - } - - //computing weight matrix - if (meter >= 3 && !bwCheck) { - Eigen::VectorXd temp(indxSize); - Eigen::MatrixXd llx(2, indxSize ); - llx.row(0) = (lx.row(0).array() - xgrid(j))/bw(0); - llx.row(1) = (lx.row(1).array() - ygrid(i))/bw(1); - - //define the kernel used - - switch (KernelName){ - case 1: // Epan - temp= ((1-llx.row(0).array().pow(2))*(1- llx.row(1).array().pow(2))).array() * - ((9./16)*lw).transpose().array(); - break; - case 2 : // Rect - temp=(lw.array())*.25 ; - break; - case 3 : // Gauss - temp = ((-.5*(llx.row(1).array().pow(2))).exp()) * invSqrt2pi * - ((-.5*(llx.row(0).array().pow(2))).exp()) * invSqrt2pi * - (lw.transpose().array()); - break; - case 4 : // GausVar - temp = (lw.transpose().array()) * - ((-0.5 * llx.row(0).array().pow(2)).array().exp() * invSqrt2pi).array() * - ((-0.5 * llx.row(1).array().pow(2)).array().exp() * invSqrt2pi).array() * - (1.25 - (0.25 * (llx.row(0).array().pow(2))).array()) * - (1.50 - (0.50 * (llx.row(1).array().pow(2))).array()); - break; - case 5 : // Quar - temp = (lw.transpose().array()) * - ((1.-llx.row(0).array().pow(2)).array().pow(2)).array() * - ((1.-llx.row(1).array().pow(2)).array().pow(2)).array() * (225./256.); - break; - } - - // make the design matrix - Eigen::MatrixXd X(indxSize ,3); - X.setOnes(); - X.col(1) = lx.row(0).array() - xgrid(j); - X.col(2) = lx.row(1).array() - ygrid(i); - Eigen::LDLT ldlt_XTWX(X.transpose() * temp.asDiagonal() *X); - // The solver should stop if the value is NaN. See the HOLE example in gcvlwls2dV2. - Eigen::VectorXd beta = ldlt_XTWX.solve(X.transpose() * temp.asDiagonal() * ly); - mu(i,j)=beta(0); - } else if(meter < 3){ - // Rcpp::Rcout <<"The meter value is:" << meter << std::endl; - if (bwCheck) { - Eigen::MatrixXd checker(1,1); - checker(0,0) = 0.; - return(checker); - } else { - Rcpp::stop("No enough points in local window, please increase bandwidth."); - } - } - } - } - - if (bwCheck){ - Eigen::MatrixXd checker(1,1); - checker(0,0) = 1.; - return(checker); - } - - if (transp) { - // Eigen::MatrixXd result(ygrid.size(),xgrid.size()); - // result = mu + mu.transpose(); - // result.diagonal() = 0.5 * result.diagonal(); - // return ( result ); - return ( Eigen::MatrixXd(mu.triangularView().transpose()) + Eigen::MatrixXd(mu.triangularView())); - } else { - return( mu ); - } -} - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/src/RmullwlskCC.cpp b/fdapace.Rcheck/00_pkg_src/fdapace/src/RmullwlskCC.cpp deleted file mode 100644 index 4e11e251..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/src/RmullwlskCC.cpp +++ /dev/null @@ -1,172 +0,0 @@ -#include -#include // to map kernels to integers for the switch -#include // to read in the kernel name -#include // to use vectors -#include // to get the intersect and sort - -// [[Rcpp::depends(RcppEigen)]] -// [[Rcpp::export]] - - -Eigen::MatrixXd RmullwlskCC( const Eigen::Map & bw, const std::string kernel_type, const Eigen::Map & tPairs, const Eigen::Map & cxxn, const Eigen::Map & win, const Eigen::Map & xgrid, const Eigen::Map & ygrid, const bool & bwCheck){ - - // tPairs : xin (in MATLAB code) - // cxxn : yin (in MATLAB code) - // xgrid: out1 (in MATLAB code) - // ygrid: out2 (in MATLAB code) - // bwCheck : boolean/ cause the function to simply run the bandwidth check. - - const double invSqrt2pi= 1./(sqrt(2.*M_PI)); - - // Map the kernel name so we can use switches - std::map possibleKernels; - possibleKernels["epan"] = 1; possibleKernels["rect"] = 2; - possibleKernels["gauss"] = 3; possibleKernels["gausvar"] = 4; - possibleKernels["quar"] = 5; - - // The following test is here for completeness, we mightwant to move it up a - // level (in the wrapper) in the future. - - // If the kernel_type key exists set KernelName appropriately - int KernelName = 0; - if ( possibleKernels.count( kernel_type ) != 0){ - KernelName = possibleKernels.find( kernel_type )->second; //Set kernel choice - } else { - // otherwise use "epan"as the kernel_type - //Rcpp::Rcout << "Kernel_type argument was not set correctly; Epanechnikov kernel used." << std::endl; - Rcpp::warning("Kernel_type argument was not set correctly; Epanechnikov kernel used."); - KernelName = possibleKernels.find( "epan" )->second;; - } - - // Check that we do not have zero weights // Should do a try-catch here - // Again this might be best moved a level-up. - if ( !(win.all()) ){ // - Rcpp::Rcout << "Cases with zero-valued windows are not yet implemented" << std::endl; - return (tPairs); - } - - // Start the actual smoother here - unsigned int xgridN = xgrid.size(); - unsigned int ygridN = ygrid.size(); - - Eigen::MatrixXd mu(xgrid.size(), ygrid.size()); - mu.setZero(); - const double bufSmall = 1e-6; // pow(double(10),-6); - - for (unsigned int j = 0; j != ygridN; ++j) { - for (unsigned int i = 0; i != xgridN; ++i) { - - //locating local window (LOL) (bad joke) - std::vector indx; - //if the kernel is not Gaussian - if ( KernelName != 3) { - //construct listX as vectors / size is unknown originally - for (unsigned int y = 0; y != tPairs.cols(); y++){ - if ( (std::abs( tPairs(0,y) - xgrid(i) ) <= (bw(0)+ bufSmall ) && std::abs( tPairs(1,y) - ygrid(j) ) <= (bw(1)+ bufSmall)) ) { - indx.push_back(y); - } - } - - } else{ // just get the whole deal - for (unsigned int y = 0; y != tPairs.cols(); ++y){ - indx.push_back(y); - } - } - - // for (unsigned int y = 0; y != indx.size(); ++y){ - // Rcpp::Rcout << "indx.at(y): " << indx.at(y)<< ", "; - // } - - unsigned int indxSize = indx.size(); - Eigen::VectorXd lw(indxSize); - Eigen::VectorXd ly(indxSize); - Eigen::MatrixXd lx(2,indxSize); - - for (unsigned int u = 0; u !=indxSize; ++u){ - lx.col(u) = tPairs.col(indx[u]); - lw(u) = win(indx[u]); - ly(u) = cxxn(indx[u]); - } - - // check enough points are in the local window - unsigned int meter=1; - for (unsigned int u =0; u< indxSize; ++u) { - for (unsigned int t = u + 1; t < indxSize; ++t) { - if ( (lx(0,u) != lx(0,t) ) || (lx(1,u) != lx(1,t) ) ) { - meter++; - } - } - if (meter >= 3) { - break; - } - } - - //computing weight matrix - if (meter >= 3 && !bwCheck) { - Eigen::VectorXd temp(indxSize); - Eigen::MatrixXd llx(2, indxSize ); - llx.row(0) = (lx.row(0).array() - xgrid(i))/bw(0); - llx.row(1) = (lx.row(1).array() - ygrid(j))/bw(1); - - //define the kernel used - - switch (KernelName){ - case 1: // Epan - temp= ((1-llx.row(0).array().pow(2))*(1- llx.row(1).array().pow(2))).array() * - ((9./16)*lw).transpose().array(); - break; - case 2 : // Rect - temp=(lw.array())*.25 ; - break; - case 3 : // Gauss - temp = ((-.5*(llx.row(1).array().pow(2))).exp()) * invSqrt2pi * - ((-.5*(llx.row(0).array().pow(2))).exp()) * invSqrt2pi * - (lw.transpose().array()); - break; - case 4 : // GausVar - temp = (lw.transpose().array()) * - ((-0.5 * llx.row(0).array().pow(2)).array().exp() * invSqrt2pi).array() * - ((-0.5 * llx.row(1).array().pow(2)).array().exp() * invSqrt2pi).array() * - (1.25 - (0.25 * (llx.row(0).array().pow(2))).array()) * - (1.50 - (0.50 * (llx.row(1).array().pow(2))).array()); - break; - case 5 : // Quar - temp = (lw.transpose().array()) * - ((1.-llx.row(0).array().pow(2)).array().pow(2)).array() * - ((1.-llx.row(1).array().pow(2)).array().pow(2)).array() * (225./256.); - break; - } - - // make the design matrix - Eigen::MatrixXd X(indxSize ,3); - X.setOnes(); - X.col(1) = lx.row(0).array() - xgrid(i); - X.col(2) = lx.row(1).array() - ygrid(j); - Eigen::LDLT ldlt_XTWX(X.transpose() * temp.asDiagonal() *X); - // The solver should stop if the value is NaN. See the HOLE example in gcvlwls2dV2. - // Rcpp::Rcout << X << std::endl; - Eigen::VectorXd beta = ldlt_XTWX.solve(X.transpose() * temp.asDiagonal() * ly); - mu(i,j)=beta(0); - } else if(meter < 3){ - // Rcpp::Rcout <<"The meter value is:" << meter << std::endl; - if (bwCheck) { - Eigen::MatrixXd checker(1,1); - checker(0,0) = 0.; - return(checker); - } else { - Rcpp::stop("No enough points in local window, please increase bandwidth."); - } - } - } - } - - if (bwCheck){ - Eigen::MatrixXd checker(1,1); - checker(0,0) = 1.; - return(checker); - } - - return ( mu ); -} - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/src/RmullwlskCCsort2.cpp b/fdapace.Rcheck/00_pkg_src/fdapace/src/RmullwlskCCsort2.cpp deleted file mode 100644 index 77338444..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/src/RmullwlskCCsort2.cpp +++ /dev/null @@ -1,209 +0,0 @@ -#include -#include // to map kernels to integers for the switch -#include // to read in the kernel name -#include // to use vectors -#include // to get the intersect, sort, lower_bound, upper_bound -// #include - -typedef std::pair valIndPair; -bool compPair(const valIndPair& l, const valIndPair& r) { - return(l.first < r.first); -} - -// [[Rcpp::depends(RcppEigen)]] -// [[Rcpp::export]] - -Eigen::MatrixXd RmullwlskCCsort2( const Eigen::Map & bw, const std::string kernel_type, const Eigen::Map & tPairs, const Eigen::Map & cxxn, const Eigen::Map & win, const Eigen::Map & xgrid, const Eigen::Map & ygrid, const bool & bwCheck){ -// Assumes the first row of tPairs is sorted in increasing order. - // tPairs : xin (in MATLAB code) - // cxxn : yin (in MATLAB code) - // xgrid: out1 (in MATLAB code) - // ygrid: out2 (in MATLAB code) - // bwCheck : boolean/ cause the function to simply run the bandwidth check. - - const double invSqrt2pi= 1./(sqrt(2.*M_PI)); - - // Map the kernel name so we can use switches - std::map possibleKernels; - possibleKernels["epan"] = 1; possibleKernels["rect"] = 2; - possibleKernels["gauss"] = 3; possibleKernels["gausvar"] = 4; - possibleKernels["quar"] = 5; - - // The following test is here for completeness, we mightwant to move it up a - // level (in the wrapper) in the future. - - // If the kernel_type key exists set KernelName appropriately - int KernelName = 0; - if ( possibleKernels.count( kernel_type ) != 0){ - KernelName = possibleKernels.find( kernel_type )->second; //Set kernel choice - } else { - // otherwise use "epan"as the kernel_type - //Rcpp::Rcout << "Kernel_type argument was not set correctly; Epanechnikov kernel used." << std::endl; - Rcpp::warning("Kernel_type argument was not set correctly; Epanechnikov kernel used."); - KernelName = possibleKernels.find( "epan" )->second;; - } - - // Check that we do not have zero weights // Should do a try-catch here - // Again this might be best moved a level-up. - if ( !(win.all()) ){ // - Rcpp::Rcout << "Cases with zero-valued windows are not yet implemented" << std::endl; - return (tPairs); - } - - // ProfilerStart("sort.log"); - // Start the actual smoother here - const unsigned int xgridN = xgrid.size(); - const unsigned int ygridN = ygrid.size(); - const unsigned int n = tPairs.cols(); - - // For sorted x1 - Eigen::VectorXd x1(tPairs.row(0).transpose()); - const double* tDat = x1.data(); - - Eigen::MatrixXd mu(xgrid.size(), ygrid.size()); - mu.setZero(); - - - for (unsigned int i = 0; i != xgridN; ++i) { - const double xl = xgrid(i) - bw(0) - 1e-6, - xu = xgrid(i) + bw(0) + 1e-6; - - unsigned int indl = std::lower_bound(tDat, tDat + n, xl) - tDat, - indu = std::upper_bound(tDat, tDat + n, xu) - tDat; - - // sort the y index - std::vector yval(indu - indl); - for (unsigned int k = 0; k < yval.size(); ++k){ - yval[k] = std::make_pair(tPairs(1, k + indl), k + indl); - } - std::sort::iterator>(yval.begin(), yval.end(), compPair); - - std::vector::iterator ylIt = yval.begin(), - yuIt = yval.begin(); - - for (unsigned int j = 0; j != ygridN; ++j) { - const double yl = ygrid(j) - bw(1) - 1e-6, - yu = ygrid(j) + bw(1) + 1e-6; - - //locating local window (LOL) (bad joke) - std::vector indx; - - //if the kernel is not Gaussian - if ( KernelName != 3) { - // Search the lower and upper bounds increasingly. - ylIt = std::lower_bound(ylIt, yval.end(), valIndPair(yl, 0), compPair); - yuIt = std::upper_bound(yuIt, yval.end(), valIndPair(yu, 0), compPair); - - // The following works nice for the Gaussian - // but for very small samples it complains - //} else { - // ylIt = yval.begin(); - // yuIt = yval.end(); - //} - - for (std::vector::iterator y = ylIt; y != yuIt; ++y){ - indx.push_back(y->second); - } - } else { //When we finally get c++11 we will use std::iota - for( unsigned int y = 0; y != n; ++y){ - indx.push_back(y); - } - } - - // for (unsigned int y = 0; y != indx.size(); ++y){ - // Rcpp::Rcout << "indx.at(y): " << indx.at(y)<< ", "; - // } - unsigned int indxSize = indx.size(); - Eigen::VectorXd lw(indxSize); - Eigen::VectorXd ly(indxSize); - Eigen::MatrixXd lx(2,indxSize); - - for (unsigned int u = 0; u !=indxSize; ++u){ - lx.col(u) = tPairs.col(indx[u]); - lw(u) = win(indx[u]); - ly(u) = cxxn(indx[u]); - } - - // check enough points are in the local window - unsigned int meter=1; - for (unsigned int u =0; u< indxSize; ++u) { - for (unsigned int t = u + 1; t < indxSize; ++t) { - if ( (lx(0,u) != lx(0,t) ) || (lx(1,u) != lx(1,t) ) ) { - meter++; - } - } - if (meter >= 3) { - break; - } - } - - //computing weight matrix - if (meter >= 3 && !bwCheck) { - Eigen::VectorXd temp(indxSize); - Eigen::MatrixXd llx(2, indxSize ); - llx.row(0) = (lx.row(0).array() - xgrid(i))/bw(0); - llx.row(1) = (lx.row(1).array() - ygrid(j))/bw(1); - - //define the kernel used - - switch (KernelName){ - case 1: // Epan - temp= ((1-llx.row(0).array().pow(2))*(1- llx.row(1).array().pow(2))).array() * - ((9./16)*lw).transpose().array(); - break; - case 2 : // Rect - temp=(lw.array())*.25 ; - break; - case 3 : // Gauss - temp = ((-.5*(llx.row(1).array().pow(2))).exp()) * invSqrt2pi * - ((-.5*(llx.row(0).array().pow(2))).exp()) * invSqrt2pi * - (lw.transpose().array()); - break; - case 4 : // GausVar - temp = (lw.transpose().array()) * - ((-0.5 * llx.row(0).array().pow(2)).array().exp() * invSqrt2pi).array() * - ((-0.5 * llx.row(1).array().pow(2)).array().exp() * invSqrt2pi).array() * - (1.25 - (0.25 * (llx.row(0).array().pow(2))).array()) * - (1.50 - (0.50 * (llx.row(1).array().pow(2))).array()); - break; - case 5 : // Quar - temp = (lw.transpose().array()) * - ((1.-llx.row(0).array().pow(2)).array().pow(2)).array() * - ((1.-llx.row(1).array().pow(2)).array().pow(2)).array() * (225./256.); - break; - } - - // make the design matrix - Eigen::MatrixXd X(indxSize ,3); - X.setOnes(); - X.col(1) = lx.row(0).array() - xgrid(i); - X.col(2) = lx.row(1).array() - ygrid(j); - Eigen::LDLT ldlt_XTWX(X.transpose() * temp.asDiagonal() *X); - // The solver should stop if the value is NaN. See the HOLE example in gcvlwls2dV2. - Eigen::VectorXd beta = ldlt_XTWX.solve(X.transpose() * temp.asDiagonal() * ly); - mu(i,j)=beta(0); - } - // else if(meter < 3){ - // // Rcpp::Rcout <<"The meter value is:" << meter << std::endl; - // if (bwCheck) { - // Eigen::MatrixXd checker(1,1); - // checker(0,0) = 0.; - // return(checker); - // } else { - // Rcpp::stop("No enough points in local window, please increase bandwidth."); - // } - // } - } - } - - if (bwCheck){ - Eigen::MatrixXd checker(1,1); - checker(0,0) = 1.; - return(checker); - } - -// ProfilerStop(); - return ( mu ); -} - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/src/RmullwlskUniversal.cpp b/fdapace.Rcheck/00_pkg_src/fdapace/src/RmullwlskUniversal.cpp deleted file mode 100644 index 50005247..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/src/RmullwlskUniversal.cpp +++ /dev/null @@ -1,210 +0,0 @@ -#include -#include // to map kernels to integers for the switch -#include // to read in the kernel name -#include // to use vectors -#include // to get the intersect, sort, lower_bound, upper_bound -// #include - -typedef std::pair valIndPair; -bool comparePair(const valIndPair& l, const valIndPair& r) { - return(l.first < r.first); -} - -// [[Rcpp::depends(RcppEigen)]] -// [[Rcpp::export]] - -Eigen::MatrixXd RmullwlskUniversal( const Eigen::Map & bw, const std::string kernel_type, const Eigen::Map & tPairs, const Eigen::Map & cxxn, const Eigen::Map & win, const Eigen::Map & xgrid, const Eigen::Map & ygrid, const bool & bwCheck, const bool & autoCov){ -// Assumes the first row of tPairs is sorted in increasing order. - // tPairs : xin (in MATLAB code) - // cxxn : yin (in MATLAB code) - // xgrid: out1 (in MATLAB code) - // ygrid: out2 (in MATLAB code) - // bwCheck : boolean / cause the function to simply run the bandwidth check. //To be depreciated - // autoCov : boolean / cause the function to return the autocovariance. - - const double invSqrt2pi= 1./(sqrt(2.*M_PI)); - - // Map the kernel name so we can use switches - std::map possibleKernels; - possibleKernels["epan"] = 1; possibleKernels["rect"] = 2; - possibleKernels["gauss"] = 3; possibleKernels["gausvar"] = 4; - possibleKernels["quar"] = 5; - - // The following test is here for completeness, we mightwant to move it up a - // level (in the wrapper) in the future. - - // If the kernel_type key exists set KernelName appropriately - int KernelName = 0; - if ( possibleKernels.count( kernel_type ) != 0){ - KernelName = possibleKernels.find( kernel_type )->second; //Set kernel choice - } else { - // otherwise use "epan"as the kernel_type - //Rcpp::Rcout << "Kernel_type argument was not set correctly; Epanechnikov kernel used." << std::endl; - Rcpp::warning("Kernel_type argument was not set correctly; Epanechnikov kernel used."); - KernelName = possibleKernels.find( "epan" )->second;; - } - - // Check that we do not have zero weights // Should do a try-catch here - // Again this might be best moved a level-up. - if ( !(win.all()) ){ // - Rcpp::Rcout << "Cases with zero-valued windows are not yet implemented" << std::endl; - return (tPairs); - } - - // ProfilerStart("sort.log"); - // Start the actual smoother here - const unsigned int xgridN = xgrid.size(); - const unsigned int ygridN = ygrid.size(); - const unsigned int n = tPairs.cols(); - - // For sorted x1 - Eigen::VectorXd x1(tPairs.row(0).transpose()); - const double* tDat = x1.data(); - - Eigen::MatrixXd mu(xgrid.size(), ygrid.size()); - mu.setZero(); - - - for (unsigned int i = 0; i != xgridN; ++i) { - const double xl = xgrid(i) - bw(0) - 1e-6, - xu = xgrid(i) + bw(0) + 1e-6; - - unsigned int indl = std::lower_bound(tDat, tDat + n, xl) - tDat, - indu = std::upper_bound(tDat, tDat + n, xu) - tDat; - - // sort the y index - std::vector yval(indu - indl); - for (unsigned int k = 0; k < yval.size(); ++k){ - yval[k] = std::make_pair(tPairs(1, k + indl), k + indl); - } - std::sort::iterator>(yval.begin(), yval.end(), comparePair); - - std::vector::iterator ylIt = yval.begin(), - yuIt = yval.begin(); - - for (unsigned int j = !autoCov? 0: i; j != ygridN; ++j) { - const double yl = ygrid(j) - bw(1) - 1e-6, - yu = ygrid(j) + bw(1) + 1e-6; - - //locating local window (LOL) (bad joke) - std::vector indx; - - //if the kernel is not Gaussian - if ( KernelName != 3) { - // Search the lower and upper bounds increasingly. - ylIt = std::lower_bound(ylIt, yval.end(), valIndPair(yl, 0), comparePair); - yuIt = std::upper_bound(yuIt, yval.end(), valIndPair(yu, 0), comparePair); - - // The following works nice for the Gaussian - // but for very small samples it complains - //} else { - // ylIt = yval.begin(); - // yuIt = yval.end(); - //} - - for (std::vector::iterator y = ylIt; y != yuIt; ++y){ - indx.push_back(y->second); - } - } else { //When we finally get c++11 we will use std::iota - for( unsigned int y = 0; y != n; ++y){ - indx.push_back(y); - } - } - - unsigned int indxSize = indx.size(); - Eigen::VectorXd lw(indxSize); - Eigen::VectorXd ly(indxSize); - Eigen::MatrixXd lx(2,indxSize); - - for (unsigned int u = 0; u !=indxSize; ++u){ - lx.col(u) = tPairs.col(indx[u]); - lw(u) = win(indx[u]); - ly(u) = cxxn(indx[u]); - } - - // check enough points are in the local window - unsigned int meter=1; - for (unsigned int u =0; u< indxSize; ++u) { - for (unsigned int t = u + 1; t < indxSize; ++t) { - if ( (lx(0,u) != lx(0,t) ) || (lx(1,u) != lx(1,t) ) ) { - meter++; - } - } - if (meter >= 3) { - break; - } - } - - //computing weight matrix - if (meter >= 3 && !bwCheck) { - Eigen::VectorXd temp(indxSize); - Eigen::MatrixXd llx(2, indxSize ); - llx.row(0) = (lx.row(0).array() - xgrid(i))/bw(0); - llx.row(1) = (lx.row(1).array() - ygrid(j))/bw(1); - - //define the kernel used - - switch (KernelName){ - case 1: // Epan - temp= ((1-llx.row(0).array().pow(2))*(1- llx.row(1).array().pow(2))).array() * - ((9./16)*lw).transpose().array(); - break; - case 2 : // Rect - temp=(lw.array())*.25 ; - break; - case 3 : // Gauss - temp = ((-.5*(llx.row(1).array().pow(2))).exp()) * invSqrt2pi * - ((-.5*(llx.row(0).array().pow(2))).exp()) * invSqrt2pi * - (lw.transpose().array()); - break; - case 4 : // GausVar - temp = (lw.transpose().array()) * - ((-0.5 * llx.row(0).array().pow(2)).array().exp() * invSqrt2pi).array() * - ((-0.5 * llx.row(1).array().pow(2)).array().exp() * invSqrt2pi).array() * - (1.25 - (0.25 * (llx.row(0).array().pow(2))).array()) * - (1.50 - (0.50 * (llx.row(1).array().pow(2))).array()); - break; - case 5 : // Quar - temp = (lw.transpose().array()) * - ((1.-llx.row(0).array().pow(2)).array().pow(2)).array() * - ((1.-llx.row(1).array().pow(2)).array().pow(2)).array() * (225./256.); - break; - } - - // make the design matrix - Eigen::MatrixXd X(indxSize ,3); - X.setOnes(); - X.col(1) = lx.row(0).array() - xgrid(i); - X.col(2) = lx.row(1).array() - ygrid(j); - Eigen::LDLT ldlt_XTWX(X.transpose() * temp.asDiagonal() *X); - // The solver should stop if the value is NaN. See the HOLE example in gcvlwls2dV2. - Eigen::VectorXd beta = ldlt_XTWX.solve(X.transpose() * temp.asDiagonal() * ly); - mu(i,j)=beta(0); - } - else if(meter < 3){ - // // Rcpp::Rcout <<"The meter value is:" << meter << std::endl; - // if (bwCheck) { - // Eigen::MatrixXd checker(1,1); - // checker(0,0) = 0.; - // return(checker); - // } else { - Rcpp::stop("No enough points in local window, please increase bandwidth using userBwCov."); - // } - } - } - } - - if (bwCheck){ - Eigen::MatrixXd checker(1,1); - checker(0,0) = 1.; - return(checker); - } - if(autoCov){ - return ( Eigen::MatrixXd(mu.triangularView().transpose()) + Eigen::MatrixXd(mu.triangularView())); - } else { - // ProfilerStop(); - return ( mu ); - } -} - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/src/RmullwlskUniversalDeriv.cpp b/fdapace.Rcheck/00_pkg_src/fdapace/src/RmullwlskUniversalDeriv.cpp deleted file mode 100644 index 9a4f5257..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/src/RmullwlskUniversalDeriv.cpp +++ /dev/null @@ -1,244 +0,0 @@ -#include -#include // to map kernels to integers for the switch -#include // to read in the kernel name -#include // to use vectors -#include // to get the intersect, sort, lower_bound, upper_bound -// #include - -typedef std::pair valIndPair; -bool comparePair(const valIndPair& l, const valIndPair& r); -// bool comparePair(const valIndPair& l, const valIndPair& r) { - // return(l.first < r.first); -// } - -unsigned int factorial(unsigned int n) { - return (n == 1 || n == 0) ? 1 : factorial(n - 1) * n; -} -// [[Rcpp::depends(RcppEigen)]] -// [[Rcpp::export]] - -Eigen::MatrixXd RmullwlskUniversalDeriv( - const Eigen::Map & bw, - const std::string kernel_type, - const Eigen::Map & tPairs, - const Eigen::Map & cxxn, - const Eigen::Map & win, - const Eigen::Map & xgrid, - const Eigen::Map & ygrid, - const int & npoly, - const int & nder1, - const int & nder2, - const bool & bwCheck, - const bool & autoCov){ -// Assumes the first row of tPairs is sorted in increasing order. - // tPairs : xin (in MATLAB code) - // cxxn : yin (in MATLAB code) - // xgrid: out1 (in MATLAB code) - // ygrid: out2 (in MATLAB code) - // bwCheck : boolean / cause the function to simply run the bandwidth check. //To be depreciated - // autoCov : boolean / cause the function to return the autocovariance. - - const double invSqrt2pi= 1./(sqrt(2.*M_PI)); - - // Map the kernel name so we can use switches - std::map possibleKernels; - possibleKernels["epan"] = 1; possibleKernels["rect"] = 2; - possibleKernels["gauss"] = 3; possibleKernels["gausvar"] = 4; - possibleKernels["quar"] = 5; - - // The following test is here for completeness, we mightwant to move it up a - // level (in the wrapper) in the future. - - // If the kernel_type key exists set KernelName appropriately - int KernelName = 0; - if ( possibleKernels.count( kernel_type ) != 0){ - KernelName = possibleKernels.find( kernel_type )->second; //Set kernel choice - } else { - // otherwise use "epan"as the kernel_type - //Rcpp::Rcout << "Kernel_type argument was not set correctly; Epanechnikov kernel used." << std::endl; - Rcpp::warning("Kernel_type argument was not set correctly; Epanechnikov kernel used."); - KernelName = possibleKernels.find( "epan" )->second;; - } - - // Check that we do not have zero weights // Should do a try-catch here - // Again this might be best moved a level-up. - if ( !(win.all()) ){ // - Rcpp::Rcout << "Cases with zero-valued windows are not yet implemented" << std::endl; - return (tPairs); - } - - const unsigned int nder = nder1 + nder2; - const bool isSymmetric = (nder1 == nder2); - - if (npoly < 1) { - Rcpp::stop("npoly should be not less than nder1 + nder2"); - } - if (nder1 < 0 || nder1 > 1 || nder2 < 0 || nder2 > 1) { - Rcpp::stop("nder should be either 0 or 1"); - } - - unsigned int nXcols = (npoly + 1) * (npoly + 2) / 2; - - // ProfilerStart("sort.log"); - // Start the actual smoother here - const unsigned int xgridN = xgrid.size(); - const unsigned int ygridN = ygrid.size(); - const unsigned int n = tPairs.cols(); - - // For sorted x1 - Eigen::VectorXd x1(tPairs.row(0).transpose()); - const double* tDat = x1.data(); - - Eigen::MatrixXd mu(xgrid.size(), ygrid.size()); - mu.setZero(); - - - for (unsigned int i = 0; i != xgridN; ++i) { - const double xl = xgrid(i) - bw(0) - 1e-6, - xu = xgrid(i) + bw(0) + 1e-6; - - unsigned int indl = std::lower_bound(tDat, tDat + n, xl) - tDat, - indu = std::upper_bound(tDat, tDat + n, xu) - tDat; - - // sort the y index - std::vector yval(indu - indl); - for (unsigned int k = 0; k < yval.size(); ++k){ - yval[k] = std::make_pair(tPairs(1, k + indl), k + indl); - } - std::sort::iterator>(yval.begin(), yval.end(), comparePair); - - std::vector::iterator ylIt = yval.begin(), - yuIt = yval.begin(); - - for (unsigned int j = (autoCov && isSymmetric)? i: 0; j != ygridN; ++j) { - const double yl = ygrid(j) - bw(1) - 1e-6, - yu = ygrid(j) + bw(1) + 1e-6; - - //locating local window (LOL) (bad joke) - std::vector indx; - - //if the kernel is not Gaussian - if ( KernelName != 3) { - // Search the lower and upper bounds increasingly. - ylIt = std::lower_bound(ylIt, yval.end(), valIndPair(yl, 0), comparePair); - yuIt = std::upper_bound(yuIt, yval.end(), valIndPair(yu, 0), comparePair); - - // The following works nice for the Gaussian - // but for very small samples it complains - //} else { - // ylIt = yval.begin(); - // yuIt = yval.end(); - //} - - for (std::vector::iterator y = ylIt; y != yuIt; ++y){ - indx.push_back(y->second); - } - } else { //When we finally get c++11 we will use std::iota - for( unsigned int y = 0; y != n; ++y){ - indx.push_back(y); - } - } - - unsigned int indxSize = indx.size(); - Eigen::VectorXd lw(indxSize); - Eigen::VectorXd ly(indxSize); - Eigen::MatrixXd lx(2,indxSize); - - for (unsigned int u = 0; u !=indxSize; ++u){ - lx.col(u) = tPairs.col(indx[u]); - lw(u) = win(indx[u]); - ly(u) = cxxn(indx[u]); - } - - // check enough points are in the local window - unsigned int meter=1; - for (unsigned int u =0; u < indxSize; ++u) { - for (unsigned int t = u + 1; t < indxSize; ++t) { - if ( (lx(0,u) != lx(0,t) ) || (lx(1,u) != lx(1,t) ) ) { - meter++; - } - } - if (meter >= nXcols) { - break; - } - } - - //computing weight matrix - if (meter >= nXcols && !bwCheck) { - Eigen::VectorXd temp(indxSize); - Eigen::MatrixXd llx(2, indxSize ); - llx.row(0) = (lx.row(0).array() - xgrid(i))/bw(0); - llx.row(1) = (lx.row(1).array() - ygrid(j))/bw(1); - - //define the kernel used - - switch (KernelName){ - case 1: // Epan - temp= ((1-llx.row(0).array().pow(2))*(1- llx.row(1).array().pow(2))).array() * - ((9./16)*lw).transpose().array(); - break; - case 2 : // Rect - temp=(lw.array())*.25 ; - break; - case 3 : // Gauss - temp = ((-.5*(llx.row(1).array().pow(2))).exp()) * invSqrt2pi * - ((-.5*(llx.row(0).array().pow(2))).exp()) * invSqrt2pi * - (lw.transpose().array()); - break; - case 4 : // GausVar - temp = (lw.transpose().array()) * - ((-0.5 * llx.row(0).array().pow(2)).array().exp() * invSqrt2pi).array() * - ((-0.5 * llx.row(1).array().pow(2)).array().exp() * invSqrt2pi).array() * - (1.25 - (0.25 * (llx.row(0).array().pow(2))).array()) * - (1.50 - (0.50 * (llx.row(1).array().pow(2))).array()); - break; - case 5 : // Quar - temp = (lw.transpose().array()) * - ((1.-llx.row(0).array().pow(2)).array().pow(2)).array() * - ((1.-llx.row(1).array().pow(2)).array().pow(2)).array() * (225./256.); - break; - } - - // make the design matrix - Eigen::MatrixXd X(indxSize, nXcols); - X.col(0).setOnes(); - unsigned int curCol = 1; - for (unsigned int poly = 1; poly <= npoly; ++poly) { - for (unsigned int d2 = 0; d2 <= poly; ++d2) { - X.col(poly * (poly + 1) / 2 + d2) = - (lx.row(0).array() - xgrid(i)).pow(poly - d2) * - (lx.row(1).array() - ygrid(j)).pow(d2); - ++curCol; - } - } - - Eigen::LDLT ldlt_XTWX(X.transpose() * temp.asDiagonal() * X); - Eigen::VectorXd beta = ldlt_XTWX.solve(X.transpose() * temp.asDiagonal() * ly); - - // Take the correct index and multiply by the factorial. - // Rcpp::Rcout << npoly << ' ' << nder1 << ' ' << nder2 << '\n'; - mu(i,j)=beta(nder * (nder + 1) / 2 + nder2) * factorial(nder1) * - factorial(nder2); - } else if(meter < nXcols) { - Rcpp::stop("No enough points in local window, please increase bandwidth using userBwCov."); - } - } - } - - if (bwCheck){ - Eigen::MatrixXd checker(1,1); - checker(0,0) = 1.; - return(checker); - } - if (autoCov && isSymmetric){ - return ( - Eigen::MatrixXd(mu.triangularView().transpose()) + - Eigen::MatrixXd(mu.triangularView()) - ); - } else { - // ProfilerStop(); - return ( mu ); - } -} - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/src/RrotatedMullwlsk.cpp b/fdapace.Rcheck/00_pkg_src/fdapace/src/RrotatedMullwlsk.cpp deleted file mode 100644 index 7b244f64..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/src/RrotatedMullwlsk.cpp +++ /dev/null @@ -1,161 +0,0 @@ -#include -#include // to map kernels to integers for the switch -#include // to read in the kernel name -#include // to use vectors -#include // to get the intersect and sort - -// [[Rcpp::depends(RcppEigen)]] -// [[Rcpp::export]] - -Eigen::VectorXd Rrotatedmullwlsk( const Eigen::Map & bw, const std::string kernel_type, const Eigen::Map & tPairs, const Eigen::Map & cxxn, const Eigen::Map & win, const Eigen::Map & xygrid, const unsigned int npoly, const bool & bwCheck){ - - // tPairs : xin (in MATLAB code) - // cxxn : yin (in MATLAB code) - // xygrid: d (in MATLAB code) - // npoly: redundant? - - const double invSqrt2pi= 1./(sqrt(2.*M_PI)); - - // Map the kernel name so we can use switches - std::map possibleKernels; - possibleKernels["epan"] = 1; possibleKernels["rect"] = 2; - possibleKernels["gauss"] = 3; possibleKernels["gausvar"] = 4; - possibleKernels["quar"] = 5; - - // The following test is here for completeness, we mightwant to move it up a - // level (in the wrapper) in the future. - - // If the kernel_type key exists set KernelName appropriately - int KernelName = 0; - if ( possibleKernels.count( kernel_type ) != 0){ - KernelName = possibleKernels.find( kernel_type )->second; //Set kernel choice - } else { - // otherwise use "epan"as the kernel_type - // Rcpp::Rcout << "Kernel_type argument was not set correctly; Epanechnikov kernel used." << std::endl; - Rcpp::warning("Kernel_type argument was not set correctly; Epanechnikov kernel used."); - KernelName = possibleKernels.find( "epan" )->second;; - } - - // Check that we do not have zero weights // Should do a try-catch here - // Again this might be best moved a level-up. - if ( !(win.all()) ){ // - Rcpp::Rcout << "Cases with zero-valued windows are not yet implemented" << std::endl; - return (tPairs); - } - - Eigen::Matrix2d RC; // Rotation Coordinates - RC << 1, -1, 1, 1; - RC *= sqrt(2.)/2.; - - Eigen::MatrixXd rtPairs = RC * tPairs; - Eigen::MatrixXd rxygrid = RC * xygrid; - - unsigned int xygridN = rxygrid.cols(); - - Eigen::VectorXd mu(xygridN); - mu.setZero(); - - for (unsigned int i = 0; i != xygridN; ++i){ - - //locating local window (LOL) (bad joke) - std::vector indx; - //if the kernel is not Gaussian or Gaussian-like - if ( KernelName != 3 && KernelName != 4 ) { - //construct listX as vectors / size is unknown originally - std::vector list1, list2; - for (unsigned int y = 0; y != tPairs.cols(); y++){ - if ( std::abs( rtPairs(0,y) - rxygrid(0,i) ) <= bw(0) ) { - list1.push_back(y); - } - if ( std::abs( rtPairs(1,y) - rxygrid(1,i) ) <= bw(1) ) { - list2.push_back(y); - } - } - - //get intersection between the two lists - std::set_intersection(list1.begin(), list1.begin() + list1.size(), list2.begin(), list2.begin() + list2.size(), std::back_inserter(indx)); - - } else { // just get the whole deal - for (unsigned int y = 0; y != tPairs.cols(); ++y){ - indx.push_back(y); - } - } - - unsigned int indxSize = indx.size(); - Eigen::VectorXd lw(indxSize); - Eigen::VectorXd ly(indxSize); - Eigen::MatrixXd lx(2,indxSize); - for (unsigned int u = 0; u !=indxSize; ++u){ - lx.col(u) = rtPairs.col(indx[u]); - lw(u) = win(indx[u]); - ly(u) = cxxn(indx[u]); - } - - - if (ly.size()>=npoly+1 && !bwCheck ){ - - //computing weight matrix - Eigen::VectorXd temp(indxSize); - Eigen::MatrixXd llx(2, indxSize ); - llx.row(0) = (lx.row(0).array() - rxygrid(0,i))/bw(0); - llx.row(1) = (lx.row(1).array() - rxygrid(1,i))/bw(1); - - //define the kernel used - switch (KernelName){ - case 1: // Epan - temp= ((1-llx.row(0).array().pow(2))*(1- llx.row(1).array().pow(2))).array() * - ((9./16)*lw).transpose().array(); - break; - case 2 : // Rect - temp=(lw.array())*.25 ; - break; - case 3 : // Gauss - temp = ((-.5*(llx.row(1).array().pow(2))).exp()) * invSqrt2pi * - ((-.5*(llx.row(0).array().pow(2))).exp()) * invSqrt2pi * - (lw.transpose().array()); - break; - case 4 : // GausVar - temp = (lw.transpose().array()) * - ((-0.5 * llx.row(0).array().pow(2)).array().exp() * invSqrt2pi).array() * - ((-0.5 * llx.row(1).array().pow(2)).array().exp() * invSqrt2pi).array() * - (1.25 - (0.25 * (llx.row(0).array().pow(2))).array()) * - (1.50 - (0.50 * (llx.row(1).array().pow(2))).array()); - break; - case 5 : // Quar - temp = (lw.transpose().array()) * - ((1.-llx.row(0).array().pow(2)).array().pow(2)).array() * - ((1.-llx.row(1).array().pow(2)).array().pow(2)).array() * (225./256.); - break; - } - - // make the design matrix - Eigen::MatrixXd X(indxSize ,3); - X.setOnes(); - X.col(1) = (lx.row(0).array() - rxygrid(0,i)).array().pow(2); - X.col(2) = (lx.row(1).array() - rxygrid(1,i)); - Eigen::LDLT ldlt_XTWX(X.transpose() * temp.asDiagonal() *X); - Eigen::VectorXd beta = ldlt_XTWX.solve(X.transpose() * temp.asDiagonal() * ly); - mu(i)=beta(0); - } else if ( ly.size() == 1 && !bwCheck) { // Why only one but not two is handled? - mu(i) = ly(0); - } else if ( ly.size() != 1 && (ly.size() < npoly+1) ) { - if ( bwCheck ){ - Eigen::VectorXd checker(1); - checker(0) = 0.; - return(checker); - } else { - Rcpp::stop("No enough points in local window, please increase bandwidth."); - } - } - } - - if (bwCheck){ - Eigen::VectorXd checker(1); - checker(0) = 1.; - return(checker); - } - - return ( mu ); -} - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/src/cumtrapzRcpp.cpp b/fdapace.Rcheck/00_pkg_src/fdapace/src/cumtrapzRcpp.cpp deleted file mode 100644 index 34f8ab90..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/src/cumtrapzRcpp.cpp +++ /dev/null @@ -1,40 +0,0 @@ - -#include -using namespace Rcpp; - -template bool is_sorted (ForwardIterator first, ForwardIterator last) -{ - if (first==last) return true; - ForwardIterator next = first; - while (++next!=last) { - if (*next<*first) - return false; - ++first; - } - return true; -} -//' Cumulative Trapezoid Rule Numerical Integration -//' -//' Cumulative Trapezoid Rule Numerical Integration using Rcpp -//' @param X Sorted vector of X values -//' @param Y Vector of Y values. -//' @export -// [[Rcpp::export]] -Rcpp::NumericVector cumtrapzRcpp(const Rcpp::NumericVector X,const Rcpp::NumericVector Y){ - - // Basic check - if( Y.size() != X.size()){ - Rcpp::stop("The input Y-grid does not have the same number of points as input X-grid."); - } - if(is_sorted(X.begin(),X.end())){ - Rcpp::NumericVector ctrapzsum(X.size()); - ctrapzsum[0] = 0.0; - for (unsigned int ind = 0; ind != X.size()-1; ++ind){ - ctrapzsum[ind+1] = 0.5 * (X[ind + 1] - X[ind]) *(Y[ind] + Y[ind + 1]) + ctrapzsum[ind]; - } - return ctrapzsum; - } else { - Rcpp::stop("The input X-grid is not sorted."); - return 1; - } -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/src/dropZeroElementsXYWin.cpp b/fdapace.Rcheck/00_pkg_src/fdapace/src/dropZeroElementsXYWin.cpp deleted file mode 100644 index f509c89c..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/src/dropZeroElementsXYWin.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include -#include // to map kernels to integers for the switch -#include // to read in the kernel name -#include // to use vectors -#include // to get the intersect and sort - -// [[Rcpp::depends(RcppEigen)]] -// [[Rcpp::export]] - - -Eigen::MatrixXd dropZeroElementsXYWin( const Eigen::Map & win, const Eigen::Map & xin, const Eigen::Map & yin){ - - const unsigned int nXGrid = xin.size(); - - // Check that we have equal number of readings - if( nXGrid != yin.size()){ - Rcpp::stop("The input Y-grid does not have the same number of points as input X-grid."); - } - - if( nXGrid != win.size()){ - Rcpp::stop("The input weight vector does not have the same number of points as input X-grid."); - } - - unsigned int nZeroElements = std::count(&win[0], &win[nXGrid], 0.); - - // Check that we do not have zero weights // Should do a try-catch here - if( nZeroElements != 0 ){ // - Eigen::MatrixXd Q(nXGrid - nZeroElements,3); - unsigned int q = 0; - for( unsigned int i = 0; i != nXGrid; ++i){ - if ( win[i] != 0 ) { - Q(q,0) = xin[i]; - Q(q,1) = yin[i]; - Q(q,2) = win[i]; - ++q; - } - } - return( Q ); - } else { - Eigen::MatrixXd Q(nXGrid,3); - Q.col(0) = xin; - Q.col(1) = yin; - Q.col(2) = win; - return( Q ); - } -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/src/interp2lin.cpp b/fdapace.Rcheck/00_pkg_src/fdapace/src/interp2lin.cpp deleted file mode 100644 index 026aa42d..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/src/interp2lin.cpp +++ /dev/null @@ -1,129 +0,0 @@ -#include -#include // to get std::lower_bound -#include // to get std::iterator -#include // to get NaN - -// [[Rcpp::depends(RcppEigen)]] -// [[Rcpp::export]] - -Eigen::VectorXd interp2lin( const Eigen::Map & xin, const Eigen::Map & yin, const Eigen::Map & zin, const Eigen::Map & xou, const Eigen::Map & you){ - - // Setting up initial values - - const unsigned int nXGrid = xin.size(); - const unsigned int nYGrid = yin.size(); - const unsigned int nKnownPoints = nXGrid * nYGrid; - const unsigned int nUnknownPoints = xou.size(); - - Eigen::VectorXd result(nUnknownPoints); - - // Preliminary checks - - // if ( nXGrid != nYGrid ){ - // Rcpp::stop("Input Y-grid does not have the same number of points as Input X-grid."); - // } else - if ( nKnownPoints != zin.size() ) { - Rcpp::stop("Input Z-grid does not have the same number of points as the product of #Input Y-grid times #Input X-grid."); - } else if ( nUnknownPoints != you.size() ){ - Rcpp::stop("Output Y-grid does not have the same number of points as Output X-grid."); - } else if ( xin.minCoeff() > xou.minCoeff() ){ - Rcpp::warning("Output X-grid is outside the lower range of the input X-grid."); - } else if ( yin.minCoeff() > you.minCoeff() ){ - Rcpp::warning("Output Y-grid is outside the lower range of the input Y-grid."); - } else if ( xin.maxCoeff() < xou.maxCoeff() ){ - Rcpp::warning("Output X-grid is outside the upper range of the input X-grid."); - } else if ( yin.maxCoeff() < you.maxCoeff() ){ - Rcpp::warning("Output Y-grid is outside the upper range of the input Y-grid."); - } - - const double ymin = yin.minCoeff(); - const double xmin = xin.minCoeff(); - const double ymax = yin.maxCoeff(); - const double xmax = xin.maxCoeff(); - - // The actual interpolation routine - // Check: https://en.wikipedia.org/wiki/Bilinear_interpolation#Alternative_algorithm - // for a quick reference - - Eigen::RowVector4d fq; - Eigen::Vector2d xa; - Eigen::Vector2d ya; - Eigen::Vector4d za; - Eigen::Matrix4d A; - // Column 1 - A.setOnes(); - - for (unsigned int u = 0; u !=nUnknownPoints; ++u){ - - if ( (xmax < xou(u)) || (ymax < you(u)) || // If x/you(u) is above the upper values of xin/yin - (xmin > xou(u)) || (ymin > you(u)) ){ // If x/you(u) is below the lower values of xin/yin - result(u) = std::numeric_limits::quiet_NaN() ; - - } else { - // Find the appropriate x coordinates/save them in xa (2-by-1) - // Get iterator pointing to the first element which is not less than xou(u) - - // This works if compiled with g++ -DNDEBUG ... etc. - //const double* x1 = std::lower_bound(&xin[0], &xin[nXGrid], xou(u)); - //const double* y1 = std::lower_bound(&yin[0], &yin[nYGrid], you(u)); - - const double* x1 = std::lower_bound(xin.data(), xin.data() + nXGrid, xou(u)); - const double* y1 = std::lower_bound(yin.data(), yin.data() + nYGrid, you(u)); - - xa(1) = *x1; - ya(1) = *y1; - -// const double* x1p = std::find(&xin[0], &xin[nXGrid], xa(1)); -// const double* y1p = std::find(&yin[0], &yin[nYGrid], ya(1)); - const double* x1p = std::find( xin.data(), xin.data() + nXGrid, xa(1)); - const double* y1p = std::find( yin.data(), yin.data() + nYGrid, ya(1)); - - const double* x0p; - const double* y0p; - - - if( y1 != &yin[0]){ - ya(0) = *--y1; - y0p = y1p - 1; - } else { - ya(0) = ya(1); - y0p = y1p; - } - if( x1 != &xin[0]){ - xa(0) = *--x1; - x0p = x1p - 1; - } else { - xa(0) = xa(1); - x0p = x1p; - } - -// const double* x1p = std::find(&xin[0], &xin[nXGrid], xa(1)); -// const double* y1p = std::find(&yin[0], &yin[nYGrid], ya(1)); -// const double* x0p = x1p - 1; -// const double* y0p = y1p - 1; - - za(0) = zin( (y0p -&yin[0]) * nXGrid + (x0p -&xin[0])); - za(1) = zin( (y1p -&yin[0]) * nXGrid + (x0p -&xin[0])); - za(2) = zin( (y0p -&yin[0]) * nXGrid + (x1p -&xin[0])); - za(3) = zin( (y1p -&yin[0]) * nXGrid + (x1p -&xin[0])); - - // Column 2 - A(0,1) = xa(0); A(1,1) = xa(0); - A(2,1) = xa(1); A(3,1) = xa(1); - // Column 3 - A(0,2) = ya(0); A(1,2) = ya(1); - A(2,2) = ya(0); A(3,2) = ya(1); - // Column 4 - A(0,3) = ya(0) * xa(0); A(1,3) = ya(1) * xa(0); - A(2,3) = ya(0) * xa(1); A(3,3) = ya(1) * xa(1); - - fq << 1 , xou(u), you(u), xou(u)*you(u); - - // Rcpp::Rcout << "xa: " << xa.transpose() << ", ya: " << ya.transpose() << ", za: " << za.transpose() << ", fq: " << fq << std::endl; - - result(u) = fq * A.colPivHouseholderQr().solve(za); - } - } - - return ( result ); -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/src/trapzRcpp.cpp b/fdapace.Rcheck/00_pkg_src/fdapace/src/trapzRcpp.cpp deleted file mode 100644 index a2848756..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/src/trapzRcpp.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include -#include // to get NaN -using namespace Rcpp; - -template bool is_sorted (iter begin, iter end) -{ - if (begin==end) return true; - iter next = begin; - while (++next!=end) { - if (*next<*begin) - return false; - ++begin; - } - return true; -} - -//' Trapezoid Rule Numerical Integration -//' -//' Trapezoid Rule Numerical Integration using Rcpp -//' @param X Sorted vector of X values -//' @param Y Vector of Y values. -//' @export -// [[Rcpp::export]] -double trapzRcpp(const Rcpp::NumericVector X, const Rcpp::NumericVector Y){ - - if( Y.size() != X.size()){ - Rcpp::stop("The input Y-grid does not have the same number of points as input X-grid."); - } - if(is_sorted(X.begin(),X.end())){ - double trapzsum = 0; - for (unsigned int ind = 0; ind != X.size()-1; ++ind){ - trapzsum += 0.5 * (X[ind + 1] - X[ind]) *(Y[ind] + Y[ind + 1]); - } - return trapzsum; - } else { - Rcpp::stop("The input X-grid is not sorted."); - return std::numeric_limits::quiet_NaN(); - } - return std::numeric_limits::quiet_NaN(); -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/AAAtestthat.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/AAAtestthat.R deleted file mode 100644 index 03b1bb1c..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/AAAtestthat.R +++ /dev/null @@ -1,9 +0,0 @@ -# # Based on https://github.com/hadley/testthat#integration-with-r-cmd-check -# splitting test files into multiple ones so that each one runs within 10 mins, -# which is the limit on travis CI. -# This file contains the "fast" checks. - -library(testthat) -library(fdapace) -test_check("fdapace", filter='_(?!FPCA)(?!FCReg)(?!FClust)(?!FSVD)(?!FVPA)(?!MultiFAM)', perl=TRUE) -# test_check("fdapace") diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_BinRawCov.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_BinRawCov.R deleted file mode 100644 index 1fce1a57..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_BinRawCov.R +++ /dev/null @@ -1,27 +0,0 @@ -# devtools::load_all() -library(testthat) - -# GMeanAndGCV - -set.seed(1) -pts <- c(0, 1, 3:100) / 100 -regGrid <- seq(0, 1, by=0.1) -samp3 <- Wiener(200, pts, sparsify=2:7) -p0 <- SetOptions(samp3$Ly, samp3$Lt, optns=list(dataType='Sparse', error=TRUE, kernel='epan')) -mu3 <- rep(0, length(pts)) -rcov3 <- GetRawCov(samp3$Ly, samp3$Lt, pts, mu3, p0$dataType, error=p0$error) - -brcov3 <- BinRawCov(rcov3) - -test_that('BinRawCov works', { - tPairs <- matrix(c(1, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2), ncol=2, byrow=TRUE) - rcov <- list(tPairs=tPairs, cxxn=1:nrow(tPairs), error=FALSE) - brcov <- BinRawCov(rcov) - expect_equal(brcov$tPairs, matrix(c(1, 1, 2, 1, 1, 2, 2, 2), ncol=2, byrow=TRUE)) - expect_equal(brcov$meanVals, c(1, 2.5, 6, 4)) - - rcov <- list(tPairs=tPairs, cxxn=1:nrow(tPairs), error=TRUE) - brcov <- BinRawCov(rcov) - expect_equal(brcov$tPairs, matrix(c(1, 1, 2, 1, 1, 2, 2, 2), ncol=2, byrow=TRUE)) - expect_equal(brcov$meanVals, c(1, 2.5, 6, 4)) -}) \ No newline at end of file diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_BwNN.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_BwNN.R deleted file mode 100644 index 15a60127..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_BwNN.R +++ /dev/null @@ -1,30 +0,0 @@ -# devtools::load_all(); library(testthat) - - -library(testthat) -test_that('FindNN is correct', { - tPairs <- matrix(c(0, 0, - 1, 1, - 0, 1, - 1, 0, - 0, 0.2, - 0.2, 0, - 0.2, 0.2, - 0.2, 1, - 1, 0.2), byrow=TRUE, ncol=2) - expect_equal(FindNN(tPairs), 0.8) -}) - - - -test_that('BWNN works for large sample', { - library(fdapace) - set.seed(1) - n <- 100 - pts <- seq(0, 1, length.out=100) - sparsity <- 2:5 - samp <- Wiener(n, pts, sparsity) - bw <- BwNN(samp[[1]]) # Lt or Lt - expect_true(bw['cov'] >= 0.01 && bw['cov'] < 0.1 && bw['mu'] <= bw['cov']) -}) - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_CheckData.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_CheckData.R deleted file mode 100644 index 7ea936e1..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_CheckData.R +++ /dev/null @@ -1,23 +0,0 @@ -cat("\nTests for 'CheckData'") - -test_that("basic valid lists arguments do not return any errors ", { - CheckData(y = list(c(1,2,3), c(1,2)), t = list(c(1,2,3), c(1,2))) - CheckData(t = list(c(1,2,3), c(1,2)), y = list(runif(3), runif(2))) -}) - - -test_that("basic invalid nolists arguments do return errors ", { - # expect_equal(CheckData( runif(4), list(c(1,2,NA), c(1,2)) ), TRUE) # We handle NA now - # expect_equal(CheckData( list(c(1,2,3), c(1,NA)), runif(3) ), TRUE) # We handle NA now - expect_error(CheckData( matrix(1:6,2,3), list(c(1,2,3), c(1,2)) ), 'y should be list') - expect_error(CheckData( list(c(1,2,3), c(1,2)), matrix(1:6,2,3) ), 't should be list') -}) - - -test_that("basic checks where input data has an additional arbitray value works (issue #9) ", { - data(medfly25) - Flies1 <- MakeFPCAInputs(medfly25$ID, medfly25$Days, medfly25$nEggs) - class(Flies1$Ly[[1]]) <- append(Flies1$Ly[[1]], "some") - expect_s3_class(FPCA(Ly= Flies1$Ly[1:100], Lt= Flies1$Lt[1:100] ), 'FPCA') -}) - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_ConvertSupport.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_ConvertSupport.R deleted file mode 100644 index 1e93f0c0..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_ConvertSupport.R +++ /dev/null @@ -1,16 +0,0 @@ -# devtools::load_all() -library(testthat) - -fromGrid <- seq(0, pi / 2, 0.1) -toGrid <- fromGrid + 0.001 -toGrid[length(toGrid)] <- toGrid[length(toGrid)] - 0.002 -mu <- sin(fromGrid) -phi <- cbind(sin(fromGrid), cos(fromGrid)) -phi1 <- matrix(phi[, 1], ncol=1) -Cov <- tcrossprod(phi) - -test_that('ConvertSupport works', { - expect_equal(mu, ConvertSupport(fromGrid, toGrid, mu=mu), tolerance=2e-3) - expect_equal(phi, ConvertSupport(fromGrid, toGrid, phi=phi), tolerance=2e-3) - expect_equal(Cov, ConvertSupport(fromGrid, toGrid, Cov=Cov), tolerance=1e-3) -}) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_CreateBasis.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_CreateBasis.R deleted file mode 100644 index 63d586c3..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_CreateBasis.R +++ /dev/null @@ -1,14 +0,0 @@ -# devtools::load_all('../../RPACE/tPACE') - -test_that('legendre basis works', { - M <- 20000 - pts <- seq(0, 1, length.out=M) - K <- 10 - - tmp <- CreateBasis(K, pts, 'legendre01') - expect_equal(crossprod(tmp) / M, diag(K), scale=1, tol=1e-3) - - K <- 1 - tmp <- CreateBasis(K, pts, 'legendre01') - expect_equal(crossprod(tmp) / M, matrix(1), scale=1, tol=1e-3) -}) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_CreateDiagnosticPlot.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_CreateDiagnosticPlot.R deleted file mode 100644 index edbdb37d..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_CreateDiagnosticPlot.R +++ /dev/null @@ -1,26 +0,0 @@ -# devtools::load_all() - -viewPdf <- FALSE -set.seed(1) -n <- 100 -M <- 51 -pts <- seq(0, 1, length.out=M) -mu <- rep(0, length(pts)) -sampDense <- Wiener(n, pts) -samp <- Sparsify(sampDense, pts, M) -res <- FPCA(samp$Ly, samp$Lt, list(error=TRUE, FVEthreshold=1, dataType='Dense', plot=TRUE)) - -if (viewPdf) { - pdf('tmp.pdf') -} - -plot(res) -CreateDesignPlot(samp$Lt) -plot(res, addLegend=FALSE) -CreateDesignPlot(samp$Lt, addLegend=FALSE) - -if (viewPdf) { - dev.off() - system('open tmp.pdf') - file.remove('tmp.pdf') -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_CreateFolds.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_CreateFolds.R deleted file mode 100644 index 0c39bd7d..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_CreateFolds.R +++ /dev/null @@ -1,50 +0,0 @@ -#options(error=recover) -library(testthat) - -test_that('SimpleFolds works', { - samp <- 1:10 - res1 <- SimpleFolds(samp, 10) - expect_equal(length(res1), 10) - expect_equal(sum(sapply(res1, length)), length(samp)) - expect_equal(diff(range(sapply(res1, length))), 0) - - samp <- 20:60 - res2 <- SimpleFolds(samp, 10) - expect_equal(length(res2), 10) - expect_equal(sum(sapply(res2, length)), length(samp)) - expect_equal(diff(range(sapply(res2, length))), 1) -}) - -test_that('CreateFolds works for numeric responses', { - set.seed(1) - samp1 <- CreateFolds(rnorm(55), 10) - sampVec1 <- sort(do.call(c, samp1)) - expect_true(diff(range(sapply(samp1, length))) <= 5) - expect_equal(sampVec1, seq_along(sampVec1)) - - samp2 <- CreateFolds(rnorm(5), 10) - sampVec2 <- sort(do.call(c, samp2)) - expect_true(diff(range(sapply(samp2, length))) <= 1) - expect_equal(sampVec2, seq_along(sampVec2)) -}) - -test_that('CreateFolds works for factor/class responses', { - set.seed(1) - nclass <- 2 - tmp <- sample(c(rep(0, 10), rep(1, 11))) - samp3 <- CreateFolds(tmp, 10) - expect_true(diff(range(sapply(samp3, length))) <= nclass) - expect_true(all(sapply(samp3, function(ind) any(tmp[ind] == 0) && any(tmp[ind] == 1)))) - - nclass <- 3 - tmp <- sample(c(rep(1, 10), rep(2, 11), rep(3, 5))) - tmp <- factor(tmp) - samp4 <- CreateFolds(tmp, 10) - expect_true(diff(range(sapply(samp4, length))) <= nclass) - expect_true(all(sapply(samp4, function(ind) sum(table(tmp[ind]) != 0) >= 2))) -}) - -# debug(CreateFolds) -# undebug(CreateFolds) -# debug(SimpleFolds) -# undebug(SimpleFolds) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_CreatePathPlot.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_CreatePathPlot.R deleted file mode 100644 index d2ebb5ab..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_CreatePathPlot.R +++ /dev/null @@ -1,38 +0,0 @@ -library(testthat) -# devtools::load_all() - -set.seed(1) -n <- 300 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- sampWiener + matrix(rnorm(n, sd=0.1), n, length(pts)) -sampWiener <- Sparsify(sampWiener, pts, 1:5) -res <- FPCA(sampWiener$Ly, sampWiener$Lt, - list(dataType='Sparse', kernel='epan')) -resDer <- FPCAder(res, list(method='DPC')) - -test_that('CreatePathPlot works for FPCA object', { - CreatePathPlot(res) - CreatePathPlot(res, 1:10) - CreatePathPlot(res, 1:20, showObs=FALSE) - CreatePathPlot(res, 1:20, showMean=TRUE, showObs=FALSE) - CreatePathPlot(res, 1:20, obsOnly=TRUE) - CreatePathPlot(res, 1:20, obsOnly=TRUE, showObs=FALSE) - CreatePathPlot(inputData=sampWiener, subset=1:20, obsOnly=TRUE) - CreatePathPlot(res, subset=seq_len(n) %% 5 == 0, K=4, inputData=list(Lt=sampWiener$Lt, Ly=sampWiener$Ly), main='123', xlab='T') -}) - -test_that('CreatePathPlot works for FPCAder object', { - CreatePathPlot(resDer) - CreatePathPlot(resDer, 1:10) - CreatePathPlot(resDer, 1:10, showMean=TRUE) - CreatePathPlot(resDer, 1:20, showObs=TRUE) - CreatePathPlot(resDer, 1:20, obsOnly=TRUE, showObs=FALSE) -}) - -test_that('User defined colors work', { - showInd <- 11:13 - shown <- length(showInd) - CreatePathPlot(res, showInd) - CreatePathPlot(res, showInd, col=c('blue', 'cyan', 'grey')) -}) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_CreateStringingPlot.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_CreateStringingPlot.R deleted file mode 100644 index 3c28fa1b..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_CreateStringingPlot.R +++ /dev/null @@ -1,50 +0,0 @@ -# test CreateStringingPlot -library(testthat) - -# implement the first kind of simulation in stringing paper -# Fourier basis, specify signal-to-noise ratio (SNR), number of components used -# returns true underlying curves XTraj, and randomly ordered design matrix X -stringing_sim1 <- function(K = 4, SNR = 10, n = 50, p = 50){ - grid = seq(5/p,5,5/p) - lambda = 8*(0.5^(1:K)) # exponential decay - phi = cbind(-sqrt(0.2)*cos(0.2*pi*grid), sqrt(0.2)*sin(0.2*pi*grid), - -sqrt(0.2)*cos(0.4*pi*grid), sqrt(0.2)*sin(0.4*pi*grid)) - scores = t(MASS::mvrnorm(n = n, mu = rep(0,K), Sigma = diag(lambda))) - Xtrue = t(phi %*% scores) # ith row corresponds to ith subject - if(SNR == Inf){ - Xt = Xtrue - } else { - Xt = Xtrue + rnorm(n*p, mean=0, sd=mean(abs(Xtrue))/SNR) - } - rdmorder = sample(x = 1:p, size = p, replace = FALSE) # random columns indices for the original order - X = Xt[,rdmorder] - return(list(XTraj = Xt, X = X, order = rdmorder, n = n, p = p, RegGrid = grid)) -} - -test_that("CreateStringingPlot works",{ - set.seed(1) - simdata = stringing_sim1(SNR = Inf) - stringingfit = Stringing(simdata$X, disOptns = "correlation") - # check with simulated data to see if reversal of order is needed - diff_norev = sum(abs(simdata$order[stringingfit$StringingOrder] - 1:simdata$p)) - diff_rev = sum(abs(simdata$order[stringingfit$StringingOrder] - simdata$p:1)) - if(diff_rev <= diff_norev){ - stringingfit$StringingOrder = rev(stringingfit$StringingOrder) - stringingfit$Ly = lapply(stringingfit$Ly, rev) - } - CreateStringingPlot(stringingObj = stringingfit, subset = 1:10) -}) - -test_that("CreateStringingPlot works",{ - set.seed(1) - simdata = stringing_sim1(SNR = Inf) - stringingfit = Stringing(simdata$X, disOptns = "euclidean", standardize = TRUE) - # check with simulated data to see if reversal of order is needed - diff_norev = sum(abs(simdata$order[stringingfit$StringingOrder] - 1:simdata$p)) - diff_rev = sum(abs(simdata$order[stringingfit$StringingOrder] - simdata$p:1)) - if(diff_rev <= diff_norev){ - stringingfit$StringingOrder = rev(stringingfit$StringingOrder) - stringingfit$Ly = lapply(stringingfit$Ly, rev) - } - CreateStringingPlot(stringingObj = stringingfit, subset = 1:10) -}) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_CreateTrueMean.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_CreateTrueMean.R deleted file mode 100644 index 2b2679f8..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_CreateTrueMean.R +++ /dev/null @@ -1,30 +0,0 @@ - -myEps <- .Machine$double.eps; - -test_that(" basic 0/1 combination matches MATLAB output ", { - expect_equal( CreateTrueMean(1,0), 0) - expect_equal( CreateTrueMean(0,1), 0) - expect_equal( CreateTrueMean(0,0), 0) - expect_equal( CreateTrueMean(1,1), 1.841470984807897, tolerance = 2*myEps, scale = 1) -}) - -test_that(" 'multiple t, single p'-case matches MATLAB output ", { - expect_equal( CreateTrueMean( c(0.1, 1.3), 3), c(0.199833416646828, 2.263558185417193), tolerance = 2*myEps, scale = 1 ) - expect_equal( CreateTrueMean( c(0.1, 1.3), 1), c(0.199833416646828, 0) , tolerance = 2*myEps, scale = 1 ) -}) - -test_that(" 'single t, multiple p'-case matches MATLAB output ", { - expect_equal( CreateTrueMean( 1, c(0.1, 1.3)), 0 ) - expect_equal( CreateTrueMean( 3, c(0.1, 1.3)), c(0, 0) ) -}) - -test_that(" 'multiple t, multiple p'-case matches MATLAB output ", { - expect_equal( CreateTrueMean( c(3, 1), c(0.1, 1.3)), c(0, 1.841470984807897), tolerance = 2*myEps, scale = 1) - expect_equal( CreateTrueMean( c(1, 3), c(0.1, 1.3)), c(0, 0) , tolerance = 2*myEps, scale = 1) - expect_equal( CreateTrueMean( c(0.1, 1.3), c(3, 1)), c(0.199833416646828, 0), tolerance = 2*myEps, scale = 1) - expect_equal( CreateTrueMean( c(0.1, 1.3), c(1, 3)), c(0.199833416646828, 2.263558185417193), tolerance = 2*myEps, scale = 1) - expect_equal( CreateTrueMean( c(1.1, 0.3), c(3, 1)), c(1.991207360061436, 0.595520206661340), tolerance = 2*myEps, scale = 1) - expect_equal( CreateTrueMean( c(1.1, 0.3), c(1, 3)), c(0, 0.595520206661340), tolerance = 2*myEps, scale = 1) -}) - -# cat("Done") \ No newline at end of file diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_DynCorr.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_DynCorr.R deleted file mode 100644 index 125b998d..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_DynCorr.R +++ /dev/null @@ -1,92 +0,0 @@ -#devtools::load_all() -library(testthat) - -#positive test 1 -test_that('when y_i[t] - mean(y[t]) = 2(x_i[t]-mean(x[t])), expect correlation 1', { - library(MASS) - set.seed(10) - n=200 - t=seq(0,1,length.out=100) - - mu_quad_x=8*t^2-4*t+5 - mu_quad_y=8*t^2-12*t+6 - - fun=rbind(rep(1,length(t)),-t,t^2) - z1=mvrnorm(n,rep(0,3),diag(c(2,16/3,4))) # covariance matrix of random effects - x1_quad=y1_quad=x1_quad_error=y1_quad_error=matrix(0,nrow=n,ncol=length(t)) - - for (i in 1:n){ - x1_quad[i,]=mu_quad_x+z1[i,]%*%fun - y1_quad[i,]=mu_quad_y+2*z1[i,]%*%fun - } - - dyn1_quad=DynCorr(x1_quad,y1_quad,t) - expect_equal(min(dyn1_quad),1) -}) - -#positive test 2 -test_that('first generate y_i[t] - mean(y[t]) = 2(x_i[t]-mean(x[t])) then add noise to y and x, expect correlation close to 1', { - library(MASS) - set.seed(10) - - n=200 - t=seq(0,1,length.out=100) - - mu_quad_x=8*t^2-4*t+5 - mu_quad_y=8*t^2-12*t+6 - - fun=rbind(rep(1,length(t)),-t,t^2) - z1=mvrnorm(n,rep(0,3),diag(c(2,16/3,4))) # covariance matrix of random effects - x1_quad=y1_quad=x1_quad_error=y1_quad_error=matrix(0,nrow=n,ncol=length(t)) - - for (i in 1:n){ - x1_quad[i,]=mu_quad_x+z1[i,]%*%fun+rnorm(length(t),0,0.01) - y1_quad[i,]=mu_quad_y+2*z1[i,]%*%fun+rnorm(length(t),0,0.01) - } - - dyn1_quad=DynCorr(x1_quad,y1_quad,t) - expect_equal(max(1-dyn1_quad) < 0.1,T) -}) - -#positive test 3 -test_that('setting same as test #1 but with 1/5 missings in each observation, expect result close to 1', { - library(MASS) - set.seed(10) - - n=200 - t=seq(0,1,length.out=100) - - mu_quad_x=8*t^2-4*t+5 - mu_quad_y=8*t^2-12*t+6 - - fun=rbind(rep(1,length(t)),-t,t^2) - z1=mvrnorm(n,rep(0,3),diag(c(2,16/3,4))) # covariance matrix of random effects - x1_quad=y1_quad=x1_quad_error=y1_quad_error=matrix(0,nrow=n,ncol=length(t)) - - for (i in 1:n){ - x1_quad[i,]=mu_quad_x+z1[i,]%*%fun - y1_quad[i,]=mu_quad_y+2*z1[i,]%*%fun - } - - for(i in 1:n){ - ms_x = sample(t,20) - ms_y = sample(t,20) - x1_quad[i,ms_x] = NA - y1_quad[i,ms_y] = NA - } - - dyn1_quad=DynCorr(x1_quad,y1_quad,t) - expect_equal(max(1-dyn1_quad) < 0.1,T) -}) - -#negative test -expect_error({ - set.seed(10) - n=200 - t=seq(0,1,length.out=100) - - x = Wiener(n,t) - y= Wiener(n+1,t) - - dyn=DynCorr(x,y,t) -}) \ No newline at end of file diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_Dyn_test.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_Dyn_test.R deleted file mode 100644 index 95e6922f..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_Dyn_test.R +++ /dev/null @@ -1,91 +0,0 @@ -#devtools::load_all() -library(testthat) - -#positive test 1 -test_that('one sample test, when y_i[t] - mean(y[t]) = 2(x_i[t]-mean(x[t])), expect p-value very small', { - library(MASS) - set.seed(10) - n=200 - t=seq(0,1,length.out=100) - - mu_quad_x=8*t^2-4*t+5 - mu_quad_y=8*t^2-12*t+6 - - fun=rbind(rep(1,length(t)),-t,t^2) - z1=mvrnorm(n,rep(0,3),diag(c(2,16/3,4))) # covariance matrix of random effects - x1_quad=y1_quad=matrix(0,nrow=n,ncol=length(t)) - - for (i in 1:n){ - x1_quad[i,]=mu_quad_x+z1[i,]%*%fun - y1_quad[i,]=mu_quad_y+2*z1[i,]%*%fun - } - - bt_dc=Dyn_test(x1_quad,y1_quad,t) - expect_equal(bt_dc$pval < 0.01,T) -}) - -#positive test 2 -test_that('one sample test, setting same as test #1 but with 1/5 missings in each observation, expect p-value very small', { - library(MASS) - set.seed(10) - - n=200 - t=seq(0,1,length.out=100) - - mu_quad_x=8*t^2-4*t+5 - mu_quad_y=8*t^2-12*t+6 - - fun=rbind(rep(1,length(t)),-t,t^2) - z1=mvrnorm(n,rep(0,3),diag(c(2,16/3,4))) # covariance matrix of random effects - x1_quad=y1_quad=matrix(0,nrow=n,ncol=length(t)) - - for (i in 1:n){ - x1_quad[i,]=mu_quad_x+z1[i,]%*%fun - y1_quad[i,]=mu_quad_y+2*z1[i,]%*%fun - } - - for(i in 1:n){ - ms_x = sample(t,20) - ms_y = sample(t,20) - x1_quad[i,ms_x] = NA - y1_quad[i,ms_y] = NA - } - - bt_dc=Dyn_test(x1_quad,y1_quad,t) - expect_equal(bt_dc$pval < 0.01,T) -}) - -#positive test 3 -test_that('two sample test, the first sample has the same setting as test #2, the second sample is the first sample with noise, expect p-value larger than 0.2', { - library(MASS) - set.seed(10) - - n=200 - t=seq(0,1,length.out=100) - - mu_quad_x=8*t^2-4*t+5 - mu_quad_y=8*t^2-12*t+6 - - fun=rbind(rep(1,length(t)),-t,t^2) - z1=mvrnorm(n,rep(0,3),diag(c(2,16/3,4))) # covariance matrix of random effects - x1_quad=y1_quad=x1_quad_error=y1_quad_error=matrix(0,nrow=n,ncol=length(t)) - - for (i in 1:n){ - x1_quad[i,]=mu_quad_x+z1[i,]%*%fun - y1_quad[i,]=mu_quad_y+2*z1[i,]%*%fun - x1_quad_error[i,]=x1_quad[i,]+rnorm(length(t),0,0.1) - y1_quad_error[i,]=y1_quad[i,]+rnorm(length(t),0,0.1) - } - - for(i in 1:n){ - ms_x = sample(t,20) - ms_y = sample(t,20) - x1_quad[i,ms_x] = NA - y1_quad[i,ms_y] = NA - x1_quad_error[i,ms_x] = NA - y1_quad_error[i,ms_y] = NA - } - - bt_dc=Dyn_test(x1_quad,y1_quad,t,x1_quad_error,y1_quad_error,t) - expect_equal(bt_dc$pval > 0.2,T) -}) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FCCor.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FCCor.R deleted file mode 100644 index 4ece02fc..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FCCor.R +++ /dev/null @@ -1,38 +0,0 @@ -library(testthat) -# devtools::load_all('.') - -test_that('FCCor works', { - set.seed(4) - - n <- 200 - nGridIn <- 50 - sparsity <- 1:5 # must have length > 1 - bw <- 0.1 - kern <- 'epan' - T <- matrix(seq(0.5, 1, length.out=nGridIn)) - - ## Corr(X(t), Y(t)) = 1/2 - A <- Wiener(n, T) - B <- Wiener(n, T) - C <- Wiener(n, T) + matrix((1:nGridIn) , n, nGridIn, byrow=TRUE) - X <- A + B - Y <- A + C - indEach <- lapply(1:n, function(x) sort(sample(nGridIn, sample(sparsity, 1)))) - tAll <- lapply(1:n, function(i) T[indEach[[i]]]) - Xsp <- lapply(1:n, function(i) X[i, indEach[[i]]]) - Ysp <- lapply(1:n, function(i) Y[i, indEach[[i]]]) - - expect_equal(sapply(Xsp, length), sapply(Ysp, length)) - expect_equal(sapply(Xsp, length), sapply(tAll, length)) - - # Perfect correlation case - expect_equal(mean(FCCor(Xsp, Xsp, tAll, bw)[['corr']], na.rm=TRUE), 1) - - # Consistency - expect_true(mean((FCCor(Xsp, Ysp, tAll, bw, kern)[['corr']] - 0.5)^2, na.rm=TRUE) < 1e-2) - - # Gauss and epan kernels are similar - expect_equal(FCCor(Xsp, Ysp, tAll, bw, 'epan')[['corr']], FCCor(Xsp, Ysp, tAll, bw, 'gauss')[['corr']], 0.1) -}) - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FCReg.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FCReg.R deleted file mode 100644 index e6efdaab..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FCReg.R +++ /dev/null @@ -1,251 +0,0 @@ -library(MASS) -library(testthat) -# devtools::load_all() - -test_that('Simple dense case works', { - # X(t) = Y(t), and they are contaminated with errors. - # beta_0 = 0; beta_1 = t - set.seed(1) - n <- 100 - p <- 20 - sigma <- 1 - pts <- seq(0, 1, length.out=p) - T <- 1 + pts * p - X <- Wiener(n, pts) + rnorm(n) - Y <- t(apply(X, 1, `*`, e2=pts)) - Xn <- X + rnorm(n * p, sd=sigma) - Yn <- Y + rnorm(n * p, sd=sigma) - vars <- list(X=MakeFPCAInputs(tVec=T, yVec=Xn), - Y=MakeFPCAInputs(tVec=T, yVec=Yn)) - - bw <- 0.25 * diff(range(T)) - kern <- 'epan' - - res <- FCReg(vars, bw, bw, T, kern, measurementError=FALSE) - resN <- FCReg(vars, bw, bw, T, kern, measurementError=TRUE) - # plot(pts, res$beta); abline(a=0, b=1) - # plot(pts, resN$beta); abline(a=0, b=1) - expect_equal(as.numeric(res$beta), pts, scale=1, tolerance=0.1) - expect_equal(as.numeric(resN$beta), pts, scale=1, tolerance=0.1) - # Assume noise is better than no noise - expect_lt(mean((as.numeric(resN$beta) - pts)^2), mean((as.numeric(res$beta) - pts)^2)) -}) - -# Y(t) = \beta_0(t) + \beta_1(t) X_1(t) + \beta_2(t) X_2(t) + \beta_3 Z_3 + \beta_4 Z_4 + \epsilon -# X_1(t) = \mu_{X_1}(t) + Z_1 \phi_1(t); X_2(t) = \mu_{X_2}(t) + Z_2 \phi_2(t); -# \mu_{X_1}(t) = 2t, \mu_{X_2}(t) = -2t -# (Z_1, \dots, Z_4) \sim N(0, \Sigma). \Sigma = 1/4 + diag(3/4) -# \phi_1(t) = 1, \phi_2(t) = sqrt(2) * cos(\pi t), t \in [0, 1]. So $cov(X_1(s), X_2(t)) = sqrt(2)/4 \cos(\pi t).$ -# \epsilon \sim N(0, \sigma^2). -# \beta_1 = \beta_2 = \beta_3 = \beta_4 = 1. - -set.seed(1) -n <- 100 -nGridIn <- 200 -sparsity <- 5:10 # must have length > 1 -bw <- 0.2 -kern <- 'gauss' -T <- seq(0, 1, length.out=nGridIn) - -Sigma <- 1 / 4 + diag(3 / 4, 4) -mu <- T * 2 -sigma <- 1 - -beta_0 <- 0 -beta_1 <- 1 -beta_2 <- 1 -beta_3 <- 1 -beta_4 <- 1 - -Z <- mvrnorm(n, rep(0, 4), Sigma) -X_1 <- Z[, 1, drop=FALSE] %*% matrix(1, 1, nGridIn) + matrix(mu, n, nGridIn, byrow=TRUE) -X_2 <- Z[, 2, drop=FALSE] %*% matrix(sqrt(2) * cos(pi * T), 1, nGridIn) - matrix(mu, n, nGridIn, byrow=TRUE) -# tmp <- cov(X_1, X_2); colMeans(tmp) -epsilon <- rnorm(n, sd=sigma) -Y <- matrix(NA, n, nGridIn) -for (i in seq_len(n)) { - Y[i, ] <- beta_0 + beta_1 * X_1[i, ] + beta_2 * X_2[i, ] + beta_3 * Z[i, 3] + beta_4 * Z[i, 4] + epsilon[i] -} -denseMuY <- colMeans(Y) -denseCovY <- cov(Y) - -set.seed(1) -X_1sp <- Sparsify(X_1, T, sparsity) -set.seed(1) -X_2sp <- Sparsify(X_2, T, sparsity) -set.seed(1) -Ysp <- Sparsify(Y, T, sparsity) -outGrid <- round(seq(min(T), 1, by=0.05), 2) -vars <- list(X_1=X_1sp, X_2=X_2sp, Z_3=Z[, 3], Z_4=Z[, 4], Y=Ysp) - -test_that('Scaler-scaler cov', - expect_equal(as.numeric(uniCov(Z[, 3], Z[, 4])), cov(Z[, 3], Z[, 4])) -) - -test_that('Scaler-function cov = Function-scaler cov', { - expect_equal(uniCov(X_1sp, Z[, 3], bw, outGrid), - t(uniCov(Z[, 3], X_1sp, bw, outGrid))) -}) - -cov12 <- uniCov(X_1sp, X_2sp, bw, outGrid, kern) -# cov12_rd <- uniCov(X_1sp, X_2sp, bw, outGrid, kern, rmDiag=TRUE) -cov12_1D <- uniCov(X_1sp, X_2sp, bw, outGrid, kern, use1D=TRUE) -cov13 <- uniCov(X_1sp, Z[, 3], bw, outGrid, kern) -cov21 <- uniCov(X_2sp, X_1sp, bw, outGrid, kern) -# cov11 <- uniCov(X_1sp, X_1sp, bw, outGrid, kern) -# cov11_rd <- uniCov(X_1sp, X_1sp, bw, outGrid, kern, rmDiag=TRUE) -# cov22 <- uniCov(X_2sp, X_2sp, bw, outGrid, kern) -# cov22_rd <- uniCov(X_2sp, X_2sp, bw, outGrid, kern, rmDiag=TRUE) -# rgl::persp3d(outGrid, outGrid, cov12) -test_that('Function-function cov works', { - expect_equal(cov12, t(cov21)) - - # x-direction is close to constant. - expect_true(mean(apply(cov12, 2, sd), trim=0.1) < 0.08) - - # y-direction is close to 1/4 * (1.5 + cos(pi t)) - expect_true(sqrt(mean((colMeans(cov12) - sqrt(2) / 4 * cos(pi * outGrid))^2, trim=0.1)) < 0.133) - - # 1D and 2D smoother is similar - expect_equal(diag(cov12), diag(cov12_1D), tolerance=0.2) -}) - -covAll <- MvCov(vars, bw, outGrid, kern) -covAllNoError <- MvCov(vars, bw, outGrid, kern, measurementError=FALSE) - -test_that('Multi-function/scaler cov works', { -# The cov(x, y) and cov(y, x) is symmetric. - expect_equal(as.numeric(cov12), as.numeric(covAll[, , 1, 2])) - expect_equal(covAll[, , 3, 1], t(covAll[, , 1, 3])) - expect_equal(covAll[, , 4, 3], t(covAll[, , 3, 4])) - expect_equal(covAll[, , 1, 2], t(covAll[, , 2, 1])) - expect_equal(covAll[, , 1, 2], covAllNoError[, , 1, 2]) - tmp <- max(abs(covAll[, , 1, 1] - covAllNoError[, , 1, 1])) - expect_true(tmp > 0.01 && tmp < 0.35) - - # rgl::persp3d(outGrid, outGrid, covAll[, , 1, 1], col='blue', xlab='X(s)', ylab='Y(t)') - # rgl::persp3d(outGrid, outGrid, covAll[, , 1, 1], col='blue', xlab='X(s)', ylab='Y(t)') -}) - -demeanRes <- demean(vars, bw, kern) -varsDemean <- demeanRes[['xList']] -muDemean <- demeanRes[['muList']] -covAllDemean <- MvCov(varsDemean, bw, outGrid, kern, center=FALSE) - -test_that('demean works', { - expect_equal(demeanRes[['muList']][['Z_3']], mean(vars[['Z_3']])) - expect_equal(demeanRes[['muList']][['Z_4']], mean(vars[['Z_4']])) - expect_equal(uniCov(varsDemean[['X_1']], varsDemean[['X_2']], bw, outGrid, center=FALSE), cov12) - expect_equal(uniCov(varsDemean[['X_1']], varsDemean[['Z_3']], bw, outGrid, center=FALSE), cov13) - expect_equal(covAll, covAllDemean) -}) - -withError2D <- FCReg(vars, bw,bw, outGrid) -withError1D <- FCReg(vars, bw,bw, outGrid, diag1D='cross') -noError2D <- FCReg(vars, bw,bw, outGrid, measurementError=FALSE) -noError1D <- FCReg(vars, bw, bw,outGrid, measurementError=FALSE, diag1D='all') - -# matplot(outGrid, t(withError2D$beta), 'l') -# matplot(outGrid, t(noError2D$beta), 'l') -# matplot(outGrid, t(noError1D$beta), 'l') - -expect_error(FCReg(vars, bw, bw, outGrid, measurementError=TRUE, diag1D='all'), "Cannot assume measurement error when diag1D == 'all'") - -# # Minimal eigenvalues sometimes smaller than 0. -# minLambda <- sapply(seq_along(outGrid), function(i) { - # min(eigen(noError1D[['cov']][i, i, 1:4, 1:4])[['values']]) -# }) -# minLambda2D <- sapply(seq_along(outGrid), function(i) { - # min(eigen(noError2D[['cov']][i, i, 1:4, 1:4])[['values']]) -# }) - -test_that('1D and 2D covariance estimates are similar', { - expect_true(sqrt(mean( - (withError2D[['beta']] - withError1D[['beta']])^2, - trim=0.2)) < 0.2) - expect_equal(noError2D[['beta']], noError1D[['beta']], tolerance=0.1) -}) - -withError2DRect <- FCReg(vars, bw, bw, outGrid, kern='rect') -withError1DRect <- FCReg(vars, bw,bw, outGrid, diag1D='cross', kern='rect') -noError2DRect <- FCReg(vars, bw,bw, outGrid, measurementError=FALSE, kern='rect') -noError1DRect <- FCReg(vars, bw,bw, outGrid, measurementError=FALSE, diag1D='all', kern='rect') -withError2DEpan <- FCReg(vars, bw,bw, outGrid, kern='epan') -withError1DEpan <- FCReg(vars, bw,bw, outGrid, diag1D='cross', kern='epan') -noError2DEpan <- FCReg(vars, bw,bw, outGrid, measurementError=FALSE, kern='epan') -noError1DEpan <- FCReg(vars, bw,bw, outGrid, measurementError=FALSE, diag1D='all', kern='epan') - -test_that('Different kernel type works', { - expect_true(sqrt(mean( - (withError2DRect[['beta']] - withError1DRect[['beta']])^2, - trim=0.2)) < 0.2) - expect_equal(noError2DRect[['beta']], noError2D[['beta']], tolerance=0.2) - expect_equal(noError1DRect[['beta']], noError1D[['beta']], tolerance=0.2) - # expect_equal(withError2DRect[['beta']], withError2DEpan[['beta']], tolerance=0.2) - # expect_equal(withError1DRect[['beta']], withError1DEpan[['beta']], tolerance=0.2) - expect_equal(noError2DRect[['beta']], noError2DEpan[['beta']], tolerance=0.2) - expect_equal(noError1DRect[['beta']], noError1DEpan[['beta']], tolerance=0.2) -}) - -fpcaX1 <- FPCA(X_1sp[['Ly']], X_1sp[['Lt']], list(userBwMu=bw, userBwCov=bw)) -fpcaX2 <- FPCA(X_2sp[['Ly']], X_2sp[['Lt']], list(userBwMu=bw, userBwCov=bw)) -fpcaY <- FPCA(Ysp[['Ly']], Ysp[['Lt']], list(userBwMu=bw, userBwCov=bw)) -FPCAlist <- list(Y=fpcaY, X_1=fpcaX1, X_2=fpcaX2) -imputeRes <- imputeConReg(FPCAlist, Z[, 3:4], outGrid) -test_that('imputation and 1D beta estimates are similar', { - expect_equal(imputeRes[['beta0']], noError1D[['beta0']], scale=1, tolerance=0.5) - expect_equal(unname(imputeRes[['beta']]), unname(noError1D[['beta']]), scale=1, tolerance=0.5) -}) - -## subsetVars -test_that('subseting covariates is fine', { - subVars <- subsetVars(vars, 1) - subVarsTF <- subsetVars(vars, c(TRUE, rep(FALSE, n - 1))) - expect_equal(subVars, subVarsTF) - expect_equal(subVars[['X_1']][['Lt']][[1]], X_1sp[['Lt']][[1]]) - expect_equal(length(subVars[['X_1']][['Lt']]), 1) - expect_equal(length(subVars[['Z_3']]), 1) -}) - -test_that('Test based on previous implementation: simple concurrent regression works fine', { - set.seed(123); N = 1001; M = 101; - # Define the continuum - s = seq(0,10,length.out = M) - # Define the mean and 2 eigencomponents - meanFunct <- function(s) 0.2*s + 2.0*exp(-(s-5)^2) - eigFunct1 <- function(s) +cos(2*s*pi/10) / sqrt(5) - eigFunct2 <- function(s) 1* -sin(2*s*pi/10) / sqrt(5) - # Create FPC scores - Ksi = matrix(rnorm(N*2), ncol=2); - Ksi = apply(Ksi, 2, scale) - Ksi = Ksi %*% diag(c(5,2)) - # Create X_covariate - xTrue = Ksi %*% t(matrix(c(eigFunct1(s),eigFunct2(s)), ncol=2)) - # Create beta_Func - betaFunc1 = c(2,2) %*% t(matrix(c(eigFunct1(s),eigFunct2(s)), ncol=2)) - z1 <- rnorm(N,sd=1) - # Create scalar dep. variable a - y = matrix(rep(0,N*M), ncol = M); - yTrue = matrix(rep(0,N*M), ncol = M); - for (i in 1:N) { - y[i,] = rnorm(sd=1.99,0, n=M) + z1[i] * 2.5 + 0.2 * s +(xTrue[i,]) * t(betaFunc1); - yTrue[i,] = rnorm(sd=0.0011,0, n=M) + z1[i] * 2.5 + 0.2 * s +(xTrue[i,]) * t(betaFunc1); - } - sparsitySchedule = 1:16; - set.seed(1) - Yf <- Sparsify(y, s, sparsitySchedule) - set.seed(1) - Xf <- Sparsify(xTrue, s, sparsitySchedule) - - outGrid <- s - vars <- list(X = Xf, Z = z1, Y = Yf) - - Q <- FCReg(vars, 0.5,0.5, outGrid, 'epan', measurementError=FALSE) - - expect_equal( 2.5, mean(Q$beta[2,]) , tol= 0.01 ) - expect_gt( cor( Q$beta0, 0.2*s), 0.95) # this should be change to beta0 at some point. - expect_gt( cor(Q$beta[1,], as.vector(betaFunc1)), 0.99) -}) - - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FClust.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FClust.R deleted file mode 100644 index f2f1154e..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FClust.R +++ /dev/null @@ -1,42 +0,0 @@ -# devtools::load_all() -library(testthat) - -test_that('the growth example works.', { - - - A <- read.table(system.file('testdata', 'growth.dat', - package='fdapace')) - B <- MakeFPCAInputs( IDs = A[,1], tVec = A$V3, yVec = A$V4) - C <- FClust(B$Ly, B$Lt, k = 2, cmethod = 'EMCluster') - D <- FClust(B$Ly, B$Lt, k = 2, cmethod = 'kCFC') - trueClusters <- A$V2[!duplicated(A$V1)] - N = length(trueClusters) - cRates <- c( sum(trueClusters == C$cluster), sum(trueClusters == C$cluster) )/N # 0.9677 & 0.9355 - cRates <- sapply(cRates, function(x) ifelse(x < 0.5, 1- x, x)) - - expect_gt( cRates[2], 0.935) # kCFC - expect_gt( cRates[1], 0.967) # Rmixmod - - load(system.file('data', 'medfly25.RData', package='fdapace')) - Flies <- MakeFPCAInputs(medfly25$ID, medfly25$Days, medfly25$nEggs) - for (i in 1:3) { - set.seed(i) - A <- FClust(Flies$Ly, Flies$Lt, optnsFPCA = list(methodMuCovEst = 'smooth', userBwCov = 2, FVEthreshold = 0.90)) - # B <- FClust(Flies$Ly, Flies$Lt, optnsFPCA = list(methodMuCovEst = 'smooth', userBwCov = 2, FVEthreshold = 0.90), k = 2, seed=i) - } -}) - -test_that('the k-means initialisation error occurs normally.', { - - set.seed(1) - n <- 100 - p <- 101 - pts <- seq(0, 1, length.out=p) - sigma2 <- 0.1 - mu <- pts - sampTrue <- Wiener(n, pts) + matrix(pts, n, p, byrow=TRUE) - samp <- sampTrue + rnorm(n * length(pts), sd=sqrt(sigma2)) - tmp <- MakeFPCAInputs(tVec=pts, yVec=samp) - expect_error(FClust(tmp$Ly, tmp$Lt, k = 14, cmethod = "kCFC", optnsFPCA = list(userBwCov= 2, FVEthreshold = 0.90)) ) - -}) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FOptDes.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FOptDes.R deleted file mode 100644 index a6cbdc35..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FOptDes.R +++ /dev/null @@ -1,94 +0,0 @@ -cat("\nTests for 'FOptDes'") -library(testthat) - -test_that("optimal designs for trajectory recovery for dense data does not return any errors", { - set.seed(1) - n <- 50 - pts <- seq(0, 1, by=0.05) - sampWiener <- Wiener(n, pts) - sampWiener <- MakeFPCAInputs(IDs = rep(c(1:n),length(pts)), tVec = rep(pts,each = n), yVec = as.vector(sampWiener)) - # global - res <- FOptDes(Ly=sampWiener$Ly, Lt=sampWiener$Lt, p=3, - isSequential=FALSE, RidgeCand = seq(0.1,1,0.1)) - # sequential optimization - res <- FOptDes(Ly=sampWiener$Ly, Lt=sampWiener$Lt, p=3, - isSequential=TRUE, RidgeCand = seq(0.1,1,0.1)) -}) - -test_that("optimal designs for trajectory recovery for sparse data does not return any errors",{ - set.seed(1) - n <- 50 - pts <- seq(0, 1, by=0.05) - sampWiener <- Wiener(n, pts) - sampWiener <- Sparsify(sampWiener, pts, 4:6) - # global - res <- FOptDes(Ly=sampWiener$Ly, Lt=sampWiener$Lt, p=3, - isSequential=FALSE, RidgeCand = seq(2,10,1)) - # sequential optimization - resseq <- FOptDes(Ly=sampWiener$Ly, Lt=sampWiener$Lt, p=3, - isSequential=TRUE, RidgeCand = seq(2,10,1)) -}) - -test_that("optimal designs for response prediction for dense data does not return any errors", { - eifnMat <- function(K,t){ - l <- diff(range(t)) - a <- t[1] - mat <- c() - for(k in 1:K){ - mat <- cbind(mat,sqrt(2/l)*cos((k/l)*pi*(t-a))) - } - return(mat) - } - n=100 - reggrid = seq(0,1,0.05) - mu=rep(0,length(reggrid)) - phi=eifnMat(K=10,t=reggrid) - lambda=c(30, 20, 12, 8, 30/c(5:10)^2) - K=10 - errorvar=0.25 - resp_errorvar = 0.25 - isDense = TRUE - Sparsity = 4:8 - DenseTrue <- matrix(rep(mu,n),byrow=TRUE,nrow=n,ncol=length(reggrid)) # n by length(RegGrid) matrix - scores <- matrix(0,nrow=n,ncol=length(lambda)) # n by K matrix of FPC scores - for(i in 1:ncol(scores)){ scores[,i] <- rnorm(n,mean=0,sd=sqrt(lambda[i])) } - DenseTrue <- DenseTrue + t(phi %*% t(scores)) - # Generate independent measurement errors - errorMat <- matrix(rnorm(n*length(reggrid),mean=0,sd=sqrt(errorvar)),nrow=n,ncol=length(reggrid)) - DenseObs <- DenseTrue + errorMat - RespTrue <- scores %*% c(1,-2,1,-2,rep(0,K-4)) - RespObs <- c(RespTrue + rnorm(n, mean=0, sd=sqrt(resp_errorvar))) - t <- list(); y <- list(); - for(i in 1:n){ t[[i]] <- reggrid; y[[i]] <- DenseObs[i,] } - # global - #res <- FOptDes(Ly=y, Lt=t, Resp=RespObs, p=3, - # isSequential=FALSE, RidgeCand = seq(0.1,1,0.1)) - # sequential optimization - res <- FOptDes(Ly=y, Lt=t, Resp=RespObs, p=3, - isSequential=TRUE, RidgeCand = seq(0.1,1,0.1)) -}) - -test_that("trajectory recovery case with p=1 for Brownian Motion on [0,1] returns theoretically correct optimal design", { - set.seed(1) - n <- 100 - pts <- seq(0, 1, by=0.05) - sampWiener <- Wiener(n, pts) - fpcainput <- MakeFPCAInputs(IDs = rep(seq_len(n), each=length(pts)), tVec = rep(pts, n), - yVec = t(sampWiener)) - # global - res <- FOptDes(Ly=fpcainput$Ly, Lt=fpcainput$Lt, p=1, - isSequential=FALSE, RidgeCand = 0.05) - expect_equal(res$OptDes, 0.75) -}) - -test_that("medfly25 data example: optimal designs for response prediction for sparse data does not return error", { - data(medfly25) - set.seed(1) - medinput = MakeFPCAInputs(IDs = medfly25$ID, tVec = medfly25$Days, - yVec = medfly25$nEggs) - n = length(unique(medfly25$ID)) - respidx = seq(from = 1, by = 25, length.out = n) - Resp = medfly25$nEggsRemain[respidx] - res <- FOptDes(Ly = medinput$Ly, Lt = medinput$Lt, Resp = Resp, p = 2, - isSequential = FALSE, RidgeCand = seq(60,70,1)) -}) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FPCA.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FPCA.R deleted file mode 100644 index be872274..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FPCA.R +++ /dev/null @@ -1,332 +0,0 @@ -# devtools::load_all() -library(testthat) -##options(error=recover) - -trueLam <- 4 / ((2 * (1:50) - 1 ) * pi) ^ 2 - -# set.seed(1) -# n <- 100 -# pts <- seq(0, 1, by=0.05) -# samp3 <- Wiener(n, pts) + rnorm(n * length(pts), sd=0.1) -# samp3 <- Sparsify(samp3, pts, 10) -# res <- FPCA(samp3$Ly, samp3$Lt, list(dataType='Sparse', useBins=TRUE)) -# res$lambda / trueLam[1:length(res$lambda)] -# res$sigma2 - -# CreateCovPlot(res, 'Smoothed', FALSE) - -test_that('error == FALSE works', { - set.seed(1) - n <- 100 - M <- 51 - pts <- seq(0, 1, length.out=M) - mu <- rep(0, length(pts)) - sampDense <- Wiener(n, pts) - samp4 <- Sparsify(sampDense, pts, 10) - res4NE <- FPCA(samp4$Ly, samp4$Lt, list(error=FALSE, nRegGrid=M, FVEthreshold=1)) - res4Err <- FPCA(samp4$Ly, samp4$Lt, list(error=TRUE, nRegGrid=M, FVEthreshold=1)) - - # CreatePathPlot(res4Err, 11:15) - # CreatePathPlot(res4NE, 11:15) - expect_equal(res4NE$sigma2, NULL) - expect_true(mean((fitted(res4NE) - sampDense)^2) > - mean((fitted(res4Err) - sampDense)^2)) -}) - -test_that('Truncation works for FPCA Wiener process', { - set.seed(1) - n <- 100 - pts <- seq(0, 1, by=0.01) - mu <- rep(0, length(pts)) - samp4 <- Wiener(n, pts) + rnorm(n * length(pts), sd=0.1) - samp4 <- Sparsify(samp4, pts, 10) - samp5 <- samp4 - samp4$Ly[[1]] <- samp4$Lt[[1]] <- c(0, 1) - pTrunc <- SetOptions(samp4$Ly, samp4$Lt, list(dataType='Sparse', error=TRUE, kernel='epan', outPercent=c(0.03, 0.97), verbose=TRUE)) - pNoTrunc <- SetOptions(samp4$Ly, samp4$Lt, list(dataType='Sparse', error=TRUE, kernel='epan', outPercent=c(0, 1), verbose=TRUE)) - set.seed(1); res4 <- FPCA(samp4$Ly, samp4$Lt, pTrunc) - set.seed(1); res5NoTrunc <- FPCA(samp5$Ly, samp5$Lt, pNoTrunc) - set.seed(1); res4NoTrunc <- FPCA(samp4$Ly, samp4$Lt, pNoTrunc) - - expect_equal(res4[c('sigma2', 'bwMu', 'bwCov')], res4NoTrunc[c('sigma2', 'bwMu', 'bwCov')]) - expect_equal(min(max(abs(res4$xiEst[-1, 1] - res4NoTrunc$xiEst[-1, 1])), max(abs(res4$xiEst[-1, 1] + res4NoTrunc$xiEst[-1, 1]))), 0, tol=0.5) - expect_equal(min(max(abs(res5NoTrunc$xiEst[-1, 1] - res4NoTrunc$xiEst[-1, 1])), max(abs(res5NoTrunc$xiEst[-1, 1] + res4NoTrunc$xiEst[-1, 1]))), 0, tol=0.05) - expect_equal(nrow(res4$xiEst), nrow(res4NoTrunc$xiEst)) - expect_equal(length(res4$xiVar), length(res4NoTrunc$xiVar)) -}) - -test_that('Missing values work for FPCA Wiener process', { - set.seed(1) - n <- 200 - pts <- seq(0, 1, by=0.01) - mu <- rep(0, length(pts)) - samp4 <- Wiener(n, pts) + rnorm(n * length(pts), sd=0.1) - samp4 <- Sparsify(samp4, pts, 10) - samp4$Ly[[1]] <- samp4$Lt[[1]] <- c(0, 1) - pNoTrunc <- SetOptions(samp4$Ly, samp4$Lt, list(dataType='Sparse', error=TRUE, kernel='epan', outPercent=c(0, 1), verbose=TRUE)) - - samp4$Ly[[2]] <- samp4$Lt[[2]] <- c(0.1, 0.2, 0.5) - set.seed(1); res4 <- FPCA(samp4$Ly, samp4$Lt, pNoTrunc) - - samp4$Ly[[2]] <- c(NA, 0.2, 0.5) - set.seed(1); res4NaN <- FPCA(samp4$Ly, samp4$Lt, pNoTrunc) - - samp4$Ly[[2]] <- c(0.1, 0.2, 0.5) - samp4$Lt[[2]] <- c(NA, 0.2, 0.5) - set.seed(1); res4NaN2 <- FPCA(samp4$Ly, samp4$Lt, pNoTrunc) - - expect_equal(res4[c('sigma2', 'bwMu', 'bwCov')], res4NaN[c('sigma2', 'bwMu', 'bwCov')], tol=1e-7) - expect_equal(nrow(res4$xiEst), nrow(res4NaN$xiEst)) - expect_equal(length(res4$xiVar), length(res4NaN$xiVar)) - expect_equal(res4NaN$inputData$Ly[[2]], c(0.2,0.5)) - expect_equal( res4$inputData$Ly[[2]], c(0.1,0.2,0.5)) - expect_equal(res4NaN2[c('sigma2', 'bwMu', 'lambda')], res4NaN[c('sigma2', 'bwMu', 'lambda')], tol=1e-7) - -}) -test_that('User provided mu and cov for simple example',{ - - set.seed(123) - N = 200; - M = 100; - - # Define the continuum - s = seq(0,10,length.out = M) - - # Define the mean and 2 eigencomponents - meanFunct <- function(s) s + 10*exp(-(s-5)^2) - eigFunct1 <- function(s) +cos(2*s*pi/10) / sqrt(5) - eigFunct2 <- function(s) -sin(2*s*pi/10) / sqrt(5) - ef <- matrix(c(eigFunct1(s),eigFunct2(s)), ncol=2) - ev <- c(5, 2)^2 - covTrue <- ef %*% diag(ev) %*% t(ef) - - # Create FPC scores - Ksi = matrix(rnorm(N*2), ncol=2); - Ksi = apply(Ksi, 2, scale) - Ksi = Ksi %*% diag(sqrt(ev)) - - # Create Y_true - yTrue = Ksi %*% t(ef) + t(matrix(rep(meanFunct(s),N), nrow=M)) - - # Create sparse sample - # Each subject has one to five readings (median: 3); - ySparse = Sparsify(yTrue, s, c(2:5)) - - # Give your sample a bit of noise - ySparse$yNoisy = lapply( ySparse$Ly, function(x) x + 1 * rnorm(length(x))) - - # Do FPCA on this sparse sample - FPCAsparseA = FPCA(ySparse$yNoisy,ySparse$Lt, optns = - list(userMu = list(t=s,mu= meanFunct(s)), userCov = list(t=s,cov= covTrue) )) - - expect_equal(FPCAsparseA$sigma2, 1, tolerance=0.1) - expect_equal( spline(y = FPCAsparseA$mu, x = FPCAsparseA$workGrid, xout = FPCAsparseA$obsGrid)$y, - expected = meanFunct(s), tolerance = 1e-3) - expect_equal( FPCAsparseA$lambda, expected=ev, tolerance = 1e-1) - expect_equal( abs(cor( FPCAsparseA$xiEst[,1], Ksi[,1])) > 0.9, TRUE) -}) - -test_that('User provided mu, cov, and sigma2',{ - - set.seed(123) - N = 200; - M = 90; - - # Define the continuum - s = seq(0,10,length.out = M) - - # Define the mean and 2 eigencomponents - meanFunct <- function(s) s + 10*exp(-(s-5)^2) - eigFunct1 <- function(s) +cos(2*s*pi/10) / sqrt(5) - eigFunct2 <- function(s) -sin(2*s*pi/10) / sqrt(5) - - # Create FPC scores - Ksi = matrix(rnorm(N*2), ncol=2); - Ksi = apply(Ksi, 2, scale) - Ksi = Ksi %*% diag(c(5,2)) - - # Create Y_true - yTrue = Ksi %*% t(matrix(c(eigFunct1(s),eigFunct2(s)), ncol=2)) + t(matrix(rep(meanFunct(s),N), nrow=M)) - - # Create sparse sample - # Each subject has one to five readings (median: 3); - ySparse = Sparsify(yTrue, s, c(2:5)) - - # Give your sample a bit of noise - ySparse$yNoisy = lapply( ySparse$Ly, function(x) x + 0.025*rnorm(length(x))) - - userSigma2 <- 0.1 - # Do FPCA on this sparse sample - FPCAsparseA = FPCA(ySparse$yNoisy,ySparse$Lt, optns = - list(userMu = list(t=s,mu= meanFunct(s)), userSigma2=0.1 )) - - expect_equal( FPCAsparseA$sigma2, userSigma2) - expect_equal( sqrt(FPCAsparseA$lambda[1:2]), expected=c(5,2), tolerance = 1e-1) - expect_equal( abs(cor( FPCAsparseA$xiEst[,1], Ksi[,1])) > 0.95, TRUE) - expect_equal( abs(cor( FPCAsparseA$xiEst[,2], Ksi[,2])) > 0.90, TRUE) -}) - -test_that('Case where one component should be returned',{ - - set.seed(123) - N = 111; - M = 81; - - # Define the continuum - s = seq(0,10,length.out = M) - - # Define the mean and 2 eigencomponents - meanFunct <- function(s) s + 1 - eigFunct1 <- function(s) +cos(2*s*pi/10) / sqrt(5) - eigFunct2 <- function(s) -sin(2*s*pi/10) / sqrt(5) - - # Create FPC scores - Ksi = matrix(rnorm(N*2), ncol=2); - Ksi = apply(Ksi, 2, scale) - Ksi = Ksi %*% diag(c(5,2)) - - # Create Y_true - yTrue = Ksi %*% t(matrix(c(eigFunct1(s),eigFunct2(s)), ncol=2)) + t(matrix(rep(meanFunct(s),N), nrow=M)) - - # Create sparse sample - # Each subject has one to five readings (median: 3); - ySparse = Sparsify(yTrue, s, c(1:5)) - FPCAsparseA = FPCA(ySparse$Ly,ySparse$Lt, optns = - list( FVEthreshold = 0.4, userMu = list(t=s,mu= meanFunct(s)) ) ) - - expect_equal(spline(y = FPCAsparseA$mu, x = FPCAsparseA$workGrid, xout = FPCAsparseA$obsGrid)$y, - expected = meanFunct(s), tolerance = 1e-3) - expect_equal( length(FPCAsparseA$lambda), 1) - -}) - -test_that('GetCovDense with noise, get sigma2', { - set.seed(1) - n <- 200 - p <- 101 - pts <- seq(0, 1, length.out=p) - sigma2 <- 0.1 - mu <- pts - sampTrue <- Wiener(n, pts) + matrix(pts, n, p, byrow=TRUE) - samp <- sampTrue + rnorm(n * length(pts), sd=sqrt(sigma2)) - tmp <- MakeFPCAInputs(tVec=pts, yVec=samp) - - resNoerr <- FPCA(tmp$Ly, tmp$Lt, list(error=FALSE, dataType='Dense', lean=TRUE)) - resErr <- FPCA(tmp$Ly, tmp$Lt, list(error=TRUE, dataType='Dense', shrink=TRUE, lean=TRUE)) - resErr$optns - - expect_equal(resErr$sigma2, sigma2, tolerance=1e-1) - # shrinkage should be a bit better - expect_true(mean((fitted(resNoerr) - sampTrue) ^ 2) > - mean((fitted(resErr) - sampTrue) ^ 2)) -}) - -test_that('Dense data that requires binning', { - set.seed(1) - n <- 100 - p <- 1001 - pts <- seq(0, 1, length.out=p) - sigma2 <- 0.1 - mu <- pts - sampTrue <- Wiener(n, pts) + matrix(pts, n, p, byrow=TRUE) - samp <- sampTrue + rnorm(n * length(pts), sd=sqrt(sigma2)) - tmp <- MakeFPCAInputs(tVec=pts, yVec=samp) - - resErr <- FPCA(tmp$Ly, tmp$Lt, list(error=TRUE, dataType='Dense', useBinnedData='AUTO')) - resErrNoBin <- FPCA(tmp$Ly, tmp$Lt, list(error=TRUE, dataType='Dense', useBinnedData='OFF')) - - expect_equal(range(resErr$obsGrid), range(resErrNoBin$obsGrid)) - expect_equal(range(resErr$workGrid), range(resErrNoBin$workGrid)) - expect_equal(resErr$sigma2, sigma2, tolerance=1e-1) - expect_equal(length(resErr$obsGrid), 400) - expect_equal(length(resErr$workGrid), 400) - plot(resErr) -}) - - -if (Sys.getenv('TRAVIS') != 'true') { - - - test_that('GetCovDense with noise, known cov, get sigma2', { - set.seed(1) - n <- 200 - p <- 101 - pts <- seq(0, 1, length.out=p) - sigma2 <- 0.1 - mu <- pts - sampTrue <- Wiener(n, pts) + matrix(pts, n, p, byrow=TRUE) - samp <- sampTrue + rnorm(n * length(pts), sd=sqrt(sigma2)) - tmp <- MakeFPCAInputs(tVec=pts, yVec=samp) - - resErr <- FPCA(tmp$Ly, tmp$Lt, list(error=TRUE, dataType='Dense', shrink=TRUE, lean=TRUE, userCov=list(t=pts, cov=outer(pts, pts, pmin)))) - - expect_equal(resErr$sigma2, sigma2, tolerance=1e-1) - }) - - test_that('noisy dense data, cross-sectional mu/cov, use IN/CE score', { - set.seed(1) - n <- 200 - p <- 101 - pts <- seq(0, 1, length.out=p) - sigma2 <- 0.1 - mu <- pts - sampTrue <- Wiener(n, pts) + matrix(pts, n, p, byrow=TRUE) - samp <- sampTrue + rnorm(n * length(pts), sd=sqrt(sigma2)) - tmp <- MakeFPCAInputs(tVec=pts, yVec=samp) - - resErrCE <- FPCA(tmp$Ly, tmp$Lt, list(error=TRUE, dataType='Dense', lean=TRUE, methodXi='CE')) - resErrCEKnownSigma2 <- FPCA(tmp$Ly, tmp$Lt, list(error=TRUE, dataType='Dense', lean=TRUE, methodXi='CE', userSigma2=sigma2)) - resErrIN <- FPCA(tmp$Ly, tmp$Lt, list(error=TRUE, dataType='Dense', lean=TRUE, methodXi='IN')) - - expect_equal(resErrCE$xiEst[, 1], resErrIN$xiEst[, 1], tolerance=1e-2) - expect_equal(resErrCE$xiEst[, 2], resErrIN$xiEst[, 2], tolerance=5e-2) - expect_equal(resErrCE$xiEst[, 3], resErrIN$xiEst[, 3], tolerance=1e-1) - expect_equal(resErrCEKnownSigma2$xiEst[, 1], resErrIN$xiEst[, 1], tolerance=1e-2) - }) - - test_that('noisy dense data, smooth mu/cov, use IN/CE score', { - set.seed(1) - n <- 200 - p <- 101 - pts <- seq(0, 1, length.out=p) - sigma2 <- 0.1 - mu <- pts - sampTrue <- Wiener(n, pts) + matrix(pts, n, p, byrow=TRUE) - samp <- sampTrue + rnorm(n * length(pts), sd=sqrt(sigma2)) - tmp <- MakeFPCAInputs(tVec=pts, yVec=samp) - tmpMV <- tmp - tmpMV$Ly[[1]][1] <- NA - - resErrCSCE <- FPCA(tmp$Ly, tmp$Lt, list(error=TRUE, dataType='Dense', lean=TRUE, methodMuCovEst='cross-sectional', methodXi='CE')) - resErrCE <- FPCA(tmp$Ly, tmp$Lt, list(error=TRUE, dataType='Dense', lean=TRUE, methodMuCovEst='smooth', methodXi='CE')) - resErrIN <- FPCA(tmp$Ly, tmp$Lt, list(error=TRUE, dataType='Dense', lean=TRUE, methodMuCovEst='smooth', methodXi='IN')) - resErrCEMV <- FPCA(tmpMV$Ly, tmpMV$Lt, list(error=TRUE, dataType='DenseWithMV', lean=TRUE, methodMuCovEst='smooth', methodXi='CE')) - resErrINMV <- FPCA(tmpMV$Ly, tmpMV$Lt, list(error=TRUE, dataType='DenseWithMV', lean=TRUE, methodMuCovEst='smooth', methodXi='IN')) - - trueCov <- outer(pts, pts, pmin) - expect_true(max(abs(resErrCE$smoothedCov - trueCov)) < 0.1) - expect_true(max(abs(resErrCSCE$smoothedCov - trueCov)) < 0.25) - expect_equal(resErrCE$xiEst[, 1], resErrIN$xiEst[, 1], tolerance=1e-2) - expect_equal(resErrCE$xiEst[, 2], resErrIN$xiEst[, 2], tolerance=6e-2) - expect_equal(resErrCE$xiEst[, 3], resErrIN$xiEst[, 3], tolerance=1e-1) - expect_equal(resErrCE$fittedCov, resErrCEMV$fittedCov, tolerance=1e-1) - expect_equal(resErrIN$xiEst[, 1:4], resErrINMV$xiEst[, 1:4], tolerance=1e-1) - }) - - - test_that('CV/useBW1SE works', { - set.seed(1) - n <- 100 - M <- 51 - pts <- seq(0, 1, length.out=M) - mu <- rep(0, length(pts)) - sampDense <- Wiener(n, pts) - samp4 <- Sparsify(sampDense, pts, 10) - res5 <- FPCA(samp4$Ly, samp4$Lt, list(methodBwMu = 'CV',methodBwCov = 'CV', useBinnedCov= FALSE)) - res51 <- FPCA(samp4$Ly, samp4$Lt, list(methodBwMu = 'CV',methodBwCov = 'CV', useBW1SE = TRUE, useBinnedCov= FALSE)) - - expect_true( res51$bwCov >= res5$bwCov ) - expect_true( res51$bwMu >= res5$bwMu ) - }) - -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FPCAder.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FPCAder.R deleted file mode 100644 index 9ac156a6..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FPCAder.R +++ /dev/null @@ -1,173 +0,0 @@ -# devtools::load_all() -library(testthat) -# library(RColorBrewer) - -test_that('FPCAder correct derivatives of mean for dense case', { - set.seed(1) - n <- 500 - p <- 300 - pts <- seq(0, 1, length.out=p) - samp <- Wiener(n, pts) - samp <- samp + rnorm(n * p, sd=0.01) + matrix(pts, n, p, byrow=TRUE) - spSamp <- Sparsify(samp, pts, p) # This just puts the sample in list. - fpcaObj <- FPCA(spSamp$Ly, spSamp$Lt, list(dataType='Dense' )) - fpcaObjDer <- FPCAder(fpcaObj, list(p=1)) - - expect_equal(median(fpcaObjDer$muDer), 1, tolerance=0.1, scale = 1) -}) - - - - -test_that('FPCAder correct derivatives of mean for sparse case',{ - set.seed(1) - n <- 333 - pts <- seq(0, 1, by=0.01) - mu <- 0:(length(pts)-1) / 50 - phi = CreateBasis(K=4, type='fourier', pts= pts) - samp1 <- t(mu + phi %*% matrix( rnorm(n*4, mean=0, sd=c(1,.4, 0.01, 0.001)), nrow=4)) - samp2 <- Sparsify(samp1, pts, 8) - fpcaObj = FPCA(samp2$Lt, Ly= samp2$Ly) - fpcaObjDer <- FPCAder(fpcaObj, list(p=1)) - expect_equal(median(fpcaObjDer$muDer), 2, tolerance=0.1, scale = 1) -}) - - -test_that('noisy dense case for DPC, FPC, and FPC1', { - bw <- 0.2 - kern <- 'epan' - set.seed(1) - n <- 100 - plotInd <- 1:8 - pts <- seq(0, 1, by=0.01) - M <- length(pts) - sparsity <- length(pts) - mu <- seq(0, 1, length.out=length(pts)) - phi <- CreateBasis(K=3, type='legendre01', pts=pts) - basisDerMat <- apply(phi, 2, function(x) ConvertSupport(seq(0, 1, length.out=M - 1), pts, diff(x) * (M - 1))) - lambdaTrue <- c(1, 0.8, 0.5)^2 - sigma2 <- 1 - - samp2 <- MakeGPFunctionalData(n, M, pts, K=length(lambdaTrue), lambda=lambdaTrue, sigma=sqrt(sigma2), basisType='legendre01') - samp2 <- c(samp2, MakeFPCAInputs(tVec=pts, yVec=samp2$Yn)) - trueDer <- matrix(1, n, M, byrow=TRUE) + tcrossprod(samp2$xi, basisDerMat) - samp2 <- c(samp2, list(trueDer=trueDer)) - fpcaObj <- FPCA(samp2$Ly, samp2$Lt, list(nRegGrid=M, methodMuCovEst='smooth', userBwCov=bw, userBwMu=bw, kernel=kern)) - - FPCoptn1 <- list(bw=bw, kernelType=kern, p=1, method='FPC') - FPCoptn2 <- list(bw=bw, kernelType=kern, p=1, method='FPC1') - DPCoptn1 <- list(bw=bw, kernelType=kern, p=1, method='DPC', G10_1D=TRUE) - # DPCoptn2 <- list(bw=bw, kernelType=kern, p=1, method='DPC', G10_1D=FALSE) - FPC <- FPCAder(fpcaObj, FPCoptn1) - FPC1 <- FPCAder(fpcaObj, FPCoptn2) - fpcaObjDer1 <- FPCAder(fpcaObj, DPCoptn1) - # fpcaObjDer2 <- FPCAder(fpcaObj, DPCoptn2) - k1 <- 3 - estFPC <- fitted(FPC, k1) - estFPC1 <- fitted(FPC1, k1) - estDPC <- fitted(fpcaObjDer1, k1) - # estDPC1 <- fitted(fpcaObjDer2, k1) - - matplot(t(samp2$Y), type='l') - matplot(t(trueDer), type='l') - matplot(t(estFPC1), type='l') - matplot(t(estFPC), type='l') - matplot(t(estDPC), type='l') - # matplot(t(estDPC1), type='l') - - expect_equal(estFPC, trueDer, tolerance=1, scale=1) - expect_equal(estFPC1, trueDer, tolerance=1, scale=1) - expect_equal(estDPC, trueDer, tolerance=1, scale=1) - - # 1D smoother for cov10 is better - # expect_true(mean(abs(estDPC - trueDer)) < mean(abs(estDPC1 - trueDer))) -}) - -# test_that('noiseless dense case for DPC', { - # bw <- 0.1 - # set.seed(1) - # n <- 100 - # plotInd <- 1:8 - # pts <- seq(0, 1, by=0.01) - # sparsity <- length(pts) - # mu <- seq(0, 1, length.out=length(pts)) - # phi <- CreateBasis(K=3, type='fourier', pts= pts) - # lambdaTrue <- c(1, 0.8, 0.5)^2 - # sigma2 <- 0 - # nRegGrid <- 51 - # regGrid <- seq(0, 1, length.out=nRegGrid) - - # samp1 <- t(mu + phi %*% matrix(rnorm(n*3, mean=0, sd=sqrt(lambdaTrue)), nrow=3)) - # samp1p <- t(apply(samp1, 1, diff) / (pts[2] - pts[1])) - # samp1p <- t(ConvertSupport(seq(min(pts), max(pts), length.out=length(pts) - 1), regGrid, phi=t(samp1p))) - # samp2 <- Sparsify(samp1 + rnorm(length(samp1), sd=sqrt(sigma2)), pts, sparsity) - # # Cross-sectional is used! - # fpcaObj <- FPCA(samp2$Lt, Ly= samp2$Ly, list(nRegGrid=nRegGrid, methodMuCovEst='cross-sectional')) - - # derOptns1 <- list(bw=bw, kernelType='epan', p=1, method='DPC', useTrue=FALSE, G10_1D=TRUE) - # fpcaObjDer1 <- FPCAder(fpcaObj, derOptns1) - # derOptns2 <- list(bw=bw, kernelType='epan', p=1, method='DPC', useTrue=FALSE, G10_1D=FALSE) - # fpcaObjDer2 <- FPCAder(fpcaObj, derOptns2) - # k1 <- 2 - # est1 <- fitted(fpcaObjDer1, k1, derOptns1) - # k2 <- 2 - # est2 <- fitted(fpcaObjDer2, k2, derOptns2) - # expect_equal(est1, samp1p, tolerance=1.5, scale=1) - # # 1D smoother for cov10 is better - # expect_true(mean(abs(est1 - samp1p)) < mean(abs(est2 - samp1p))) - - # # # display.brewer.all() - # # color <- brewer.pal(8, 'Dark2') - # # ylim <- c(min(samp1p[, plotInd]), max(samp1p[, plotInd])) - # # matplot(regGrid, t(samp1p[plotInd, ]), type='l', ylim=ylim, col=color, lwd=2) - # # CreatePathPlot(fpcaObjDer1, plotInd, 2, derOptns=derOptns1, ylim=ylim, col=color, lwd=2) - # # CreatePathPlot(fpcaObjDer2, plotInd, 2, derOptns=derOptns2, ylim=ylim, col=color, lwd=2) -# }) - - -test_that('noisy sparse case for DPC, FPC, and FPC1', { - bw <- 0.4 - kern <- 'epan' - set.seed(1) - n <- 100 - pts <- seq(0, 1, by=0.01) - M <- length(pts) - sparsity <- 2:9 - mu <- seq(0, 1, length.out=length(pts)) - phi <- CreateBasis(K=3, type='legendre01', pts=pts) - basisDerMat <- apply(phi, 2, function(x) ConvertSupport(seq(0, 1, length.out=M - 1), pts, diff(x) * (M - 1))) - lambdaTrue <- c(1, 0.8, 0.5)^2 - sigma2 <- 0.01 - - samp2 <- MakeSparseGP(n, runif, sparsity, identity, K=length(lambdaTrue), lambda=lambdaTrue, sigma=sqrt(sigma2), basisType='legendre01') - trueDer <- matrix(1, n, M, byrow=TRUE) + tcrossprod(samp2$xi, basisDerMat) - samp2 <- c(samp2, list(trueDer=trueDer)) - fpcaObj <- FPCA(samp2$Ly, samp2$Lt, list(nRegGrid=M, methodMuCovEst='smooth', userBwCov=bw, userBwMu=bw, kernel=kern)) - - FPCoptn1 <- list(bw=bw, kernelType=kern, p=1, method='FPC') - FPCoptn2 <- list(bw=bw, kernelType=kern, p=1, method='FPC1') - DPCoptn1 <- list(bw=bw, kernelType=kern, p=1, method='DPC', G10_1D=TRUE) - # DPCoptn2 <- list(bw=bw, kernelType=kern, p=1, method='DPC', G10_1D=FALSE) - FPC <- FPCAder(fpcaObj, FPCoptn1) - FPC1 <- FPCAder(fpcaObj, FPCoptn2) - fpcaObjDer1 <- FPCAder(fpcaObj, DPCoptn1) - # fpcaObjDer2 <- FPCAder(fpcaObj, DPCoptn2) - k1 <- 2 - estFPC <- fitted(FPC, k1) - estFPC1 <- fitted(FPC1, k1) - estDPC <- fitted(fpcaObjDer1, k1) - # estDPC1 <- fitted(fpcaObjDer2, k1) - - matplot(t(trueDer), type='l') - matplot(t(estFPC), type='l') - matplot(t(estFPC1), type='l') - matplot(t(estDPC), type='l') - # matplot(t(estDPC1), type='l') - - expect_equal(estFPC, trueDer, tolerance=5, scale=1) - expect_equal(estFPC1, trueDer, tolerance=5, scale=1) - expect_equal(estDPC, trueDer, tolerance=2, scale=1) - - # 1D smoother for cov10 is better - # expect_true(mean(abs(estDPC - trueDer)) < mean(abs(estDPC1 - trueDer))) -}) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FPCReg.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FPCReg.R deleted file mode 100644 index e9df7bad..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FPCReg.R +++ /dev/null @@ -1,170 +0,0 @@ -library(testthat) -#devtools::load_all('D:\\tPACE\\tPACE') - -test_that ('Simple Dense and Sparse Case works', { -set.seed(1000) -n <- 300 #number of subjects -ngrids <- 51 #number of grids in [0,1] for X(s) -ngridt <- 51 #number of grids in [0,1] for Y(t) -grids <- seq(0, 1, length.out = ngrids) #regular grids in [0,1] for X(s) -gridt <- seq(0, 1, length.out = ngridt) #regular grids in [0,1] for Y(t) -#generate X -#{1, sqrt(2)*sin(2*pi*s), sqrt(2)*cos(2*pi*t)} are used to generate X. -eigenFun <- list(function(s){1 + 0 * s}, function(s){sqrt(2) * sin(2 * pi * s)}, function(s){sqrt(2) * cos(2 * pi * s)}) -basisX <- sapply(eigenFun,function(x){x(grids)}) -scoreX <- matrix(rnorm(n * 3), n, 3) #eigenvalues are assumed to be 1. -latentX <- scoreX %*% t(basisX) -measErrX <- sqrt(0.01) * matrix(rnorm(n * ngrids), n, ngrids) #0.01 is sigma^2. -denseX <- latentX + measErrX -#generate Y -#beta(s,t) <- sin(2*pi*s)*cos(2*pi*t) -betaEigen1 <- function(t){f <- function(s){sin(2 * pi * s) * cos(2 * pi * t) * (1 + 0 * s)}; return(f)} -betaEigen2 <- function(t){f <- function(s){sin(2 * pi * s) * cos(2 * pi * t) * (sqrt(2) * sin(2 * pi * s))}; return(f)} -betaEigen3 <- function(t){f <- function(s){sin(2 * pi * s) * cos(2 * pi * t) * (sqrt(2) * cos(2 * pi * s))}; return(f)} -betaEigen <- list(betaEigen1, betaEigen2, betaEigen3) -basisY <- array(0, c(ngridt, 3)) -for (i in 1:3) { - intbetaEigen <- function (t) {integrate(betaEigen[[i]](t), lower=0, upper=1)$value} - basisY[,i] <- sapply(1:ngridt, function(x){intbetaEigen(gridt[x])}) - } -latentY <- scoreX %*% t(basisY) -measErrY <- sqrt(0.01) * matrix(rnorm(n * ngridt), n, ngridt) #0.05 is sigma^2 -denseY <- latentY + measErrY - -#Dense data -timeX <- t(matrix(rep(grids, n), length(grids), n)) -timeY <- t(matrix(rep(gridt, n), length(gridt), n)) -denseVars <- list(X1 = list(Ly = denseX, Lt = timeX), Y = list(Ly = denseY, Lt = timeY)) -resuDense <- FPCReg(denseVars) -estiBetaX1Y_Dense <- resuDense$estiBeta$betaX1Y - -#Sparse data with fixed bw to avoid sensitive issue of possible revised of FPCA() bw in near future -sparseX <- Sparsify(denseX,grids,1:10) -sparseY <- Sparsify(denseY,gridt,1:10) -sparseVars <- list(X1 = sparseX, Y = sparseY) -resuSparse <- FPCReg(sparseVars,varsOptns = list(X1=list(userBwMu = 0.05, userBwCov = 0.1),Y=list(userBwMu = 0.05, userBwCov = 0.1)),Kx=3) -estiBetaX1Y_Sparse <- resuSparse $estiBeta$betaX1Y - -trueBetaX1Y <- sin(2 * pi * grids) %*% t(cos(2 * pi * gridt)) - -#Dense ratio of err and trun under L^2 -expect_equal(mean((estiBetaX1Y_Dense - trueBetaX1Y)^2)/mean(trueBetaX1Y^2), 0, tol = 1e-2) -#Sparse ratio of err and trun under L^2 -expect_equal(mean((estiBetaX1Y_Sparse - trueBetaX1Y)^2)/mean(trueBetaX1Y^2), 0, tol = 0.3) -}) - - - -#test for two predictors X1 and X2 -set.seed(1000) -#Model: E(Y(t)|X) = int(beta(s,t)*X(s)) -n <- 300 #number of subjects -ngrids <- 101 #number of grids in [0,1] for X(s) -ngridt <- 51 #number of grids in [0,1] for Y(t) -grids <- seq(0, 1, length.out=ngrids) #regular grids in [0,1] for X(s) -gridt <- seq(0, 1, length.out=ngridt) #regular grids in [0,1] for Y(t) - -#generate X -#{1, sqrt(2)*sin(2*pi*s), sqrt(2)*cos(2*pi*t)} are used to generate X. -eigenFun <- list(function(s){1 + 0 * s},function(s){sqrt(2) * sin(2*pi*s)},function(s){sqrt(2) * cos(2*pi*s)}) - -sig <- matrix(c(1.5, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0, 1.2, 0.0, 0.0, 0.0, 0.0, - 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, - 0.0, 0.0, 0.0, 2.0, 0.0, 0.0, - 0.0, 0.0, 0.0, 0.0, 1.5, 0.0, - 0.0, 0.0, 0.0, 0.0, 0.0, 1.0), - nrow=6,ncol=6) - -scoreX <- MASS::mvrnorm(n,mu=rep(0,6),Sigma=sig) -scoreX1 <- scoreX[,1:3] -scoreX2 <- scoreX[,4:6] - -basisX1 <- sapply(eigenFun,function(x){x(grids)}) -latentX1 <- scoreX1 %*% t(basisX1) -measErrX1 <- sqrt(0.03) * matrix(rnorm(n * ngrids), n, ngrids) #0.01 is sigma^2. -denseX1 <- latentX1 + measErrX1 - -basisX2 <- sapply(eigenFun,function(x){x(grids)}) -latentX2 <- scoreX2 %*% t(basisX2) -measErrX2 <- sqrt(0.03) * matrix(rnorm(n * ngrids), n, ngrids) #0.01 is sigma^2. -denseX2 <- latentX2 + measErrX2 - -#generate Y -#beta(s, t) <- sin(2 * pi * s)*cos(2 * pi * t) -betaEigen1 <- function(t){f <- function(s){sin(2*pi*s) * cos(2*pi*t) * (1+0*s)};return(f)} -betaEigen2 <- function(t){f <- function(s){sin(2*pi*s) * cos(2*pi*t) * (sqrt(2)*sin(2*pi*s))}; return(f)} -betaEigen3 <- function(t){f <- function(s){sin(2*pi*s) * cos(2*pi*t) * (sqrt(2)*cos(2*pi*s))}; return(f)} -betaEigen <- list(betaEigen1, betaEigen2, betaEigen3) -basisY <- array(0,c(ngridt, 3)) -for(i in 1:3){ - intbetaEigen <- function (t) {integrate(betaEigen[[i]](t), lower = 0, upper = 1)$value} - basisY[, i] <- sapply(1:ngridt, function(x){intbetaEigen(gridt[x])}) - } -#Note that in the case BetaX1Y = beta and BetaX2Y = -beta -latentY <- scoreX1 %*% t(basisY) - scoreX2 %*% t(basisY) -measErrY <- sqrt(0.01) * matrix(rnorm(n*ngridt), n, ngridt) #0.01 is sigma^2 -denseY <- latentY + measErrY - -#======Dense data=============================================== -timeX <- t(matrix(rep(grids, n),length(grids), n)) -timeY <- t(matrix(rep(gridt, n),length(gridt), n)) -denseVars <- list(X1 = list(Ly = denseX1, Lt = timeX), - X2 = list(Ly = denseX2, Lt = timeX), - Y=list(Ly = denseY,Lt = timeY)) - -p <- length(denseVars)-1 -optns <- list(dataType = "Dense" ,error = 1, kernel='gauss', nRegGrid=51, useBinnedData='OFF') -brkX <- c(0, cumsum(c(ngrids,ngrids))) -dxMatrix <- dx(p, c(1,1), c(ngrids,ngrids), brkX) -gridNum <- c(ngrids,ngrids) -resdenseCov <- denseCov(p, denseVars, brkX, dxMatrix, gridNum, varsOptns= list(X1=optns,X2=optns,Y=optns)) - -test_that ('eigen decomposition of denseCov() works',{ -expect_equal( abs(resdenseCov$eigenValue[1]-max(diag(sig)))/max(diag(sig)), 0, tol = 1e-1) -expect_equal( abs(sum(resdenseCov$eigenValue[1:6])-sum(diag(sig)))/sum(diag(sig)), 0, tol = 1e-1) -}) - -resuDense <- FPCReg(denseVars, method="FVE") -estiBetaX1Y_Dense <- resuDense$estiBeta$betaX1Y -estiBetaX2Y_Dense <- resuDense$estiBeta$betaX2Y - -trueBetaX1Y <- sin(2 * pi * grids) %*% t(cos(2 * pi * gridt)) -test_that ('beta works in Dense with two predictors',{ -expect_equal(mean((estiBetaX1Y_Dense - trueBetaX1Y)^2)/mean(trueBetaX1Y^2), 0, tol = 1e-2) -expect_equal(mean((estiBetaX2Y_Dense + trueBetaX1Y)^2)/mean(trueBetaX1Y^2), 0, tol = 1e-2) -}) - -#======Sparse data=============================================== -sparsity = 5:10 -sparseX1 <- Sparsify(denseX1, grids, sparsity) -sparseX2 <- Sparsify(denseX2, grids, sparsity) -sparseY <- Sparsify(denseY, gridt, sparsity) -sparseVars <- list(X1 = sparseX1, X2 = sparseX2, Y = sparseY) - -ngrids <- 51 -grid <- seq(0, 1, length.out = ngrids) -p <- length(denseVars)-1 -brkX <- c(0, cumsum(c(ngrids,ngrids))) -dxMatrix <- dx(p, c(1,1), c(ngrids,ngrids), brkX) -gridNum <- c(ngrids,ngrids) -optns <- list(dataType = "Sparse" ,error = TRUE, kernel='gauss', nRegGrid=ngrids , useBinnedData='OFF') -demeanedRes <- demeanFuc(p, sparseVars, kern='gauss', varsOptns= list(X1=optns,X2=optns,Y=optns)) #Centered predictors. Using gauss for demeanFuc, but may be relaxed. -varsTrain <- demeanedRes[['xList']] -muList <- demeanedRes[['muList']] -ressparseCov <- sparseCov(p, sparseVars, brkX, varsOptns= list(X1=optns,X2=optns,Y=optns), sparseVars, muList, gridNum, dxMatrix, list(grid,grid)) - -test_that ('eigen decomposition of sparseCov() works',{ -expect_equal( abs(ressparseCov$eigenValue[1]-max(diag(sig)))/max(diag(sig)), 0, tol = 0.3) -expect_equal( abs(sum(ressparseCov$eigenValue[1:6])-sum(diag(sig)))/sum(diag(sig)), 0, tol = 0.3) -}) - -resuSparse <- FPCReg(sparseVars, varsOptns = list(X1=list(userBwMu = 0.05, userBwCov = 0.1), X2=list(userBwMu = 0.05, userBwCov = 0.1), Y=list(userBwMu = 0.05, userBwCov = 0.1)) , Kx=6) -estiBetaX1Y_Sparse <- resuSparse$estiBeta$betaX1Y -estiBetaX2Y_Sparse <- resuSparse$estiBeta$betaX2Y - -trueBetaX1Y <- sin(2 * pi * grid) %*% t(cos(2 * pi * grid)) -test_that ('beta estimates works in sparse with two predictors',{ -expect_equal(mean((estiBetaX1Y_Sparse - trueBetaX1Y)^2)/mean(trueBetaX1Y^2), 0, tol = 0.3) -expect_equal(mean((estiBetaX2Y_Sparse + trueBetaX1Y)^2)/mean(trueBetaX1Y^2), 0, tol = 0.3) -}) \ No newline at end of file diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FPCquantile.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FPCquantile.R deleted file mode 100644 index d7fe9b96..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FPCquantile.R +++ /dev/null @@ -1,107 +0,0 @@ -#devtools::load_all() -library(testthat) - -#positive test 1 -test_that('test estimates when x,y are independent', { - set.seed(10) - n = 20000 - m = 50 - ei = rnorm(n) - y=1:n - x=list() - t_x=list() - for(i in 1:n){ - t_x = c(t_x,list(0:m/m)) - x = c(x,list(ei[i]*array(1,m+1))) - y[i] = rnorm(1) - } - - outQ = c(0.1,0.25,0.5,0.75,0.9,0.95) - isNewsub = rep(0,n) - qtreg = FPCquantile(x, t_x, y, outQ,optns_x = NULL,isNewsub) - - expect_equal(max(abs(qtreg$pred_quantile[,1]-qnorm(0.1)))<0.1,T) - expect_equal(max(abs(qtreg$pred_quantile[,2]-qnorm(0.25)))<0.1,T) - expect_equal(max(abs(qtreg$pred_quantile[,3]-qnorm(0.5)))<0.1,T) - expect_equal(max(abs(qtreg$pred_quantile[,4]-qnorm(0.75)))<0.1,T) - expect_equal(max(abs(qtreg$pred_quantile[,5]-qnorm(0.9)))<0.1,T) - expect_equal(max(abs(qtreg$pred_quantile[,6]-qnorm(0.95)))<0.1,T) -}) - -#positive test 2 -test_that('test estimates when x only takes 2 values', { - set.seed(10) - n = 2000 - m = 50 - ei = c(rep(0,n/2),rep(1,n/2)) - y=1:n - x=list() - t_x=list() - for(i in 1:n){ - t_x = c(t_x,list(0:m/m)) - x = c(x,list(ei[i]*array(1,m+1))) - if(ei[i]==0){ - y[i] = rnorm(1) - }else{ - y[i] = runif(1,0,1) - } - } - - outQ = c(0.1,0.25,0.5,0.75,0.9) - isNewsub = rep(0,n) - qtreg = FPCquantile(x, t_x, y, outQ,optns_x = NULL,isNewsub) - - expect_equal(max(abs(qtreg$pred_quantile[ei==0,1]-qnorm(0.1)))<0.1,T) - expect_equal(max(abs(qtreg$pred_quantile[ei==0,2]-qnorm(0.25)))<0.1,T) - expect_equal(max(abs(qtreg$pred_quantile[ei==0,3]-qnorm(0.5)))<0.1,T) - expect_equal(max(abs(qtreg$pred_quantile[ei==0,4]-qnorm(0.75)))<0.1,T) - expect_equal(max(abs(qtreg$pred_quantile[ei==0,5]-qnorm(0.9)))<0.1,T) - expect_equal(max(abs(qtreg$pred_quantile[ei==1,1]-0.1))<0.1,T) - expect_equal(max(abs(qtreg$pred_quantile[ei==1,2]-0.25))<0.1,T) - expect_equal(max(abs(qtreg$pred_quantile[ei==1,3]-0.5))<0.1,T) - expect_equal(max(abs(qtreg$pred_quantile[ei==1,4]-0.75))<0.1,T) - expect_equal(max(abs(qtreg$pred_quantile[ei==1,5]-0.9))<0.1,T) -}) - - -# negative test 1 -test_that('test when output quantiles are not in [0,1]', { - n = 200 - npred = 50 - m = 50 - xi <- Wiener(n, 0:m/m) - y=1:n - x=list() - t_x=list() - for(i in 1:n){ - t_x = c(t_x,list(0:m/m)) - x = c(x,list(xi[i,])) - y[i] = 5*rnorm(1)+2*sum(xi[i,]) - } - - outQ = c(-0.1,0.25,0.5,0.75,0.9,0.95) - isNewsub = c(rep(0,n-npred),rep(1,npred)) - expect_error(FPCquantile(x, t_x, y, outQ,optns_x = NULL,isNewsub) ) - #qtreg = FPCquantile(x, t_x, y, outQ,optns_x = NULL,isNewsub) -}) - -# negative test 2 -test_that('test when y and Lx does not have same length', { - n = 200 - npred = 50 - m = 50 - xi <- Wiener(n, 0:m/m) - y=1:(n+1) - x=list() - t_x=list() - for(i in 1:n){ - t_x = c(t_x,list(0:m/m)) - x = c(x,list(xi[i,])) - y[i] = 5*rnorm(1)+2*sum(xi[i,]) - } - - outQ = c(0.1,0.25,0.5,0.75,0.9,0.95) - isNewsub = c(rep(0,n-npred),rep(1,npred)) - expect_error(FPCquantile(x, t_x, y, outQ,optns_x = NULL,isNewsub) ) - #qtreg = FPCquantile(x, t_x, y, outQ,optns_x = NULL,isNewsub) -}) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FSVD.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FSVD.R deleted file mode 100644 index 9541e198..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FSVD.R +++ /dev/null @@ -1,133 +0,0 @@ -if (Sys.getenv('TRAVIS') != 'true') {# Do not run on travis since this is slow -# devtools::load_all() -library(testthat) -library(mvtnorm) - -### Simulaiton setting in FSVD paper -# Generate X, Y functional samples with certain covariance structure -K = 3 # number of singular pairs -t = 10 # domain end point -obsGrid = seq(0, t, length.out = 51) -# singular functions -# X -phi1 = sqrt(2/t) * sin(2*pi*obsGrid/t) -phi2 = -sqrt(2/t) * cos(4*pi*obsGrid/t) -phi3 = -sqrt(2/t) * cos(2*pi*obsGrid/t) -Phi = cbind(phi1, phi2, phi3) -# Y -psi1 = phi3; psi2 = phi1; psi3 = phi2 -Psi = cbind(psi1, psi2, psi3) -# singular components -CovscX = matrix(c(8,3,-2,3,4,1,-2,1,3), nrow=3) -CovscY = matrix(c(6,-2,1,-2,4.5,1.5,1,1.5,3.25), nrow=3) -CovscXY = diag(c(3,1.5,0.5)) -CXY = CovscXY[1,1]*phi1%*%t(psi1) + CovscXY[2,2]*phi2%*%t(psi2) + - CovscXY[3,3]*phi3%*%t(psi3) -rho1 = CovscXY[1,1]/sqrt(CovscX[1,1]*CovscY[1,1]) -rho2 = CovscXY[2,2]/sqrt(CovscX[2,2]*CovscY[2,2]) -rho3 = CovscXY[3,3]/sqrt(CovscX[3,3]*CovscY[3,3]) -# observed error sigma2 -sigma2 = 0.05 - -### test for consistency in dense case -test_that('consistent estimates for dense case', { - n = 10000 # sample size - set.seed(1) - singscore = rmvnorm(n=n, mean = rep(0,6), sigma = cbind(rbind(CovscX,CovscXY),rbind(CovscXY, CovscY))) - zeta1 = singscore[,1] # X - zeta2 = singscore[,2] # X - zeta3 = singscore[,3] # X - xi1 = singscore[,4] #Y - xi2 = singscore[,5] #Y - xi3 = singscore[,6] #Y - - Xmat = t(Phi %*% t(singscore[,1:3])) + rnorm(n = n*length(obsGrid),mean = 0,sd = sqrt(sigma2)) - Ymat = t(Psi %*% t(singscore[,4:6])) + rnorm(n = n*length(obsGrid),mean = 0,sd = sqrt(sigma2)) - Xins = MakeFPCAInputs(tVec = obsGrid, yVec = Xmat) - Yins = MakeFPCAInputs(tVec = obsGrid, yVec = Ymat) - - Ly1 = Xins$Ly - Lt1 = Xins$Lt - Ly2 = Yins$Ly - Lt2 = Yins$Lt - fsvdobj = FSVD(Ly1, Lt1, Ly2, Lt2, SVDoptns = list(methodSelectK=3)) - expect_equal(fsvdobj$sValues, diag(CovscXY), tolerance = 0.01*diag(CovscXY)) - expect_equal(fsvdobj$canCorr, c(rho1, rho2, rho3), tolerance = 0.18*c(rho1, rho2, rho3)) - # test for high correlation between true and observed singular scores - expect_gt(abs(cor(fsvdobj$sScores1[,1], singscore[,1])), 0.99) - expect_gt(abs(cor(fsvdobj$sScores1[,2], singscore[,2])), 0.99) - expect_gt(abs(cor(fsvdobj$sScores1[,3], singscore[,3])), 0.99) - expect_gt(abs(cor(fsvdobj$sScores2[,1], singscore[,4])), 0.99) - expect_gt(abs(cor(fsvdobj$sScores2[,2], singscore[,5])), 0.99) - expect_gt(abs(cor(fsvdobj$sScores2[,3], singscore[,6])), 0.99) -}) - -### test for consistency in sparse case -test_that('consistent estimates for sparse case', { - n = 2000 # sample size - set.seed(123) - singscore = rmvnorm(n=n, mean = rep(0,6), sigma = cbind(rbind(CovscX,CovscXY),rbind(CovscXY, CovscY))) - zeta1 = singscore[,1] # X - zeta2 = singscore[,2] # X - zeta3 = singscore[,3] # X - xi1 = singscore[,4] #Y - xi2 = singscore[,5] #Y - xi3 = singscore[,6] #Y - - Xmat = t(Phi %*% t(singscore[,1:3])) + rnorm(n = n*length(obsGrid),mean = 0,sd = sqrt(sigma2)) - Ymat = t(Psi %*% t(singscore[,4:6])) + rnorm(n = n*length(obsGrid),mean = 0,sd = sqrt(sigma2)) - XinSparse = Sparsify(samp = Xmat, pts = obsGrid, sparsity = sample(6:10,size=n,replace=TRUE)) - YinSparse = Sparsify(samp = Ymat, pts = obsGrid, sparsity = sample(6:10,size=n,replace=TRUE)) - - Ly1 = XinSparse$Ly - Lt1 = XinSparse$Lt - Ly2 = YinSparse$Ly - Lt2 = YinSparse$Lt - fsvdObj1 = FSVD(Ly1, Lt1, Ly2, Lt2, SVDoptns = list(methodSelectK=3,bw1=1.2,bw2=1.2)) - expect_equal(fsvdObj1$sValues, diag(CovscXY), tolerance = 0.61, scale = 1) - expect_equal(fsvdObj1$canCorr, c(rho1,rho2,rho3), tolerance = 0.07, scale=1) - # test for high correlation between true and observed singular scores - expect_gt(abs(cor(fsvdObj1$sScores1[,1], singscore[,1])), 0.985) - expect_gt(abs(cor(fsvdObj1$sScores1[,2], singscore[,2])), 0.91) - expect_gt(abs(cor(fsvdObj1$sScores1[,3], singscore[,3])), 0.95) - expect_gt(abs(cor(fsvdObj1$sScores2[,1], singscore[,4])), 0.98) - expect_gt(abs(cor(fsvdObj1$sScores2[,2], singscore[,5])), 0.965) - expect_gt(abs(cor(fsvdObj1$sScores2[,3], singscore[,6])), 0.92) -}) - - -### test for consistency in sparse case -test_that('Check flipping the components in the sparse case results into perfectly anti-correlated scores', { - n = 200 # sample size - set.seed(123) - singscore = rmvnorm(n=n, mean = rep(0,6), sigma = cbind(rbind(CovscX,CovscXY),rbind(CovscXY, CovscY))) - zeta1 = singscore[,1] # X - zeta2 = singscore[,2] # X - zeta3 = singscore[,3] # X - xi1 = singscore[,4] #Y - xi2 = singscore[,5] #Y - xi3 = singscore[,6] #Y - - Xmat = t(Phi %*% t(singscore[,1:3])) + rnorm(n = n*length(obsGrid),mean = 0,sd = sqrt(sigma2)) - Ymat = t(Psi %*% t(singscore[,4:6])) + rnorm(n = n*length(obsGrid),mean = 0,sd = sqrt(sigma2)) - XinSparse = Sparsify(samp = Xmat, pts = obsGrid, sparsity = sample(6:10,size=n,replace=TRUE)) - YinSparse = Sparsify(samp = Ymat, pts = obsGrid, sparsity = sample(6:10,size=n,replace=TRUE)) - - Ly1 = XinSparse$Ly - Lt1 = XinSparse$Lt - Ly2 = YinSparse$Ly - Lt2 = YinSparse$Lt - fsvdObj1 = FSVD(Ly1, Lt1, Ly2, Lt2, SVDoptns = list(methodSelectK=3,bw1=1.2,bw2=1.2, flip= FALSE)) - fsvdObj2 = FSVD(Ly1, Lt1, Ly2, Lt2, SVDoptns = list(methodSelectK=3,bw1=1.2,bw2=1.2, flip= TRUE)) - expect_equal(fsvdObj1$sValues, fsvdObj2$sValues, tolerance = 0.001, scale = 1) - expect_equal(fsvdObj1$canCorr, fsvdObj2$canCorr, tolerance = 0.001, scale=1) - # test for high correlation between computed singular scores - expect_lt( (cor(fsvdObj1$sScores2[,3], fsvdObj2$sScores2[,3])), -0.99) - expect_lt( (cor(fsvdObj1$sScores2[,2], fsvdObj2$sScores2[,2])), -0.99) - expect_lt( (cor(fsvdObj1$sScores2[,1], fsvdObj2$sScores2[,1])), -0.99) - expect_lt( (cor(fsvdObj1$sScores1[,3], fsvdObj2$sScores1[,3])), -0.99) - expect_lt( (cor(fsvdObj1$sScores1[,2], fsvdObj2$sScores1[,2])), -0.99) - expect_lt( (cor(fsvdObj1$sScores1[,1], fsvdObj2$sScores1[,1])), -0.99) - -}) -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FVEdataset.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FVEdataset.R deleted file mode 100644 index c1ef97e0..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FVEdataset.R +++ /dev/null @@ -1,21 +0,0 @@ -# devtools::load_all() - - - -# -#FVEdata <- read.table("http://www.hsph.harvard.edu/fitzmaur/ala2e/fev1.txt", col.names=c('SubjectID', 'Height', 'Age', 'InitialHeight', 'InitialAge', 'LogFEV1'), skip=42 ); -# -#mySample = MakeFPCAInputs(IDs= FVEdata$SubjectID, tVec=FVEdata$Age, yVec=FVEdata$LogFEV1); -# -#y= mySample$Ly -#t= mySample$Lt -# -## optns = CreateOptions() -## system.time(tmp <- FPCA(y, t, optns)) -## tmp$sigma2 -# -# -#optns1 <- list(kernel='rect') -#system.time(tmp1 <- FPCA(y, t, optns1)) -## plot(tmp1$phi[, 1]) # off -## CreateCovPlot(tmp1, 'Smoothed', TRUE) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FVPA.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FVPA.R deleted file mode 100644 index e8c7f4d5..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FVPA.R +++ /dev/null @@ -1,162 +0,0 @@ -# devtools::load_all() -library(testthat) - -test_that('noisy dense data, default arguments: ie. cross-sectional mu/cov, use IN score', { - - # Define the continuum and basic constants - set.seed(123); N = 333; M = 101; - s = seq(0,10,length.out = M) - - # Create S_true - meanFunct <- function(s) s + 10*exp(-(s-5)^2) - eigFunct1 <- function(s) +cos(2*s*pi/10) / sqrt(5) - eigFunct2 <- function(s) -sin(2*s*pi/10) / sqrt(5) - Phi <- matrix(c(eigFunct1(s),eigFunct2(s)), ncol=2) - ev <- c(5, 2)^2 - Ksi = apply(matrix(rnorm(N*2), ncol=2), 2, scale) %*% diag(sqrt(ev)) - - Sij = Ksi %*% t(Phi) + t(matrix(rep(meanFunct(s),N), nrow=M)) - - # Create Signs - epsilonSign = ifelse( matrix(runif(N*M)-0.5, ncol = M) > 0, 1, -1) - - # Create residuals - sigmaW = 0.05 - Wij = matrix(rnorm(N*M, sd = sigmaW/1), ncol = M) - eigFunctA <- function(s) +cos(9*s*pi/10) / sqrt(5) - eigFunctB <- function(s) -cos(1*s*pi)/sqrt(5) - Psi = matrix(c(eigFunctA(s),eigFunctB(s)), ncol=2) - evR <- c(0.5, 0.3)^2 - Zeta = apply(matrix(rnorm(N*2), ncol=2), 2, scale) %*% diag(sqrt(evR)) - Vij = Zeta %*% t(Psi) - - # matplot(t( exp(Vij + Wij)^0.5 ), t='l') - Rij = epsilonSign * ( exp(Vij + Wij)^(0.5) ) - - Xij = Sij + Rij; - - tmp <- MakeFPCAInputs(tVec=s, yVec=Xij) - - fvpaResults = FVPA(y= tmp$Ly, t= tmp$Lt) - - expect_gt( abs( cor( eigFunct1(s), fvpaResults$fpcaObjY$phi[,1])), 0.975) - expect_gt( abs( cor( eigFunct2(s), fvpaResults$fpcaObjY$phi[,2])), 0.975) - expect_gt( abs( cor( eigFunctA(s), fvpaResults$fpcaObjR$phi[,1])), 0.975) - expect_gt( abs( cor( eigFunctB(s), fvpaResults$fpcaObjR$phi[,2])), 0.975) - - expect_gt( abs( cor( Ksi[,1], fvpaResults$fpcaObjY$xiEst[,1])), 0.975) - expect_gt( abs( cor( Ksi[,2], fvpaResults$fpcaObjY$xiEst[,2])), 0.975) - expect_gt( abs( cor( Zeta[,1], fvpaResults$fpcaObjR$xiEst[,1])), 0.975) - expect_gt( abs( cor( Zeta[,2], fvpaResults$fpcaObjR$xiEst[,2])), 0.94) - -}) - -test_that('noisy dense data, CE scores and cross-sectional mu/cov', { - - # Define the continuum and basic constants - set.seed(123); N = 333; M = 101; - s = seq(0,10,length.out = M) - - # Create S_true - meanFunct <- function(s) s + 10*exp(-(s-5)^2) - eigFunct1 <- function(s) +cos(2*s*pi/10) / sqrt(5) - eigFunct2 <- function(s) -sin(2*s*pi/10) / sqrt(5) - Phi <- matrix(c(eigFunct1(s),eigFunct2(s)), ncol=2) - ev <- c(5, 2)^2 - Ksi = apply(matrix(rnorm(N*2), ncol=2), 2, scale) %*% diag(sqrt(ev)) - - Sij = Ksi %*% t(Phi) + t(matrix(rep(meanFunct(s),N), nrow=M)) - - # Create Signs - epsilonSign = ifelse( matrix(runif(N*M)-0.5, ncol = M) > 0, 1, -1) - - # Create residuals - sigmaW = 0.05 - Wij = matrix(rnorm(N*M, sd = sigmaW/1), ncol = M) - eigFunctA <- function(s) +cos(9*s*pi/10) / sqrt(5) - eigFunctB <- function(s) -cos(1*s*pi)/sqrt(5) - Psi = matrix(c(eigFunctA(s),eigFunctB(s)), ncol=2) - evR <- c(0.5, 0.3)^2 - Zeta = apply(matrix(rnorm(N*2), ncol=2), 2, scale) %*% diag(sqrt(evR)) - Vij = Zeta %*% t(Psi) - - Rij = epsilonSign * ( exp(Vij + Wij)^(0.5) ) - - Xij = Sij + Rij; - - tmp <- MakeFPCAInputs(tVec=s, yVec=Xij) - - fvpaResults = FVPA(y= tmp$Ly, t= tmp$Lt, optns = list(error=TRUE, FVEthreshold = 0.9, methodXi='CE' )) - - expect_gt( abs( cor( eigFunct1(s), fvpaResults$fpcaObjY$phi[,1])), 0.975) - expect_gt( abs( cor( eigFunct2(s), fvpaResults$fpcaObjY$phi[,2])), 0.975) - expect_gt( abs( cor( eigFunctA(s), fvpaResults$fpcaObjR$phi[,1])), 0.975) - expect_gt( abs( cor( eigFunctB(s), fvpaResults$fpcaObjR$phi[,2])), 0.975) - - expect_gt( abs( cor( Ksi[,1], fvpaResults$fpcaObjY$xiEst[,1])), 0.975) - expect_gt( abs( cor( Ksi[,2], fvpaResults$fpcaObjY$xiEst[,2])), 0.975) - expect_gt( abs( cor( Zeta[,1], fvpaResults$fpcaObjR$xiEst[,1])), 0.975) - expect_gt( abs( cor( Zeta[,2], fvpaResults$fpcaObjR$xiEst[,2])), 0.94) - -}) - -test_that('noisy dense data, IN scores and smooth mu/cov', { - - # Define the continuum and basic constants - set.seed(123); N = 333; M = 101; - s = seq(0,10,length.out = M) - - # Create S_true - meanFunct <- function(s) s + 10*exp(-(s-5)^2) - eigFunct1 <- function(s) +cos(2*s*pi/10) / sqrt(5) - eigFunct2 <- function(s) -sin(2*s*pi/10) / sqrt(5) - Phi <- matrix(c(eigFunct1(s),eigFunct2(s)), ncol=2) - ev <- c(5, 2)^2 - Ksi = apply(matrix(rnorm(N*2), ncol=2), 2, scale) %*% diag(sqrt(ev)) - - Sij = Ksi %*% t(Phi) + t(matrix(rep(meanFunct(s),N), nrow=M)) - - # Create Signs - epsilonSign = ifelse( matrix(runif(N*M)-0.5, ncol = M) > 0, 1, -1) - - # Create residuals - sigmaW = 0.05 - Wij = matrix(rnorm(N*M, sd = sigmaW/1), ncol = M) - eigFunctA <- function(s) +cos(9*s*pi/10) / sqrt(5) - eigFunctB <- function(s) -cos(1*s*pi)/sqrt(5) - Psi = matrix(c(eigFunctA(s),eigFunctB(s)), ncol=2) - evR <- c(0.5, 0.3)^2 - Zeta = apply(matrix(rnorm(N*2), ncol=2), 2, scale) %*% diag(sqrt(evR)) - Vij = Zeta %*% t(Psi) - - Rij = epsilonSign * ( exp(Vij + Wij)^(0.5) ) - - Xij = Sij + Rij; - - tmp <- MakeFPCAInputs(tVec=s, yVec=Xij) - - fvpaResults = FVPA(y= tmp$Ly, t= tmp$Lt, optns = list(error=TRUE, FVEthreshold = 0.9, methodMuCovEst='smooth', userBwCov = 0.600 )) - - expect_gt( abs( cor( eigFunct1(s), fvpaResults$fpcaObjY$phi[,1])), 0.975) - expect_gt( abs( cor( eigFunct2(s), fvpaResults$fpcaObjY$phi[,2])), 0.975) - expect_gt( abs( cor( eigFunctA(s), fvpaResults$fpcaObjR$phi[,1])), 0.975) - expect_gt( abs( cor( eigFunctB(s), fvpaResults$fpcaObjR$phi[,2])), 0.975) - - expect_gt( abs( cor( Ksi[,1], fvpaResults$fpcaObjY$xiEst[,1])), 0.975) - expect_gt( abs( cor( Ksi[,2], fvpaResults$fpcaObjY$xiEst[,2])), 0.975) - expect_gt( abs( cor( Zeta[,1], fvpaResults$fpcaObjR$xiEst[,1])), 0.97) - expect_gt( abs( cor( Zeta[,2], fvpaResults$fpcaObjR$xiEst[,2])), 0.91) - -}) - -test_that('FVPA works for long dense data', { - - set.seed(123) - n <- 100 - p <- 500 - - input <- Wiener(n, seq(0, 1, length.out=p), sparsify=p) - expect_error(FVPA(input$Ly, input$Lt, optns=list(useBinnedData='FORCE', error=TRUE, FVEthreshold=0.9)), "optns\\$useBinnedData cannot be 'FORCE'") - res <- FVPA(input$Ly, input$Lt, optns=list(error=TRUE, FVEthreshold=0.9)) -}) - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FitEigenValues.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FitEigenValues.R deleted file mode 100644 index 62891ef8..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_FitEigenValues.R +++ /dev/null @@ -1,36 +0,0 @@ -# devtools::load_all() -##options(error=recover) -library(testthat) - -test_that('FitEigenValues works for binned rcov, error=TRUE', { - set.seed(2) - pts <- seq(0, 1, by=0.001) - samp3 <- Wiener(10, pts, sparsify=2:7) - rcov3 <- GetRawCov(samp3$Ly, samp3$Lt, pts, rep(0, length(pts)), 'Sparse', error=TRUE) - brcov3 <- BinRawCov(rcov3) - phi <- cbind(sin((2 * 1 - 1) * pi * pts / 2), sin((2 * 2 - 1) * pi * pts / 2)) * sqrt(2) - expect_equal(FitEigenValues(rcov3, pts, phi, 2), FitEigenValues(brcov3, pts, phi, 2)) -}) - -test_that('FitEigenValues works for binned rcov, error=FALSE', { - set.seed(2) - pts <- seq(0, 1, by=0.001) - samp3 <- Wiener(10, pts, sparsify=2:7) - rcov3 <- GetRawCov(samp3$Ly, samp3$Lt, pts, rep(0, length(pts)), 'Sparse', error=FALSE) - brcov3 <- BinRawCov(rcov3) - phi <- cbind(sin((2 * 1 - 1) * pi * pts / 2), sin((2 * 2 - 1) * pi * pts / 2)) * sqrt(2) - expect_equal(FitEigenValues(rcov3, pts, phi, 2), FitEigenValues(brcov3, pts, phi, 2)) -}) - -trueLambda <- 4 / (2 * (1:20) - 1)^2 / pi^2 -test_that('FitEigenValues is consistent', { - set.seed(2) - pts <- seq(0, 1, by=0.05) - samp3 <- Wiener(300, pts, sparsify=length(pts)) - rcov3 <- GetRawCov(samp3$Ly, samp3$Lt, pts, rep(0, length(pts)), 'Sparse', error=TRUE) - phi <- cbind(sin((2 * 1 - 1) * pi * pts / 2), sin((2 * 2 - 1) * pi * pts / 2)) * sqrt(2) - estLam <- FitEigenValues(rcov3, pts, phi, 2) - expect_equal(estLam, trueLambda[1:length(estLam)], tolerance = 0.15) -}) - -# Test truncation diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetBinnedCurve.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetBinnedCurve.R deleted file mode 100644 index 5aba8b22..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetBinnedCurve.R +++ /dev/null @@ -1,37 +0,0 @@ -# devtools::load_all() -library(testthat) - -test_that('GetBinnedCurve() works on trivial examples', { - x = 1:100 - y = 2*x - A = GetBinnedCurve(x,y,M=50) - expect_equal( sum(diff(A$midpoint) ) , diff(range(x)) ) - expect_equal( sd(A$newy), sd(y), tolerance=0.05) - B = GetBinnedCurve(x,y,M=33) - expect_equal( sum(diff(B$midpoint) ) , diff(range(x))) - expect_equal( sd(B$newy), sd(y), tolerance=0.05) -}) - -test_that('GetBinnedCurve() works on a nearly trivial example', { - x = seq(0,4, length.out=100) - y = x + sin(x); - A = GetBinnedCurve(x,y, 32, TRUE, TRUE, c(1,2.5)) - expect_equal( sum(diff(A$midpoint) ), 1.5, tolerance=0.05 ) - expect_equal( sd(A$newy), 0.38, tolerance=0.05) -}) - -test_that('GetBinnedCurve() works for large case',{ - x <- 1:2000 - y <- 2 * x - A = GetBinnedCurve(x, y, 400, TRUE, TRUE, c(1, 1999)) - expect_equal( A$binWidth, 4.995 ) - expect_lte( sd(A$count), 0.2) - expect_equal( sd(A$newy), sd(y), tolerance=0.03) - expect_equal( sd(A$midpoint), sd(x), tolerance=0.03) -}) - - - - - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetBinnedDataset.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetBinnedDataset.R deleted file mode 100644 index 6a829b10..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetBinnedDataset.R +++ /dev/null @@ -1,28 +0,0 @@ -# devtools::load_all() -library(testthat) - -test_that('GetBinnedDataset() works on trivial examples', { - - y = list( c(1:1000), c(3:1012)) - t = list( seq(0,1,length.out=1000), seq(0,1,length.out=1010)) - A = GetBinnedDataset(y,t, optns=SetOptions(y,t,NULL)) - - expect_equal( length(A$newt[[2]]), 400) - expect_equal( A$newt[[2]][113] , 0.2807, tolerance=0.01, scale=1) - expect_equal( mean( A$newt[[1]]), mean( A$newt[[2]]) ) - expect_equal( A$newy[[1]][313] , 782, tolerance=0.01, scale=1) - expect_equal( mean( A$newy[[1]]), 5.005000000000000e+02 ) - -}) - -test_that('GetBinnedDataset() works on binned examples, with the first individual being singleton', { - - y = list(1, seq(0, 1000, length.out=1000), seq(3, 1012, length.out=1010)) - t = list(0.5, seq(0,1,length.out=1000), seq(0,1,length.out=1010)) - A = GetBinnedDataset(y,t, optns=SetOptions(y,t, list(numBins=20))) - - expect_equal( length(A$newt[[3]]), 20) - expect_true(abs(A$newt[[2]][10] - A$newy[[2]][10] / 1000) < 1e-3) - expect_equal( mean( A$newt[[3]]), mean( A$newt[[2]]) ) - - }) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetCEScores.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetCEScores.R deleted file mode 100644 index 8686bf4a..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetCEScores.R +++ /dev/null @@ -1,155 +0,0 @@ -# devtools::load_all() -#options(error=recover) -library(testthat) - -# test GetIndCEScores -obsGrid <- seq(0, 1, by=0.1) -yVec <- c(1, -1) -muVec <- c(0, 0) -lamVec <- c(6, 1) -phiMat <- diag(1, 2) -Sigma_Yi <- diag(10, 2) -test_that('GetIndCEScores works', { - expect_equal(GetIndCEScores(yVec, muVec, lamVec, phiMat, Sigma_Yi)[1:2], - list(xiEst=matrix(c(0.6, -0.1)), xiVar=diag(c(2.4, 0.9)))) - expect_equal(GetIndCEScores(c(), muVec, lamVec, phiMat, Sigma_Yi)[1:2], # integer(0) is not really an empty vector, 'c()' is more obvious - list(xiEst=matrix(NA, length(lamVec)), xiVar=matrix(NA, length(lamVec), length(lamVec)))) - expect_equal(GetIndCEScores(yVec, muVec, lamVec, phiMat, Sigma_Yi, newyInd=1)$fittedY, matrix(0)) -}) - -GetIndCEScores(yVec[1], muVec[1], lamVec, phiMat[1, , drop=FALSE], Sigma_Yi[1, 1, drop=FALSE], newyInd=1) - -# Set up -set.seed(1) -n <- 20 -pts <- seq(0, 1, by=0.05) -truncPts <- seq(0.2, 0.8, 0.05) -regGrid <- seq(0, 1, by=0.01) -sigma2 <- 0.4 -samp1 <- Wiener(n, pts) + rnorm(length(pts) * n, sd=sigma2) -samp1 <- Sparsify(samp1, pts, 2:7) -mu1 <- rep(0, length(pts)) -pNoTrunc <- SetOptions(samp1$Ly, samp1$Lt, list(dataType='Sparse', error=TRUE, kernel='epan', userBwCov = 0.2)) -smc1 <- GetSmoothedCovarSurface(samp1$Ly, samp1$Lt, mu1, pts, regGrid, pNoTrunc) -eig1 <- GetEigenAnalysisResults(smc1$smoothCov, regGrid, pNoTrunc) - -# test GetMuPhiSig -# no truncation -phiObs <- ConvertSupport(regGrid, pts, phi=eig1$phi) -CovObs <- ConvertSupport(regGrid, pts, Cov=eig1$fittedCov) -notruncSamp <- TruncateObs(samp1$Ly, samp1$Lt, pts) -expect_equal(sapply(notruncSamp$Ly, length), sapply(samp1$Ly, length)) -tmp <- GetMuPhiSig(notruncSamp$Lt, pts, mu1, phiObs, CovObs + diag(smc1$sigma2, length(pts))) -expect_equal(sapply(tmp, function(x) length(x$muVec)), sapply(samp1$Ly, length)) - - -# truncation -test_that('Observations with length 0 produces NA in the xiEst, xiVar, and fittedY', { - set.seed(1) - n <- 20 - pts <- signif(seq(0, 1, by=0.05), 4) - truncPts <- signif(seq(0.2, 0.8, 0.05), 4) - regGrid <- seq(0, 1, by=0.01) - sigma2 <- 0.4 - samp1 <- Wiener(n, pts) + rnorm(length(pts) * n, sd=sigma2) - samp1 <- Sparsify(samp1, pts, 2:7) - mu1 <- rep(0, length(pts)) - pNoTrunc <- SetOptions(samp1$Ly, samp1$Lt, list(dataType='Sparse', error=TRUE, kernel='epan', userBwCov = 0.2)) - smc1 <- GetSmoothedCovarSurface(samp1$Ly, samp1$Lt, mu1, pts, regGrid, pNoTrunc) - eig1 <- GetEigenAnalysisResults(smc1$smoothCov, regGrid, pNoTrunc) - phiObs <- ConvertSupport(regGrid, truncPts, phi=eig1$phi) - CovObs <- ConvertSupport(regGrid, truncPts, Cov=eig1$fittedCov) - truncSamp <- TruncateObs(samp1$Ly, samp1$Lt, truncPts) - tmp <- GetMuPhiSig(truncSamp$Lt, truncPts, mu1[1:length(truncPts)], phiObs, CovObs + diag(smc1$sigma2, length(truncPts))) - expect_equal(sapply(tmp, function(x) length(x$muVec)), sapply(truncSamp$Ly, length)) - tmp1 <- GetCEScores(truncSamp$Ly[17:20], truncSamp$Lt[17:20], list(verbose=TRUE), rep(0, length(truncPts)), truncPts, CovObs, eig1$lambda, phiObs, smc1$sigma2) - - expect_equal(tmp1[[1, 1]], matrix(NA, length(eig1$lambda))) - expect_equal(tmp1[[2, 1]], matrix(NA, length(eig1$lambda), length(eig1$lambda))) - expect_equal(tmp1[[3, 1]], matrix(NA, 0, 0)) -}) - -# Test GetCEScores: compare to Matlab -test_that('GetCEScores for sparse case matches Matlab', { - y <- list(c(1, 2), 4, c(0, 2, 3)) - t <- list(c(1.5, 2.5), 2, c(1, 1.5, 2.5)) - # mu <- rep(0, 7) - mu <- seq(0, 3, length.out=7) - obsGrid <- seq(0, 3, length.out=7) - pts <- seq(0, 1, length.out=7) - phi <- cbind(sin(2 * pi * pts), cos(2 * pi * pts)) - lambda <- c(6, 1) - sigma2 <- 0.4 - fittedCov <- phi %*% diag(lambda) %*% t(phi) - tmp <- GetCEScores(y, t, list(), mu, obsGrid, fittedCov, lambda, phi, sigma2) -# xiEst are the same - expect_equal(t(do.call(cbind, tmp[1, ])), - matrix(c(0.709244942754497, 0.337643678160920, - -2.017923270954032, -0.194174757281554, - -1.011227267892009, -0.329341317365270), 3, 2, - byrow=TRUE)) -# xiVar are the same - expect_equal(unlist(tmp[2, ]), c(0.568965517241379, 0.149314724790420, - 0.149314724790420, 0.281609195402299, - 0.757281553398058, -0.504480817738509, - -0.504480817738509, 0.951456310679612, - 0.341317365269461, 0.155573425829540, - 0.155573425829540, 0.281437125748503)) -# fitted Y_i are the same - expect_equal(unlist(tmp[3, ]), c(1.162356321839080, 2.054597701149425, 3.844660194174757, 0.288922155688622, 1.829341317365270, 3.211077844311377)) -}) - -# # Matlab code: -# y = cell(1, 3); -# t = y; -# y{1} = [1, 2]; y{2} = [4]; y{3} = [0, 2, 3]; -# t{1} = [1.5, 2.5]; t{2} = [2]; t{3} = [1, 1.5, 2.5]; -# # mu = zeros(1, 7); -# mu = linspace(0, 3, 7); -# out1 = linspace(0, 3, 7); -# pts = linspace(0, 1, 7); -# phi = [sin(2 * pi * pts)', cos(2 * pi * pts)']; -# lambda = [6, 1]; -# sigma = 0; -# sigma_new = 0.4; -# noeig = 2; -# error = 1; -# method = 'CE'; -# shrink = 0; -# regular = 0; -# rho = 0; -# [xi_est, xi_var, ypred] = getScores1(y, t, mu, phi, lambda, sigma, sigma_new, noeig, error, method, shrink, out1, regular, rho) - - - -# no error case. This observation has a singular Sigma_Yi, which should not work in theory. - - - - -# truncation -test_that('Noiseless example', { - set.seed(1) - n <- 100 - M <- 50 - K <- 5 - samp <- MakeGPFunctionalData(n, M, K=K, lambda=2^(-seq(1, K))) - # matplot(t(samp$Y[1:10, ])) - sampList <- MakeFPCAInputs(tVec=samp$pts, yVec=samp$Y) - resIN <- FPCA(sampList$Ly, sampList$Lt, list(methodXi='IN', lean=TRUE, error=FALSE, rho='no')) - resCE <- FPCA(sampList$Ly, sampList$Lt, list(methodXi='CE', lean=TRUE, error=FALSE, rho='no')) - - expect_gt( abs( cor( samp$xi[,1] , resIN$xiEst[,1])),0.97) - expect_gt( abs(cor( samp$xi[,2] , resIN$xiEst[,2])),0.97) - expect_gt( abs(cor( samp$xi[,3] , resIN$xiEst[,3])),0.97) - expect_gt( abs(cor( samp$xi[,4] , resIN$xiEst[,4])), 0.97) - expect_gt( abs(cor( samp$xi[,5] , resIN$xiEst[,5])), 0.94) - - expect_gt( abs( cor( samp$xi[,1] , resCE$xiEst[,1])),0.97) - expect_gt( abs(cor( samp$xi[,2] , resCE$xiEst[,2])),0.97) - expect_gt( abs(cor( samp$xi[,3] , resCE$xiEst[,3])),0.97) - expect_gt( abs(cor( samp$xi[,4] , resCE$xiEst[,4])), 0.97) - expect_gt( abs(cor( samp$xi[,5] , resCE$xiEst[,5])), 0.94) - -}) - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetCovDense.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetCovDense.R deleted file mode 100644 index 26da0fd7..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetCovDense.R +++ /dev/null @@ -1,45 +0,0 @@ -# devtools::load_all() -library(testthat) -##options(error=recover) - -trueLam <- 4 / ((2 * (1:50) - 1 ) * pi) ^ 2 - -test_that('GetCovDense fails when data is too sparse', { - - set.seed(1) - n <- 200 - p <- 101 - pts <- seq(0, 1, length.out=p) - sigma2 <- 0.1 - mu <- pts - samp <- Wiener(n, pts) + matrix(pts, n, p, byrow=TRUE) + - rnorm(n * length(pts), sd=sqrt(sigma2)) - samp[seq_len(n - 1), 1] <- NA # only subject 1 was observed at the first time point - expect_error(GetCovDense(samp, colMeans(samp), list(error=FALSE, dataType='DenseWithMV')), - "Data is too sparse to be considered DenseWithMV. Remove sparse observations or specify dataType='Sparse' for FPCA") - -}) - - -test_that('GetCovDense with noise, get sigma2', { - set.seed(1) - n <- 200 - p <- 101 - pts <- seq(0, 1, length.out=p) - sigma2 <- 0.1 - mu <- pts - samp <- Wiener(n, pts) + matrix(pts, n, p, byrow=TRUE) + - rnorm(n * length(pts), sd=sqrt(sigma2)) - tmp <- MakeFPCAInputs(tVec=pts, yVec=samp) - - optnsNoerr <- SetOptions(tmp$Ly, tmp$Lt, list(error=FALSE, dataType='Dense')) - optnsErr <- SetOptions(tmp$Ly, tmp$Lt, list(error=TRUE, dataType='Dense')) - noerr <- GetCovDense(samp, colMeans(samp), optnsNoerr) - err <- GetCovDense(samp, colMeans(samp), optnsErr) - - eigNoerr <- GetEigenAnalysisResults(noerr$smoothCov, pts, optnsNoerr) - eigErr <- GetEigenAnalysisResults(err$smoothCov, pts, optnsErr) - - expect_equal(err$sigma2, sigma2, tolerance=1e-2) - expect_equal(eigNoerr$fittedCov, eigNoerr$fittedCov) -}) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetCrCovYX.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetCrCovYX.R deleted file mode 100644 index e985dbee..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetCrCovYX.R +++ /dev/null @@ -1,228 +0,0 @@ -# devtools::load_all() -library(testthat) - -test_that('The binned crosscov is the same as unbinned',{ - - N = 100 - set.seed(123) - Ly1 = lapply(1:N, function(x) runif(7)) - Ly2 = lapply(1:N, function(x) runif(7)) - Lt1 = lapply(1:N, function(x) round(sort(c(0, runif(5),1)), 2)) - Lt2 = Lt1 - Ymu1 = rep(0.5, length(unique(unlist(Lt1)))) - Ymu2 = rep(0.1^9, length(unique(unlist(Lt2)))) - - system.time(A1<-GetCrCovYX(Ly1 = Ly1, Ly2= Ly2, Lt1=Lt1, Lt2=Lt2, Ymu1=Ymu1, Ymu2=Ymu2, bw1=2, bw2=2)) - system.time(A2 <- GetCrCovYX_old(Ly1 = Ly1, Ly2= Ly2, Lt1=Lt1, Lt2=Lt2, Ymu1=Ymu1, Ymu2=Ymu2, bw1=2, bw2=2)) - expect_equal(A1$smoothedCC, A2$smoothedCC) -}) - -test_that('The cross-covariance of two constant processes is zero.',{ - - Ly1= list( rep(2.1,7), rep(2.1,3),2.1 ); - Lt1 = list(1:7,1:3, 1); - Ly2 = list( rep(1.1,7), rep(1.1,3),1.1); - Lt2 = list(1:7,1:3, 1); - Ymu1 = rep(55,7); - Ymu2 = rep(1.1,7); - - AA<-GetCrCovYX(Ly1 = Ly1, Ly2= Ly2, Lt1=Lt1, Lt2=Lt2, Ymu1=Ymu1, Ymu2=Ymu2) - expect_equal( 0, sum(AA$smoothedCC) ) - -}) - -test_that('The cross-covariance of two unrelated process is close to zero.',{ - - N = 100 - set.seed(123) - Ly1 = lapply(1:N, function(x) runif(7)) - Ly2 = lapply(1:N, function(x) runif(7)) - Lt1 = lapply(1:N, function(x) round(sort(c(0, runif(5),1)), 2)) - Lt2 = Lt1 - Ymu1 = rep(0.5, length(unique(unlist(Lt1)))) - Ymu2 = rep(0.1^9, length(unique(unlist(Lt2)))) - - system.time(AA<-GetCrCovYX(Ly1 = Ly1, Ly2= Ly2, Lt1=Lt1, Lt2=Lt2, Ymu1=Ymu1, Ymu2=Ymu2, bw1=2, bw2=2)) - system.time(A2 <- GetCrCovYX_old(Ly1 = Ly1, Ly2= Ly2, Lt1=Lt1, Lt2=Lt2, Ymu1=Ymu1, Ymu2=Ymu2, bw1=2, bw2=2)) - expect_equal( 0.0, mean(AA$smoothedCC), tol=1e-3 ) -}) - -test_that('The cross-covariance of two unrelated process is close to zero. Different readings lengths.',{ - - N = 100 - set.seed(123) - Ly1 = lapply(1:N, function(x) runif(7)) - Ly2 = lapply(1:N, function(x) runif(4)) - Lt1 = lapply(1:N, function(x) sort(c(0, runif(5),1)) ) - Lt2 = lapply(1:N, function(x) sort(c(0, runif(2),1)) ) - Ymu1 = rep(0.5, length(unique(unlist(Lt1)))) - Ymu2 = rep(0.1^9, length(unique(unlist(Lt2)))) - - AA<-GetCrCovYX(Ly1 = Ly1, Ly2= Ly2, Lt1=Lt1, Lt2=Lt2, Ymu1=Ymu1, Ymu2=Ymu2, bw1=2, bw2=2) - expect_equal( 0.0, mean(AA$smoothedCC), tol=1e-3 ) -}) - -test_that('The cross-covariance of two simple related process is correct. Same readings lengths.',{ - - set.seed(123) - N = 1111; - M = 101; - - # Define the continuum - s = seq(0,10,length.out = M) - - # Define the mean and 2 eigencomponents - eigFunct1 <- function(s) +cos(2*s*pi/10) / sqrt(5) - - # Create FPC scores - Ksi = matrix(rnorm(N*2), ncol=2); - Ksi = apply(Ksi, 2, scale) - Ksi = t(t(chol(matrix(c(5,3,3,4),2))) %*% t(Ksi)) - - # Create Y_true - yTrueA = Ksi[,1] %*% t(matrix(eigFunct1(s), ncol=1)) - yTrueB = Ksi[,2] %*% t(matrix(eigFunct1(s), ncol=1)) - - AA <- GetCrCovYX(Ly1 = yTrueB, Ly2 =yTrueA) - - # we know that the covariance between ksi_1 and ksi_2 is three - expect_equal( max(abs( eigFunct1(s)%*%t(eigFunct1(s))*3 - AA$rawCC$rawCCov )), 0.01, tol=.01, scale=1 ) -}) - -if (Sys.getenv('TRAVIS') != 'true') { # slow -test_that('The cross-covariance of two simple related process is correct. Same readings lengths.',{ - - set.seed(123) - N = 311; - M = 101; - - # Define the continuum - s = seq(0,10,length.out = M) - - # Define the mean and 2 eigencomponents - eigFunct1 <- function(s) +cos(2*s*pi/10) / sqrt(5) - - # Create FPC scores - Ksi = matrix(rnorm(N*2), ncol=2); - Ksi = apply(Ksi, 2, scale) - Ksi = t(t(chol(matrix(c(5,3,3,4),2))) %*% t(Ksi)) - - # Create Y_true - yTrueA = Ksi[,1] %*% t(matrix(eigFunct1(s), ncol=1)) - yTrueB = Ksi[,2] %*% t(matrix(eigFunct1(s), ncol=1)) - - ySparseA = Sparsify(yTrueA, s, c(3:5)) - ySparseB = Sparsify(yTrueB, s, c(3:5)) - - BB1 <- GetCrCovYX(Ly1 = ySparseA$Ly, Lt1 = ySparseA$Lt, Ly2 = ySparseB$Ly, Lt2 = ySparseB$Lt, - Ymu1 = rep(0,M), Ymu2 = rep(0,M), useGAM = TRUE ) - BB2 <- GetCrCovYX(Ly1 = ySparseA$Ly, Lt1 = ySparseA$Lt, Ly2 = ySparseB$Ly, Lt2 = ySparseB$Lt, - Ymu1 = rep(0,M), Ymu2 = rep(0,M), bw1=0.4, bw2=0.4 ) - BB3 <- GetCrCovYX(Ly1 = ySparseA$Ly, Lt1 = ySparseA$Lt, Ly2 = ySparseB$Ly, Lt2 = ySparseB$Lt, bwRoutine = 'l-bfgs-b', - Ymu1 = rep(0,M), Ymu2 = rep(0,M), ) - BB4 <- GetCrCovYX(Ly1 = ySparseA$Ly, Lt1 = ySparseA$Lt, Ly2 = ySparseB$Ly, Lt2 = ySparseB$Lt, bwRoutine = 'bobyqa', - Ymu1 = rep(0,M), Ymu2 = rep(0,M)) - # BB5 <- GetCrCovYX(Ly1 = ySparseA$Ly, Lt1 = ySparseA$Lt, Ly2 = ySparseB$Ly, Lt2 = ySparseB$Lt, # Too expensive / - # Ymu1 = rep(0,M), Ymu2 = rep(0,M), bwRoutine = 'grid-search' ) - - sSmall = seq(0,10,length.out = 51) - - # we know that the covariance between ksi_1 and ksi_2 is three - expect_equal( median(abs( eigFunct1(sSmall)%*%t(eigFunct1(sSmall))*3 - BB1$smoothedCC )), 0.02, tol=.02, scale=1 ) - expect_equal( median(abs( eigFunct1(sSmall)%*%t(eigFunct1(sSmall))*3 - BB2$smoothedCC )), 0.02, tol=.02, scale=1 ) - expect_equal( median(abs( eigFunct1(sSmall)%*%t(eigFunct1(sSmall))*3 - BB3$smoothedCC )), 0.02, tol=.02, scale=1 ) - expect_equal( median(abs( eigFunct1(sSmall)%*%t(eigFunct1(sSmall))*3 - BB4$smoothedCC )), 0.02, tol=.02, scale=1 ) - # expect_equal( median(abs( eigFunct1(sSmall)%*%t(eigFunct1(sSmall))*3 - BB5$smoothedCC )), 0.02, tol=.02, scale=1 ) - -})} - -test_that('The cross-covariance of two simple unrelated process is correct. Same readings lengths.',{ - - set.seed(123) - N = 1511; - M = 101; - - # Define the continuum - s = seq(0,10,length.out = M) - - # Define the mean and 2 eigencomponents - eigFunct1 <- function(s) +cos(2*s*pi/10) / sqrt(5) - eigFunct2 <- function(s) +sin(2*s*pi/10) / sqrt(5) - - # Create FPC scores - Ksi = matrix(rnorm(N*2), ncol=2); - Ksi = apply(Ksi, 2, scale) - Ksi = t(t(chol(matrix(c(5,3,3,4),2))) %*% t(Ksi)) - - # Create Y_true - yTrueA = Ksi[,1] %*% t(matrix(eigFunct1(s), ncol=1)) - yTrueB = Ksi[,2] %*% t(matrix(eigFunct2(s), ncol=1)) - - ySparseA = Sparsify(yTrueA, s, c(3:5)) - ySparseB = Sparsify(yTrueB, s, c(3:5)) - - BB1 <- GetCrCovYX(Ly1 = ySparseA$Ly, Lt1 = ySparseA$Lt, Ly2 = ySparseB$Ly, Lt2 = ySparseB$Lt, - Ymu1 = rep(0,M), Ymu2 = rep(0,M), useGAM = TRUE ) - - BB2 <- GetCrCovYX(Ly1 = ySparseA$Ly, Lt1 = ySparseA$Lt, Ly2 = ySparseB$Ly, Lt2 = ySparseB$Lt, - Ymu1 = rep(0,M), Ymu2 = rep(0,M), bw1=0.4, bw2=0.4 ) - - sSmall = seq(0,10,length.out = 51) - - # we know that the covariance between ksi_1 and ksi_2 is three - expect_equal( median(abs( eigFunct1(sSmall)%*%t(eigFunct2(sSmall))*3 - BB1$smoothedCC )), 0.02, tol=.01, scale=1 ) - expect_equal( median(abs( eigFunct1(sSmall)%*%t(eigFunct2(sSmall))*3 - BB2$smoothedCC )), 0.02, tol=.01, scale=1 ) - - # par(mfrow(1,3)) - # plot3D::persp3D(s,s, z= cov(yTrueA,yTrueB)) - # plot3D::persp3D(sSmall, sSmall, BB1$smoothedCC ) - # plot3D::persp3D(sSmall, sSmall, BB2$smoothedCC ) - -}) - -test_that('Dense Wiener process has cov(s,t) = min(s,t)', { - set.seed(4) - n <- 500 - nGridIn <- 51 - sparsity <- 1:5 # must have length > 1 - bw <- NA - T <- matrix(seq(0, 1, length.out=nGridIn)) - -## Corr(X(t), Y(t)) = 1/2 - A <- Wiener(n, T) - B <- Wiener(n, T) - C <- Wiener(n, T) - X <- A + B - Y <- A + C - - tmp <- GetCrCovYX(bw, bw, Ly1=X, Ly2=Y) - tmp1 <- GetCrCovYX(NULL, NULL, Ly1=X, Ly2=Y) - expect_equal(diag(tmp$rawCC$rawCCov), as.numeric(T), tolerance=0.1) - expect_equal(tmp, tmp1) # for dense data no smoothing is used. -}) - -test_that('Sparse Wiener process has cov(s,t) = min(s,t)', { - set.seed(4) - n <- 500 - nGridIn <- 51 - sparsity <- 1:5 # must have length > 1 - bw <- 0.2 - kern <- 'epan' - T <- matrix(seq(0, 1, length.out=nGridIn)) - -## Corr(X(t), Y(t)) = 1/2 - A <- Wiener(n, T) - B <- Wiener(n, T) - C <- Wiener(n, T)# + matrix((1:nGridIn) , n, nGridIn, byrow=TRUE) - X <- A + B - Y <- A + C - indEach <- lapply(1:n, function(x) sort(sample(nGridIn, sample(sparsity, 1)))) - tAll <- lapply(1:n, function(i) T[indEach[[i]]]) - Xsp <- lapply(1:n, function(i) X[i, indEach[[i]]]) - Ysp <- lapply(1:n, function(i) Y[i, indEach[[i]]]) - - tmp <- GetCrCovYX(bw, bw, Xsp, tAll, rep(0, nGridIn), Ysp, tAll, rep(0, nGridIn)) - #tmpGCV <- GetCrCovYX(NULL, NULL, Xsp, tAll, rep(0, nGridIn), Ysp, tAll, rep(0, nGridIn)) # Too costly test - expect_equal(diag(tmp$smoothedCC), as.numeric(T), tolerance=0.1, scale=1) - #expect_equal(diag(tmpGCV$smoothedCC), as.numeric(T), tolerance=0.15) -}) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetEigenAnalysisResults.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetEigenAnalysisResults.R deleted file mode 100644 index e5e9e241..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetEigenAnalysisResults.R +++ /dev/null @@ -1,35 +0,0 @@ -# devtools::load_all() -library(testthat) - -trueLam <- 4 / ((2 * (1:50) - 1 ) * pi) ^ 2 - -set.seed(1) -pts <- seq(0, 1, by=0.05) -regGrid <- seq(0, 1, by=0.01) -samp3 <- Wiener(50, pts, sparsify=length(pts)) -mu3 <- rep(0, length(pts)) - -# without error -p0 <- SetOptions(samp3$Ly, samp3$Lt, list(maxK=50, FVEthreshold=1, dataType='Sparse', error=FALSE, kernel='epan')) -noErrBin <- GetSmoothedCovarSurface(samp3$Ly, samp3$Lt, mu3, pts, regGrid, p0, useBinnedCov=TRUE) -tmp <- GetEigenAnalysisResults(noErrBin$smoothCov, regGrid, p0) - -# consistency test -test_that('Eigenvalues are close', { - expect_equal((abs(tmp$lam - trueLam[1:length(tmp$lam)]) / trueLam[1:length(tmp$lam)] )[1:3], trueLam[1:3], tolerance=0.2) -}) - -# TEst integrate to one. -innerProd <- apply(tmp$phi, 2, function(lam1) - apply(tmp$phi, 2, function(lam2) - pracma::trapz(noErrBin$outGrid, lam1 * lam2))) -test_that('Eigenfunctions are orthonormal', { - expect_equal(diag(innerProd), rep(1, tmp$kChoosen)) - expect_equal(innerProd[row(innerProd) != col(innerProd)], rep(0, length(innerProd) - nrow(innerProd)), tolerance=0.010) -}) - - -# # with error -# p1 <- SetOptions(samp3$Ly, samp3$Lt, CreateOptions(dataType='Sparse', error=TRUE, kernel='epan')) -# Err <- GetSmoothedCovarSurface(samp3$Ly, samp3$Lt, mu3, pts, regGrid, p1, useBinnedCov=FALSE) - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetNormalisedSample.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetNormalisedSample.R deleted file mode 100644 index 5b9c8057..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetNormalisedSample.R +++ /dev/null @@ -1,24 +0,0 @@ -# devtools::load_all() - -test_that('GetNormalisedSample output a homoscadestic sample', { - set.seed(1) - n <- 100 - M <- 51 - pts <- seq(0, 1, length.out=M) - mu <- rep(0, length(pts)) - sampDense <- MakeGPFunctionalData(n, M, mu, K=1, basisType='sin', sigma=0.01) - samp4 <- MakeFPCAInputs(tVec=sampDense$pts, yVec=sampDense$Yn) - res4E <- FPCA(samp4$Ly, samp4$Lt, list(error=TRUE)) - sampN <- GetNormalisedSample(res4E, errorSigma=TRUE) - sampN0 <- GetNormalisedSample(res4E, errorSigma=FALSE) - - # Cross-sectional standard deviation - sdCr <- apply(simplify2array(sampN$Ly), 1, sd) - sdCr0 <- apply(simplify2array(sampN0$Ly), 1, sd) - expect_equal(sdCr[-c(1:2, (M-1):M)], rep(1, M - 4), tolerance=1e-4) - expect_equal(sdCr0[-c(1:2, (M-1):M)], rep(1, M - 4), tolerance=1e-3) - - # CreatePathPlot(subset=1:20, inputData=samp4, obsOnly=TRUE, showObs=FALSE) - # CreatePathPlot(subset=1:20, inputData=sampN, obsOnly=TRUE, showObs=FALSE) - # CreatePathPlot(subset=1:20, inputData=sampN0, obsOnly=TRUE, showObs=FALSE) -}) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetRawCov.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetRawCov.R deleted file mode 100644 index 3a91a570..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetRawCov.R +++ /dev/null @@ -1,44 +0,0 @@ - -myEps <- .Machine$double.eps; -load(system.file('testdata', 'dataForGetRawCov.RData', package='fdapace')) -AA = GetRawCov(y,t, sort(unlist(t)), mu,'Sparse',TRUE) #Matches ML output -BB = GetRawCov(y,t, sort(unlist(t)), mu,'Sparse',FALSE) #Matches ML output - -test_that(" basic argument match MATLAB output ", { - expect_equal( sum(AA$indx) , 184, tolerance = 2*myEps, scale = 1) - expect_equal( sum(AA$cxxn) , -7.416002855888680, tolerance = 1e-13, scale = 1) - expect_equal( sum(AA$cyy) , 16.327874649330514, tolerance = 1e-13, scale = 1) - expect_equal( sum(AA$tPairs) , 4.053285461728229e+02, tolerance = 1e-12, scale = 1) -}) - -test_that(" basic argument match MATLAB output ", { - expect_equal( sum(BB$indx) , 298, tolerance = 2*myEps, scale = 1) - expect_equal( sum(BB$cxxn) , 16.327874649330514, tolerance = 1e-13, scale = 1) - expect_equal( sum(BB$cyy) , 16.327874649330514, tolerance = 1e-13, scale = 1) - expect_equal( sum(BB$tPairs) , 6.330209554605514e+02, tolerance = 1e-12, scale = 1) -}) - -y2 = list(1:10, 2:11) -t2 = list( 1:10, 1:10) - -CC = GetRawCov(y2,t2, sort(unique(unlist(t2))), seq(1.5,10.5, length.out=10) ,'Dense',TRUE) #Matches ML output -DD = GetRawCov(y2,t2, sort(unique(unlist(t2))), seq(1.5,10.5, length.out=10) ,'Dense',FALSE) #Matches ML output -# DD = getRawCov(y2,t2, sort(unique(cell2mat(t2))), linspace(1.5,10.5, 10), 2, 0) - - -test_that(" basic argument match MATLAB output ", { - expect_equal( sum(CC$indx) , 0, tolerance = 2*myEps, scale = 1) - expect_equal( sum(CC$cxxn) , 22.5, tolerance = 1e-13, scale = 1) - expect_equal( sum(CC$cyy) , 25, tolerance = 1e-13, scale = 1) - expect_equal( sum(CC$tPairs) , 990, tolerance = 1e-12, scale = 1) -}) - - -test_that(" basic argument match MATLAB output ", { - expect_equal( sum(DD$indx) , 0, tolerance = 2*myEps, scale = 1) - expect_equal( sum(DD$cxxn) , 25, tolerance = 1e-13, scale = 1) - expect_equal( sum(DD$cyy) , 25, tolerance = 1e-13, scale = 1) - expect_equal( sum(DD$tPairs) , 1100, tolerance = 1e-12, scale = 1) -}) - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetRawCrCovFuncFunc.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetRawCrCovFuncFunc.R deleted file mode 100644 index aa55324a..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetRawCrCovFuncFunc.R +++ /dev/null @@ -1,70 +0,0 @@ -# devtools::load_all() -library(testthat) -#source('GetRawCrCovFuncFunc.R') - -# These check out OK. -test_that("basic R output matche MATLAB output for different means", { - - # simplest case - AA = GetRawCrCovFuncFunc( Ly1 = list(c(5,0,3)), Lt1 = list(c(1,2,3)), Ymu1 = c(1,4,5), - Ly2 = list(c(1,5)), Lt2 = list(c(1,2)), Ymu2 = c(6,5)) - # t_x = {[1 2 3]}; x= {[5 0 3]}; y ={[1 5]}; t_y={[1 2]}; mu_x = [1,4, 5]; mu_y = [6 5]; isYFun=1; regular=0; - - # simplest case different means - BB = GetRawCrCovFuncFunc( Ly1 = list(c(5,0,3)), Lt1 = list(c(1,2,3)), Ymu1 = c(1,4,15), - Ly2 = list(c(1,5)), Lt2 = list(c(1,2)), Ymu2 = c(6,15)) - # t_x = {[1 2 3]}; x= {[5 0 3]}; y ={[1 5]}; t_y={[1 2]}; mu_x = [1,4, 15]; mu_y = [6 15]; isYFun=1; regular=0; - - # simple case with single value elements - CC = GetRawCrCovFuncFunc( Ly1 = list(c(5,0,3),c(4)), Lt1 = list(c(1,2,3),c(3)), Ymu1 = c(1,4,15), - Ly2 = list(c(1,5),c(5)), Lt2 = list(c(1,2),c(1)), Ymu2= c(6,15)) - # t_x = {[1 2 3],[3]}; x= {[5 0 3],[4]}; y ={[1 5],[5]}; t_y={[1 2],[1]}; mu_x = [1,4, 15]; mu_y = [6 15]; isYFun=1; regular=0; - - # simple case with just two vectors each - DD = GetRawCrCovFuncFunc( Ly1 = list(c(5,0,3),c(1,4,8)), Lt1 = list(c(1,2,3),c(1,3,8)), Ymu1 = c(1,4,15,16), - Ly2 = list(c(1,5),c(5)), Lt2 = list(c(1,2),c(1)), Ymu2= c(6,15)) - # t_x = {[1 2 3],[1 3 8]}; x= {[5 0 3],[1 4 8]}; y ={[1 5],[5]}; t_y={[1 2],[1]}; mu_x = [1,4, 15, 16]; mu_y = [6 15]; isYFun=1; regular=0; - - # simple case with just two vectors but extended grid - EE = GetRawCrCovFuncFunc( Ly1 = list(c(5,0,3),c(1,4,8)), Lt1 = list(c(1,2,3),c(1,3,8)), Ymu1 = c(1,4,15,16), - Ly2 = list(c(1,5),c(5)), Lt2 = list(c(1,2),c(16)), Ymu2= c(6,15,15)) - # t_x = {[1 2 3],[1 3 8]}; x= {[5 0 3],[1 4 8]}; y ={[1 5],[5]}; t_y={[1 2],[16]}; mu_x = [1,4, 15, 16]; mu_y = [6 15 15]; isYFun=1; regular=0; - - # simple case with three vectors each many duplicate elements - FF = GetRawCrCovFuncFunc( Ly1 = list(c(5,0,3),c(1,4,8), c(1,2)), Lt1 = list(c(1,2,3),c(1,3,8), c(1,2)), Ymu1 = c(1,4,15,16), - Ly2 = list(c(1,5),c(1:5), c(11, 31)), Lt2 = list(c(1,2),c(16:20), c(1,2)), Ymu2= c(6,15,15,0,0,0,0)) - # t_x = {[1 2 3],[1 3 8],[1 2]}; x= {[5 0 3],[1 4 8], [1 2]}; mu_x = [1,4, 15, 16]; t_y = {[1 2], [16:20] [1 2]}; y ={[1 5], [1:5], [11 31]}; mu_y = [6 15 15 0 0 0 0 ]; isYFun=1; regular=0; - - expect_equal( as.vector(AA$tpairn), c(1, 1, 2, 2, 3, 3, 1, 2, 1, 2, 1, 2) ) - expect_equal( AA$rawCCov, c(-20, 0, 20, 0, 10, 0)) - - expect_equal( as.vector(BB$tpairn), c(1, 1, 2, 2, 3, 3, 1, 2, 1, 2, 1, 2) ) - expect_equal( BB$rawCCov, c(-20, -40, 20, 40, 60, 120)) - - expect_equal( as.vector(CC$tpairn), c(1, 1, 2, 2, 3, 3, 3, 1, 2, 1, 2, 1, 2, 1) ) - expect_equal( CC$rawCCov, c(-20, -40, 20, 40, 60, 120, 11)) - - expect_equal( as.vector(DD$tpairn), c(1, 1, 2, 2, 3, 3, 1, 3, 8, 1, 2, 1, 2, 1, 2, 1, 1, 1) ) - expect_equal( DD$rawCCov, c(-20, -40, 20, 40, 60, 120, 0, 11, 8)) - - expect_equal( as.vector(EE$tpairn), c( 1, 1, 2, 2, 3, 3, 1, 3, 8, 1, 2, 1, 2, 1, 2, 16, 16, 16 ) ) - expect_equal( EE$rawCCov, c(-20, -40, 20, 40, 60, 120, 0, 110, 80)) - - expect_equal( as.vector(FF$tpairn), c(1, 1, 2, 2, 3, 3, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 8, 8, 8, 8, 8, 1, 1, 2, 2, 1, 2, 1, 2, 1, 2, 16, 17, 18, 19, 20, 16, 17, 18, 19, 20, 16, 17, 18, 19, 20, 1, 2, 1, 2 ) ) - expect_equal( FF$rawCCov, c( -20, -40, 20, 40, 60, 120, 0, 0, 0, 0, 0, 154, -22, -33, -44, -55, 112, -16, -24, -32, -40, 0, 0, -10, -32)) -}) - -test_that('Binned rawCC is the same as unbinned', { - Ly1 <- list(c(5,0,3),c(1,4,8), c(1,2)) - Lt1 <- list(c(1,2,3),c(1,3,8), c(1,2)) - Ymu1 <- c(1,4,15,16) - Ly2 <- list(c(1,5),c(1:5), c(11, 31)) - Lt2 <- list(c(1,2),c(16:20), c(1,2)) - Ymu2 <- c(6,15,15,0,0,0,0) - FF <- GetRawCrCovFuncFunc(Ly1, Lt1, Ymu1, Ly2, Lt2, Ymu2) - FFbin <- BinRawCov(FF) - - expect_equal(weighted.mean(FFbin$meanVals, FFbin$count), mean(FF$rawCCov)) - expect_equal(sort(unique(FFbin$tPairs[, 1])), sort(unique(FF$tpairn[, 1]))) - expect_equal(sort(unique(FFbin$tPairs[, 2])), sort(unique(FF$tpairn[, 2]))) -}) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetRawCrCovFuncScal.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetRawCrCovFuncScal.R deleted file mode 100644 index 8a03082f..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetRawCrCovFuncScal.R +++ /dev/null @@ -1,39 +0,0 @@ -library(testthat) -#source('GetRawCrCovFuncScal.R') - -# These check out OK. -test_that("basic R output matche MATLAB output for different means", { - - # simplest case - AA = GetRawCrCovFuncScal(list(c(5,5,5),c(2,2,2)), list(c(1,2,3), c(1,3,5)), c(1,2,3,4),Z =c(4,5), Zmu = 4) - # t_x = {[1,2,3], [1,3,5]} ; x= {[5 5 5], [2 2 2]}; y =[ 4 5]; t_y=[]; mu_x = [1,2,3,4]; mu_y = 4; isYFun=0; regular=0; - - # simplest case different E[Y] - BB = GetRawCrCovFuncScal(list(c(5,5,5),c(2,2,2)), list(c(1,2,3), c(1,3,5)), c(1,2,3,4),Z =c(4,5), Zmu = 6) - # t_x = {[1,2,3], [1,3,5]} ; x= {[5 5 5], [2 2 2]}; y =[ 4 5]; t_y=[]; mu_x = [1,2,3,4]; mu_y = 6; isYFun=0; regular=0; - - # simple case more readings per sample - CC = GetRawCrCovFuncScal(list(c(5,5,5,0),c(2,2,2,0)), list(c(1,2,3,8), c(1,3,5,8)), c(1,2,3,4,1),Z =c(4,5), Zmu =6) - # t_x = {[1,2,3,8], [1,3,5,8]} ; x= {[5 5 5 0], [2 2 2 0]}; y =[ 4 5]; t_y=[]; mu_x = [1,2,3,4,1]; mu_y = 6; isYFun=0; regular=0; - - # simple case more three curves - DD = GetRawCrCovFuncScal(list(c(5,5,5,0),c(2,2,2,0),c(1,2,5)), list(c(1,2,3,8), c(1,3,5,8), c(1,2,5)), c(1,2,3,4,1),Z =c(4,5,0), Zmu = 0) - # t_x = {[1,2,3,8],[1,3,5,8],[1,2,5]} ; x= {[5 5 5 0],[2 2 2 0],[1 2 5]}; y =[ 4 5 0]; t_y=[]; mu_x = [1,2,3,4,1]; mu_y = 0; isYFun=0; regular=0; - - # simple case readings with single measurement - EE = GetRawCrCovFuncScal(list(c(5,5,5,0),c(2)), list(c(1,2,3,8), c(5)), c(1,2,3,4,1),Z =c(4,5), Zmu = 6) - # t_x = {[1,2,3,8], [5]} ; x= {[5 5 5 0], [2]}; y =[ 4 5]; t_y=[]; mu_x = [1,2,3,4,1]; mu_y = 6; isYFun=0; regular=0; - - expect_equal( AA$tpairn, c(1,2,3,1,3,5)) - expect_equal( BB$tpairn, c(1,2,3,1,3,5)) - expect_equal( CC$tpairn, c(1,2,3,8,1,3,5,8)) - expect_equal( DD$tpairn, c(1,2,3,8,1,3,5,8,1,2,5)) - expect_equal( EE$tpairn, c(1,2,3,8,5)) - - expect_equal( AA$rawCCov, c(0, 0, 0, 1,-1,-2)) - expect_equal( BB$rawCCov, c(-8,-6,-4,-1,1,2)) - expect_equal( CC$rawCCov, c(-8,-6,-4,2,-1,1,2,1)) - expect_equal( DD$rawCCov, c(16,12,8,-4, 5,-5,-10,-5,0,0,0)) - expect_equal( EE$rawCCov, c(-8,-6,-4,2,2)) - -}) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetRho.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetRho.R deleted file mode 100644 index d0e8a02c..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetRho.R +++ /dev/null @@ -1,91 +0,0 @@ -# devtools::load_all() -#options(error=recover) -library(testthat) - -# set up -y <- list(c(1, 2), 4, c(0, 2, 3)) -t <- list(c(1.5, 2.5), 2, c(1, 1.5, 2.5)) -obsGrid <- seq(0, 3, length.out=7) -mu <- obsGrid -pts <- seq(0, 1, length.out=7) -phi <- cbind(sin(2 * pi * pts), cos(2 * pi * pts)) -lambda <- c(6, 1) -rho <- 0.5 -fittedCov <- phi %*% diag(lambda) %*% t(phi) - - -# RandTime -test_that('RandTime is the same as getTimeID', - expect_equal(RandTime(t, isRandom=FALSE), c(2, 1, 2))) - - -# cvRho -leaveOutInd <- RandTime(t, isRandom=FALSE) -test_that('cvRho matches getScores2', - expect_equal(cvRho(0.5, leaveOutInd, y, t, list(), mu, obsGrid, - fittedCov, lambda, phi), 0.775069444444445)) - - -test_that('GetRho matches cv_rho.m', - expect_equal(GetRho(y, t, list(), mu, obsGrid, fittedCov, lambda, phi, 0.01), 0.510049017252264) - ) - -# test_that('cvRho for example.m are almost the same', { -# load(system.file('testdata', '200curvesByExampleSeed123.RData', package='fdapace')) -# load(system.file('testdata', 'exampleResultsFromMatlab.RData', package='fdapace')) -# tmpCov <- ConvertSupport(res$out21, res$out1, Cov=res$xcovfit) -# expect_equal(GetRho(y, t, list(), res$mu, res$out1, tmpCov, as.numeric(res$lambda), res$phi, as.numeric(res$sigma)), 0.939907526613129, tolerance=1e-2) -# }) - -test_that('Truncation works for GetRho', { - set.seed(1) - n <- 20 - pts <- signif(seq(0, 1, by=0.05), 14) - truncPts <- signif(seq(0.1, 0.9, 0.05), 14) - mu <- rep(0, length(pts)) - samp4 <- Wiener(n, pts) + rnorm(n * length(pts), sd=0.1) - samp4 <- Sparsify(samp4, pts, 10) - samp4$Ly[[1]] <- samp4$Lt[[1]] <- c(0, 1) - samp4Trunc <- TruncateObs(samp4$Ly, samp4$Lt, truncPts) - pTrunc <- SetOptions(samp4$Ly, samp4$Lt, list(dataType='Sparse', error=TRUE, kernel='epan', verbose=TRUE)) - smc4 <- GetSmoothedCovarSurface(samp4$Ly, samp4$Lt, mu, pts, pts, pTrunc) - eig4 <- GetEigenAnalysisResults(smc4$smoothCov, pts, pTrunc) - phiObs <- ConvertSupport(pts, truncPts, phi=eig4$phi) - CovObs <- ConvertSupport(pts, truncPts, Cov=eig4$fittedCov) - - rho4 <- GetRho(samp4Trunc$Ly, samp4Trunc$Lt, pTrunc, mu[1:length(truncPts)], truncPts, CovObs, eig4$lambda, phiObs, smc4$sigma2) - expect_true(rho4 < 0.2) -}) - -# # Matlab code: -# y{1} = [1, 2]; y{2} = [4]; y{3} = [0, 2, 3] -# t{1} = [1.5, 2.5]; t{2} = [2]; t{3} = [1, 1.5, 2.5] -# ni = cellfun(@length, y); -# mu = linspace(0, 3, 7); -# out1 = linspace(0, 3, 7); -# pts = linspace(0, 1, 7); -# phi = [sin(2 * pi * pts)', cos(2 * pi * pts)']; -# lambda = [6, 1]; -# sigma = 0; -# sig1 = 0.4; -# noeig = 2; -# error = 1; -# method = 'CE'; -# shrink = 0; -# regular = 0; -# rho = 0; -# [muSub, phiSub] = convertMuPhi(t, out1, mu, phi, regular); -# LAMBDA = diag(lambda); -# rho = 0.5; -# subID = [1 3]; -# tjID = [2 1 2 3]; -# verbose = false; - -# getScores2(y, t, mu, phi, lambda, sigma, sig1, noeig, error, method, shrink, out1, regular, muSub, phiSub, LAMBDA, rho, subID, tjID) - -# T = range(out1); -# gamma = ((trapz(out1, mu.^2)+sum(lambda))/T)^(0.5); -# alpha = linspace(0.01, 0.22,50); -# rho = gamma*alpha; -# cv_rho(y, t, mu, phi, lambda, sigma, sig1, noeig, error, method, shrink, out1, regular, rho, ni, tjID, verbose) - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetSmoothedCovarSurface.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetSmoothedCovarSurface.R deleted file mode 100644 index 739a4597..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetSmoothedCovarSurface.R +++ /dev/null @@ -1,52 +0,0 @@ -# devtools::load_all() -library(testthat) - -# GMeanAndGCV - -set.seed(1) -pts <- seq(0, 1, by=0.05) -regGrid <- seq(0, 1, by=0.1) -samp3 <- Wiener(50, pts, sparsify=length(pts)) -mu3 <- rep(0, length(pts)) - -# without error -p0 <- SetOptions(samp3$Ly, samp3$Lt, list(dataType='Sparse', error=FALSE, kernel='epan')) -noErr <- GetSmoothedCovarSurface(samp3$Ly, samp3$Lt, mu3, pts, regGrid, p0, useBinnedCov=FALSE) - -# with error -p1 <- SetOptions(samp3$Ly, samp3$Lt,list(dataType='Sparse', error=TRUE, kernel='epan')) -Err <- GetSmoothedCovarSurface(samp3$Ly, samp3$Lt, mu3, pts, regGrid, p1, useBinnedCov=FALSE) - -# unit tests: test the interface. -rcov3 <- GetRawCov(samp3$Ly, samp3$Lt, pts, mu3, p1$dataType, p1$error) -system.time(tmp <- GCVLwls2DV2(pts, regGrid=regGrid, kern='epan', rcov=rcov3, t=samp3$Lt)) -gcvBW3 <- sqrt(tmp$h * tmp$minBW) -sigma23 <- PC_CovE(pts, regGrid, gcvBW3, kernel='epan', rcov=rcov3, rotationCut=c(0.25, 0.75))$sigma2 -test_that('Smooth Cov Surface interface is right', { - expect_equal(rcov3, Err$rawCov) - expect_equal(as.numeric(gcvBW3), Err$bwCov, tolerance = 0.01, scale = 1) - # expect_equal(gcvBW3, Err$bwCov, tolerance = 0.05) // If someone gets time check why this doesn't work perfectly. - # Entry (11,11) is different tha expected and I think this is a boundary issue but I am not sure. - # This problem is only with the Epan kern, rect and gauss are fine. - expect_equal(sigma23, Err$sigma2, tolerance = 0.1) -}) - -# GCV -p2 <- SetOptions(samp3$Ly, samp3$Lt, list(methodBwCov='GCV', dataType='Sparse', error=FALSE, kernel='epan')) -tmp2 <- GetSmoothedCovarSurface(samp3$Ly, samp3$Lt, mu3, pts, regGrid, p2, useBinnedCov=FALSE) -sum((diag(tmp2$smoothCov) - seq(0, 1, by=0.1))^2) - -# CV -p3 <- SetOptions(samp3$Ly, samp3$Lt, list(methodBwCov='CV', dataType='Sparse', error=FALSE, kernel='epan')) -system.time(tmp3 <- GetSmoothedCovarSurface(samp3$Ly, samp3$Lt, mu3, pts, regGrid, p3, useBinnedCov=FALSE)) -sum((diag(tmp3$smoothCov) - seq(0, 1, by=0.1))^2) - -# truncation. -pTrunc <- SetOptions(samp3$Ly, samp3$Lt,list(dataType='Sparse', error=FALSE, kernel='epan', outPercent=c(0.01, 0.99))) -noErrTrunc <- GetSmoothedCovarSurface(samp3$Ly, samp3$Lt, mu3, pts, regGrid, pTrunc, useBinnedCov=FALSE) -test_that('Cov Surface truncation works', { - expect_equal(noErr$smoothedCov[2:10, 2:10], noErrTrunc$smoothedCov) - expect_equal(noErr$rawCov, noErrTrunc$rawCov) - expect_equal(noErr$bwCov, noErrTrunc$bwCov) - expect_equal(noErr$sigma2, noErrTrunc$sigma2) -}) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetSmoothedMeanCurve.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetSmoothedMeanCurve.R deleted file mode 100644 index f15c4f81..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_GetSmoothedMeanCurve.R +++ /dev/null @@ -1,36 +0,0 @@ - cat("\nTests for 'GetSmoothedMeanCurve.R'") -library(testthat) -load(system.file('testdata', 'dataGeneratedByExampleSeed123.RData', package='fdapace')) - -p = list(kernel='epan') -optns = SetOptions(y,t,p) -out1 = sort(unique( c(unlist(t), optns$newdata))); -out21 = seq(min(out1), max(out1),length.out = 30); - -test_that("basic that the Epan. kernel gives the same results as MATLAB", { - - smcObj = GetSmoothedMeanCurve(y=y, t=t, obsGrid = out1, regGrid = out21, optns = optns) - #expect_equal( sum(smcObj$mu) , 1.176558873333339e+02,tolerance = 1e-13, scale = 1 ) # Original - - expect_equal( sum(smcObj$mu) , 1.176558873333339e+02,tolerance = 4, scale = 1 ) # New - } ) - -test_that("basic that the Rect. kernel gives the same results as MATLAB", { - - optns$kernel = 'rect'; - smcObj = GetSmoothedMeanCurve(y=y, t=t, obsGrid = out1, regGrid = out21, optns = optns) - expect_equal( sum(smcObj$mu) , 1.186398254457767e+02,tolerance = 6, scale = 1 )# New - - } ) - - - -test_that("basic that the Gaussian kernel gives the same results as MATLAB", { - - optns$kernel = 'gauss'; - smcObj = GetSmoothedMeanCurve(y=y, t=t, obsGrid = out1, regGrid = out21, optns = optns) - expect_equal( sum(smcObj$mu) , 1.206167514696777e+02,tolerance =4 , scale = 1 )# New - - } ) - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_IsRegular.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_IsRegular.R deleted file mode 100644 index fbb8a0ef..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_IsRegular.R +++ /dev/null @@ -1,11 +0,0 @@ -cat("\ntests for 'IsRegular'") - -test_that("basic valid lists arguments do not return any errors", { - expect_equal(IsRegular(list(c(1,2,3,4), c(1,2,3,4), c(1,2,3,4))), 'Dense') - expect_equal(IsRegular(list(c(1,2,3 ), c(1,2,3,4), c(1,2,3,4))), 'DenseWithMV') - expect_equal(IsRegular(list(c(1,2 ), c(1,2,3 ), c(1,2,3,4))), 'Sparse') -} -) - -cat("\nexcept for dense but irregular case") -IsRegular(list(c(1,2,3,5),c(1,2,3,5),c(1,2,3,5))) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_Lwls2D.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_Lwls2D.R deleted file mode 100644 index 718772b0..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_Lwls2D.R +++ /dev/null @@ -1,67 +0,0 @@ -# devtools::load_all() -library(testthat) - -# as in test_Rmullwlsk.R -try(silent=TRUE, load(system.file('testdata', 'InputFormMllwlskInCpp.RData', package='fdapace'))) -#try(silent=TRUE, load(system.file('testdata', 'InputFormMllwlskInCpp.RData', package='fdapace'))) - -IN = InputFormMllwlskInCpp -if(1==1){ - - test_that('Lwls2D interface is correct using xout1 and xout2', { - AA = Rmullwlsk(2* IN$bw,t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='gauss',win=rep(1,38), FALSE) - BB = Rmullwlsk(2* IN$bw,t(IN$tPairs),cxxn=IN$cxxn, xgrid=sort(unique(IN$tPairs[, 1])), ygrid=sort(unique(IN$tPairs[, 2])), kernel_type='gauss',win=rep(1,38), FALSE) - CC = Rmullwlsk(2* IN$bw,t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='epan',win=rep(1,38), FALSE) - DD = Rmullwlsk(2* IN$bw,t(IN$tPairs),cxxn=IN$cxxn, xgrid=sort(unique(IN$tPairs[, 1])), ygrid=sort(unique(IN$tPairs[, 2])), kernel_type='epan',win=rep(1,38), FALSE) - expect_equal(Lwls2D(2* IN$bw, kern='gauss', IN$tPairs, IN$cxxn, xout1=IN$regGrid, xout2=IN$regGrid), AA) - expect_equal(Lwls2D(2* IN$bw, kern='gauss', IN$tPairs, IN$cxxn), BB) - expect_equal(Lwls2D(2* IN$bw, kern='epan', IN$tPairs, IN$cxxn, xout1=IN$regGrid, xout2=IN$regGrid), CC) - expect_equal(Lwls2D(2* IN$bw, kern='epan', IN$tPairs, IN$cxxn), DD) - }) - - - test_that('Lwls2D interface is correct using xout', { - AA = diag(Rmullwlsk(2* IN$bw,t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='gauss',win=rep(1,38), FALSE)) - BB = diag(Rmullwlsk(2* IN$bw,t(IN$tPairs),cxxn=IN$cxxn, xgrid=sort(unique(IN$tPairs[, 1])), ygrid=sort(unique(IN$tPairs[, 2])), kernel_type='gauss',win=rep(1,38), FALSE)) - CC = diag(Rmullwlsk(2* IN$bw,t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='epan',win=rep(1,38), FALSE)) - DD = diag(Rmullwlsk(2* IN$bw,t(IN$tPairs),cxxn=IN$cxxn, xgrid=sort(unique(IN$tPairs[, 1])), ygrid=sort(unique(IN$tPairs[, 2])), kernel_type='epan',win=rep(1,38), FALSE)) - expect_equal(Lwls2D(2* IN$bw, kern='gauss', IN$tPairs, IN$cxxn, xout=cbind(IN$regGrid, IN$regGrid)), AA, tolerance=0.05) - expect_equal(Lwls2D(2* IN$bw, kern='gauss', IN$tPairs, IN$cxxn, xout=cbind(sort(unique(IN$tPairs[, 1])), sort(unique(IN$tPairs[, 2])))), BB) - expect_equal(Lwls2D(2* IN$bw, kern='epan', IN$tPairs, IN$cxxn, xout=cbind(IN$regGrid, IN$regGrid)), CC, tolerance=0.05) - expect_equal(Lwls2D(2* IN$bw, kern='epan', IN$tPairs, IN$cxxn, xout=cbind(sort(unique(IN$tPairs[, 1])), sort(unique(IN$tPairs[, 2])))), DD) - }) - -} - -if(1==1){ - - test_that('Lwls2D interface is correct using xout1 and xout for crosscovariances', { - - tPairs = matrix(c(1,3,4,1,2,1,1,2,3,4), ncol=2) - - AA = Lwls2D(bw=c(0.5,0.5), kern ='gauss', xin=tPairs, yin=c(1,2,3,4,5), xout1=as.numeric(c(1,4)), xout2=as.numeric(c(1,4)), crosscov=TRUE); - AA2 = Lwls2D(bw=c(0.5,0.5), kern ='gauss', xin=cbind(tPairs[, 2], tPairs[, 1]), yin=c(1,2,3,4,5), xout1=as.numeric(c(1,4)), xout2=as.numeric(c(1,4)), crosscov=TRUE); - BB = Lwls2D(bw=c(0.5,5.0), kern ='gauss', xin=tPairs, yin=c(1,2,3,4,5), xout1=as.numeric(c(1,4)), xout2=as.numeric(c(1,4)), crosscov=TRUE); - CC = Lwls2D(bw=c(5.0,5.0), kern ='gauss', xin=tPairs, yin=c(1,2,3,4,5), xout1=as.numeric(c(1,4)), xout2=as.numeric(c(1,4)), crosscov=TRUE); - DD = Lwls2D(bw=c(5.0,5.0), kern ='gauss', xin=tPairs, yin=c(1,2,3,4,5), xout1=as.numeric(c(1,4)), xout2=as.numeric(c(1,40)), crosscov=TRUE); - ZZ = Lwls2D(bw=c(5.0,0.5), kern ='gauss', xin=tPairs, yin=c(1,2,3,4,5), xout1=as.numeric(c(1,4)), xout2=as.numeric(c(1,4,4.5)), crosscov=TRUE); - # MATLAB equiv. - # [invalid, AA]= mullwlsk_2([0.5,0.5], 'gauss', [1 3 4 1 2; 1 1 2 3 4], [1 2 3 4 5]', [1 1 1 1 1], [1 4], [1 4]) - # [invalid, BB]= mullwlsk_2([0.5,5.0], 'gauss', [1 3 4 1 2; 1 1 2 3 4], [1 2 3 4 5]', [1 1 1 1 1], [1 4], [1 4]) - # [invalid, CC]= mullwlsk_2([5.0,5.0], 'gauss', [1 3 4 1 2; 1 1 2 3 4], [1 2 3 4 5]', [1 1 1 1 1], [1 4], [1 4]) - # [invalid, DD]= mullwlsk_2([5.0,5.0], 'gauss', [1 3 4 1 2; 1 1 2 3 4], [1 2 3 4 5]', [1 1 1 1 1], [1 4], [1 40]) - # [invalid, ZZ]= mullwlsk_2([5.0,0.5], 'gauss', [1 3 4 1 2; 1 1 2 3 4], [1 2 3 4 5]', [1 1 1 1 1], [1 4], [1 4 4.5]); sum( ZZ(:)) - - expect_equal(AA, t(AA2)) - expect_equal(13.997323601735092, sum(AA), tolerance=1e-9) - expect_equal(13.498112821557918, sum(BB), tolerance=1e-9) - expect_equal(13.669203283501956, sum(CC), tolerance=1e-9) - expect_equal(89.458361008948557, sum(DD), tolerance=1e-9) - expect_equal(24.498113242794656, sum(ZZ), tolerance=1e-9) - }) - -} - - - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_Lwls2DDeriv.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_Lwls2DDeriv.R deleted file mode 100644 index cb492889..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_Lwls2DDeriv.R +++ /dev/null @@ -1,198 +0,0 @@ -# devtools::load_all() -library(testthat) -# library(scatterplot3d) - -try(silent=TRUE, load(system.file('testdata', 'InputFormMllwlskInCpp.RData', package='fdapace'))) -IN <- InputFormMllwlskInCpp - - -test_that('Lwls2DDeriv original curve is correct', { - A1 <- Lwls2D(2* IN$bw, kern='gauss', IN$tPairs, IN$cxxn, xout1=IN$regGrid, xout2=IN$regGrid, crosscov=TRUE) - A2 <- Lwls2DDeriv(2* IN$bw, kern='gauss', IN$tPairs, IN$cxxn, xout1=IN$regGrid, xout2=IN$regGrid, crosscov=TRUE) - B1 <- Lwls2D(2* IN$bw, kern='gauss', IN$tPairs, IN$cxxn, crosscov=TRUE) - B2 <- Lwls2DDeriv(2* IN$bw, kern='gauss', IN$tPairs, IN$cxxn, crosscov=TRUE) - C1 <- Lwls2D(2* IN$bw, kern='epan', IN$tPairs, IN$cxxn, xout1=IN$regGrid, xout2=IN$regGrid, crosscov=TRUE) - C2 <- Lwls2DDeriv(2* IN$bw, kern='epan', IN$tPairs, IN$cxxn, xout1=IN$regGrid, xout2=IN$regGrid, crosscov=TRUE) - D1 <- Lwls2D(2* IN$bw, kern='epan', IN$tPairs, IN$cxxn, crosscov=TRUE) - D2 <- Lwls2DDeriv(2* IN$bw, kern='epan', IN$tPairs, IN$cxxn, crosscov=TRUE) - expect_equal(A1, A2) - expect_equal(B1, B2) - expect_equal(C1, C2) - expect_equal(D1, D2) -}) - - -test_that('bilinear regression function', { - n <- 500 - bw <- 0.7 - outGrid <- seq(-1, 1, by=0.05) - sigma <- 0.1 - f <- function(x, y) -(2 * x + y) - - set.seed(1) - xin <- matrix(runif(2 * n, -1, 1), ncol=2) - yin <- apply(xin, 1, function(x) f(x[1], x[2])) - inGrid <- seq(-1, 1, length.out=floor(sqrt(n))) - xinReg <- expand.grid(inGrid, inGrid) - yinReg <- apply(xinReg, 1, function(x) f(x[1], x[2])) - - # scatterplot3d(xin[, 1], xin[, 2], yin) - # scatterplot3d(xinReg[, 1], xinReg[, 2], yinReg) - - # Noisy observations - bwn <- 1 - yinNoisy <- yin + rnorm(length(yin), sd=sigma) - yinRegNoisy <- yinReg + rnorm(length(yinReg), sd=sigma) - # rgl::persp3d(inGrid, inGrid, yinRegNoisy, xlab='t1', ylab='t2') - - for (kern in c('gauss', 'epan')) { - # Noiseless - # Naming: results{npoly}{nder1}{nder2} - resOld <- Lwls2D(bw, kern, xin, yin, xout1=outGrid, xout2=outGrid, crosscov=TRUE) - d100 <- Lwls2DDeriv(bw, kern, xin, yin, xout1=outGrid, xout2=outGrid, npoly=1, nder1=0, nder2=0, crosscov=TRUE) - d110 <- Lwls2DDeriv(bw, kern, xin, yin, xout1=outGrid, xout2=outGrid, npoly=1, nder1=1, nder2=0) - d101 <- Lwls2DDeriv(bw, kern, xin, yin, xout1=outGrid, xout2=outGrid, npoly=1, nder1=0, nder2=1) - d211 <- Lwls2DDeriv(bw, kern, xin, yin, xout1=outGrid, xout2=outGrid, npoly=2, nder1=1, nder2=1) - # rgl::persp3d(outGrid, outGrid, d100) - - expect_equal(d100, sapply(outGrid, function(y) sapply(outGrid, function(x) f(x, y)))) - expect_equal(resOld, d100) - expect_equal(d110, matrix(-2, nrow(d110), ncol(d110))) - expect_equal(d101, matrix(-1, nrow(d101), ncol(d101))) - expect_equal(d211, matrix(0, nrow(d211), ncol(d211))) - - # Noisy - d100n <- Lwls2DDeriv(bwn, kern, xin, yinNoisy, xout1=outGrid, xout2=outGrid, npoly=1, nder1=0, nder2=0, crosscov=TRUE) - d110n <- Lwls2DDeriv(bwn, kern, xin, yinNoisy, xout1=outGrid, xout2=outGrid, npoly=1, nder1=1, nder2=0) - d101n <- Lwls2DDeriv(bwn, kern, xin, yinNoisy, xout1=outGrid, xout2=outGrid, npoly=1, nder1=0, nder2=1) - # d111n <- Lwls2DDeriv(bwn, kern, xin, yinNoisy, xout1=outGrid, xout2=outGrid, npoly=1, nder1=1, nder2=1) - d211n <- Lwls2DDeriv(1, kern, xin, yinNoisy, xout1=outGrid, xout2=outGrid, npoly=2, nder1=1, nder2=1) - # rgl::persp3d(outGrid, outGrid, d100n) - # rgl::persp3d(outGrid, outGrid, d110n) - # rgl::persp3d(outGrid, outGrid, d101n) - # # rgl::persp3d(outGrid, outGrid, d111n) - # rgl::persp3d(outGrid, outGrid, d211n) - - expect_equal(d100n, sapply(outGrid, function(y) sapply(outGrid, function(x) f(x, y))), tolerance=1e-2) - expect_equal(d110n, matrix(-2, nrow(d110n), ncol(d110n)), tolerance=5e-2) - expect_equal(d101n, matrix(-1, nrow(d101n), ncol(d101n)), tolerance=5e-2) - expect_equal(d211n, matrix(0, nrow(d211n), ncol(d211n)), tolerance=1e-1) - } -}) - - -test_that('biquadratic regression function', { - n <- 5000 - outGrid <- seq(-1, 1, by=0.05) - sigma <- 1 - f <- function(x, y) -(2 * x + y)^2 - - set.seed(1) - xin <- matrix(runif(2 * n, -1, 1), ncol=2) - yin <- apply(xin, 1, function(x) f(x[1], x[2])) - inGrid <- seq(-1, 1, length.out=floor(sqrt(n))) - xinReg <- expand.grid(inGrid, inGrid) - yinReg <- apply(xinReg, 1, function(x) f(x[1], x[2])) - - # scatterplot3d(xin[, 1], xin[, 2], yin) - # scatterplot3d(xinReg[, 1], xinReg[, 2], yinReg) - - # Noisy observations - yinNoisy <- yin + rnorm(length(yin), sd=sigma) - yinRegNoisy <- yinReg + rnorm(length(yinReg), sd=sigma) - # rgl::persp3d(inGrid, inGrid, yinRegNoisy, xlab='t1', ylab='t2') - - for (kern in c('epan', 'gauss')) { - if (kern == 'epan') { - bw <- 0.2 - } else if (kern == 'gauss') { - bw <- 0.1 - } - bwn <- bw * 2 # bandwidth for noisy case - - # Noiseless - # Naming: results{npoly}{nder1}{nder2} - bw <- 0.1 - bwn <- 0.2 - resOld <- Lwls2D(bw, kern, xin, yin, xout1=outGrid, xout2=outGrid, crosscov=TRUE) - d100 <- Lwls2DDeriv(bw, kern, xin, yin, xout1=outGrid, xout2=outGrid, npoly=1, nder1=0, nder2=0, crosscov=TRUE) - d110 <- Lwls2DDeriv(bw, kern, xin, yin, xout1=outGrid, xout2=outGrid, npoly=1, nder1=1, nder2=0) - d101 <- Lwls2DDeriv(bw, kern, xin, yin, xout1=outGrid, xout2=outGrid, npoly=1, nder1=0, nder2=1) - d211 <- Lwls2DDeriv(bw, kern, xin, yin, xout1=outGrid, xout2=outGrid, npoly=2, nder1=1, nder2=1) - # rgl::persp3d(outGrid, outGrid, d100) - - expect_equal(d100, - sapply(outGrid, function(y) sapply(outGrid, function(x) f(x, y))), - tolerance=1e-1) - expect_equal(resOld, d100) - expect_equal(d110, - sapply(outGrid, function(y) sapply(outGrid, function(x) -4 * (2 * x + y))), - tolerance=1e-1) - expect_equal(d101, - sapply(outGrid, function(y) sapply(outGrid, function(x) -2 * (2 * x + y))), - tolerance=1e-1) - expect_equal(d211, matrix(-4, nrow(d211), ncol(d211)), tolerance=1e-5) - - - d100n <- Lwls2DDeriv(bwn, kern, xin, yinNoisy, xout1=outGrid, xout2=outGrid, npoly=1, nder1=0, nder2=0, crosscov=TRUE) - d110n <- Lwls2DDeriv(bwn, kern, xin, yinNoisy, xout1=outGrid, xout2=outGrid, npoly=1, nder1=1, nder2=0) - d101n <- Lwls2DDeriv(bwn, kern, xin, yinNoisy, xout1=outGrid, xout2=outGrid, npoly=1, nder1=0, nder2=1) - d211n <- Lwls2DDeriv(1, kern, xin, yinNoisy, xout1=outGrid, xout2=outGrid, npoly=2, nder1=1, nder2=1) - # rgl::persp3d(outGrid, outGrid, d100n) - # rgl::persp3d(outGrid, outGrid, d110n) - # rgl::persp3d(outGrid, outGrid, d101n) - # rgl::persp3d(outGrid, outGrid, d211n) - - expect_equal(d100n, - sapply(outGrid, function(y) sapply(outGrid, function(x) f(x, y))), - tolerance=1e-1) - expect_equal(d110n, - sapply(outGrid, function(y) sapply(outGrid, function(x) -4 * (2 * x + y))), - tolerance=5e-1) - expect_equal(d101n, - sapply(outGrid, function(y) sapply(outGrid, function(x) -2 * (2 * x + y))), - tolerance=5e-1) - expect_equal(d211n, matrix(-4, nrow(d211n), ncol(d211n)), tolerance=1e-1) - } -}) - - -test_that('biexponential regression function', { - sqrtn <- 50 - n <- sqrtn^2 - inGrid <- outGrid <- seq(-1, 1, length.out=sqrtn) - f <- function(x, y) exp(-2 * x + y) - - set.seed(1) - xin <- as.matrix(expand.grid(inGrid, inGrid)) - yin <- f(xin[, 1], xin[, 2]) - inGrid <- seq(-1, 1, length.out=floor(sqrt(n))) - # persp3d(inGrid, inGrid, yin, col='white', xlab='x', ylab='y') - - kern <- 'epan' - bw <- 0.1 - - # Noiseless - # Naming: results{npoly}{nder1}{nder2} - resOld <- Lwls2D(bw, kern, xin, yin, xout1=outGrid, xout2=outGrid, crosscov=TRUE) - d100 <- Lwls2DDeriv(bw, kern, xin, yin, xout1=outGrid, xout2=outGrid, npoly=1, nder1=0, nder2=0, crosscov=TRUE) - d110 <- Lwls2DDeriv(bw, kern, xin, yin, xout1=outGrid, xout2=outGrid, npoly=1, nder1=1, nder2=0) - d101 <- Lwls2DDeriv(bw, kern, xin, yin, xout1=outGrid, xout2=outGrid, npoly=1, nder1=0, nder2=1) - d211 <- Lwls2DDeriv(bw, kern, xin, yin, xout1=outGrid, xout2=outGrid, npoly=2, nder1=1, nder2=1) - - expect_equal(d100, - matrix(yin, sqrtn, sqrtn), - tolerance=1e-2) - expect_equal(resOld, d100) - expect_equal(d110, - sapply(outGrid, function(y) - sapply(outGrid, function(x) -2 * exp(-2 * x + y))), - tolerance=1e-1) - expect_equal(d101, - sapply(outGrid, function(y) - sapply(outGrid, function(x) exp(-2 * x + y))), - tolerance=1e-1) - expect_equal(d211, sapply(outGrid, function(y) - sapply(outGrid, function(x) -2 * exp(-2 * x + y))), tolerance=1e-1) - -}) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_MakeFPCAInputs.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_MakeFPCAInputs.R deleted file mode 100644 index f12368cb..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_MakeFPCAInputs.R +++ /dev/null @@ -1,52 +0,0 @@ -# devtools::load_all() -library(testthat) - -test_that('MakeFPCAInputs works', { - set.seed(1) - NN = 32 - LyOrig = sapply( 1:NN, function(x) rnorm(x), simplify=FALSE) - LtOrig = sapply( 1:NN, function(x) sample(1:100,x), simplify=FALSE) - - LyOrigVec = as.vector(unlist(LyOrig)) - LtOrigVec = as.vector(unlist(LtOrig)) - - LusersOrig = sapply( 1:NN, function(x) rep( paste0(collapse='', 'user', x), x) ) - LusersOrigVec = as.vector(unlist(LusersOrig)) - ZZ = MakeFPCAInputs(IDs= LusersOrigVec, tVec=LtOrigVec,yVec= LyOrigVec) - # BB = FPCA(Ly= ZZ$Ly, Lt= ZZ$Lt) # This errs! - ZZs = MakeFPCAInputs(IDs= LusersOrigVec, tVec=LtOrigVec,yVec= LyOrigVec, sort=TRUE) - # CC = FPCA(Ly= ZZs$Ly, Lt= ZZs$Lt) - - expect_s3_class(FPCA(Ly= ZZs$Ly, Lt= ZZs$Lt), 'FPCA') - expect_error( FPCA(Ly = ZZ$Ly, Lt = ZZ$Lt), "Each vector in t should be in ascending order" ) - -}) - -test_that("basic arguments give reasonable output ", { - - IDs = factor(c('a','a','b','b', 'd'), c('d', 'a', 'b', 'c')) - tVec = 1:5; - yVec = cos(tVec); - B = MakeFPCAInputs(IDs= IDs , tVec=tVec, yVec=yVec) - - expect_equal( unname(unlist(B$Lt)), tVec, tolerance = 2*.Machine$double.eps, scale = 1) - expect_equal( B$Ly[[2]], cos(c(3,4)), tolerance = 2*.Machine$double.eps, scale = 1) - expect_true( (length(B$Lid) == length(B$Ly)) && (length(B$Ly) == length(B$Lt)) ) - expect_true( B$Lid[[3]] == IDs[5] ) -}) - -test_that("basic arguments give reasonable output when number of measurement points is equal ", { - - IDs = rep(1:3,each=3); - tVec = rep(c(0,2,5),3); - yVec = 10:19; - - B = MakeFPCAInputs(IDs= IDs , tVec=tVec, yVec=yVec) - - expect_equal( unname(unlist(B$Lt)), tVec, tolerance = 2*.Machine$double.eps, scale = 1) - expect_equal( B$Ly[[2]], c(13,14,15), tolerance = 2*.Machine$double.eps, scale = 1) - expect_true( (length(B$Lid) == length(B$Ly)) && (length(B$Ly) == length(B$Lt)) ) - expect_true( B$Lid[[3]] == IDs[9] ) -}) - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_MakeSparseGP.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_MakeSparseGP.R deleted file mode 100644 index 617d6175..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_MakeSparseGP.R +++ /dev/null @@ -1,33 +0,0 @@ -# devtools::load_all() -library(testthat) - -test_that('MakeSparseGP works', { - set.seed(1) - n <- 100 - r1 <- MakeSparseGP(n) - r2 <- MakeSparseGP(n, function(ni) rbeta(ni, 2/3, 1)) - r3 <- MakeSparseGP(n, sparsity=1) - r31 <- MakeSparseGP(n, sparsity=3) - r4 <- MakeSparseGP(n, muFun=identity, lambda=1e-2) - r5 <- MakeSparseGP(n, K=1) - r6 <- MakeSparseGP(n, K=10) - r7 <- MakeSparseGP(n, lambda=3:1) - r8 <- MakeSparseGP(n, sigma=1) - r9 <- MakeSparseGP(n, basisType='sin') - r10 <- MakeSparseGP(2, CovFun=function(x) matrix(1, length(x), length(x))) - - expect_equal(length(r1$Ly), length(r1$Lt)) - # hist(unlist(r2$Lt)) - t2 <- unlist(r2$Lt) - expect_true(sum(t2 < 0.1) > 1.5 * sum(t2 > 0.9)) - expect_true(all(r3$Ni == 1)) - expect_true(all(r31$Ni == 3)) - expect_true(cor(unlist(r4$Lt), unlist(r4$Ly)) > 0.9) - expect_equal(ncol(r5$xi), 1) - expect_equal(ncol(r6$xi), 10) - expect_equal(ncol(r7$xi), 3) - expect_equal(sd(unlist(r7$Ly)), sqrt(sum(3:1)), tolerance=0.1) - expect_equal(sd(unlist(r8$Ly) - unlist(r8$LyTrue)), 1, tolerance=0.1) - expect_equal(mean(abs(unlist(r9$Ly)[unlist(r9$Lt) < 0.05])), 0, scale=1, tolerance=0.5) - expect_equal(max(abs(sapply(r10$yCurve, diff))), 0, scale=1, tolerance=1e-6) -}) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_RcppPseudoApprox.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_RcppPseudoApprox.R deleted file mode 100644 index 422115c7..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_RcppPseudoApprox.R +++ /dev/null @@ -1,16 +0,0 @@ -# devtools::load_all() -library(testthat) - -test_that('RcppPseudoApprox works on a nearly trivial example', { - set.seed(111) - z = runif(44); - expect_equal( RcppPseudoApprox(X = c(0,1), Y = c(0,2) , X_target = z), 2*z, tolerance = 1e-7) - -}) - -test_that('RcppPseudoApprox errs on obviously wrong data.', { - - expect_error( RcppPseudoApprox(X = c(0,1), Y = c(0,2,4) , X_target = 0), - "Problem with unequal vector sizes when doing linear interpolation.") - -}) \ No newline at end of file diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_Rmullwlsk.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_Rmullwlsk.R deleted file mode 100644 index de743084..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_Rmullwlsk.R +++ /dev/null @@ -1,130 +0,0 @@ -# devtools::load_all() -# setwd('misc/') -load(system.file('testdata', 'InputFormMllwlskInCpp.RData', package='fdapace')) -if( !exists('Rmullwlsk') ) { - library(Rcpp) - sourceCpp('src/Rmullwlsk.cpp') -} -IN = InputFormMllwlskInCpp - -library(testthat) - -# tolerance is relatively large because we cannot control of 2500 * 1e-16 anyway -# I have already tried using .inverse instead of LLT for the solution and that -# did not make a difference numericallly (small systems anyway) - -# These check out OK. -U = test_that("basic Epanetchnikov kernel inputs match MATLAB output for different bandwidths", { - - AA = Rmullwlsk(2* IN$bw,t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='epan',win=rep(1,38), bwCheck = FALSE) - BB = Rmullwlsk( c(5,3),t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='epan',win=rep(1,38), bwCheck = FALSE) - CC = Rmullwlsk( c(13.3,23.3),t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='epan',win=rep(1,38), bwCheck = FALSE) - - expect_equal(sum(AA), -3.777751915321487e+02, tolerance = 1e-12,scale = 1) - expect_equal(sum(BB), -3.540768950285936e+02, tolerance = 1e-12,scale = 1) - expect_equal(sum(CC), -3.761635853631063e+02, tolerance = 1e-12,scale = 1) -}) - -# These check out OK. -V = test_that("basic rectangular kernel inputs match MATLAB output for different bandwidths", { - - AA = Rmullwlsk(2* IN$bw,t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='rect',win=rep(1,38), bwCheck = FALSE) - BB = Rmullwlsk( c(5,3),t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='rect',win=rep(1,38), bwCheck = FALSE) - CC = Rmullwlsk( c(13.3,23.3),t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='rect',win=rep(1,38), bwCheck = FALSE) - - expect_equal(sum(AA), -3.288244527254398e+02, tolerance = 1e-11,scale = 1) - expect_equal(sum(BB), -3.333882366681741e+02, tolerance = 1e-11,scale = 1) - expect_equal(sum(CC), -3.732842331060850e+02, tolerance = 1e-11,scale = 1) -}) - -# These check out OK. -H = test_that("basic gaussian kernel inputs match MATLAB output for different bandwidths", { - - AA = Rmullwlsk(2* IN$bw,t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='gauss',win=rep(1,38), bwCheck = FALSE) - BB = Rmullwlsk( c(5,3),t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='gauss',win=rep(1,38), bwCheck = FALSE) - CC = Rmullwlsk( c(13.3,23.3),t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='gauss',win=rep(1,38), bwCheck = FALSE) - - expect_equal(sum(AA), -3.689730466900281e+02, tolerance = 1e-12,scale = 1) - expect_equal(sum(BB), -3.588111399081811e+02, tolerance = 1e-11,scale = 1) - expect_equal(sum(CC), -3.745624473416967e+02, tolerance = 1e-11,scale = 1) -}) - -# These check out OK. -Ft = test_that("basic quartic kernel inputs match MATLAB output for different bandwidths", { - - AA = Rmullwlsk(2* IN$bw,t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='quar',win=rep(1,38), bwCheck = FALSE) - BB = Rmullwlsk( c(5,3),t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='quar',win=rep(1,38), bwCheck = FALSE) - CC = Rmullwlsk( c(13.3,23.3),t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='quar',win=rep(1,38), bwCheck = FALSE) - - expect_equal(sum(AA), -4.021549928032208e+02, tolerance = 1e-12,scale = 1) - expect_equal(sum(BB), -3.472853895316415e+02, tolerance = 1e-11,scale = 1) - expect_equal(sum(CC), -3.784289764092692e+02, tolerance = 1e-12,scale = 1) -}) - -# These check out OK. -G = test_that("basic gausvar kernel inputs match MATLAB output for different bandwidths", { - - AA = Rmullwlsk(2* IN$bw,t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='gausvar',win=rep(1,38), bwCheck = FALSE) - BB = Rmullwlsk( c(5,3),t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='gausvar',win=rep(1,38), bwCheck = FALSE) - CC = Rmullwlsk( c(13.3,23.3),t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='gausvar',win=rep(1,38), bwCheck = FALSE) - - expect_equal(sum(AA), -3.513625436558207e+02, tolerance = 1e-12,scale = 1) - expect_equal(sum(BB), -3.480022325255190e+02, tolerance = 1e-12,scale = 1) - expect_equal(sum(CC), -3.747722240234172e+02, tolerance = 1e-12,scale = 1) -}) - -# These check out OK. -S = test_that("strictly positive window weights inputs match MATLAB output for different bandwidths/kernels", { - - AA = Rmullwlsk( c(4,2), t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='gauss', win=seq(1,38)+0, bwCheck = FALSE) - BB = Rmullwlsk( c(4,2), t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='rect', win=seq(1,38)+0, bwCheck = FALSE) - CC = Rmullwlsk( c(13.3,23.3), t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='gausvar', win=seq(1,38)+0, bwCheck = FALSE) - DD = Rmullwlsk( c(3,4), t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='epan', win=sin(seq(1,38))+3, bwCheck = FALSE) - EE = Rmullwlsk( c(10.3,4), t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='quar', win=sin(seq(1,38))+3, bwCheck = FALSE) - - expect_equal(sum(AA), -4.337814512732364e+02, tolerance = 1e-12,scale = 1) - expect_equal(sum(BB), -3.070237338734315e+02, tolerance = 1e-12,scale = 1) - expect_equal(sum(CC), -4.782099399727079e+02, tolerance = 1e-12,scale = 1) - expect_equal(sum(DD), -4.149192163656717e+02, tolerance = 1e-11,scale = 1) - expect_equal(sum(EE), -3.573361421232184e+02, tolerance = 1e-12,scale = 1) -}) - - -# These check out OK. -Tt = test_that("incoherent kernel_types fall back to Epanechnikov kernels and give correct warnings", { - - AA = Rmullwlsk( c(3,4), t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='epan', win=sin(seq(1,38))+3, bwCheck = FALSE) - aa = Rmullwlsk( c(3,4), t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='boom3', win=sin(seq(1,38))+3, bwCheck = FALSE) - - expect_equal(sum(AA), sum(aa), tolerance = 1e-15,scale = 1) - expect_warning( Rmullwlsk(5.2* IN$bw,t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='epaffn',win=rep(1,38), bwCheck = FALSE), "Kernel_type argument was not set correctly; Epanechnikov kernel used.") - -}) - - - -Y = test_that("Small bandwidths give correct error", { - - # expect_error( Rmullwlsk(0.2* IN$bw,t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='epan',win=rep(1,38), bwCheck = FALSE), "No enough points in local window, please increase bandwidth.") - -expect_equal(as.numeric( Rmullwlsk(0.2* IN$bw,t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='epan',win=rep(1,38), bwCheck = TRUE)), 0) -expect_equal(as.numeric( Rmullwlsk(2.2* IN$bw,t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='epan',win=rep(1,38), bwCheck = TRUE)), 1) - -expect_equal(as.numeric( Rmullwlsk(0.2* IN$bw,t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='epan',win=rep(1,38), bwCheck = 1)), 0) -expect_equal(as.numeric( Rmullwlsk(2.2* IN$bw,t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='epan',win=rep(1,38), bwCheck = 1)), 1) - -expect_equal(as.numeric( Rmullwlsk(0.2* IN$bw,t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='epan',win=rep(1,38), bwCheck = 1)), 0) -expect_equal(as.numeric( Rmullwlsk(0.2* IN$bw,t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='epan',win=rep(1,38), bwCheck = TRUE)), 0) - -}) - - -# ## Speed test -# n <- 1e5 -# bw <- 0.1 -# xin <- matrix(runif(2 * n), n, 2) -# yin <- rnorm(n) -# win <- rep(1, n) -# xout1 <- xout2 <- seq(0, 1, length.out=100) -# system.time(tmp <- Rmullwlsk(c(bw, bw), 'epan', t(xin), yin, win, xout1, xout2, FALSE)) -# system.time(tmp1 <- Rmullwlsk_old(c(bw, bw), 'epan', t(xin), yin, win, xout1, xout2, FALSE)) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_RmullwlskUniversal.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_RmullwlskUniversal.R deleted file mode 100644 index 5b4e81cb..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_RmullwlskUniversal.R +++ /dev/null @@ -1,31 +0,0 @@ -library(testthat) -load(system.file('testdata', 'InputFormMllwlskInCpp.RData', package='fdapace')) -IN = InputFormMllwlskInCpp - -ord <- order(IN$tPairs[, 1]) -xin <- IN$tPairs[ord, ] -yin <- IN$cxxn[ord] -win <- rep(1,38) - - -# These check out OK. -U = test_that("basic inputs for different kernels match previous inputs.", { - - AA = Rmullwlsk(2* IN$bw,t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='epan',win=rep(1,38), bwCheck = FALSE) - AAu = RmullwlskUniversal( bw = 2* IN$bw, tPairs =t(xin), cxxn=yin, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='epan', win=win, FALSE, TRUE) - - BB = Rmullwlsk(2* IN$bw,t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='rect',win=rep(1,38), bwCheck = FALSE) - BBu = RmullwlskUniversal( bw = 2* IN$bw, tPairs =t(xin), cxxn=yin, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='rect', win=win, FALSE, TRUE) - - CC = Rmullwlsk(2* IN$bw,t(IN$tPairs),cxxn=IN$cxxn, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='gauss',win=rep(1,38), bwCheck = FALSE) - CCu = RmullwlskUniversal( bw = 2* IN$bw, tPairs =t(xin), cxxn=yin, xgrid=IN$regGrid, ygrid=IN$regGrid, kernel_type='gauss', win=win, FALSE, TRUE) - - expect_equal( CC, CCu) - expect_equal( BB, BBu) - expect_equal( AA, AAu) - - - -}) - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_Rrotatemullwlsk.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_Rrotatemullwlsk.R deleted file mode 100644 index 7567d691..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_Rrotatemullwlsk.R +++ /dev/null @@ -1,124 +0,0 @@ -# devtools::load_all() -# setwd('misc/', bwCheck = FALSE) - -library(Rcpp) - -library(testthat) - -try( silent=TRUE, load(system.file('testdata', 'InputForRotatedMllwlskInCpp.RData', package='fdapace'))) - -# tolerance is relatively large because we cannot control of 2500 * 1e-16 anyway -# I have already tried using .inverse instead of LLT for the solution and that -# did not make a difference numericallly (small systems anyway) - -U = test_that("basic Epanetchnikov kernel inputs match MATLAB output for different bandwidths", { - - AA = Rrotatedmullwlsk(bw =IN$bw, tPairs=IN$tPairs, cxxn= IN$cxxn, win= IN$win, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= IN$kernel, bwCheck = FALSE) - BB = Rrotatedmullwlsk(bw = c(3,4), tPairs=(IN$tPairs), cxxn= IN$cxxn, win= IN$win, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= IN$kernel, bwCheck = FALSE) - CC = Rrotatedmullwlsk(bw = c(13,23.3), tPairs=(IN$tPairs), cxxn= IN$cxxn, win= IN$win, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= IN$kernel, bwCheck = FALSE) - - expect_equal(sum(AA), -1.887451898050793, tolerance = 1e-13,scale = 1) - expect_equal(sum(BB), -3.264859562745997, tolerance = 1e-11,scale = 1) - expect_equal(sum(CC), -5.650324984396344, tolerance = 1e-13,scale = 1) -}) - -V = test_that("basic rectangular kernel inputs match MATLAB output for different bandwidths", { - - AA = Rrotatedmullwlsk(bw =IN$bw, tPairs=IN$tPairs, cxxn= IN$cxxn, win= IN$win, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'rect', bwCheck = FALSE) - BB = Rrotatedmullwlsk(bw = c(3,4), tPairs=(IN$tPairs), cxxn= IN$cxxn, win= IN$win, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'rect', bwCheck = FALSE) - CC = Rrotatedmullwlsk(bw = c(13,23.3), tPairs=(IN$tPairs), cxxn= IN$cxxn, win= IN$win, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'rect', bwCheck = FALSE) - - expect_equal(sum(AA), 0.408929466844517, tolerance = 1e-13,scale = 1) - expect_equal(sum(BB), -1.803538175275243, tolerance = 1e-13,scale = 1) - expect_equal(sum(CC), -5.866207150638594, tolerance = 1e-13,scale = 1) - - }) - -H = test_that("basic gaussian kernel inputs match MATLAB output for different bandwidths", { - - AA = Rrotatedmullwlsk(bw =IN$bw, tPairs=IN$tPairs, cxxn= IN$cxxn, win= IN$win, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'gauss', bwCheck = FALSE) - BB = Rrotatedmullwlsk(bw = c(3,4), tPairs=(IN$tPairs), cxxn= IN$cxxn, win= IN$win, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'gauss', bwCheck = FALSE) - CC = Rrotatedmullwlsk(bw = c(13,23.3), tPairs=(IN$tPairs), cxxn= IN$cxxn, win= IN$win, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'gauss', bwCheck = FALSE) - - expect_equal(sum(AA), -4.197686977022681, tolerance = 1e-13,scale = 1) - expect_equal(sum(BB), -4.134314374205185, tolerance = 1e-14,scale = 1) - expect_equal(sum(CC), -5.767647736432502, tolerance = 1e-13,scale = 1) - -}) - -Ft = test_that("basic quartic kernel inputs match MATLAB output for different bandwidths", { - - AA = Rrotatedmullwlsk(bw =IN$bw, tPairs=IN$tPairs, cxxn= IN$cxxn, win= IN$win, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'quar', bwCheck = FALSE) - BB = Rrotatedmullwlsk(bw = c(3,4), tPairs=(IN$tPairs), cxxn= IN$cxxn, win= IN$win, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'quar', bwCheck = FALSE) - CC = Rrotatedmullwlsk(bw = c(13,23.3), tPairs=(IN$tPairs), cxxn= IN$cxxn, win= IN$win, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'quar', bwCheck = FALSE) - - expect_equal(sum(AA), -3.753442160580053,tolerance = 1e-13,scale = 1) - expect_equal(sum(BB), -4.970567279909929, tolerance = 1e-13,scale = 1) - expect_equal(sum(CC), -5.443792883622939, tolerance = 1e-13,scale = 1) - - }) - - - - -# These check out OK. -G = test_that("basic gausvar kernel inputs match MATLAB output for different bandwidths", { - - AA = Rrotatedmullwlsk(bw =IN$bw, tPairs=IN$tPairs, cxxn= IN$cxxn, win= IN$win, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'gausvar', bwCheck = FALSE) - BB = Rrotatedmullwlsk(bw = c(3,4), tPairs=(IN$tPairs), cxxn= IN$cxxn, win= IN$win, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'gausvar', bwCheck = FALSE) - CC = Rrotatedmullwlsk(bw = c(13,23.3), tPairs=(IN$tPairs), cxxn= IN$cxxn, win= IN$win, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'gausvar', bwCheck = FALSE) - - expect_equal(sum(AA), -9.228691155965564, tolerance = 1e-13,scale = 1) - expect_equal(sum(BB), -3.594812776733668, tolerance = 1e-13,scale = 1) - expect_equal(sum(CC), -5.718225024334538, tolerance = 1e-13,scale = 1) - -}) - -# These check out OK. -S = test_that("strictly positive window weights inputs match MATLAB output for different bandwidths/kernels", { - - AA = Rrotatedmullwlsk(bw =c(3,4), tPairs=IN$tPairs, cxxn= IN$cxxn, win= seq(1,38)+0, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'gausvar', bwCheck = FALSE) - BB = Rrotatedmullwlsk(bw =c(3,4), tPairs=IN$tPairs, cxxn= IN$cxxn, win= seq(1,38)+0, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'gauss', bwCheck = FALSE) - CC = Rrotatedmullwlsk(bw =c(3,4), tPairs=IN$tPairs, cxxn= IN$cxxn, win= seq(1,38)+0, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'rect', bwCheck = FALSE) - DD = Rrotatedmullwlsk(bw =c(3,4), tPairs=IN$tPairs, cxxn= IN$cxxn, win= sin(seq(1,38))+3, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'epan', bwCheck = FALSE) - EE = Rrotatedmullwlsk(bw =c(3,4), tPairs=IN$tPairs, cxxn= IN$cxxn, win= sin(seq(1,38))+3, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'quar', bwCheck = FALSE) - - expect_equal(sum(AA), -4.924560108566402, tolerance = 1e-13,scale = 1) - expect_equal(sum(BB), -6.577000474589042, tolerance = 1e-13,scale = 1) - expect_equal(sum(CC), -1.791956888763226, tolerance = 1e-13,scale = 1) - expect_equal(sum(DD), -3.614424355861832, tolerance = 1e-13,scale = 1) - expect_equal(sum(EE), -5.450343839504677, tolerance = 1e-13,scale = 1) - -}) - - -# These check out OK. -Tt = test_that("incoherent kernel_types fall back to Epanechnikov kernels and give the proper warning msg.", { - - DD = Rrotatedmullwlsk(bw =c(3,4), tPairs=IN$tPairs, cxxn= IN$cxxn, win= sin(seq(1,38))+3, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'epan', bwCheck = FALSE) - dd = Rrotatedmullwlsk(bw =c(3,4), tPairs=IN$tPairs, cxxn= IN$cxxn, win= sin(seq(1,38))+3, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'boom3', bwCheck = FALSE) - - expect_equal(sum(DD), sum(dd), tolerance = 1e-15, scale= 1) - expect_warning( Rrotatedmullwlsk(bw =c(3,4), tPairs=IN$tPairs, cxxn= IN$cxxn, win= sin(seq(1,38))+3, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'boom3', bwCheck = FALSE), "Kernel_type argument was not set correctly; Epanechnikov kernel used.") - -}) - - -Y = test_that("Small bandwidths give correct error", { - - expect_equal( as.numeric( Rrotatedmullwlsk(bw =c(0.3,0.4), tPairs=IN$tPairs, cxxn= IN$cxxn, win= sin(seq(1,38))+3, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'rect', bwCheck = TRUE)), 0) - expect_equal( as.numeric( Rrotatedmullwlsk(bw =c(9.3,9.4), tPairs=IN$tPairs, cxxn= IN$cxxn, win= sin(seq(1,38))+3, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'rect', bwCheck = TRUE)), 1) - - expect_equal( as.numeric( Rrotatedmullwlsk(bw =c(0.3,0.4), tPairs=IN$tPairs, cxxn= IN$cxxn, win= sin(seq(1,38))+3, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'rect', bwCheck = 1)), 0) - expect_equal( as.numeric( Rrotatedmullwlsk(bw =c(9.3,9.4), tPairs=IN$tPairs, cxxn= IN$cxxn, win= sin(seq(1,38))+3, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'rect', bwCheck = 1)), 1) - - # expect_equal( as.numeric( Rrotatedmullwlsk(bw =c(0.3,0.4), tPairs=IN$tPairs, cxxn= IN$cxxn, win= sin(seq(1,38))+3, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'rect', bwCheck = 0)), 0) - # expect_equal( as.numeric( Rrotatedmullwlsk(bw =c(0.3,0.4), tPairs=IN$tPairs, cxxn= IN$cxxn, win= sin(seq(1,38))+3, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'rect', bwCheck = FALSE)), 0) - - expect_error( Rrotatedmullwlsk(bw =c(0.3,0.4), tPairs=IN$tPairs, cxxn= IN$cxxn, win= sin(seq(1,38))+3, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'rect', bwCheck = FALSE), "No enough points in local window, please increase bandwidth.") - expect_error( Rrotatedmullwlsk(bw =c(0.3,0.4), tPairs=IN$tPairs, cxxn= IN$cxxn, win= sin(seq(1,38))+3, xygrid=IN$xygrid, npoly=IN$npoly, kernel_type= 'rect', bwCheck = 0), "No enough points in local window, please increase bandwidth.") - - - -}) - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_SBFitting.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_SBFitting.R deleted file mode 100644 index f403cc59..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_SBFitting.R +++ /dev/null @@ -1,98 +0,0 @@ -#setwd('/Users/kyunghee/Desktop/SBF') -#SBF_scripts <- list.files(pattern="*.R") -#for(i in 1:length(SBF_scripts)){ -# source(SBF_scripts[i]) -#} - -#library(Rcpp) -#setwd('/Users/kyunghee/Desktop/tPACE/src') -#sourceCpp('trapzRcpp.cpp') - -library(testthat) - -test_that( - '(1) algorithm convergence including dimension checking, (2) theoretical estimation precision of true component functions.', - { - set.seed(100) - n <- 100 - d <- 2 - X <- pnorm(matrix(rnorm(n*d),nrow=n,ncol=d)%*%matrix(c(1,0.6,0.6,1),nrow=2,ncol=2)) - - f1 <- function(t) 2*(t-0.5) - f2 <- function(t) sin(2*pi*t) - - Y <- f1(X[,1])+f2(X[,2])+rnorm(n,0,0.1) - - N <- 101 - x <- matrix(rep(seq(0,1,length.out=N),d),nrow=N,ncol=d) - h <- c(0.12,0.08) - - sbfResult <- SBFitting(Y,x,X,h) - - fFit <- sbfResult$SBFit - - iterErr <- sbfResult$iterErr - iterErrDiff <- sbfResult$iterErrDiff - iterNum <- sbfResult$iterNum - critErr <- sbfResult$critErr - critErrDiff <- sbfResult$critErrDiff - critNum <- sbfResult$critNum - - expect_true(sum(dim(fFit)!=c(N,d))==0) - expect_true((iterErr> sum((mean(aligned) - me(T)).^2) - # ans = - # 0.0213 - # >> sum(abs(mean(aligned) - me(T)).^1) - # ans = - # 0.4686 - - meTRUE = exp(-10*(T-0.5)^2); # True mean - expect_lt(sum(abs(meTRUE- colMeans(sss$aligned))), 0.4686) - expect_lt(sum((meTRUE- colMeans(sss$aligned))^2), 0.0213) - -}) - -test_that('warping functions monotonic', { - - N = 44; - eps = 0.23; - M = 41; - set.seed(123) - Tfinal = 3 - me <- function(t) exp(-Tfinal*(((t/Tfinal^2)-0.5))^2); - T = seq(0,Tfinal,length.out = M) - recondingTimesMat = matrix(nrow = N, ncol = M) - yMat = matrix(nrow = N, ncol = M) - - for (i in 1:N){ - peak = runif(min = 0.25,max = 0.75,1)*Tfinal - recondingTimesMat[i,] = Tfinal* sort( unique(c( seq(0.0 , peak, length.out = round((M+1)/2)), - seq( peak, Tfinal, length.out = round((M+1)/2))) )) - yMat[i,] = me(recondingTimesMat[i,])* rnorm(1, mean=4.0, sd= eps) + rnorm(M, mean=0.0, sd= eps) - } - - Y = as.list(as.data.frame(t(yMat))) - X = rep(list(T),N) - - sss = WFDA(Ly = Y, Lt = X ) - - monotonic=matrix(F,N,M-1) - for(j in 1:N){ - for(i in 2:M){ - monotonic[j,i-1]=sss$h[i]>=sss$h[i-1] - } - } - - allvalues=apply(monotonic,1,all) - expect_true( all(allvalues)) - - -}) - -test_that('returns expected outputs', { - - N = 44; - eps = 0.23; - M = 41; - set.seed(123) - Tfinal = 3 - me <- function(t) exp(-Tfinal*(((t/Tfinal^2)-0.5))^2); - T = seq(0,Tfinal,length.out = M) - recondingTimesMat = matrix(nrow = N, ncol = M) - yMat = matrix(nrow = N, ncol = M) - - for (i in 1:N){ - peak = runif(min = 0.25,max = 0.75,1)*Tfinal - recondingTimesMat[i,] = Tfinal* sort( unique(c( seq(0.0 , peak, length.out = round((M+1)/2)), - seq( peak, Tfinal, length.out = round((M+1)/2))) )) - yMat[i,] = me(recondingTimesMat[i,])* rnorm(1, mean=4.0, sd= eps) + rnorm(M, mean=0.0, sd= eps) - } - - Y = as.list(as.data.frame(t(yMat))) - X = rep(list(T),N) - - sss = WFDA(Ly = Y, Lt = X ) - - returntype <- list(optns = list(), lambda = NA, h = array(dim = c(N, M)), hInv = array(dim = c(N, M)), aligned = array(dim = c(N, M)), - costs = vector(length=min(round(0.5 * (N - 1)))), timing = Sys.time()) - class(returntype) <- "WFDA" - - expect_true(identical(attributes(sss),attributes(returntype))) - expect_true(identical(class(sss),class(returntype))) - - -}) - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_createDesignPlot.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_createDesignPlot.R deleted file mode 100644 index b57befde..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_createDesignPlot.R +++ /dev/null @@ -1,21 +0,0 @@ -library(testthat) -# devtools::load_all() - -# Uniform time points -## a speed test -set.seed(1) -n <- 1e3 -sparsity <- 1:5 -Lt <- replicate(n, runif(sample(sparsity, 1)), simplify=FALSE) -obsGrid <- sort(unique(unlist(Lt))) -system.time( -CreateDesignPlot(Lt, obsGrid, isColorPlot=TRUE) -) - -# ... are passed in -set.seed(1) -n <- 5e2 -sparsity <- 1:5 -Lt <- replicate(n, round(runif(sample(sparsity, 1)), 2), simplify=FALSE) -obsGrid <- sort(unique(unlist(Lt))) -CreateDesignPlot(Lt, obsGrid, isColorPlot=TRUE, pch=1, cex=1, xlab='XX', ylab='YY') diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_cumtrapzRcpp.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_cumtrapzRcpp.R deleted file mode 100644 index ef347760..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_cumtrapzRcpp.R +++ /dev/null @@ -1,14 +0,0 @@ -# devtools::load_all() -library(testthat) - -test_that('cumtrapzRcpp works on a trivial example', { - x = c(0,2) - y = c(0,2) - expect_equal( cumtrapzRcpp(x,y), c(0,2) ) -}) - -test_that('trapzRcpp works on a nearly trivial example', { - x = seq(0,4, length.out=100) - y = x + sin(x); - expect_equal(sum( cumtrapzRcpp(x,y)) , 3.865524746134088e+02) -}) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_cvlwls1d.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_cvlwls1d.R deleted file mode 100644 index 5ef77465..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_cvlwls1d.R +++ /dev/null @@ -1,13 +0,0 @@ -cat("\ntests for 'CVLwls1D'") - -test_that("basic arguments match MATLAB output ", { - - try(silent=TRUE, load(system.file('testdata', 'dataGeneratedByExampleSeed123.RData', package='fdapace'))) - try(silent=TRUE, load(system.file('testdata', 'dataGeneratedByExampleSeed123.RData', package='fdapace'))) - - a_result = CVLwls1D(y, t=t, kernel='epan', npoly=1, nder=0, dataType='Sparse') - expect_equal( a_result, 4.172873877723954, tol = 0.6) # High tolerance because we have different implementation - -} -) - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_fitted.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_fitted.R deleted file mode 100644 index 99a11bc2..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_fitted.R +++ /dev/null @@ -1,42 +0,0 @@ -# devtools::load_all() -library(testthat) -set.seed(222) -n <- 201 -pts <- seq(0, 1, by=0.015) -sampWienerD <- Wiener(n, pts) -sampWiener <- Sparsify(sampWienerD, pts, 10) -res <- FPCA(sampWiener$Ly, sampWiener$Lt ) - -test_that("fitted with QUO and FPC give similar results", { - - fittedY <- fitted(res) - fittedYe <- fitted(res, K=4, derOptns = list(p=1, method='FPC')) - fittedYq <- fitted(res, K=4, derOptns = list(p=1, method='QUO')) - - if(1==3){ - par(mfrow=c(1,3)) - matplot(t(fittedY[1:3,]),t='l') - matplot(t(fittedYe[1:3,]),t='l') - matplot(t(fittedYq[1:3,]),t='l') - } - - expect_warning(fitted(res, k=4, derOptns = list(p=1, method='FPC')), "specifying 'k' is deprecated. Use 'K' instead!") - expect_equal( fittedYe, fittedYq, tolerance =0.01, scale= 1 ) #absolute difference - -}) - -test_that("fitted and real data are extremely correlated", { - - fittedY <- fitted(res) - - if(1==3){ - par(mfrow=c(1,2)) - matplot(t(fittedY[1:5,]),t='l') - matplot(t(sampWienerD[1:5,]),t='l') - } - - expect_true( cor(fittedY[,19], sampWienerD[,19] ) > 0.85 ) - expect_true( cor(fittedY[,29], sampWienerD[,29] ) > 0.85 ) - expect_true( cor(fittedY[,39], sampWienerD[,39] ) > 0.85 ) - -}) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_funSim.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_funSim.R deleted file mode 100644 index 662e68d2..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_funSim.R +++ /dev/null @@ -1,66 +0,0 @@ - - N = 333; - set.seed(123) - M = 100; - - # Define continuum - s = seq(0,10,length.out = M) - - # Define mean and 2 eigencomponents - meanFunct <- function(s) s + 10*exp(-(s-5)^2) - eigFunct1 <- function(s) +cos(2*s*pi/10) / sqrt(5) - eigFunct2 <- function(s) -sin(2*s*pi/10) / sqrt(5) - - # Create FPC scores - Ksi = matrix(rnorm(N*2), ncol=2); - Ksi = apply(Ksi, 2, scale) - Ksi = Ksi %*% diag(c(5,2)) - - # Create Y_true - yTrue = Ksi %*% t( matrix(c( eigFunct1(s), eigFunct2(s)), ncol =2)) + t( matrix( rep(meanFunct(s),N), nrow= M)) - - # # Make a quick plot of what we have - # x11() - # par(mfrow=c(2,2)) - # plot(s,meanFunct(s), xlab='s',ylab='', main="Mean Curve"); - # plot(s,eigFunct1(s), xlab='s',ylab='', main="First Eigenfunc."); - # plot(s,eigFunct2(s), xlab='s',ylab='', main="Second Eigenfunc."); - # matplot(t(yTrue), type='l', xlab='s',ylab='', main="True Sample Curves") - - # Create sparse sample - ySparse16 = Sparsify(yTrue, s, 1:16) - ySparse08 = Sparsify(yTrue, s, 1:8) - ySparse04 = Sparsify(yTrue, s, 1:4) - - # Give it a bit of noise - ySparse16$yNoisy = lapply( ySparse16$Ly, function(x) x + 0.5*rnorm(length(x))) - ySparse04$yNoisy = lapply( ySparse04$Ly, function(x) x + 0.5*rnorm(length(x))) - ySparse08$yNoisy = lapply( ySparse08$Ly, function(x) x + 0.5*rnorm(length(x))) - - # A = FPCA(ySparse16$yNoisy, t= ySparse16$Lt ) # Time consuming test - # B = FPCA(ySparse08$yNoisy, t= ySparse08$Lt ) # Time consuming test - C = FPCA(ySparse04$yNoisy, Lt= ySparse04$Lt ) - QQ = MakeFPCAInputs(IDs = rep(1:N, each=M),tVec=rep(s,N), t(yTrue) ) - D = FPCA(QQ$Ly, QQ$Lt) - - # x11() - # par(mfrow=c(2,4)) - # matplot((A$phi[,1:3]), type='l', xlab='s',ylab='', main='Eigenfunc. (median 9 p.)' ) - # matplot((B$phi[,1:3]), type='l', xlab='s',ylab='', main='Eigenfunc. (median 5 p.)' ) - # matplot((C$phi[,1:3]), type='l', xlab='s',ylab='', main='Eigenfunc. (median 3 p.)') - # matplot((D$phi[,1:2]), type='l', xlab='s',ylab='', main='Eigenfunc. (dense)') - # matplot((A$mu), type='l', xlab='s',ylab='', main='Mean (median 9 p.)' ) - # matplot((B$mu), type='l', xlab='s',ylab='', main='Mean (median 5 p.)' ) - # matplot((C$mu), type='l', xlab='s',ylab='', main='Mean (median 3 p.)' ) - # matplot((D$mu), type='l', xlab='s',ylab='', main='Mean (dense)' ) - - - # x11() - # par(mfrow=c(2,2)) - #CreateDesignPlot(t=ySparse16$Lt, obsGrid= A$obsGrid, isColorPlot=FALSE, noDiagonal= TRUE,yname= '9 p.') - #CreateDesignPlot(t=ySparse08$Lt, obsGrid= B$obsGrid, isColorPlot=FALSE, noDiagonal= TRUE,yname= '5 p.') - #CreateDesignPlot(t=ySparse04$Lt, obsGrid= C$obsGrid, isColorPlot=FALSE, noDiagonal= TRUE,yname= '3 p.') - #CreateDesignPlot(t=QQ$Lt, obsGrid= D$obsGrid, isColorPlot=FALSE, noDiagonal= FALSE,yname= 'dense') - - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_gcvlwls1d1.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_gcvlwls1d1.R deleted file mode 100644 index 9ea38d14..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_gcvlwls1d1.R +++ /dev/null @@ -1,14 +0,0 @@ - cat("\nTests for 'GCVLwls1D1.R'") - -load(system.file('testdata', 'dataForGcvLwlsTest.RData', package='fdapace')) - -test_that("basic optimal bandwidth choice for the mean function use GCV method matches MATLAB for Sparse data", { - - A <- GCVLwls1D1(y,t,'epan',1,0,'Sparse') - expect_equal( A$bOpt, 2.071354057811459 ) - - B <- GCVLwls1D1(y,t,'rect',1,0,'Sparse') - expect_equal( B$bOpt, 2.238990337557121, 0.04 ) - - } ) - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_gcvlwls2dV2.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_gcvlwls2dV2.R deleted file mode 100644 index 7b3bd0bd..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_gcvlwls2dV2.R +++ /dev/null @@ -1,92 +0,0 @@ -# devtools::load_all() -##options(error=recover) -library(testthat) - -try(silent = TRUE, load(system.file('testdata', 'dataForGetRawCov.RData', package='fdapace'))) -# try(silent = TRUE, load(system.file('testdata', 'dataForGetRawCov.RData', package='fdapace'))) -rcov <- GetRawCov(y,t, sort(unlist(t)), mu,'Sparse',FALSE) -r <- range(sort(unlist(t))) -regGrid <- seq(r[1], r[2], length.out=101) -tmp <- GCVLwls2DV2(sort(unlist(t)), regGrid, kern='epan', rcov=rcov, t=t) ## Why is this guy outside a test? -getGCVscoresV2(tmp$minBW, 'epan', rcov$tPairs, rcov$cxxn, regGrid=regGrid) - -test_that('getGCVscoresV2 spits out Inf if bandwidth is too small', { - expect_equal(suppressWarnings(getGCVscoresV2(2, 'epan', rcov$tPairs, rcov$cxxn, regGrid=regGrid)), Inf) - expect_message(getGCVscoresV2(2, 'epan', rcov$tPairs, rcov$cxxn, regGrid=regGrid, verbose=TRUE), 'Invalid bandwidth. Try enlarging the window size.\n') -}) - - -# debug(GCVLwls2DV2) -test_that('Binning works for GCV', { - set.seed(1) - pts <- seq(0, 1, by=0.05) - samp3 <- Wiener(20, pts, sparsify=2:7) - rcov3 <- GetRawCov(samp3$Ly, samp3$Lt, pts, rep(0, length(pts)), 'Sparse', error=FALSE) - brcov3 <- BinRawCov(rcov3) - obsGrid <- sort(unique(unlist(samp3$Lt))) - regGrid <- seq(min(obsGrid), max(obsGrid), length.out=101) - g1 <- GCVLwls2DV2(obsGrid, regGrid, kern='epan', rcov=rcov3, t=samp3$Lt) - g2 <- GCVLwls2DV2(obsGrid, regGrid, kern='epan', rcov=brcov3, t=samp3$Lt) - expect_equal(g1, g2) -}) - - -## Test CV -test_that('getCVscoresV2 works for binning', { - set.seed(1) - pts <- seq(0, 1, by=0.05) - samp3 <- Wiener(20, pts, sparsify=2:7) - rcov3 <- GetRawCov(samp3$Ly, samp3$Lt, pts, rep(0, length(pts)), 'Sparse', error=FALSE) - brcov3 <- BinRawCov(rcov3) - obsGrid <- sort(unique(unlist(samp3$Lt))) - regGrid <- seq(min(obsGrid), max(obsGrid), length.out=101) - partition <- CreateFolds(1:nrow(rcov3$tPairs), k=10) - bpartition <- CreateFolds(seq_along(brcov3$meanVals), k=10) - g1 <- getCVscoresV2(partition, 0.35, 'epan', rcov3$tPairs, rcov3$cxxn, regGrid=regGrid)[1] - g2 <- getCVscoresV2(bpartition, 0.35, 'epan', brcov3$tPairs, brcov3$meanVals, brcov3$count, regGrid=regGrid, RSS=brcov3$RSS)[1] - expect_equal(g1, g2, tolerance=1e-2) -}) - -test_that('GCV is closed to CV', { - set.seed(2) - pts <- seq(0, 1, by=0.05) - samp3 <- Wiener(20, pts, sparsify=2:7) - rcov3 <- GetRawCov(samp3$Ly, samp3$Lt, pts, rep(0, length(pts)), 'Sparse', error=FALSE) - obsGrid <- sort(unique(unlist(samp3$Lt))) - regGrid <- seq(min(obsGrid), max(obsGrid), length.out=101) - gcvRes <- GCVLwls2DV2(obsGrid, regGrid, kern='epan', rcov=rcov3, t=samp3$Lt) - cvRes <- GCVLwls2DV2(obsGrid, regGrid, kern='epan', rcov=rcov3, CV=10, t=samp3$Lt) - expect_equal(gcvRes$h, cvRes$h, 0.1) -}) - - -## HOLE example. Test whether the smoother can handle degenerate cases (in the local window all points lie on a line). - -test_that('GCV will avoid spitting out bandwidth that results in degenerate windows', -{ - set.seed(2) - n <- 20 - pts <- seq(0, 1, by=0.1) - samp4 <- Wiener(20, pts, sparsify=length(pts)) - # for the 10-15th observation retain only one - for (i in 1:n) { - retain <- sort(c(1, sample(c(2:3, (length(pts) - 3):length(pts)), 1), 4:(length(pts) - 4))) - samp4$Ly[[i]] <- samp4$Ly[[i]][retain] - samp4$Lt[[i]] <- samp4$Lt[[i]][retain] - } - - # CreateDesignPlot(samp4$Lt, pts, TRUE, FALSE, 'samp3') - - rcov4 <- GetRawCov(samp4$Ly, samp4$Lt, pts, rep(0, length(pts)), 'Sparse', error=FALSE) - g4 <- GCVLwls2DV2(pts, pts, kern='epan', rcov=rcov4, t=samp4$Lt) - expect_true(g4$minBW > 0.29) # by eyeballing -}) - -## To matlab -# names(samp3$Lt) <- 1:length(samp3$Lt) -# names(samp3$Ly) <- names(samp3$Lt) -# samp3$Lt <- lapply(samp3$Lt, matrix, nrow=1) -# samp3$Ly <- lapply(samp3$Ly, matrix, nrow=1) -# R.matlab::writeMat('samp3.mat', y=samp3$Ly, t=samp3$Lt) -# GCV values matches matlab, but procedures for optimal GCV BW choice are different. - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_getCrCorYX.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_getCrCorYX.R deleted file mode 100644 index 9bdd77be..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_getCrCorYX.R +++ /dev/null @@ -1,34 +0,0 @@ -library(testthat) - -test_that('GetCrCorYX works on a trivial example', { - - set.seed(123) - A = matrix(rnorm(10*7), ncol=7); - B = matrix(rnorm(10*4), ncol=4); - - covA = cov(A) - covB = cov(B) - covAB = cov(A,B) - - expect_equal(GetCrCorYX(covAB, covA, covB),cor(A,B)) - - expect_equal(GetCrCorYX(covAB, diag(covA), diag(covB)),cor(A,B)) - -}) - -test_that('GetCrCorYX works on a trivial example with a scalar', { - - set.seed(123) - A = matrix(rnorm(101*7), ncol=7); - B = rnorm(101); - - covA = cov(A) - covB = var(B) - covAB = cov(A,B) - - expect_equal(GetCrCorYX(covAB, covA, covB),cor(A,B)) - - expect_equal(GetCrCorYX(covAB, diag(covA), covB),cor(A,B)) - -}) - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_getCrCovYZ.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_getCrCovYZ.R deleted file mode 100644 index 313e622f..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_getCrCovYZ.R +++ /dev/null @@ -1,136 +0,0 @@ -# devtools::load_all() -library(testthat) - -test_that('The cross-covariance in the case of a dense matrix against a constant vector is zero and in the case of a steadily increasing matrix against a steadily increasing vector is stable',{ - set.seed(1) - n <- 100 - dccObj <- GetCrCovYZ(bw=1, Z= rep(4,n), Ly= matrix( runif(10*n), n)) - expect_equal( rep(0,10), as.numeric(dccObj$rawCC$rawCCov) ) - dccObj <- GetCrCovYZ( Z= 1:n, Ly= matrix(1:(10*n),n)) - expect_equal( 0, diff(range(dccObj$rawCC$rawCCov)) ) -}) - -test_that('The cross-covariance in the case of sparse sample and constant vector is zero',{ - set.seed(1) - # Make sparse sample - Ly <- list( runif(5), c(1:3), c(2:4), c(4)) - Lt <- list( c(1:5), c(1:3), c(1:3), 4) - Z = rep(4,4) - sccObj = GetCrCovYZ(bw=1, Z= Z, Ly=Ly, Lt=Lt, Ymu=rep(4,5)) - expect_equal( rep(0, sum(unlist(lapply(Ly, length)))), sccObj$rawCC$rawCCov ) -}) - -test_that('The cross-covariance in the case of a sparse sample that is steadily increasing and a vector that is steadily increasing is almost perfectly linear',{ - # Make sparse sample - Ly <- list(c(0:5),c(4.0000000000001), 5) - Lt <- list(c(0:5),c(4.0000000000001), 5) - Z = c(2.5, 4.0000000000001, 5) - sccObj = GetCrCovYZ( Z= Z, Ly=Ly, Lt=Lt, Ymu=rep(4.5,7)) - AA<- summary(lm( sccObj$smoothedCC ~ sort(unique(unlist(Lt))))) - expect_equal( AA$r.squared, 0.9998, tol=0.001) -}) - -test_that('The cross-covariance in the case of dense sample and a random variable with known variance',{ - - set.seed(123) - N = 1111; - M = 101; - - # Define the continuum - s = seq(0,10,length.out = M) - - # Define the mean and 2 eigencomponents - eigFunct1 <- function(s) +cos(2*s*pi/10) / sqrt(5) - - # Create FPC scores - Ksi = matrix(rnorm(N*2), ncol=2); - Ksi = apply(Ksi, 2, scale) - Ksi = t(t(chol(matrix(c(5,3,3,4),2))) %*% t(Ksi)) - - # Create Y_true - yTrue = Ksi[,1] %*% t(matrix(eigFunct1(s), ncol=1)) - sccObj = GetCrCovYZ(Z= Ksi[,2], Ly=yTrue ) - - # we know that the covariance between ksi_1 and z is three - expect_equal( max( abs( eigFunct1(s)*3 - sccObj$rawCC$rawCCov)), 0.03, tol=.01, scale=1 ) -}) - -test_that('The cross-covariance in the case of sparse sample and a random variable with known variance and the GCV bandwidth choice.',{ - - set.seed(123) - N = 3000; - M = 101; - - # Define the continuum - s = seq(0,10,length.out = M) - - # Define the mean and 2 eigencomponents - eigFunct1 <- function(s) +cos(2*s*pi/10) / sqrt(5) - - # Create FPC scores - Ksi = matrix(rnorm(N*2), ncol=2); - Ksi = apply(Ksi, 2, scale) - Ksi = t(t(chol(matrix(c(5,3,3,4),2))) %*% t(Ksi)) - - # Create Y_true - yTrue = Ksi[,1] %*% t(matrix(eigFunct1(s), ncol=1)) - ySparse = Sparsify(yTrue, s, c(3:9)) - - # Use GCV to pick the bandwidth - sccObj = GetCrCovYZ( Z= Ksi[,2],Ly=ySparse$Ly, Lt=ySparse$Lt, Ymu = rep(0,M) ) - - # Uncomment to visually check coherence. - # plot(s, sccObj$smoothedCC) - # lines(s, 3* eigFunct1(s)) - - # we know that the covariance between ksi_1 and z is three - expect_equal( mean(abs( 3*eigFunct1(s) - sccObj$smoothedCC)), 0.035, tol=.1, scale=1 ) - - # check that the relevant GCV scores are worse - sccObjDOUBLE = GetCrCovYZ( bw = sccObj$bw*2, Z= Ksi[,2],Ly=ySparse$Ly, Lt=ySparse$Lt, Ymu = rep(0,M) ) - sccObjHALF = GetCrCovYZ( bw = sccObj$bw*0.5, Z= Ksi[,2],Ly=ySparse$Ly, Lt=ySparse$Lt, Ymu = rep(0,M) ) - - expect_equal( min(c( sccObj$score, sccObjDOUBLE$score, sccObjHALF$score) ) , sccObj$score ) -}) - -test_that('Dense Wiener process has cov(int X(s) ds, X(t)) = int min(s,t) ds', { - set.seed(4) - n <- 2000 - nGridIn <- 51 - T <- matrix(seq(0, 1, length.out=nGridIn)) - -## Corr(\int X(s) ds, X(t)) = \int min(s,t) ds - covTrue <- rowMeans(outer(as.numeric(T), as.numeric(T), pmin)) - - A <- Wiener(n, T) - B <- Wiener(n, T) - X <- A + B - Z <- rowMeans(A) - - tmp <- GetCrCovYZ(NULL, Z, NULL, X, NULL, NULL, T) - expect_equal(as.numeric(tmp$rawCC$rawCCov), covTrue, tolerance=0.1) -}) - -test_that('Sparse Wiener process has cov(int X(s) ds, X(t)) = int min(s,t) ds', { - set.seed(4) - n <- 2000 - nGridIn <- 51 - sparsity <- 1:5 # must have length > 1 - bw <- 0.2 - kern <- 'epan' - T <- matrix(seq(0, 1, length.out=nGridIn)) - -## Corr(\int X(s) ds, X(t)) = \int min(s,t) ds - covTrue <- rowMeans(outer(as.numeric(T), as.numeric(T), pmin)) - - A <- Wiener(n, T) - B <- Wiener(n, T) - X <- A + B - indEach <- lapply(1:n, function(x) sort(sample(nGridIn, sample(sparsity, 1)))) - tAll <- lapply(1:n, function(i) T[indEach[[i]]]) - Xsp <- lapply(1:n, function(i) X[i, indEach[[i]]]) - Z <- rowMeans(A) - - tmp <- GetCrCovYZ(bw, Z, NULL, Xsp, tAll, rep(0, nGridIn), T) - expect_equal(tmp$smoothedCC, covTrue, tolerance=0.1) -}) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_getMinb.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_getMinb.R deleted file mode 100644 index 4372630f..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_getMinb.R +++ /dev/null @@ -1,24 +0,0 @@ -# devtools::load_all() -library(testthat) -load(system.file('testdata', 'dataForGcvLwlsTest.RData', package='fdapace')) -# rcov <- GetRawCov(y,t, sort(unlist(t)), mu,'Sparse',FALSE) #Matches ML output -test_that('2D min bandwidth is similar to Matlab', { - # expect_equal(GetMinb(rcov, sort(unique(unlist(t)))), 4.1427, tolerance=diff(range(unlist(t))) / 1000) - - # We break strict compatibility with MATLAB when we used quantile( diff(b[ids]), 0.95)/2 instead of max(diff(b[ids])/2) - # expect_equal(GetMinb(t, sort(unique(unlist(t)))), 4.1427, tolerance=diff(range(unlist(t))) / 1000) - - expect_equal( GetMinb(legacyCode = TRUE,t, sort(unique(unlist(t)))), 4.1427, tolerance= 4.1427 * 0.0175) - expect_equal( as.numeric(GetMinb(t, sort(unique(unlist(t))))), 4.1427, tolerance= 4.1427 * 0.0195 ) -}) - -test_that('2D min bandwidth for binned and unbinned rcov is the same', { - # expect_equal(GetMinb(BinRawCov(rcov), sort(unique(unlist(t)))), GetMinb(rcov, sort(unique(unlist(t))))) -}) - - -set.seed(1) -pts <- seq(0, 1, length=10) -samp2 <- Wiener(100, pts, sparsify=2:5) -rcov2 <- GetRawCov(samp2$Ly, samp2$Lt, pts, rep(0, length(pts)), 'Sparse', FALSE) -GetMinb(samp2$Lt, pts) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_interp2lin.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_interp2lin.R deleted file mode 100644 index f6d7e8db..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_interp2lin.R +++ /dev/null @@ -1,128 +0,0 @@ -# setwd('misc/') -# devtools::load_all() -# devtools::load_all('../RPACE/tPACE') - -library(testthat) -library(pracma) -# These check out OK. -U1 = test_that("basic pracma::interp2 example gives same output ", { - - x <- linspace(-1, 1, 11) - y <- linspace(-1, 1, 11) - mgrid <- meshgrid(x, y) - Z <- mgrid$X^2 + mgrid$Y^2 - xp <- yp <- linspace(-1, 1, 101) - method <- "linear" - AA = interp2(x, y, Z, xp, yp, method) - BB = interp2lin(x, y, Z, xp, yp) - expect_equal(sum(AA), sum(BB), tolerance = 2e-15) - -}) - -# These check out OK. -U2 = test_that("basic pracma::interp2 (extended) example gives same output ", { - - x <- linspace(-1, 4, 11) - y <- linspace(-1, 4, 11) - mgrid <- meshgrid(x, y) - Z <- mgrid$X^2 + 2*mgrid$Y + 3 - xp <- yp <- linspace(-1, 4, 51) - method <- "linear" - AA = interp2(x, y, Z, xp, yp, method) - BB = interp2lin( x, y, Z, xp, yp) - expect_equal(sum(AA), sum(BB), tolerance = 2e-15) -}) - - -U2_unequal = test_that("basic pracma::interp2 (extended) example gives same output ", { - - x <- linspace(-2, 5, 10) - y <- linspace(-1, 4, 11) - mgrid <- meshgrid(x, y) - Z <- mgrid$X^2 + 2*mgrid$Y + 3 - xp <- linspace(0, 3, 51) - yp <- linspace(0, 3, 51) - method <- "linear" - AA = interp2(x, y, Z, xp, yp, method) - BB = interp2lin( x, y, t(Z), xp, yp) - expect_equal(AA, BB, tolerance = 2e-15) -}) - - -# These check out OK. -U3 = test_that("basic pracma::interp2 (extended) example gives same output and out of sample", { - - x <- linspace(-1, 4, 11) - y <- linspace(-1, 4, 11) - mgrid <- meshgrid(x, y) - Z <- mgrid$X^2 + 2*mgrid$Y + 3 - xp <- yp <- linspace(-1, 5, 51) - method <- "linear" - AA = interp2(x, y, Z, xp, yp, method) - BB = interp2lin( x, y, Z, xp, yp) - expect_equal(sum(AA, na.rm=TRUE), sum(BB, na.rm=TRUE), tolerance = 2e-15) - expect_equal(is.na(BB), is.na(AA), tolerance = 2e-15) -}) - -#These check out OK. -U4 = test_that("basic pracma::interp2 example gives same outputs large output grid", { - - x <- linspace(-1, 4, 101) - y <- linspace(-1, 4, 101) - mgrid <- meshgrid(x, y) - Z <- mgrid$X^2 + 2*mgrid$Y + 3 - xout <- linspace(-1, 4, 200) - meshOut <- meshgrid(xout) - xp <- meshOut$X - yp <- meshOut$Y - method <- "linear" - system.time({AA = interp2(x, y, Z, xp, yp, method)}) - system.time({BB = interp2lin( x, y, Z, xp, yp)}) - expect_equal(sum(AA), sum(BB), tolerance = 2e-15) -}) - -#These check out OK. -U5 = test_that("basic pracma::interp2 example gives same outputs large input grid", { - - x <- linspace(-1, 4, 1001) - y <- linspace(-1, 4, 1001) - mgrid <- meshgrid(x, y) - Z <- mgrid$X^2 + 2*mgrid$Y + 3 - xout <- linspace(-1, 4, 100) - meshOut <- meshgrid(xout) - xp <- meshOut$X - yp <- meshOut$Y - method <- "linear" - system.time({AA = interp2(x, y, Z, xp, yp, method)}) - system.time({BB = interp2lin( x, y, Z, xp, yp)}) - expect_equal(sum(AA), sum(BB), tolerance = 2e-15) -}) - -U6 = test_that("basic pracma::interp2 example gives same output on different grid size", { - - x <- linspace(-2/3, 2/3, 4) - y <- linspace(-1, 1, 5) - Z <- outer(x, y, `+`) - xp <- linspace(-1/2, 1/2, 4) - yp <- linspace(-1, 1, 4) - method <- "linear" - AA = interp2(x, y, t(Z), xp, yp, method) - BB = interp2lin(x, y, Z, xp, yp) - expect_equal(AA, BB, tolerance = 2e-15) - -}) - -U7 = test_that("basic pracma::interp2 example gives same output on different grid size (large)", { - - x <- linspace(-1/2, 1/2, 3) - y <- linspace(-1, 1, 15) - Z <- outer(x, y, `*`) - xp <- linspace(-1/2, 1/2, 11) - yp <- linspace(-1, 1, 11) - method <- "linear" - AA = interp2(x, y, t(Z), xp, yp, method) - BB = interp2lin(x, y, Z, xp, yp) - expect_equal(sum(AA), sum(BB), tolerance = 2e-15) - -}) - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_mapX1d.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_mapX1d.R deleted file mode 100644 index 8c43a2ed..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_mapX1d.R +++ /dev/null @@ -1,11 +0,0 @@ -cat("\ntests for 'MapX1D'") - -test_that("basic arguments do not return any errors ", { - xn = c(1:4,16) - y = matrix(1:30, 15,2) - x = c(1:14,16) - expect_equal( MapX1D(x,y,xn), matrix(c(1,2,3,4,15,16,17,18,19,30), 5,2)) - expect_equal( MapX1D(1:14, seq(0,1,length.out=14),1:4 ), seq(0,1,length.out=14)[1:4]) -} -) - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_minb.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_minb.R deleted file mode 100644 index 4484aa4a..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_minb.R +++ /dev/null @@ -1,11 +0,0 @@ - cat("\nTests for 'Minb'") - -test_that("basic vector arguments do not return any errors ", { - expect_equal( Minb(c(1,2,3,4.1), -1), NaN) - expect_equal( Minb(c(1,2,3,4.1), 1), 2* 0.55) - expect_equal( Minb(c(11,2,3,4.1), -1), NaN) - expect_equal( Minb(c(11,2,3,4.1), 2), 8) - expect_equal( Minb(c(1,2,3,4.1), 6), NaN) -}) - -# cat("Done") diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_pc_covE.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_pc_covE.R deleted file mode 100644 index b3b46fea..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_pc_covE.R +++ /dev/null @@ -1,68 +0,0 @@ -# devtools::load_all() - -p0 <- list(dataType='Sparse', error=TRUE, kernel='epan') -p1 <- list(dataType='Dense', error=TRUE, kernel='epan') - -set.seed(1) -pts <- seq(0, 1, by=0.05) -regGrid <- seq(0, 1, by=0.1) - -sampSparse <- Wiener(100, pts, sparsify=20) -p0 <- SetOptions(sampSparse$Ly, sampSparse$Lt, p0) -sampDense <- Wiener(100, pts, sparsify=21) -p1 <- SetOptions(sampDense$Ly, sampDense$Lt, p1) - -mu3 <- rep(0, length(pts)) - -## Sparse Case -rcovSparse <- GetRawCov(sampSparse$Ly, sampSparse$Lt, pts, mu3, p0$dataType, error=p0$error) -tmpSparse <- GetSmoothedCovarSurface(sampSparse$Ly, sampSparse$Lt, mu3, pts, regGrid, - p0, useBinnedCov=FALSE) -pccovE_Sparse <- PC_CovE(pts, seq(0,1,length.out=nrow(tmpSparse$smoothCov)), - bw_userCov = tmpSparse$bwCov, rotationCut = c(0, 1), kernel = p0$kernel, rcov = rcovSparse) -pccovE_Sparse$sigma2 - -## Dense Case -rcovDense <- GetRawCov(sampDense$Ly, sampDense$Lt, pts, mu3, p1$dataType, error=p1$error) -tmpDense <- GetSmoothedCovarSurface(sampDense$Ly, sampDense$Lt, mu3, pts, regGrid, - p1, useBinnedCov=FALSE) -pccovE_Dense <- PC_CovE(pts, seq(0,1,length.out=nrow(tmpDense$smoothCov)), - bw_userCov = tmpDense$bwCov, rotationCut = c(0, 1), kernel = p1$kernel, rcov = rcovDense) -pccovE_Dense$sigma2 - -## Tests added by Xiongtao -## Dense -set.seed(1) -pts <- seq(0, 1, by=0.01) -regGrid <- seq(0, 1, by=0.02) - -n <- 10000 -sampDense <- Wiener(n, pts) -sampDense <- sampDense + rnorm(n * length(pts), sd=10) -sampDense <- Sparsify(sampDense, pts, length(pts)) -p1 <- SetOptions(sampDense$Ly, sampDense$Lt, list(dataType='Dense', error=TRUE, kernel='epan')) -mu3 <- rep(0, length(pts)) - -rcovDense <- GetRawCov(sampDense$Ly, sampDense$Lt, pts, mu3, p1$dataType, error=p1$error) -tmpDense <- GetSmoothedCovarSurface(sampDense$Ly, sampDense$Lt, mu3, pts, regGrid, p1, useBinnedCov=FALSE) - - -pccovE_Dense <- PC_CovE(pts, seq(0,1,length.out=nrow(tmpDense$smoothCov)), bw_userCov = tmpDense$bwCov, rotationCut = c(0, 1), kernel = p1$kernel, rcov = rcovDense) -sqrt(pccovE_Dense$sigma2) - -## Sparse -set.seed(1) -pts <- seq(0, 1, by=0.05) -regGrid <- seq(0, 1, by=0.1) -n <- 100 -sampSparse <- Wiener(n, pts) -sampSparse <- sampSparse + rnorm(n * length(pts), sd=0.4) -sampSparse <- Sparsify(sampSparse, pts, 2:7) -p2 <- SetOptions(sampSparse$Ly, sampSparse$Lt, list(dataType='Sparse', error=TRUE, kernel='epan')) -mu3 <- rep(0, length(pts)) - -rcovSparse <- GetRawCov(sampSparse$Ly, sampSparse$Lt, pts, mu3, p2$dataType, error=p2$error) -tmpSparse <- GetSmoothedCovarSurface(sampSparse$Ly, sampSparse$Lt, mu3, pts, regGrid, p2, useBinnedCov=FALSE) - -pccovE_Sparse <- PC_CovE(pts, seq(0,1,length.out=nrow(tmpSparse$smoothCov)), bw_userCov = tmpSparse$bwCov, rotationCut = c(0, 1), kernel = p2$kernel, rcov = rcovSparse) -sqrt(pccovE_Sparse$sigma2) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_plotFPCA.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_plotFPCA.R deleted file mode 100644 index f0411eb8..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_plotFPCA.R +++ /dev/null @@ -1,23 +0,0 @@ -# devtools::load_all() - -viewPdf <- FALSE -set.seed(2) -n <- 100 -M <- 51 -pts <- seq(0, 1, length.out=M) -mu <- rep(0, length(pts)) -sampDense <- Wiener(n, pts) -samp <- Sparsify(sampDense, pts, M) -res <- FPCA(samp$Ly, samp$Lt, list(error=TRUE, FVEthreshold=1, dataType='Dense', plot=TRUE)) - -if (viewPdf) { - pdf('tmp.pdf') -} - -plot(res) - -test_that("inner product of eigenfunctions and mean shall be non-negative", { - inprod.mu.and.phi <- res$mu %*% res$phi / M #compute inner product by simple Riemann sum - expect_true( all(inprod.mu.and.phi>=0) ) #absolute difference - -}) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_predictFPCA.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_predictFPCA.R deleted file mode 100644 index 91d6700c..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_predictFPCA.R +++ /dev/null @@ -1,120 +0,0 @@ -if (Sys.getenv('TRAVIS') != 'true') {# Do not run on travis since this is slow -# devtools::load_all() -library(testthat) - -# test for consistency in dense case -test_that('consistent estimates for dense case using IN', { - - set.seed(1) - n <- 30 - pts <- seq(0, 1, length.out = 33) - sampWiener <- Wiener(n, pts) - sampWiener <- Sparsify(sampWiener, pts, 33) - resA <- FPCA(sampWiener$Ly, sampWiener$Lt) - testK = 4; - - AAA <- predict(resA, newLy = sampWiener$Ly,newLt = sampWiener$Lt, K = testK, xiMethod = 'IN') - - expect_lt( max( abs(colMeans( abs(AAA) - abs(resA$xiEst[,1:testK]) ) ) ), .Machine$double.eps) - expect_gt( min( abs(diag(cor( AAA , resA$xiEst[,1:testK])) ) ), 0.99999) - -}) - -# test for consistency in sparse case -test_that('consistent estimates for dense case using CE', { - - set.seed(1) - n <- 30 - pts <- seq(0, 1, length.out = 33) - sampWiener <- Wiener(n, pts) - sampWiener <- Sparsify(sampWiener, pts, 33) - resB <- FPCA(sampWiener$Ly, sampWiener$Lt) - testK = 4; - BBB <- predict(resB, newLy = sampWiener$Ly,newLt = sampWiener$Lt, K = testK, xiMethod = 'CE') - - expect_lt( max( abs(colMeans( abs(BBB) - abs(resB$xiEst[,1:testK])) ) ), sd(abs(resB$xiEst[,1:testK])) / 50) - expect_gt( min( abs(diag(cor(BBB , resB$xiEst[,1:testK])) ) ), 0.99) - -}) - -# test for consistency in sparse case -test_that('consistent estimates for sparse case using CE', { - - set.seed(1) - n <- 70 - pts <- seq(0, 1, by=0.0025) - sampWiener <- Wiener(n, pts) - sampWiener <- Sparsify(sampWiener, pts, 4) - resC <- FPCA(sampWiener$Ly, sampWiener$Lt) - testK = 4 - - CCC <- predict(resC, newLy = sampWiener$Ly,newLt = sampWiener$Lt, K = testK) - - expect_lt( max( abs(colMeans(CCC - resC$xiEst[,1:testK]) ) - 1.96 * apply(CCC - resC$xiEst[,1:testK],2,sd) ), .Machine$double.eps) - expect_gt( min( abs(diag(cor(CCC , resC$xiEst[,1:testK])) ) ), 0.99999) - -}) - -# test for consistency when using dense data with a sparse object -test_that('consistent estimates for dense data with sparse FPCA object', { - - set.seed(1) - n <- 1001 # This object has to be pretty informed... - pts <- seq(0, 1, length.out = 33) - sampWiener <- Wiener(n, pts) - - set.seed(2) - sampWienerS <- Sparsify(sampWiener, pts, 9) - resS <- FPCA(sampWienerS$Ly, sampWienerS$Lt) - set.seed(2) - sampWienerD <- Sparsify(sampWiener, pts, 33) - resD <- FPCA(sampWienerD$Ly, sampWienerD$Lt) - testK = 4 - - AAA2 <- predict(resS, newLy = sampWienerD$Ly,newLt = sampWienerD$Lt, K = testK) - - expect_lt( max( abs(colMeans( abs(AAA2) - abs(resD$xiEst[,1:testK])) ) - 1.96 * apply( abs(AAA2) - abs( resD$xiEst[,1:testK]),2,sd) ), .Machine$double.eps) - expect_gt( min( abs(diag(cor(AAA2 , resD$xiEst[,1:testK])) ) ), 0.985) - -}) - -# test for consistency when using sparse data with a dense object -test_that('consistent estimates for sparse data with dense FPCA object', { - - set.seed(1) - n <- 51 - pts <- seq(0, 1, length.out = 99) - sampWiener <- Wiener(n, pts) - - set.seed(2) - sampWienerS <- Sparsify(sampWiener, pts, 11) - set.seed(2) - sampWienerD <- Sparsify(sampWiener, pts, 99) - resD <- FPCA(sampWienerD$Ly, sampWienerD$Lt) - testK = 4 - - AAA3 <- predict(resD, newLy = sampWienerS$Ly,newLt = sampWienerS$Lt, K = testK, xiMethod = 'CE') - - expect_lt( max( abs(colMeans( abs(AAA3) - abs(resD$xiEst[,1:testK])) ) - 1.96 * apply( abs(AAA3) - abs( resD$xiEst[,1:testK]),2,sd) ), .Machine$double.eps) - expect_gt( min( abs(diag(cor(AAA3, resD$xiEst[,1:testK])) ) ), 0.90) # - -}) - -# test for consistency when using sparse data with a dense object -test_that('error when using Tr. Num. Int with sparse data FPCA object', { - - set.seed(1) - n <- 51 - pts <- seq(0, 1, length.out = 99) - sampWiener <- Wiener(n, pts) - - set.seed(2) - sampWienerS <- Sparsify(sampWiener, pts, 2) - resS2 <- FPCA(sampWienerS$Ly, sampWienerS$Lt) - - expect_error( predict(resS2, newLy = sampWienerS$Ly,newLt = sampWienerS$Lt, K = testK, xiMethod = 'IN'), - message = 'Trapezoid Numerical intergration (IN) is invalid for sparse data.') # - -}) - -} diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_rotateLwls2dV2.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_rotateLwls2dV2.R deleted file mode 100644 index 4aa9f737..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_rotateLwls2dV2.R +++ /dev/null @@ -1,15 +0,0 @@ -# devtools::load_all() -set.seed(1) -n <- 100 -pts <- seq(0, 1, by=0.05) -outPts <- seq(0, 1, by=0.1) -samp3 <- Wiener(n, pts) + rnorm(n * length(pts), sd=0.5) -samp3 <- Sparsify(samp3, pts, 5:10) -rcov3 <- GetRawCov(samp3$Ly, samp3$Lt, pts, rep(0, length(pts)), 'Sparse', error=TRUE) -brcov3 <- BinRawCov(rcov3) - -gcv3b <- GCVLwls2DV2(pts, outPts, kern='epan', rcov=brcov3, t=samp3$Lt) - -test_that('RotateLwls2dV2.R interface is correct', { - expect_equal(Rrotatedmullwlsk(c(gcv3b$h, gcv3b$h) , 'epan', t(brcov3$tPairs), brcov3$meanVals, brcov3$count, rbind(outPts, outPts), npoly=1, bwCheck=FALSE), RotateLwls2DV2( gcv3b$h, 'epan', xin=brcov3$tPairs, yin=brcov3$meanVals, win=brcov3$count, xout=cbind(outPts, outPts))) -}) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_selectK.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_selectK.R deleted file mode 100644 index e9a46d41..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_selectK.R +++ /dev/null @@ -1,194 +0,0 @@ -library(testthat) -library(mvtnorm) -# devtools::load_all() - -test_that("SelectK works for dense FPCA Wiener process with measurement error",{ - n = 100; K = 10; pts = seq(0, 1, length=50) - lambda <- (1 / (1:K - 1/2) / pi)^2 - TrueFVE <- cumsum(lambda)/sum(lambda) * 100 - phi <- sqrt(2) * sin( pts %*% matrix(1:K - 1/2, 1, K) * pi ) - set.seed(1) - scores <- t(diag(1 / (1:K - 1/2) / pi) %*% matrix(rnorm(K * n), K, n)) - sd <- 0.01 - # generate Wiener process - test1 <- t(phi %*% t(scores)) # Dense data - test2 <- test1 + matrix(rnorm(nrow(test1)*ncol(test1),mean=0,sd=sd),nrow=nrow(test1)) - test4 <- Sparsify(test2, pts, rep(length(pts),n)) # Dense Data with measurement errors - Trueloglik <- rep(0, K) - for(i in 1:K){ - # marginal likelihood - Sigma_y <- phi[,1:i,drop=F] %*% (lambda[1:i]*diag(i)) %*% t(phi[,1:i,drop=F]) + sd^2 * diag(nrow(phi[,1:i,drop=F])) - detSigma_y <- det(Sigma_y) - for(j in 1:n){ - invtempsub = solve(Sigma_y, test4$Ly[[j]] - 0) - Trueloglik[i] <- Trueloglik[i] + dmvnorm(x=test4$Ly[[j]],mean=rep(0,nrow(phi)), - sigma=Sigma_y, log=TRUE) - } - # conditional likelihood - #Trueloglik[i] <- -(sum(diag((test2 - t(phi[,1:i] %*% t(scores[,1:i]))) %*% t(test2 - t(phi[,1:i] %*% t(scores[,1:i])))))/(2*sd^2) + - # length(pts)/2*log(2*pi) + length(pts)/2*log(sd^2)) - } - TrueAIC <- 2*(1:K) - 2*Trueloglik - TrueBIC <- log(n)*(1:K) - 2*Trueloglik - # FPCA - #optnDenseError <- SetOptions(test4$Ly, test4$Lt, list(dataType='Dense', error=TRUE, kernel='epan', outPercent=c(0, 1), verbose=TRUE)) - optnDenseErrorAIC <- SetOptions(test4$Ly, test4$Lt, list(dataType='Dense', error=TRUE, kernel='epan', methodSelectK = 'AIC', outPercent=c(0, 1), verbose=TRUE)) - optnDenseErrorBIC <- SetOptions(test4$Ly, test4$Lt, list(dataType='Dense', error=TRUE, kernel='epan', methodSelectK = 'BIC', outPercent=c(0, 1), verbose=TRUE)) - optnDenseErrorFVE <- SetOptions(test4$Ly, test4$Lt, list(dataType='Dense', error=TRUE, kernel='epan', methodSelectK = 'FVE', FVEthreshold = 0.85, outPercent=c(0, 1), verbose=TRUE, lean = FALSE)) - test4FPCA_AIC <- FPCA(test4$Ly, test4$Lt, optnDenseErrorAIC) - test4FPCA_BIC <- FPCA(test4$Ly, test4$Lt, optnDenseErrorBIC) - test4FPCA_FVE <- FPCA(test4$Ly, test4$Lt, optnDenseErrorFVE) - expect_equal(test4FPCA_FVE$selectK, min(which(TrueFVE >= 85))) - expect_equal(test4FPCA_AIC$selectK, which(TrueAIC == min(TrueAIC))) - expect_equal(test4FPCA_BIC$selectK, which(TrueBIC == min(TrueBIC))) -}) - -#test_that("SelectK works for sparse FPCA Wiener process with measurement error",{ -# n = 1000; K = 5; pts = seq(0, 1, length=50) -# lambda <- (1 / (1:K - 1/2) / pi)^2 -# TrueFVE <- cumsum(lambda)/sum(lambda) * 100 -# phi <- sqrt(2) * sin( pts %*% matrix(1:K - 1/2, 1, K) * pi ) -# set.seed(1) -# scores <- t(diag(1 / (1:K - 1/2) / pi) %*% matrix(rnorm(K * n), K, n)) -# sd <- 0.01 -# # generate Wiener process -# test1 <- t(phi %*% t(scores)) # Dense data -# test2 <- test1 + matrix(rnorm(nrow(test1)*ncol(test1),mean=0,sd=sd),nrow=nrow(test1)) -# test3 <- Sparsify(test2, pts, 4:10) # Sparse Data with measurement errors -# Trueloglik <- rep(0, K) -# for(i in 1:K){ -# # marginal likelihood -# for(j in 1:n){ -# phi_i = ConvertSupport(fromGrid = pts, toGrid = test3$Lt[[j]], phi = phi) -# Sigma_yi <- phi_i[,1:i,drop=F] %*% (lambda[1:i]*diag(i)) %*% t(phi_i[,1:i,drop=F]) + sd^2 * diag(nrow(phi_i[,1:i,drop=F])) -# detSigma_yi <- det(Sigma_yi) -# invtempsub = solve(Sigma_yi, test3$Ly[[j]] - 0) -# Trueloglik[i] <- Trueloglik[i] + dmvnorm(x=test3$Ly[[j]],mean=rep(0,nrow(phi_i)), -# sigma=Sigma_yi, log=TRUE) -# } -# # conditional likelihood -# #Trueloglik[i] <- -(sum(diag((test2 - t(phi[,1:i] %*% t(scores[,1:i]))) %*% -# # t(test2 - t(phi[,1:i] %*% t(scores[,1:i])))))/(2*sd^2) - -# # n*length(pts)/2*log(2*pi) - n*length(pts)/2*log(sd^2)) -# } -# TrueAIC <- 2*(1:K) - 2*Trueloglik -# TrueBIC <- log(n)*(1:K) - 2*Trueloglik -# # FPCA -# #optnSparseError <- SetOptions(test3$Ly, test3$Lt, list(dataType='Sparse', error=FALSE, kernel='epan', outPercent=c(0, 1), verbose=TRUE)) -# optnSparseError_AIC <- SetOptions(test3$Ly, test3$Lt, list(dataType='Sparse', error=TRUE, kernel='epan', methodSelectK='AIC', outPercent=c(0, 1), verbose=TRUE)) -# optnSparseError_BIC <- SetOptions(test3$Ly, test3$Lt, list(dataType='Sparse', error=TRUE, kernel='epan', methodSelectK='BIC', outPercent=c(0, 1), verbose=TRUE)) -# optnSparseError_FVE <- SetOptions(test3$Ly, test3$Lt, list(dataType='Sparse', error=TRUE, kernel='epan', methodSelectK='FVE', FVEthreshold = 0.85, outPercent=c(0, 1), verbose=TRUE)) -# test3FPCA_AIC <- FPCA(test3$Ly, test3$Lt, optnSparseError_AIC) -# test3FPCA_BIC <- FPCA(test3$Ly, test3$Lt, optnSparseError_BIC) -# test3FPCA_FVE <- FPCA(test3$Ly, test3$Lt, optnSparseError_FVE) -# expect_equal(test3FPCA_AIC$selectK, which(TrueAIC == min(TrueAIC))) -# expect_equal(test3FPCA_BIC$selectK, which(TrueBIC == min(TrueBIC))) -# expect_equal(test3FPCA_FVE$selectK, min(which(TrueFVE >= 85))) -#}) - -test_that("SelectK works outside FPCA function for Dense data and gives the same output with equivalent options",{ - n = 100; K = 10; pts = seq(0, 1, length=50) - lambda <- (1 / (1:K - 1/2) / pi)^2 - TrueFVE <- cumsum(lambda)/sum(lambda) * 100 - phi <- sqrt(2) * sin( pts %*% matrix(1:K - 1/2, 1, K) * pi ) - set.seed(1) - scores <- t(diag(1 / (1:K - 1/2) / pi) %*% matrix(rnorm(K * n), K, n)) - sd <- 0.01 - # generate Wiener process - test1 <- t(phi %*% t(scores)) # Dense data - test2 <- test1 + matrix(rnorm(nrow(test1)*ncol(test1),mean=0,sd=sd),nrow=nrow(test1)) - test4 <- Sparsify(test2, pts, rep(length(pts),n)) # Dense Data with measurement errors - Trueloglik <- rep(0, K) - for(i in 1:K){ - # marginal likelihood - Sigma_y <- phi[,1:i,drop=F] %*% (lambda[1:i]*diag(i)) %*% t(phi[,1:i,drop=F]) + sd^2 * diag(nrow(phi[,1:i,drop=F])) - detSigma_y <- det(Sigma_y) - for(j in 1:n){ - invtempsub = solve(Sigma_y, test4$Ly[[j]] - 0) - Trueloglik[i] <- Trueloglik[i] + dmvnorm(x=test4$Ly[[j]],mean=rep(0,nrow(phi)), - sigma=Sigma_y, log=TRUE) - } - # conditional likelihood - #Trueloglik[i] <- -(sum(diag((test2 - t(phi[,1:i] %*% t(scores[,1:i]))) %*% t(test2 - t(phi[,1:i] %*% t(scores[,1:i])))))/(2*sd^2) + - # length(pts)/2*log(2*pi) + length(pts)/2*log(sd^2)) - } - TrueAIC <- 2*(1:K) - 2*Trueloglik - TrueBIC <- log(n)*(1:K) - 2*Trueloglik - # FPCA - #optnDenseError <- SetOptions(test4$Ly, test4$Lt, list(dataType='Dense', error=TRUE, kernel='epan', outPercent=c(0, 1), verbose=TRUE)) - optnDenseErrorAIC <- SetOptions(test4$Ly, test4$Lt, list(dataType='Dense', error=TRUE, kernel='epan', methodSelectK = 'AIC', outPercent=c(0, 1), verbose=TRUE)) - optnDenseErrorBIC <- SetOptions(test4$Ly, test4$Lt, list(dataType='Dense', error=TRUE, kernel='epan', methodSelectK = 'BIC', outPercent=c(0, 1), verbose=TRUE)) - optnDenseErrorFVE <- SetOptions(test4$Ly, test4$Lt, list(dataType='Dense', error=TRUE, kernel='epan', methodSelectK = 'FVE', FVEthreshold = 0.85, outPercent=c(0, 1), verbose=TRUE, lean = FALSE)) - test4FPCA_AIC <- FPCA(test4$Ly, test4$Lt, optnDenseErrorAIC) - test4FPCA_BIC <- FPCA(test4$Ly, test4$Lt, optnDenseErrorBIC) - test4FPCA_FVE <- FPCA(test4$Ly, test4$Lt, optnDenseErrorFVE) - # the following default FPCA run does not select number of components - optnDenseError <- SetOptions(test4$Ly, test4$Lt, list(dataType='Dense', error=TRUE, kernel='epan', outPercent=c(0, 1), verbose=TRUE, lean = FALSE)) - test4FPCA <- FPCA(test4$Ly, test4$Lt, optnDenseError) - outAIC <- SelectK(fpcaObj = test4FPCA, criterion = 'AIC')$K - outBIC <- SelectK(fpcaObj = test4FPCA, criterion = 'BIC')$K - outFVE <- SelectK(fpcaObj = test4FPCA, criterion = 'FVE', FVEthreshold = 0.85)$K - expect_equal(test4FPCA_AIC$selectK, outAIC) - expect_equal(test4FPCA_BIC$selectK, outBIC) - expect_equal(test4FPCA_FVE$selectK, outFVE) - # the option fixedK is tested below - FixK <- 3 - optnDenseErrorfixedK <- SetOptions(test4$Ly, test4$Lt, list(dataType='Dense', error=TRUE, kernel='epan', methodSelectK = FixK, outPercent=c(0, 1), verbose=TRUE, lean = FALSE)) - test4FPCA_fixedK <- FPCA(test4$Ly, test4$Lt, optnDenseErrorfixedK) - expect_equal(test4FPCA_fixedK$selectK, FixK) - # we can get the same results if using SelectK outside FPCA - outfixedK <- SelectK(fpcaObj = test4FPCA, criterion = FixK)$K - expect_equal(outfixedK, FixK) -}) - -test_that("SelectK works outside FPCA function for Sparse data and gives the same output with equivalent options",{ - n = 1000; K = 5; pts = seq(0, 1, length=50) - lambda <- (1 / (1:K - 1/2) / pi)^2 - TrueFVE <- cumsum(lambda)/sum(lambda) * 100 - phi <- sqrt(2) * sin( pts %*% matrix(1:K - 1/2, 1, K) * pi ) - set.seed(1) - scores <- t(diag(1 / (1:K - 1/2) / pi) %*% matrix(rnorm(K * n), K, n)) - sd <- 0.01 - # generate Wiener process - test1 <- t(phi %*% t(scores)) # Dense data - test2 <- test1 + matrix(rnorm(nrow(test1)*ncol(test1),mean=0,sd=sd),nrow=nrow(test1)) - test3 <- Sparsify(test2, pts, 4:10) # Sparse Data with measurement errors - Trueloglik <- rep(0, K) - for(i in 1:K){ - # marginal likelihood - for(j in 1:n){ - phi_i = ConvertSupport(fromGrid = pts, toGrid = test3$Lt[[j]], phi = phi) - Sigma_yi <- phi_i[,1:i,drop=F] %*% (lambda[1:i]*diag(i)) %*% t(phi_i[,1:i,drop=F]) + sd^2 * diag(nrow(phi_i[,1:i,drop=F])) - detSigma_yi <- det(Sigma_yi) - invtempsub = solve(Sigma_yi, test3$Ly[[j]] - 0) - Trueloglik[i] <- Trueloglik[i] + dmvnorm(x=test3$Ly[[j]],mean=rep(0,nrow(phi_i)), - sigma=Sigma_yi, log=TRUE) - } - # conditional likelihood - #Trueloglik[i] <- -(sum(diag((test2 - t(phi[,1:i] %*% t(scores[,1:i]))) %*% - # t(test2 - t(phi[,1:i] %*% t(scores[,1:i])))))/(2*sd^2) - - # n*length(pts)/2*log(2*pi) - n*length(pts)/2*log(sd^2)) - } - TrueAIC <- 2*(1:K) - 2*Trueloglik - TrueBIC <- log(n)*(1:K) - 2*Trueloglik - # FPCA - #optnSparseError <- SetOptions(test3$Ly, test3$Lt, list(dataType='Sparse', error=FALSE, kernel='epan', outPercent=c(0, 1), verbose=TRUE)) - optnSparseError_AIC <- SetOptions(test3$Ly, test3$Lt, - list(dataType='Sparse', error=TRUE, kernel='epan', methodSelectK='AIC', outPercent=c(0, 1), verbose=TRUE)) - optnSparseError_BIC <- SetOptions(test3$Ly, test3$Lt, - list(dataType='Sparse', error=TRUE, kernel='epan', methodSelectK='BIC', outPercent=c(0, 1), verbose=TRUE)) - optnSparseError_FVE <- SetOptions(test3$Ly, test3$Lt, - list(dataType='Sparse', error=TRUE, kernel='epan', methodSelectK='FVE', FVEthreshold = 0.85, outPercent=c(0,1), verbose=TRUE)) - test3FPCA_AIC <- FPCA(test3$Ly, test3$Lt, optnSparseError_AIC) - test3FPCA_BIC <- FPCA(test3$Ly, test3$Lt, optnSparseError_BIC) - test3FPCA_FVE <- FPCA(test3$Ly, test3$Lt, optnSparseError_FVE) - # the following default FPCA run does not select number of components - optnSparseError <- SetOptions(test3$Ly, test3$Lt, list(dataType='Sparse', error=TRUE, kernel='epan', outPercent=c(0, 1), verbose=TRUE, lean = FALSE)) - test3FPCA <- FPCA(test3$Ly, test3$Lt, optnSparseError) - outAIC <- SelectK(fpcaObj = test3FPCA, criterion = 'AIC')$K - outBIC <- SelectK(fpcaObj = test3FPCA, criterion = 'BIC')$K - outFVE <- SelectK(fpcaObj = test3FPCA, criterion = 'FVE', FVEthreshold = 0.85)$K - expect_equal(test3FPCA_AIC$selectK, outAIC) - expect_equal(test3FPCA_BIC$selectK, outBIC) - expect_equal(test3FPCA_FVE$selectK, outFVE) -}) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_trapzRcpp.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_trapzRcpp.R deleted file mode 100644 index d3f1cfbf..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_trapzRcpp.R +++ /dev/null @@ -1,14 +0,0 @@ -# devtools::load_all() -library(testthat) - -test_that('trapzRcpp works on a trivial example', { - x = c(0,2) - y = c(0,2) - expect_equal( trapzRcpp(x,y), 2 ) -}) - -test_that('trapzRcpp works on a nearly trivial example', { - x = seq(0,4, length.out=100) - y = x + sin(x); - expect_equal(trapzRcpp(x,y), 9.653418652171286) -}) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_useBin.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_useBin.R deleted file mode 100644 index 24cb9074..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_useBin.R +++ /dev/null @@ -1,18 +0,0 @@ -# devtools::load_all() -library(testthat) - -test_that('The binned version is exactly the same as the unbinned version.', { - set.seed(1) - pts <- seq(0, 1, by=0.05) - samp3 <- Wiener(300, pts, sparsify=5) - y <- samp3$Ly - t <- samp3$Lt - - resNoBin <- FPCA(y, t, list(dataType='Sparse', useBinnedData='OFF', useBinnedCov=FALSE)) - resBin <- FPCA(y, t, list(dataType='Sparse', useBinnedData='OFF', useBinnedCov=TRUE)) - - resBin$timings= NULL; - resNoBin$timings=NULL; - - expect_equal(resNoBin[names(resNoBin) != 'optns'], resBin[names(resBin) != 'optns']) -}) diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_wiener.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_wiener.R deleted file mode 100644 index bbab30bc..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat/test_wiener.R +++ /dev/null @@ -1,18 +0,0 @@ -# source('.../Wiener.R') - -pts <- seq(0, 1, length=20) -tmp <- Wiener(50, pts) -tmp1 <- Sparsify(tmp, pts, c(2, 4, 6)) - -sapply(tmp1$Lt, length) -sapply(tmp1$Ly, length) - -set.seed(1) -tmp2 <- Wiener(10, pts=seq(0, 1, by=0.1)) -set.seed(1) -tmp3 <- Wiener(10, pts=seq(0, 1, by=0.1), sparsify=2) - -pts <- seq(0, 1, by=0.02) -tmp <- Wiener(1000, pts) -tmp1 <- Sparsify(tmp, pts, 1:5, fragment=0.2) -CreateDesignPlot(tmp1[['Lt']], pts, TRUE, FALSE) \ No newline at end of file diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat_slow.R b/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat_slow.R deleted file mode 100644 index a53dccf5..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/tests/testthat_slow.R +++ /dev/null @@ -1,9 +0,0 @@ -# # Based on https://github.com/hadley/testthat#integration-with-r-cmd-check - -# Splitting test files into multiple ones so that each one runs within 10 mins, -# which is the limit on travis CI. -# This file contains the slow running tests. - -library(testthat) -library(fdapace) -test_check("fdapace", filter='FClust|FSVD|FPCA|FVPA|FCReg|FOptDes|GetCrCovYX|selectK|WFDA|MultiFAM|', perl=TRUE) # diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/vignettes/fdapaceVig.Rmd b/fdapace.Rcheck/00_pkg_src/fdapace/vignettes/fdapaceVig.Rmd deleted file mode 100644 index 34b25aaf..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/vignettes/fdapaceVig.Rmd +++ /dev/null @@ -1,206 +0,0 @@ ---- -title: "Functional PCA in R" -author: "Hadjipantelis, Dai, Ji, Han, Muller & Wang - UC Davis, USA" -date: "1 December 2017" -bibliography: roxygen.bib -output: html_document -vignette: > - %\VignetteIndexEntry{Introduction to fdapace} - %\VignetteEngine{knitr::rmarkdown} - %\VignetteEncoding{UTF-8} ---- - -```{r setup, include=FALSE} -knitr::opts_chunk$set(echo = TRUE) -``` - -## Overview - -The basic work-flow behind the PACE approach for sparse functional data is as follows (see eg. [@Yao05; @Liu09] for more information): - -1. Calculate the smoothed mean $\hat{\mu}$ (using local linear smoothing) aggregating all the available readings together. -2. Calculate for each curve separately its own raw covariance and then aggregate all these raw covariances to generate the sample raw covariance. -3. Use the off-diagonal elements of the sample raw covariance to estimate the smooth covariance. -4. Perform eigenanalysis on the smoothed covariance to obtain the estimated eigenfunctions $\hat{\phi}$ and eigenvalues $\hat{\lambda}$, then project that smoothed covariance on a positive semi-definite surface [@Hall2008]. -5. Use Conditional Expectation (PACE step) to estimate the corresponding scores $\hat{\xi}$. -ie. \newline -$\hat{\xi}_{ik} = \hat{E}[\hat{\xi}_{ik}|Y_i] = \hat{\lambda}_k \hat{\phi}_{ik}^T \Sigma_{Y_i}^{-1}(Y_i-\hat{\mu}_i)$. - -As a working assumption a dataset is treated as sparse if it has on average less than 20, potentially irregularly sampled, measurements per subject. A user can manually change the automatically determined `dataType` if that is necessary. -For densely observed functional data simplified procedures are available to obtain the eigencomponents and associated functional principal components scores (see eg. [@Castro86] for more information). In particular in this case we: - -1. Calculate the cross-sectional mean $\hat{\mu}$. -2. Calculate the cross-sectional covariance surface (which is guaranteed to be positive semi-definite). -3. Perform eigenanalysis on the covariance to estimate the eigenfunctions $\hat{\phi}$ and eigenvalues $\hat{\lambda}$. -4. Use numerical integration to estimate the corresponding scores $\hat{\xi}$. - ie. \newline - $\hat{\xi}_{ik} = \int_0^T [ y(t) - \hat{\mu}(t)] \phi_i(t) dt$ - -In the case of sparse FPCA the most computational intensive part is the smoothing of the sample's raw covariance function. For this, we employ a local weighted bilinear smoother. - -A sibling MATLAB package for `fdapace` can be found in [here](http://www.stat.ucdavis.edu/PACE). - -## FPCA in R using fdapace - -The simplest scenario is that one has two lists `yList` and `tList` where `yList` is a list of vectors, each containing the observed values $Y_{ij}$ for the $i$th subject and `tList` is a list of vectors containing corresponding time points. In this case one uses: - -```{r,eval=FALSE} -FPCAobj <- FPCA(Ly=yList, Lt=tList) -``` -The generated `FPCAobj` will contain all the basic information regarding the desired FPCA. - -### Generating a toy dense functional dataset from scratch - - -```{r,eval=TRUE, echo=TRUE} - library(fdapace) - - # Set the number of subjects (N) and the - # number of measurements per subjects (M) - N <- 200; - M <- 100; - set.seed(123) - - # Define the continuum - s <- seq(0,10,length.out = M) - - # Define the mean and 2 eigencomponents - meanFunct <- function(s) s + 10*exp(-(s-5)^2) - eigFunct1 <- function(s) +cos(2*s*pi/10) / sqrt(5) - eigFunct2 <- function(s) -sin(2*s*pi/10) / sqrt(5) - - # Create FPC scores - Ksi <- matrix(rnorm(N*2), ncol=2); - Ksi <- apply(Ksi, 2, scale) - Ksi <- Ksi %*% diag(c(5,2)) - - # Create Y_true - yTrue <- Ksi %*% t(matrix(c(eigFunct1(s),eigFunct2(s)), ncol=2)) + t(matrix(rep(meanFunct(s),N), nrow=M)) -``` - -### Running FPCA on a dense dataset - -```{r,eval=TRUE, echo=TRUE} - L3 <- MakeFPCAInputs(IDs = rep(1:N, each=M), tVec=rep(s,N), t(yTrue)) - FPCAdense <- FPCA(L3$Ly, L3$Lt) - - # Plot the FPCA object - plot(FPCAdense) - - # Find the standard deviation associated with each component - sqrt(FPCAdense$lambda) - -``` -### Running FPCA on a sparse and noisy dataset - -```{r,eval=TRUE, echo=TRUE} - # Create sparse sample - # Each subject has one to five readings (median: 3) - set.seed(123) - ySparse <- Sparsify(yTrue, s, sparsity = c(1:5)) - - # Give your sample a bit of noise - ySparse$yNoisy <- lapply(ySparse$Ly, function(x) x + 0.5*rnorm(length(x))) - - # Do FPCA on this sparse sample - # Notice that sparse FPCA will smooth the data internally (Yao et al., 2005) - # Smoothing is the main computational cost behind sparse FPCA - FPCAsparse <- FPCA(ySparse$yNoisy, ySparse$Lt, list(plot = TRUE)) - -``` - -## Further functionality - - `FPCA` calculates the bandwidth utilized by each smoother using generalised cross-validation or $k$-fold cross-validation automatically. Dense data are not smoothed by default. The argument `methodMuCovEst` can be switched between `smooth` and `cross-sectional` if one wants to utilize different estimation techniques when work with dense data. - -The bandwidth used for estimating the smoothed mean and the smoothed covariance are available under `...bwMu` and `bwCov` respectively. Users can nevertheless provide their own bandwidth estimates: - -```{r,eval=TRUE, echo=TRUE} - FPCAsparseMuBW5 <- FPCA(ySparse$yNoisy, ySparse$Lt, optns= list(userBwMu = 5)) -``` -Visualising the fitted trajectories is a good way to see if the new bandwidth made any sense: - - -```{r,eval=TRUE, echo=TRUE} -par(mfrow=c(1,2)) -CreatePathPlot( FPCAsparse, subset = 1:3, main = "GCV bandwidth", pch = 16) -CreatePathPlot( FPCAsparseMuBW5, subset = 1:3, main = "User-defined bandwidth", pch = 16) -``` ---- - `FPCA` uses a Gaussian kernel when smoothing sparse functional data; other kernel types (eg. Epanechnikov/`epan`) are also available (see `?FPCA`). The kernel used for smoothing the mean and covariance surface is the same. It can be found under `$optns\$kernel` of the returned object. For instance, one can switch the default Gaussian kernel (`gauss`) for a rectangular kernel (`rect`) as follows: - -```{r,eval=TRUE, echo=TRUE} - FPCAsparseRect <- FPCA(ySparse$yNoisy, ySparse$Lt, optns = list(kernel = 'rect')) # Use rectangular kernel -``` - - `FPCA` returns automatically the smallest number of components required to explain 99.99% of a sample's variance. Using the function `selectK` one can determine the number of relevant components according to AIC, BIC or a different Fraction-of-Variance-Explained threshold. For example: - -```{r,eval=TRUE, echo=TRUE} -SelectK( FPCAsparse, criterion = 'FVE', FVEthreshold = 0.95) # K = 2 -SelectK( FPCAsparse, criterion = 'AIC') # K = 2 -``` -When working with functional data (usually not very sparse) the estimation of derivatives is often of interest. Using \texttt{fitted.FPCA} one can directly obtain numerical derivatives by defining the appropriate order `p`; `fdapace` provides for the first two derivatives ( `p =1` or `2`). Because the numerically differentiated data are smoothed the user can define smoothing specific arguments (see `?fitted.FPCA` for more information); the derivation is done by using the derivative of the linear fit. Similarly using the function `FPCAder` , one can augment an `FPCA` object with functional derivatives of a sample's mean function and eigenfunctions. - -```{r,eval=TRUE, echo=TRUE} -fittedCurvesP0 <- fitted(FPCAsparse) # equivalent: fitted(FPCAsparse, derOptns=list(p = 0)); -# Get first order derivatives of fitted curves, smooth using Epanechnikov kernel -fittedCurcesP1 <- fitted(FPCAsparse, derOptns=list(p = 1, kernelType = 'epan')) -``` - -## A real-world example - -We use the `medfly25` dataset that this available with `fdapace` to showcase `FPCA` and its related functionality. `medfly25` is a dataset containing the eggs laid from 789 medflies (Mediterranean fruit flies, Ceratitis capitata) during the first 25 days of their lives. It is a subset of the dataset used by Carey at al. (1998) [@Carey98]; only flies having lived at least 25 days are shown. The data are rather noisy, dense and with a characteristic flat start. For that reason in contrast with above we will use a smoothing estimating procedure despite having dense data. - -```{r,eval=TRUE, echo=TRUE} - # load data - data(medfly25) - - # Turn the original data into a list of paired amplitude and timing lists - Flies <- MakeFPCAInputs(medfly25$ID, medfly25$Days, medfly25$nEggs) - fpcaObjFlies <- FPCA(Flies$Ly, Flies$Lt, list(plot = TRUE, methodMuCovEst = 'smooth', userBwCov = 2)) -``` - -Based on the scree-plot we see that the first three components appear to encapsulate most of the relevant variation. The number of eigencomponents to reach a 99.99% FVE is $11$ but just $3$ eigencomponents are enough to reach a 95.0%. We can easily inspect the following visually, using the `CreatePathPlot` command. - -```{r,eval=TRUE, echo=TRUE} -par(mfrow=c(1,2)) - CreatePathPlot(fpcaObjFlies, subset = c(3,5,135), main = 'K = 11', pch = 4); grid() - CreatePathPlot(fpcaObjFlies, subset = c(3,5,135), K = 3, main = 'K = 3', pch = 4) ; grid() -``` - -One can perform outlier detection [@Febrero2007] as well as visualize data using a functional box-plot. To achieve these tasks one can use the functions `CreateOutliersPlot` nd `CreateFuncBoxPlot`. Different ranking methodologies (KDE, bagplot [@Rousseeuw1999,@Hyndman2010] or point-wise) are available and can potentially identify different aspects of a sample. For example here it is notable that the kernel density estimator `KDE` variant identifies two main clusters within the main body of sample. By construction the `bagplot` method would use a single bag and this feature would be lost. Both functions return a (temporarily) invisible copy of a list containing the labels associated with each of sample curve0 .`CreateOutliersPlot` returns a (temporarily) invisible copy of a list containing the labels associated with each of sample curve. -```{r,eval=TRUE, echo=TRUE} -par(mfrow=c(1,2)) - CreateOutliersPlot(fpcaObjFlies, optns = list(K = 3, variant = 'KDE')) - CreateFuncBoxPlot(fpcaObjFlies, xlab = 'Days', ylab = '# of eggs laid', optns = list(K =3, variant='bagplot')) -``` - -Functional data lend themselves naturally to questions about their rate of change; their derivatives. As mentioned previously using `fdapace` one can generate estimates of the sample's derivatives ( `fitted.FPCA`) or the derivatives of the principal modes of variation (`FPCAder`). In all cases, one defines a `derOptns` list of options to control the derivation parameters. Getting derivatives is obtained by using a local linear smoother as above. - -```{r,eval=TRUE, echo=TRUE} -par(mfrow=c(1,2)) - CreatePathPlot(fpcaObjFlies, subset = c(3,5,135), K = 3, main = 'K = 3', showObs = FALSE) ; grid() - CreatePathPlot(fpcaObjFlies, subset = c(3,5,135), K = 3, main = 'K = 3', showObs = FALSE, derOptns = list(p = 1, bw = 1.01 , kernelType = 'epan') ) ; grid() -``` - -We note that if finite support kernel types are used (eg. `rect` or `epan` ), bandwidths smaller than the distance between two adjacent points over which the data are registered onto will lead to (expected) `NaN` estimates. In case of dense data, the grid used is (by default) equal to the grid the data were originally registered on; in the case of sparse data, the grid used (by default) spans the range of the sample's supports and uses 51 points. A user can change the number of points using the argument `nRegGrid` . -One can investigate the effect a particular kernel type ( `kernelType` ) or bandwidth size (`bw`) has on the generated derivatives by using the function `CreateBWPlot` and providing a relevant `derOptns` list. This will generate estimates about the mean function $\mu(t)$ as well as the first two principal modes of variation $\phi_1(t)$ and $\phi_2(t)$ for different multiples of `bw`. - -```{r,eval=TRUE, echo=TRUE} -fpcaObjFlies79 <- FPCA(Flies$Ly, Flies$Lt, list(nRegGrid = 79, methodMuCovEst = 'smooth', userBwCov = 2)) # Use 79 equidistant points for the support -CreateBWPlot(fpcaObjFlies79 , derOptns = list(p = 1, bw = 2.0 , kernelType = 'rect') ) -``` - -As the `medfly` sample is dense we can immediately use standard multivaritte clustering functionality to identify potential subgroups within it; the function `FClust` is the wrapper around the clustering functionality provided by `fdapace`. By default `FClust` utilises a Gaussian Mixture Model approach based on the package `Rmixmod` [@Biernacki2006], as a general rule clustering optimality is based on negative entropy criterion. In the `medfly` dataset clustering the data allows to immediately recognise a particular subgroup of flies that lay no or very few eggs during the period examined. - - -```{r,eval=TRUE, echo=TRUE} -A <- FClust(Flies$Ly, Flies$Lt, optnsFPCA = list(methodMuCovEst = 'smooth', userBwCov = 2, FVEthreshold = 0.90), k = 2) -# The Neg-Entropy Criterion can be found as: A$clusterObj@bestResult@criterionValue -CreatePathPlot( fpcaObjFlies, K=2, showObs=FALSE, lty=1, col= A$cluster, xlab = 'Days', ylab = '# of eggs laid') -grid() -``` - -## References - - diff --git a/fdapace.Rcheck/00_pkg_src/fdapace/vignettes/roxygen.bib b/fdapace.Rcheck/00_pkg_src/fdapace/vignettes/roxygen.bib deleted file mode 100644 index fb2583b0..00000000 --- a/fdapace.Rcheck/00_pkg_src/fdapace/vignettes/roxygen.bib +++ /dev/null @@ -1,103 +0,0 @@ -@article{Castro86, - title={Principal modes of variation for processes with continuous sample curves}, - author={Castro, PE and Lawton, WH and Sylvestre, EA}, - journal={Technometrics}, - volume={28}, - number={4}, - pages={329--337}, - year={1986}, - publisher={Taylor \& Francis Group} -} - -@article{Liu09, - title={Estimating derivatives for samples of sparsely observed functions, with application to online auction dynamics}, - author={Liu, B and M{\"u}ller, H-G}, - journal={Journal of the American Statistical Association}, - volume={104}, - number={486}, - pages={704--717}, - year={2009}, - publisher={Taylor \& Francis} -} -@article{Yao05, - title={Functional data analysis for sparse longitudinal data}, - author={Yao, F and M{\"u}ller, H-G and Wang, J-L}, - journal={Journal of the American Statistical Association}, - volume={100}, - number={470}, - pages={577--590}, - year={2005}, - publisher={Taylor \& Francis} -} -@article{Higham88, - title={Computing a nearest symmetric positive semidefinite matrix}, - author={Higham, NJ}, - journal={Linear algebra and its applications}, - volume={103}, - pages={103--118}, - year={1988}, - publisher={Elsevier} -} -@article{Hyndman2010, - title={Rainbow plots, bagplots, and boxplots for functional data}, - author={Hyndman, RJ and Shang, HL}, - journal={Journal of Computational and Graphical Statistics}, - volume={19}, - number={1}, - year={2010} -} - -@article{Febrero2007, - title={A functional analysis of NOx levels: location and scale estimation and outlier detection}, - author={Febrero, M and Galeano, P and Gonz{\'a}lez-Manteiga, W}, - journal={Computational Statistics}, - volume={22}, - number={3}, - pages={411--427}, - year={2007}, - publisher={Springer} -} - -@article{Rousseeuw1999, - title={The bagplot: a bivariate boxplot}, - author={Rousseeuw, PJ and Ruts, I and Tukey, JW}, - journal={The American Statistician}, - volume={53}, - number={4}, - pages={382--387}, - year={1999}, - publisher={Taylor \& Francis Group} -} - -@article{Carey98, - title={Relationship of age patterns of fecundity to mortality, longevity, and lifetime reproduction in a large cohort of Mediterranean fruit fly females}, - author={Carey, JR and Liedo, P and M{\"u}ller, H-G and Wang, J-L and Chiou, J-M}, - journal={The Journals of Gerontology Series A: Biological Sciences and Medical Sciences}, - volume={53}, - number={4}, - pages={B245--B251}, - year={1998}, - publisher={Oxford University Press} -} - -@article{Hall2008, - title={Modelling sparse generalized longitudinal observations with latent Gaussian processes}, - author={Hall, P and M{\"u}ller, H-G and Yao, F}, - journal={Journal of the Royal Statistical Society: Series B (Statistical Methodology)}, - volume={70}, - number={4}, - pages={703--723}, - year={2008}, - publisher={Wiley Online Library} -} - -@article{Biernacki2006, - title={Model-based cluster and discriminant analysis with the MIXMOD software}, - author={Biernacki, C and Celeux, G and Govaert, G and Langrognet, F}, - journal={Computational Statistics \& Data Analysis}, - volume={51}, - number={2}, - pages={587--600}, - year={2006}, - publisher={Elsevier} -} diff --git a/fdapace.Rcheck/00install.out b/fdapace.Rcheck/00install.out deleted file mode 100644 index 89730396..00000000 --- a/fdapace.Rcheck/00install.out +++ /dev/null @@ -1,1831 +0,0 @@ -* installing *source* package ‘fdapace’ ... -** libs -clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include" -I/usr/local/include -fPIC -Wall -g -O2 -c CPPlwls1d.cpp -o CPPlwls1d.o -In file included from CPPlwls1d.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:535: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from CPPlwls1d.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:2: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/LU:47: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from CPPlwls1d.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:3: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Cholesky:12: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Jacobi:29: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from CPPlwls1d.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:3: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Cholesky:43: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from CPPlwls1d.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:4: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/QR:17: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Householder:27: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from CPPlwls1d.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:5: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/SVD:48: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from CPPlwls1d.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:6: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Geometry:58: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from CPPlwls1d.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:7: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Eigenvalues:58: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from CPPlwls1d.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:31: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:26: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/SparseCore:66: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from CPPlwls1d.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:31: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:27: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/OrderingMethods:71: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from CPPlwls1d.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:31: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:29: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/SparseCholesky:43: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from CPPlwls1d.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:31: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:32: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/SparseQR:35: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from CPPlwls1d.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:31: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:33: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/IterativeLinearSolvers:46: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from CPPlwls1d.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:32: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/CholmodSupport:45: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from CPPlwls1d.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:35: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/KroneckerProduct:34: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from CPPlwls1d.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:39: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/Polynomials:135: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from CPPlwls1d.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:40: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/SparseExtra:51: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -17 warnings generated. -clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include" -I/usr/local/include -fPIC -Wall -g -O2 -c GetIndCEScoresCPP.cpp -o GetIndCEScoresCPP.o -In file included from GetIndCEScoresCPP.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:535: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPP.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:2: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/LU:47: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPP.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:3: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Cholesky:12: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Jacobi:29: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPP.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:3: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Cholesky:43: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPP.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:4: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/QR:17: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Householder:27: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPP.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:5: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/SVD:48: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPP.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:6: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Geometry:58: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPP.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:7: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Eigenvalues:58: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPP.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:31: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:26: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/SparseCore:66: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPP.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:31: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:27: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/OrderingMethods:71: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPP.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:31: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:29: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/SparseCholesky:43: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPP.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:31: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:32: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/SparseQR:35: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPP.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:31: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:33: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/IterativeLinearSolvers:46: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPP.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:32: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/CholmodSupport:45: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPP.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:35: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/KroneckerProduct:34: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPP.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:39: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/Polynomials:135: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPP.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:40: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/SparseExtra:51: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -17 warnings generated. -clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include" -I/usr/local/include -fPIC -Wall -g -O2 -c GetIndCEScoresCPPnewInd.cpp -o GetIndCEScoresCPPnewInd.o -In file included from GetIndCEScoresCPPnewInd.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:535: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPPnewInd.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:2: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/LU:47: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPPnewInd.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:3: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Cholesky:12: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Jacobi:29: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPPnewInd.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:3: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Cholesky:43: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPPnewInd.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:4: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/QR:17: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Householder:27: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPPnewInd.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:5: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/SVD:48: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPPnewInd.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:6: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Geometry:58: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPPnewInd.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:7: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Eigenvalues:58: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPPnewInd.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:31: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:26: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/SparseCore:66: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPPnewInd.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:31: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:27: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/OrderingMethods:71: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPPnewInd.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:31: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:29: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/SparseCholesky:43: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPPnewInd.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:31: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:32: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/SparseQR:35: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPPnewInd.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:31: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:33: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/IterativeLinearSolvers:46: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPPnewInd.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:32: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/CholmodSupport:45: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPPnewInd.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:35: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/KroneckerProduct:34: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPPnewInd.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:39: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/Polynomials:135: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from GetIndCEScoresCPPnewInd.cpp:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:40: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/SparseExtra:51: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -17 warnings generated. -clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include" -I/usr/local/include -fPIC -Wall -g -O2 -c RCPPmean.cpp -o RCPPmean.o -clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include" -I/usr/local/include -fPIC -Wall -g -O2 -c RCPPvar.cpp -o RCPPvar.o -clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include" -I/usr/local/include -fPIC -Wall -g -O2 -c RcppExports.cpp -o RcppExports.o -In file included from RcppExports.cpp:4: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:535: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppExports.cpp:4: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:2: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/LU:47: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppExports.cpp:4: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:3: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Cholesky:12: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Jacobi:29: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppExports.cpp:4: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:3: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Cholesky:43: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppExports.cpp:4: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:4: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/QR:17: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Householder:27: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppExports.cpp:4: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:5: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/SVD:48: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppExports.cpp:4: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:6: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Geometry:58: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppExports.cpp:4: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:7: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Eigenvalues:58: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppExports.cpp:4: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:31: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:26: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/SparseCore:66: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppExports.cpp:4: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:31: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:27: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/OrderingMethods:71: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppExports.cpp:4: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:31: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:29: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/SparseCholesky:43: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppExports.cpp:4: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:31: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:32: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/SparseQR:35: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppExports.cpp:4: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:31: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:33: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/IterativeLinearSolvers:46: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppExports.cpp:4: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:32: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/CholmodSupport:45: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppExports.cpp:4: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:35: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/KroneckerProduct:34: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppExports.cpp:4: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:39: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/Polynomials:135: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppExports.cpp:4: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:40: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/SparseExtra:51: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -17 warnings generated. -clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include" -I/usr/local/include -fPIC -Wall -g -O2 -c RcppPseudoApprox.cpp -o RcppPseudoApprox.o -In file included from RcppPseudoApprox.cpp:2: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:535: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppPseudoApprox.cpp:2: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:2: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/LU:47: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppPseudoApprox.cpp:2: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:3: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Cholesky:12: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Jacobi:29: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppPseudoApprox.cpp:2: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:3: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Cholesky:43: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppPseudoApprox.cpp:2: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:4: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/QR:17: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Householder:27: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppPseudoApprox.cpp:2: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:5: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/SVD:48: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppPseudoApprox.cpp:2: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:6: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Geometry:58: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppPseudoApprox.cpp:2: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:7: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Eigenvalues:58: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppPseudoApprox.cpp:2: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:31: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:26: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/SparseCore:66: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppPseudoApprox.cpp:2: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:31: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:27: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/OrderingMethods:71: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppPseudoApprox.cpp:2: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:31: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:29: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/SparseCholesky:43: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppPseudoApprox.cpp:2: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:31: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:32: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/SparseQR:35: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppPseudoApprox.cpp:2: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:31: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:33: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/IterativeLinearSolvers:46: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppPseudoApprox.cpp:2: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:32: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/CholmodSupport:45: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppPseudoApprox.cpp:2: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:35: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/KroneckerProduct:34: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppPseudoApprox.cpp:2: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:39: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/Polynomials:135: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -In file included from RcppPseudoApprox.cpp:2: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:40: -In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/SparseExtra:51: -/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] - #pragma clang diagnostic pop - ^ -RcppPseudoApprox.cpp:18:17: warning: variable 'xk' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized] - for (int i=1; i -library('fdapace') - -base::assign(".oldSearch", base::search(), pos = 'CheckExEnv') -base::assign(".old_wd", base::getwd(), pos = 'CheckExEnv') -cleanEx() -nameEx("BwNN") -### * BwNN - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: BwNN -### Title: Minimum bandwidth based on kNN criterion. -### Aliases: BwNN - -### ** Examples - -tinyGrid = list(c(1,7), c(2,3), 6, c(2,4), c(4,5)) -BwNN(tinyGrid, k = 2) # c(3,2) - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("BwNN", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("CreateBWPlot") -### * CreateBWPlot - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: CreateBWPlot -### Title: Functional Principal Component Analysis Bandwidth Diagnostics -### plot -### Aliases: CreateBWPlot - -### ** Examples - -set.seed(1) -n <- 25 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- Sparsify(sampWiener, pts, 10) -res1 <- FPCA(sampWiener$Ly, sampWiener$Lt, - list(dataType='Sparse', error=FALSE, kernel='epan', verbose=FALSE)) -CreateBWPlot(res1) - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("CreateBWPlot", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("CreateBasis") -### * CreateBasis - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: CreateBasis -### Title: Create an orthogonal basis of K functions in [0, 1], with nGrid -### points. -### Aliases: CreateBasis - -### ** Examples - -basis <- CreateBasis(3, type='fourier') -head(basis) - - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("CreateBasis", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("CreateCovPlot") -### * CreateCovPlot - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: CreateCovPlot -### Title: Create the covariance surface plot based on the results from -### FPCA() or FPCder(). -### Aliases: CreateCovPlot - -### ** Examples - -set.seed(1) -n <- 20 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- Sparsify(sampWiener, pts, 10) -res <- FPCA(sampWiener$Ly, sampWiener$Lt, - list(dataType='Sparse', error=FALSE, kernel='epan', verbose=TRUE)) -CreateCovPlot(res) - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("CreateCovPlot", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("CreateDesignPlot") -### * CreateDesignPlot - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: CreateDesignPlot -### Title: Create the design plot of the functional data. -### Aliases: CreateDesignPlot - -### ** Examples - -set.seed(1) -n <- 20 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- Sparsify(sampWiener, pts, 10) -CreateDesignPlot(sampWiener$Lt, sort(unique(unlist(sampWiener$Lt)))) - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("CreateDesignPlot", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("CreateFuncBoxPlot") -### * CreateFuncBoxPlot - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: CreateFuncBoxPlot -### Title: Create functional boxplot using 'bagplot', 'KDE' or 'pointwise' -### methodology -### Aliases: CreateFuncBoxPlot - -### ** Examples - -set.seed(1) -n <- 20 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- Sparsify(sampWiener, pts, 10) -res <- FPCA(sampWiener$Ly, sampWiener$Lt, - list(dataType='Sparse', error=FALSE, kernel='epan', verbose=TRUE)) -CreateFuncBoxPlot(res, list(addIndx=c(1:3)) ) - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("CreateFuncBoxPlot", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("CreateModeOfVarPlot") -### * CreateModeOfVarPlot - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: CreateModeOfVarPlot -### Title: Functional Principal Component Analysis mode of variation plot -### Aliases: CreateModeOfVarPlot - -### ** Examples - -set.seed(1) -n <- 20 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- Sparsify(sampWiener, pts, 10) -res <- FPCA(sampWiener$Ly, sampWiener$Lt, - list(dataType='Sparse', error=FALSE, kernel='epan', verbose=TRUE)) -CreateModeOfVarPlot(res) - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("CreateModeOfVarPlot", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("CreateOutliersPlot") -### * CreateOutliersPlot - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: CreateOutliersPlot -### Title: Functional Principal Component or Functional Singular Value -### Decomposition Scores Plot using 'bagplot' or 'KDE' methodology -### Aliases: CreateOutliersPlot - -### ** Examples - -## Not run: -##D set.seed(1) -##D n <- 420 -##D pts <- seq(0, 1, by=0.05) -##D sampWiener <- Wiener(n, pts) -##D sampWiener <- Sparsify(sampWiener, pts, 10) -##D res <- FPCA(sampWiener$Ly, sampWiener$Lt, -##D list(dataType='Sparse', error=FALSE, kernel='epan', verbose=TRUE)) -##D CreateOutliersPlot(res) -## End(Not run) - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("CreateOutliersPlot", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("CreatePathPlot") -### * CreatePathPlot - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: CreatePathPlot -### Title: Create the fitted sample path plot based on the results from -### FPCA(). -### Aliases: CreatePathPlot - -### ** Examples - -set.seed(1) -n <- 20 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- Sparsify(sampWiener, pts, 10) -res <- FPCA(sampWiener$Ly, sampWiener$Lt, - list(dataType='Sparse', error=FALSE, kernel='epan', - verbose=TRUE)) -CreatePathPlot(res, subset=1:5) - -# CreatePathPlot has a lot of usages: -## Not run: -##D CreatePathPlot(res) -##D CreatePathPlot(res, 1:20) -##D CreatePathPlot(res, 1:20, showObs=FALSE) -##D CreatePathPlot(res, 1:20, showMean=TRUE, showObs=FALSE) -##D CreatePathPlot(res, 1:20, obsOnly=TRUE) -##D CreatePathPlot(res, 1:20, obsOnly=TRUE, showObs=FALSE) -##D CreatePathPlot(inputData=sampWiener, subset=1:20, obsOnly=TRUE) -## End(Not run) - - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("CreatePathPlot", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("CreateScreePlot") -### * CreateScreePlot - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: CreateScreePlot -### Title: Create the scree plot for the fitted eigenvalues -### Aliases: CreateScreePlot - -### ** Examples - -set.seed(1) -n <- 20 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- Sparsify(sampWiener, pts, 10) -res <- FPCA(sampWiener$Ly, sampWiener$Lt, - list(dataType='Sparse', error=FALSE, kernel='epan', verbose=TRUE)) -CreateScreePlot(res) - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("CreateScreePlot", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("CreateStringingPlot") -### * CreateStringingPlot - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: CreateStringingPlot -### Title: Create plots for observed and stringed high dimensional data -### Aliases: CreateStringingPlot - -### ** Examples - -set.seed(1) -n <- 50 -wiener = Wiener(n = n)[,-1] -p = ncol(wiener) -rdmorder = sample(size = p, x=1:p, replace = FALSE) -stringingfit = Stringing(X = wiener[,rdmorder], disOptns = "correlation") -diff_norev = sum(abs(rdmorder[stringingfit$StringingOrder] - 1:p)) -diff_rev = sum(abs(rdmorder[stringingfit$StringingOrder] - p:1)) -if(diff_rev <= diff_norev){ - stringingfit$StringingOrder = rev(stringingfit$StringingOrder) - stringingfit$Ly = lapply(stringingfit$Ly, rev) -} -CreateStringingPlot(stringingfit, 1:20) - - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("CreateStringingPlot", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("DynCorr") -### * DynCorr - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: DynCorr -### Title: Dynamical Correlation -### Aliases: DynCorr - -### ** Examples - -set.seed(10) -n=200 # sample size -t=seq(0,1,length.out=100) # length of data -mu_quad_x=8*t^2-4*t+5 -mu_quad_y=8*t^2-12*t+6 -fun=rbind(rep(1,length(t)),-t,t^2) -z1=matrix(0,n,3) -z1[,1]=rnorm(n,0,2) -z1[,2]=rnorm(n,0,16/3) -z1[,3]=rnorm(n,0,4) -x1_quad_error=y1_quad_error=matrix(0,nrow=n,ncol=length(t)) -for (i in 1:n){ - x1_quad_error[i,]=mu_quad_x+z1[i,]%*%fun+rnorm(length(t),0,0.01) - y1_quad_error[i,]=mu_quad_y+2*z1[i,]%*%fun +rnorm(length(t),0,0.01) -} -dyn1_quad=DynCorr(x1_quad_error,y1_quad_error,t) - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("DynCorr", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("Dyn_test") -### * Dyn_test - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: Dyn_test -### Title: Bootstrap test of Dynamic correlation -### Aliases: Dyn_test - -### ** Examples - -n=200 # sample size -t=seq(0,1,length.out=100) # length of data -mu_quad_x=8*t^2-4*t+5 -mu_quad_y=8*t^2-12*t+6 -fun=rbind(rep(1,length(t)),-t,t^2) -z1=matrix(0,n,3) -z1[,1]=rnorm(n,0,2) -z1[,2]=rnorm(n,0,16/3) -z1[,3]=rnorm(n,0,4) # covariance matrix of random effects -x1_quad_error=y1_quad_error=matrix(0,nrow=n,ncol=length(t)) -for (i in 1:n){ - x1_quad_error[i,]=mu_quad_x+z1[i,]%*%fun+rnorm(length(t),0,0.01) - y1_quad_error[i,]=mu_quad_y+2*z1[i,]%*%fun +rnorm(length(t),0,0.01) -} -bt_DC=Dyn_test(x1_quad_error,y1_quad_error,t,B=1000) - - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("Dyn_test", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("FAM") -### * FAM - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: FAM -### Title: Functional Additive Models -### Aliases: FAM - -### ** Examples - -set.seed(1000) - -library(MASS) - -f1 <- function(t) 0.5*t -f2 <- function(t) 2*cos(2*pi*t/4) -f3 <- function(t) 1.5*sin(2*pi*t/4) -f4 <- function(t) 2*atan(2*pi*t/4) - -n<-250 -N<-500 - -sig <- diag(c(4.0,2.0,1.5,1.2)) - -scoreX <- mvrnorm(n,mu=rep(0,4),Sigma=sig) -scoreXTest <- mvrnorm(N,mu=rep(0,4),Sigma=sig) - -Y <- f1(scoreX[,1]) + f2(scoreX[,2]) + f3(scoreX[,3]) + f4(scoreX[,4]) + rnorm(n,0,0.1) -YTest <- f1(scoreXTest[,1]) + f2(scoreXTest[,2]) + - f3(scoreXTest[,3]) + f4(scoreXTest[,4]) + rnorm(N,0,0.1) - -phi1 <- function(t) sqrt(2)*sin(2*pi*t) -phi2 <- function(t) sqrt(2)*sin(4*pi*t) -phi3 <- function(t) sqrt(2)*cos(2*pi*t) -phi4 <- function(t) sqrt(2)*cos(4*pi*t) - -grid <- seq(0,1,length.out=21) -Lt <- Lx <- list() -for (i in 1:n) { - Lt[[i]] <- grid - Lx[[i]] <- scoreX[i,1]*phi1(grid) + scoreX[i,2]*phi2(grid) + - scoreX[i,3]*phi3(grid) + scoreX[i,4]*phi4(grid) + rnorm(1,0,0.01) -} - -LtTest <- LxTest <- list() -for (i in 1:N) { - LtTest[[i]] <- grid - LxTest[[i]] <- scoreXTest[i,1]*phi1(grid) + scoreXTest[i,2]*phi2(grid) + - scoreXTest[i,3]*phi3(grid) + scoreXTest[i,4]*phi4(grid) + rnorm(1,0,0.01) -} - - -# estimation -fit <- FAM(Y=Y,Lx=Lx,Lt=Lt) - -xi <- fit$xi - -par(mfrow=c(2,2)) -j <- 1 -g1 <- f1(sort(xi[,j])) -tmpSgn <- sign(sum(g1*fit$fam[,j])) -plot(sort(xi[,j]),g1,type='l',col=2,ylim=c(-2.5,2.5),xlab='xi1') -points(sort(xi[,j]),tmpSgn*fit$fam[order(xi[,j]),j],type='l') - -j <- 2 -g2 <- f2(sort(xi[,j])) -tmpSgn <- sign(sum(g2*fit$fam[,j])) -plot(sort(xi[,j]),g2,type='l',col=2,ylim=c(-2.5,2.5),xlab='xi2') -points(sort(xi[,j]),tmpSgn*fit$fam[order(xi[,j]),j],type='l') - -j <- 3 -g3 <- f3(sort(xi[,j])) -tmpSgn <- sign(sum(g3*fit$fam[,j])) -plot(sort(xi[,j]),g3,type='l',col=2,ylim=c(-2.5,2.5),xlab='xi3') -points(sort(xi[,j]),tmpSgn*fit$fam[order(xi[,j]),j],type='l') - -j <- 4 -g4 <- f4(sort(xi[,j])) -tmpSgn <- sign(sum(g4*fit$fam[,j])) -plot(sort(xi[,j]),g4,type='l',col=2,ylim=c(-2.5,2.5),xlab='xi4') -points(sort(xi[,j]),tmpSgn*fit$fam[order(xi[,j]),j],type='l') - - -# fitting -fit <- FAM(Y=Y,Lx=Lx,Lt=Lt,nEval=0) -yHat <- fit$mu+apply(fit$fam,1,'sum') -par(mfrow=c(1,1)) -plot(yHat,Y) -abline(coef=c(0,1),col=2) - - -# R^2 -R2 <- 1-sum((Y-yHat)^2)/sum((Y-mean(Y))^2) -R2 - - -# prediction -fit <- FAM(Y=Y,Lx=Lx,Lt=Lt,newLx=LxTest,newLt=LtTest) -yHat <- fit$mu+apply(fit$fam,1,'sum') -par(mfrow=c(1,1)) -plot(yHat,YTest,xlim=c(-10,10)) -abline(coef=c(0,1),col=2) - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("FAM", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -graphics::par(get("par.postscript", pos = 'CheckExEnv')) -cleanEx() -nameEx("FCCor") -### * FCCor - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: FCCor -### Title: Calculate functional correlation between two simultaneously -### observed processes. -### Aliases: FCCor - -### ** Examples - -set.seed(1) -n <- 200 -nGridIn <- 50 -sparsity <- 1:5 # must have length > 1 -bw <- 0.2 -kern <- 'epan' -T <- matrix(seq(0.5, 1, length.out=nGridIn)) - -## Corr(X(t), Y(t)) = 1/2 -A <- Wiener(n, T) -B <- Wiener(n, T) -C <- Wiener(n, T) + matrix((1:nGridIn) , n, nGridIn, byrow=TRUE) -X <- A + B -Y <- A + C -indEach <- lapply(1:n, function(x) sort(sample(nGridIn, sample(sparsity, 1)))) -tAll <- lapply(1:n, function(i) T[indEach[[i]]]) -Xsp <- lapply(1:n, function(i) X[i, indEach[[i]]]) -Ysp <- lapply(1:n, function(i) Y[i, indEach[[i]]]) - -plot(T, FCCor(Xsp, Ysp, tAll, bw)[['corr']], ylim=c(-1, 1)) -abline(h=0.5) - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("FCCor", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("FCReg") -### * FCReg - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: FCReg -### Title: Functional Concurrent Regression by 2D smoothing method. -### Aliases: FCReg - -### ** Examples - -# Y(t) = \beta_0(t) + \beta_1(t) X_1(t) + \beta_2(t) Z_2 + \epsilon - -# Settings -set.seed(1) -n <- 75 -nGridIn <- 150 -sparsity <- 5:10 # Sparse data sparsity -T <- round(seq(0, 1, length.out=nGridIn), 4) # Functional data support -bw <- 0.1 -outGrid <- round(seq(min(T), 1, by=0.05), 2) - -# Simulate functional data -mu <- T * 2 # mean function for X_1 -sigma <- 1 - -beta_0 <- 0 -beta_1 <- 1 -beta_2 <- 1 - -Z <- MASS::mvrnorm(n, rep(0, 2), diag(2)) -X_1 <- Z[, 1, drop=FALSE] %*% matrix(1, 1, nGridIn) + matrix(mu, n, nGridIn, byrow=TRUE) -epsilon <- rnorm(n, sd=sigma) -Y <- matrix(NA, n, nGridIn) -for (i in seq_len(n)) { - Y[i, ] <- beta_0 + beta_1 * X_1[i, ] + beta_2 * Z[i, 2] + epsilon[i] -} - -# Sparsify functional data -set.seed(1) -X_1sp <- Sparsify(X_1, T, sparsity) -set.seed(1) -Ysp <- Sparsify(Y, T, sparsity) -vars <- list(X_1=X_1sp, Z_2=Z[, 2], Y=Ysp) -withError2D <- FCReg(vars, bw, bw, outGrid) - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("FCReg", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("FClust") -### * FClust - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: FClust -### Title: Functional clustering and identifying substructures of -### longitudinal data -### Aliases: FClust - -### ** Examples - -## Not run: -##D data(medfly25) -##D Flies <- MakeFPCAInputs(medfly25$ID, medfly25$Days, medfly25$nEggs) -##D newClust <- FClust(Flies$Ly, Flies$Lt, k = 2, optnsFPCA = -##D list(methodMuCovEst = 'smooth', userBwCov = 2, FVEthreshold = 0.90)) -##D -##D # We denote as 'veryLowCount' the group of flies that lay less -##D # than twenty-five eggs during the 25-day period examined. -##D -##D veryLowCount = ifelse( sapply( unique(medfly25$ID), function(u) -##D sum( medfly25$nEggs[medfly25$ID == u] )) < 25, 0, 1) -##D N <- length(unique(medfly25$ID)) -##D (correctRate <- sum( (1 + veryLowCount) == newClust$cluster) / N) # 99.6% -## End(Not run) - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("FClust", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("FOptDes") -### * FOptDes - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: FOptDes -### Title: Optimal Designs for Functional and Longitudinal Data for -### Trajectory Recovery or Scalar Response Prediction -### Aliases: FOptDes - -### ** Examples - -set.seed(1) -n <- 50 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- MakeFPCAInputs(IDs = rep(1:n, each=length(pts)), - tVec = rep(pts, times = n), - yVec = t(sampWiener)) -res <- FOptDes(Ly=sampWiener$Ly, Lt=sampWiener$Lt, p=2, - isSequential=FALSE, RidgeCand = seq(0.02,0.2,0.02)) - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("FOptDes", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("FPCA") -### * FPCA - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: FPCA -### Title: Functional Principal Component Analysis -### Aliases: FPCA - -### ** Examples - -set.seed(1) -n <- 20 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- Sparsify(sampWiener, pts, 10) -res <- FPCA(sampWiener$Ly, sampWiener$Lt, - list(dataType='Sparse', error=FALSE, kernel='epan', verbose=TRUE)) -plot(res) # The design plot covers [0, 1] * [0, 1] well. -CreateCovPlot(res, 'Fitted') - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("FPCA", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("FPCAder") -### * FPCAder - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: FPCAder -### Title: Take derivative of an FPCA object -### Aliases: FPCAder - -### ** Examples - - -bw <- 0.2 -kern <- 'epan' -set.seed(1) -n <- 100 -M <- 40 -pts <- seq(0, 1, length.out=M) -lambdaTrue <- c(1, 0.8, 0.1)^2 -sigma2 <- 0.1 - -samp2 <- MakeGPFunctionalData(n, M, pts, K=length(lambdaTrue), - lambda=lambdaTrue, sigma=sqrt(sigma2), basisType='legendre01') -samp2 <- c(samp2, MakeFPCAInputs(tVec=pts, yVec=samp2$Yn)) -fpcaObj <- FPCA(samp2$Ly, samp2$Lt, list(methodMuCovEst='smooth', - userBwCov=bw, userBwMu=bw, kernel=kern, error=TRUE)) -CreatePathPlot(fpcaObj, showObs=FALSE) - -FPCoptn <- list(bw=bw, kernelType=kern, method='FPC') -DPCoptn <- list(bw=bw, kernelType=kern, method='DPC') -FPC <- FPCAder(fpcaObj, FPCoptn) -DPC <- FPCAder(fpcaObj, DPCoptn) - -CreatePathPlot(FPC, ylim=c(-5, 10)) -CreatePathPlot(DPC, ylim=c(-5, 10)) - -# Get the true derivatives -phi <- CreateBasis(K=3, type='legendre01', pts=pts) -basisDerMat <- apply(phi, 2, function(x) - ConvertSupport(seq(0, 1, length.out=M - 1), pts, diff(x) * (M - 1))) -trueDer <- matrix(1, n, M, byrow=TRUE) + tcrossprod(samp2$xi, basisDerMat) -matplot(t(trueDer), type='l', ylim=c(-5, 10)) - -# DPC is slightly better in terms of RMSE -mean((fitted(FPC) - trueDer)^2) -mean((fitted(DPC) - trueDer)^2) - - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("FPCAder", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("FPCReg") -### * FPCReg - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: FPCReg -### Title: Function for performing functonal linear regression where the -### covariates are functions X1(t1),X2(t2),.. and the response is a -### function Y(t_y). -### Aliases: FPCReg - -### ** Examples - -set.seed(1000) -#Model: E(Y(t)|X) = int(beta(s,t)*X(s)) -n <- 200 #number of subjects -ngrids <- 51 #number of grids in [0,1] for X(s) -ngridt <- 101 #number of grids in [0,1] for Y(t) -grids <- seq(0, 1, length.out=ngrids) #regular grids in [0,1] for X(s) -gridt <- seq(0, 1, length.out=ngridt) #regular grids in [0,1] for Y(t) - -#generate X -#{1, sqrt(2)*sin(2*pi*s), sqrt(2)*cos(2*pi*t)} are used to generate X. -eigenFun <- list( function(s){1 + 0 * s}, - function(s){sqrt(2) * sin(2*pi*s)}, - function(s){sqrt(2) * cos(2*pi*s)}) - -sig <- matrix(c(1.5, 0.0, 0.0, 0.9, -.5, 0.1, - 0.0, 1.2, 0.0, -.3, 0.8, 0.4, - 0.0, 0.0, 1.0, 0.4, -.3, 0.7, - 0.9, -.3, 0.4, 2.0, 0.0, 0.0, - -.5, 0.8, -.3, 0.0, 1.5, 0.0, - 0.1, 0.4, 0.7, 0.0, 0.0, 1.0), - nrow=6,ncol=6) - -scoreX <- MASS::mvrnorm(n,mu=rep(0,6),Sigma=sig) -scoreX1 <- scoreX[,1:3] -scoreX2 <- scoreX[,4:6] - -basisX1 <- sapply(eigenFun,function(x){x(grids)}) -latentX1 <- scoreX1 %*% t(basisX1) -measErrX1 <- sqrt(0.03) * matrix(rnorm(n * ngrids), n, ngrids) #0.01 is sigma^2. -denseX1 <- latentX1 + measErrX1 - -basisX2 <- sapply(eigenFun,function(x){x(grids)}) -latentX2 <- scoreX2 %*% t(basisX2) -measErrX2 <- sqrt(0.03) * matrix(rnorm(n * ngrids), n, ngrids) #0.01 is sigma^2. -denseX2 <- latentX2 + measErrX2 - -#generate Y -#beta(s, t) <- sin(2 * pi * s)*cos(2 * pi * t) -betaEigen1 <- function(t){f <- function(s){ - sin(2*pi*s) * cos(2*pi*t) * (1+0*s)}; return(f)} -betaEigen2 <- function(t){f <- function(s){ - sin(2*pi*s) * cos(2*pi*t) * (sqrt(2)*sin(2*pi*s))}; return(f)} -betaEigen3 <- function(t){f <- function(s){ - sin(2*pi*s) * cos(2*pi*t) * (sqrt(2)*cos(2*pi*s))}; return(f)} -betaEigen <- list(betaEigen1, betaEigen2, betaEigen3) -basisY <- array(0,c(ngridt, 3)) -for(i in 1:3){ - intbetaEigen <- function (t) {integrate(betaEigen[[i]](t), lower = 0, upper = 1)$value} - basisY[, i] <- sapply(1:ngridt, function(x){intbetaEigen(gridt[x])}) - } -latentY <- scoreX1 %*% t(basisY) - scoreX2 %*% t(basisY) -measErrY <- sqrt(0.01) * matrix(rnorm(n*ngridt), n, ngridt) #0.01 is sigma^2 -denseY <- latentY + measErrY - -#======Dense data=============================================== -timeX <- t(matrix(rep(grids, n),length(grids), n)) -timeY <- t(matrix(rep(gridt, n),length(gridt), n)) -denseVars <- list(X1 = list(Ly = denseX1, Lt = timeX), - X2 = list(Ly = denseX2, Lt = timeX), - Y=list(Ly = denseY,Lt = timeY)) - -resuDense <- FPCReg(denseVars, method="FVE") - -par(mfrow=c(1,2)) -estiBetaX1Y_Dense <- resuDense$estiBeta$betaX1Y -args1 <- list(xlab = 's', ylab = 't', zlab = 'estiBetaX1Y_Dense(s, t)', - lighting = FALSE, phi = 45, theta = 45) -args2 <- list(x = 1:ngrids, y = 1:ngridt, z = estiBetaX1Y_Dense[1:ngrids, 1:ngridt]) -do.call(plot3D::persp3D,c(args2, args1)) - -estiBetaX2Y_Dense <- resuDense$estiBeta$betaX2Y -args1 <- list(xlab = 's', ylab = 't', zlab = 'estiBetaX2Y_Dense(s, t)', - lighting = FALSE, phi = 45, theta = 45) -args2 <- list(x = 1:ngrids, y = 1:ngridt, z = estiBetaX2Y_Dense[1:ngrids, 1:ngridt]) - # do.call(plot3D::persp3D,c(args2, args1)) - -#======Sparse data=============================================== -## Not run: -##D sparsity = 5:8 -##D sparseX1 <- Sparsify(denseX1, grids, sparsity) -##D sparseX2 <- Sparsify(denseX2, grids, sparsity) -##D sparseY <- Sparsify(denseY, gridt, sparsity) -##D sparseVars <- list(X1 = sparseX1, X2 = sparseX2, Y = sparseY) -##D -##D resuSparse <- FPCReg(sparseVars, method="FVE", FVEthreshold=0.98) -##D #or resuSparse <- FPCReg(vars = sparseVars, -##D # varsOptns = list(X1=list(userBwCov = 0.03))) -##D -##D par(mfrow=c(1,2)) -##D estiBetaX1Y_Sparse = resuSparse$estiBeta$betaX1Y -##D args1 = list(xlab = 's', ylab = 't', zlab = 'estiBetaX1Y_Sparse(s,t)', -##D lighting = FALSE, phi = 45,theta = 45) -##D args2 = list(x = 1:51, y = 1:51, z = estiBetaX1Y_Sparse[1:51, 1:51]) -##D do.call(plot3D::persp3D, c(args2, args1)) -##D -##D estiBetaX2Y_Sparse = resuSparse$estiBeta$betaX2Y -##D args1 = list(xlab = 's', ylab = 't', zlab = 'estiBetaX2Y_Sparse(s,t)', -##D lighting = FALSE, phi = 45,theta = 45) -##D args2 = list(x = 1:51, y = 1:51, z = estiBetaX2Y_Sparse[1:51, 1:51]) -##D do.call(plot3D::persp3D, c(args2, args1)) -##D -##D par(mfrow=c(2,3)) -##D for(i in 1:6){ -##D plot(sparseVars[['Y']]$Lt[[i]], sparseVars[['Y']]$Ly[[i]], -##D xlab = 'time', ylab = 'observations', ylim = c(-1.5, 1.5)) -##D lines(seq(0, 1, length.out = 51), resuSparse$predictY[[i]]) -##D lines(seq(0, 1, length.out = 51), resuSparse$cbandY[[i]][,2], lty = 2) -##D lines(seq(0, 1, length.out = 51), resuSparse$cbandY[[i]][,1], lty = 2) -##D } -##D -## End(Not run) - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("FPCReg", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -graphics::par(get("par.postscript", pos = 'CheckExEnv')) -cleanEx() -nameEx("FPCquantile") -### * FPCquantile - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: FPCquantile -### Title: Conditional Quantile estimation with functional covariates -### Aliases: FPCquantile - -### ** Examples - -set.seed(10) - -n = 200 -npred = 50 -m = 50 -xi <- Wiener(n, 0:m/m) - -x=list() -t_x=list() -y=numeric(n) -for(i in 1:n){ - t_x = c(t_x,list(0:m/m)) - x = c(x,list(xi[i,])) - y[i] = 5*rnorm(1)+2*sum(xi[i,]) -} - -outQ = c(0.1,0.25,0.5,0.75,0.9,0.95) -isNewsub = c(rep(0,150),rep(1,50)) -qtreg = FPCquantile(x, t_x, y, outQ,optns_x = NULL,isNewsub) - - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("FPCquantile", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("FVPA") -### * FVPA - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: FVPA -### Title: Functional Variance Process Analysis for dense functional data -### Aliases: FVPA - -### ** Examples - -set.seed(1) -n <- 25 -pts <- seq(0, 1, by=0.01) -sampWiener <- Wiener(n, pts) -# Data have to dense for FVPA to be relevant! -sampWiener <- Sparsify(sampWiener, pts, 101) -fvpaObj <- FVPA(sampWiener$Ly, sampWiener$Lt) - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("FVPA", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("GetCrCovYX") -### * GetCrCovYX - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: GetCrCovYX -### Title: Functional Cross Covariance between longitudinal variable Y and -### longitudinal variable X -### Aliases: GetCrCovYX - -### ** Examples - -Ly1= list( rep(2.1,7), rep(2.1,3),2.1 ); -Lt1 = list(1:7,1:3, 1); -Ly2 = list( rep(1.1,7), rep(1.1,3),1.1); -Lt2 = list(1:7,1:3, 1); -Ymu1 = rep(55,7); -Ymu2 = rep(1.1,7); -AA<-GetCrCovYX(Ly1 = Ly1, Ly2= Ly2, Lt1=Lt1, Lt2=Lt2, Ymu1=Ymu1, Ymu2=Ymu2) - - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("GetCrCovYX", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("GetCrCovYZ") -### * GetCrCovYZ - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: GetCrCovYZ -### Title: Functional Cross Covariance between longitudinal variable Y and -### scalar variable Z -### Aliases: GetCrCovYZ - -### ** Examples - -Ly <- list( runif(5), c(1:3), c(2:4), c(4)) -Lt <- list( c(1:5), c(1:3), c(1:3), 4) -Z = rep(4,4) # Constant vector so the covariance has to be zero. -sccObj = GetCrCovYZ(bw=1, Z= Z, Ly=Ly, Lt=Lt, Ymu=rep(4,5)) - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("GetCrCovYZ", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("GetNormalisedSample") -### * GetNormalisedSample - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: GetNormalisedSample -### Title: Normalise sparse functional sample -### Aliases: GetNormalisedSample GetNormalizedSample - -### ** Examples - -set.seed(1) -n <- 100 -M <- 51 -pts <- seq(0, 1, length.out=M) -mu <- rep(0, length(pts)) -sampDense <- MakeGPFunctionalData(n, M, mu, K=1, basisType='sin', sigma=0.01) -samp4 <- MakeFPCAInputs(tVec=sampDense$pts, yVec=sampDense$Yn) -res4E <- FPCA(samp4$Ly, samp4$Lt, list(error=TRUE)) -sampN <- GetNormalisedSample(res4E, errorSigma=TRUE) - -CreatePathPlot(subset=1:20, inputData=samp4, obsOnly=TRUE, showObs=FALSE) -CreatePathPlot(subset=1:20, inputData=sampN, obsOnly=TRUE, showObs=FALSE) - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("GetNormalisedSample", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("MultiFAM") -### * MultiFAM - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: MultiFAM -### Title: Functional Additive Models with Multiple Predictor Processes -### Aliases: MultiFAM - -### ** Examples - -set.seed(1000) - -library(MASS) - -f11 <- function(t) t -f12 <- function(t) 2*cos(2*pi*t/4) -f21 <- function(t) 1.5*sin(2*pi*t/4) -f22 <- function(t) 1.5*atan(2*pi*t/4) - -n<-100 -N<-200 - -sig <- matrix(c(2.0, 0.0, 0.5, -.2, - 0.0, 1.2, -.2, 0.3, - 0.5, -.2, 1.7, 0.0, - -.2, 0.3, 0.0, 1.0), - nrow=4,ncol=4) - -scoreX <- mvrnorm(n,mu=rep(0,4),Sigma=sig) -scoreXTest <- mvrnorm(N,mu=rep(0,4),Sigma=sig) - -Y <- f11(scoreX[,1]) + f12(scoreX[,2]) + f21(scoreX[,3]) + f22(scoreX[,4]) + rnorm(n,0,0.5) -YTest <- f11(scoreXTest[,1]) + f12(scoreXTest[,2]) + -f21(scoreXTest[,3]) + f22(scoreXTest[,4]) + rnorm(N,0,0.5) - -phi11 <- function(t) sqrt(2)*sin(2*pi*t) -phi12 <- function(t) sqrt(2)*sin(4*pi*t) -phi21 <- function(t) sqrt(2)*cos(2*pi*t) -phi22 <- function(t) sqrt(2)*cos(4*pi*t) - -grid <- seq(0,1,length.out=21) -Lt <- Lx1 <- Lx2 <- list() -for (i in 1:n) { - Lt[[i]] <- grid - Lx1[[i]] <- scoreX[i,1]*phi11(grid) + scoreX[i,2]*phi12(grid) + rnorm(1,0,0.01) - Lx2[[i]] <- scoreX[i,3]*phi21(grid) + scoreX[i,4]*phi22(grid) + rnorm(1,0,0.01) -} - -LtTest <- Lx1Test <- Lx2Test <- list() -for (i in 1:N) { - LtTest[[i]] <- grid - Lx1Test[[i]] <- scoreXTest[i,1]*phi11(grid) + scoreXTest[i,2]*phi12(grid) + rnorm(1,0,0.01) - Lx2Test[[i]] <- scoreXTest[i,3]*phi21(grid) + scoreXTest[i,4]*phi22(grid) + rnorm(1,0,0.01) -} - -X1 <- list(Ly=Lx1, Lt=Lt) -X2 <- list(Ly=Lx2, Lt=Lt) - -X1Test <- list(Ly=Lx1Test, Lt=LtTest) -X2Test <- list(Ly=Lx2Test, Lt=LtTest) - -X <- list(X1, X2) -XTest <- list(X1Test, X2Test) - -# estimation -sbf <- MultiFAM(Y=Y,X=X) - -xi <- sbf$xi - -par(mfrow=c(2,2)) -j <- 1 -p0 <- trapzRcpp(sort(xi[,j]),dnorm(sort(xi[,j]),0,sqrt(sig[j,j]))) -g11 <- f11(sort(xi[,j])) - -trapzRcpp(sort(xi[,j]),f11(sort(xi[,j]))*dnorm(sort(xi[,j]),0,sqrt(sig[j,j])))/p0 -tmpSgn <- sign(sum(g11*sbf$SBFit[,j])) -plot(sort(xi[,j]),g11,type='l',col=2,ylim=c(-2.5,2.5),xlab='xi11') -points(sort(xi[,j]),tmpSgn*sbf$SBFit[order(xi[,j]),j],type='l') -legend('top',c('true','SBF'),col=c(2,1),lwd=2,bty='n',horiz=TRUE) - -j <- 2 -p0 <- trapzRcpp(sort(xi[,j]),dnorm(sort(xi[,j]),0,sqrt(sig[j,j]))) -g12 <- f12(sort(xi[,j])) - -trapzRcpp(sort(xi[,j]),f12(sort(xi[,j]))*dnorm(sort(xi[,j]),0,sqrt(sig[j,j])))/p0 -tmpSgn <- sign(sum(g12*sbf$SBFit[,j])) -plot(sort(xi[,j]),g12,type='l',col=2,ylim=c(-2.5,2.5),xlab='xi12') -points(sort(xi[,j]),tmpSgn*sbf$SBFit[order(xi[,j]),j],type='l') -legend('top',c('true','SBF'),col=c(2,1),lwd=2,bty='n',horiz=TRUE) - -j <- 3 -p0 <- trapzRcpp(sort(xi[,j]),dnorm(sort(xi[,j]),0,sqrt(sig[j,j]))) -g21 <- f21(sort(xi[,j])) - -trapzRcpp(sort(xi[,j]),f21(sort(xi[,j]))*dnorm(sort(xi[,j]),0,sqrt(sig[j,j])))/p0 -tmpSgn <- sign(sum(g21*sbf$SBFit[,j])) -plot(sort(xi[,j]),g21,type='l',col=2,ylim=c(-2.5,2.5),xlab='xi21') -points(sort(xi[,j]),tmpSgn*sbf$SBFit[order(xi[,j]),j],type='l') -legend('top',c('true','SBF'),col=c(2,1),lwd=2,bty='n',horiz=TRUE) - -j <- 4 -p0 <- trapzRcpp(sort(xi[,j]),dnorm(sort(xi[,j]),0,sqrt(sig[j,j]))) -g22 <- f22(sort(xi[,j])) - -trapzRcpp(sort(xi[,j]),f22(sort(xi[,j]))*dnorm(sort(xi[,j]),0,sqrt(sig[j,j])))/p0 -tmpSgn <- sign(sum(g22*sbf$SBFit[,j])) -plot(sort(xi[,j]),g22,type='l',col=2,ylim=c(-2.5,2.5),xlab='xi22') -points(sort(xi[,j]),tmpSgn*sbf$SBFit[order(xi[,j]),j],type='l') -legend('top',c('true','SBF'),col=c(2,1),lwd=2,bty='n',horiz=TRUE) - -## Not run: -##D # fitting -##D sbf <- MultiFAM(Y=Y,X=X,nEval=0) -##D yHat <- sbf$mu+apply(sbf$SBFit,1,'sum') -##D par(mfrow=c(1,1)) -##D plot(yHat,Y) -##D abline(coef=c(0,1),col=2) -##D -##D -##D # R^2 -##D R2 <- 1-sum((Y-yHat)^2)/sum((Y-mean(Y))^2) -##D R2 -##D -##D -##D # prediction -##D sbf <- MultiFAM(Y=Y,X=X,XTest=XTest) -##D yHat <- sbf$mu+apply(sbf$SBFit,1,'sum') -##D par(mfrow=c(1,1)) -##D plot(yHat,YTest) -##D abline(coef=c(0,1),col=2) -## End(Not run) - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("MultiFAM", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -graphics::par(get("par.postscript", pos = 'CheckExEnv')) -cleanEx() -nameEx("SBFitting") -### * SBFitting - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: SBFitting -### Title: Iterative Smooth Backfitting Algorithm -### Aliases: SBFitting - -### ** Examples - -set.seed(100) - -n <- 100 -d <- 2 -X <- pnorm(matrix(rnorm(n*d),nrow=n,ncol=d)%*%matrix(c(1,0.6,0.6,1),nrow=2,ncol=2)) - -f1 <- function(t) 2*(t-0.5) -f2 <- function(t) sin(2*pi*t) - -Y <- f1(X[,1])+f2(X[,2])+rnorm(n,0,0.1) - -# component function estimation -N <- 101 -x <- matrix(rep(seq(0,1,length.out=N),d),nrow=N,ncol=d) -h <- c(0.12,0.08) - -sbfEst <- SBFitting(Y,x,X,h) -fFit <- sbfEst$SBFit - -par(mfrow=c(1,2)) -plot(x[,1],f1(x[,1]),type='l',lwd=2,col=2,lty=4,xlab='X1',ylab='Y') -points(x[,1],fFit[,1],type='l',lwd=2,col=1) -points(X[,1],Y,cex=0.3,col=8) -legend('topleft',legend=c('SBF','true'),col=c(1,2),lwd=2,lty=c(1,4),horiz=FALSE,bty='n') -abline(h=0,col=8) - -plot(x[,2],f2(x[,2]),type='l',lwd=2,col=2,lty=4,xlab='X2',ylab='Y') -points(x[,2],fFit[,2],type='l',lwd=2,col=1) -points(X[,2],Y,cex=0.3,col=8) -legend('topright',legend=c('SBF','true'),col=c(1,2),lwd=2,lty=c(1,4),horiz=FALSE,bty='n') -abline(h=0,col=8) - -# prediction -x <- X -h <- c(0.12,0.08) - -sbfPred <- SBFitting(Y,X,X,h) -fPred <- sbfPred$mY+apply(sbfPred$SBFit,1,'sum') - -par(mfrow=c(1,1)) -plot(fPred,Y,cex=0.5,xlab='SBFitted values',ylab='Y') -abline(coef=c(0,1),col=8) - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("SBFitting", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -graphics::par(get("par.postscript", pos = 'CheckExEnv')) -cleanEx() -nameEx("Stringing") -### * Stringing - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: Stringing -### Title: Stringing for High-Dimensional data -### Aliases: Stringing - -### ** Examples - -set.seed(1) -n <- 50 -wiener = Wiener(n = n)[,-1] -p = ncol(wiener) -rdmorder = sample(size = p, x=1:p, replace = FALSE) -stringingfit = Stringing(X = wiener[,rdmorder], disOptns = "correlation") -diff_norev = sum(abs(rdmorder[stringingfit$StringingOrder] - 1:p)) -diff_rev = sum(abs(rdmorder[stringingfit$StringedOrder] - p:1)) -if(diff_rev <= diff_norev){ - stringingfit$StringingOrder = rev(stringingfit$StringingOrder) - stringingfit$Ly = lapply(stringingfit$Ly, rev) -} -plot(1:p, rdmorder[stringingfit$StringingOrder], pch=18); abline(a=0,b=1) - - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("Stringing", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("TVAM") -### * TVAM - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: TVAM -### Title: Iterative Smooth Backfitting Algorithm -### Aliases: TVAM - -### ** Examples - - -set.seed(1000) - -n <- 100 -Lt <- list() -Ly <- list() -Lx1 <- list() -Lx2 <- list() - -for (i in 1:n) { - Ni <- sample(10:15,1) - - Lt[[i]] <- sort(runif(Ni,0,1)) - Lx1[[i]] <- runif(Ni,0,1) - Lx2[[i]] <- runif(Ni,0,1) - Ly[[i]] <- Lt[[i]]*(cos(2*pi*Lx1[[i]]) + sin(2*pi*Lx2[[i]])) + rnorm(Ni,0,0.1) - -} - -LLx <- list(Lx1,Lx2) - -gridT <- seq(0,1,length.out=41) -x0 <- seq(0,1,length.out=51) -x <- cbind(x0,x0) - -ht <- 0.1 -hx <- c(0.1,0.1) - -tvam <- TVAM(Lt,Ly,LLx,gridT=gridT,x=x,ht=ht,hx=hx,K='epan') - -g0Sbf <- tvam$tvamMean -gjSbf <- tvam$tvamComp - -par(mfrow=c(1,2)) -par(mar=c(1,1,1,1)+0.1) -persp(gridT,x0,gjSbf[[1]],theta=60,phi=30, - xlab='time',ylab='x1',zlab='g1(t, x1)') -persp(gridT,x0,gjSbf[[2]],theta=60,phi=30, - xlab='time',ylab='x2',zlab='g1(t, x2)') - - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("TVAM", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -graphics::par(get("par.postscript", pos = 'CheckExEnv')) -cleanEx() -nameEx("VCAM") -### * VCAM - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: VCAM -### Title: Sieve estimation -### Aliases: VCAM - -### ** Examples - - -library(MASS) - -set.seed(100) - -n <- 100 -d <- 2 - -Lt <- list() -Ly <- list() - -m <- rep(0,2) -S <- matrix(c(1,0.5,0.5,1),nrow=2,ncol=2) -X <- pnorm(mvrnorm(n,m,S)) - -beta0 <- function(t) 1.5*sin(3*pi*(t+0.5)) -beta1 <- function(t) 3*(1-t)^2 -beta2 <- function(t) 4*t^3 - -phi1 <- function(x) sin(2*pi*x) -phi2 <- function(x) 4*x^3-1 - -for (i in 1:n) { - Ni <- sample(10:20,1) - - Lt[[i]] <- sort(runif(Ni,0,1)) - Ly[[i]] <- beta0(Lt[[i]]) + beta1(Lt[[i]])*phi1(X[i,1]) + beta2(Lt[[i]])*phi2(X[i,2]) + rnorm(Ni,0,0.1) - -} - - -vcam <- VCAM(Lt,Ly,X) - -par(mfrow=c(1,1)) -plot(unlist(vcam$LyHat),unlist(Ly),xlab='observed Y',ylab='fitted Y') -abline(coef=c(0,1),col=8) - -par(mfrow=c(1,2)) -plot(vcam$gridX[,1],vcam$phiEst[,1],type='l',ylim=c(-1,1),xlab='x1',ylab='phi1') -points(vcam$gridX[,1],phi1(vcam$gridX[,1]),col=2,type='l',lty=2,lwd=2) -legend('topright',c('true','est'),lwd=2,lty=c(1,2),col=c(1,2)) - -plot(vcam$gridX[,2],vcam$phiEst[,2],type='l',ylim=c(-1,3),xlab='x2',ylab='phi2') -points(vcam$gridX[,2],phi2(vcam$gridX[,2]),col=2,type='l',lty=2,lwd=2) -legend('topleft',c('true','est'),lwd=2,lty=c(1,2),col=c(1,2)) - -par(mfrow=c(1,3)) -plot(vcam$gridT,vcam$beta0Est,type='l',xlab='t',ylab='beta0') -points(vcam$gridT,beta0(vcam$gridT),col=2,type='l',lty=2,lwd=2) -legend('topright',c('true','est'),lwd=2,lty=c(1,2),col=c(1,2)) - -plot(vcam$gridT,vcam$betaEst[,1],type='l',xlab='t',ylab='beta1') -points(vcam$gridT,beta1(vcam$gridT),col=2,type='l',lty=2,lwd=2) -legend('topright',c('true','est'),lwd=2,lty=c(1,2),col=c(1,2)) - -plot(vcam$gridT,vcam$betaEst[,2],type='l',xlab='t',ylab='beta2') -points(vcam$gridT,beta2(vcam$gridT),col=2,type='l',lty=2,lwd=2) -legend('topright',c('true','est'),lwd=2,lty=c(1,2),col=c(1,2)) - - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("VCAM", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -graphics::par(get("par.postscript", pos = 'CheckExEnv')) -cleanEx() -nameEx("WFDA") -### * WFDA - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: WFDA -### Title: Warped Functional Data Analysis -### Aliases: WFDA - -### ** Examples - -N = 44; -eps = 0.123; -M = 41; -set.seed(123) -Tfinal = 3 -me <- function(t) exp(-Tfinal*(((t/Tfinal^2)-0.5))^2); -T = seq(0,Tfinal,length.out = M) -recondingTimesMat = matrix(nrow = N, ncol = M) -yMat = matrix(nrow = N, ncol = M) - -for (i in 1:N){ - peak = runif(min = 0.2,max = 0.8,1) * Tfinal - recondingTimesMat[i,] = sort( unique(c( seq(0.0 , peak, length.out = round((M+1)/2)), - seq( peak, Tfinal, length.out = round((M+1)/2))))) * Tfinal - yMat[i,] = me(recondingTimesMat[i,]) * rnorm(1, mean=4.0, sd= eps) - + rnorm(M, mean=0.0, sd= eps) -} - -Y = as.list(as.data.frame(t(yMat))) -X = rep(list(T),N) - -sss = WFDA(Ly = Y, Lt = X, list( choice = 'weighted' )) -par(mfrow=c(1,2)) -matplot(x= T, t(yMat), t='l', main = 'Raw', ylab = 'Y'); grid() -matplot(x= T, t(sss$aligned), t='l', main = 'Aligned', ylab='Y'); grid() - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("WFDA", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -graphics::par(get("par.postscript", pos = 'CheckExEnv')) -cleanEx() -nameEx("fitted.FPCA") -### * fitted.FPCA - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: fitted.FPCA -### Title: Fitted functional sample from FPCA object -### Aliases: fitted.FPCA - -### ** Examples - -set.seed(1) -n <- 100 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- Sparsify(sampWiener, pts, 5:10) -res <- FPCA(sampWiener$Ly, sampWiener$Lt, - list(dataType='Sparse', error=FALSE, kernel='epan', verbose=TRUE)) -fittedY <- fitted(res, ciOptns = list(alpha=0.05)) - -workGrid <- res$workGrid -cvgUpper <- fittedY$cvgUpper -cvgLower <- fittedY$cvgLower - -par(mfrow=c(2,3)) -ind <- sample(1:n,6) -for (i in 1:6) { - j <- ind[i] - plot(workGrid,cvgUpper[j,],type='l',ylim=c(min(cvgLower[j,]),max(cvgUpper[j,])),col=4,lty=2, - xlab='t', ylab='X(t)', main=paste(j,'-th subject',sep='')) - points(workGrid,cvgLower[j,],type='l',col=4,lty=2) - points(res$inputData$Lt[[j]],res$inputData$Ly[[j]]) -} - - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("fitted.FPCA", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -graphics::par(get("par.postscript", pos = 'CheckExEnv')) -cleanEx() -nameEx("fitted.FPCAder") -### * fitted.FPCAder - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: fitted.FPCAder -### Title: Fitted functional sample from FPCAder object -### Aliases: fitted.FPCAder - -### ** Examples - -set.seed(1) -n <- 20 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- Sparsify(sampWiener, pts, 10) - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("fitted.FPCAder", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("kCFC") -### * kCFC - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: kCFC -### Title: Functional clustering and identifying substructures of -### longitudinal data using kCFC. -### Aliases: kCFC - -### ** Examples - -data(medfly25) -Flies <- MakeFPCAInputs(medfly25$ID, medfly25$Days, medfly25$nEggs) -kcfcObj <- kCFC(Flies$Ly[1:250], Flies$Lt[1:250], # using only 250 for speed consideration - optnsSW = list(methodMuCovEst = 'smooth', userBwCov = 2, FVEthreshold = 0.90), - optnsCS = list(methodMuCovEst = 'smooth', userBwCov = 2, FVEthreshold = 0.70)) - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("kCFC", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("plot.FPCA") -### * plot.FPCA - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: CreateDiagnosticsPlot -### Title: Functional Principal Component Analysis Diagnostics plot -### Aliases: CreateDiagnosticsPlot plot.FPCA - -### ** Examples - -set.seed(1) -n <- 20 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- Sparsify(sampWiener, pts, 10) -res1 <- FPCA(sampWiener$Ly, sampWiener$Lt, - list(dataType='Sparse', error=FALSE, kernel='epan', verbose=FALSE)) -plot(res1) - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("plot.FPCA", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("predict.FPCA") -### * predict.FPCA - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: predict.FPCA -### Title: Predict FPC scores for a new sample given an FPCA object -### Aliases: predict.FPCA - -### ** Examples - -set.seed(1) -n <- 50 -pts <- seq(0, 1, by=0.05) -# The first n samples are for training and the rest testing -sampWiener <- Wiener(2 * n, pts) -sparsity <- 2:5 -train <- Sparsify(sampWiener[seq_len(n), , drop=FALSE], pts, sparsity) -test <- Sparsify(sampWiener[seq(n + 1, 2 * n), , drop=FALSE], pts, sparsity) -res <- FPCA(train$Ly, train$Lt) -pred <- predict(res, test$Ly, test$Lt, K=5) -plot(pred[, 1], pred[, 2]) - - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("predict.FPCA", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -cleanEx() -nameEx("print.FPCA") -### * print.FPCA - -flush(stderr()); flush(stdout()) - -base::assign(".ptime", proc.time(), pos = "CheckExEnv") -### Name: print.FPCA -### Title: Print an FPCA object -### Aliases: print.FPCA - -### ** Examples - -set.seed(1) -n <- 20 -pts <- seq(0, 1, by=0.05) -sampWiener <- Wiener(n, pts) -sampWiener <- Sparsify(sampWiener, pts, 10) -res <- FPCA(sampWiener$Ly, sampWiener$Lt) -res - - - - -base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") -base::cat("print.FPCA", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") -### *