diff --git a/DESCRIPTION b/DESCRIPTION index 00db3e7..f57ba57 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: resemble Type: Package Title: Memory-Based Learning in Spectral Chemometrics -Version: 2.2.2 -Date: 2023-04-19 +Version: 2.2.3 +Date: 2024-02-16 Author: Leonardo Ramirez-Lopez [aut, cre], Antoine Stevens [aut, ctb], Claudio Orellano [ctb], @@ -48,7 +48,7 @@ VignetteBuilder: knitr NeedsCompilation: yes LazyData: true Repository: CRAN -RoxygenNote: 7.2.1 +RoxygenNote: 7.3.1 Encoding: UTF-8 Roxygen: list(markdown = TRUE) -Config/VersionName: Sky +Config/VersionName: embryo diff --git a/LICENSE b/LICENSE index 2710ae0..8041658 100644 --- a/LICENSE +++ b/LICENSE @@ -1,2 +1,2 @@ -YEAR: 2014 - 2020 +YEAR: 2014 - 2024 COPYRIGHT HOLDER: Leonardo Ramirez Lopez diff --git a/NEWS.md b/NEWS.md index 6ac000f..d3d0847 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,12 @@ -# `resemble` +# `resemble 2.2.3 (embryo)` +=============== +### Fixes + +* Fixed items in the documentation ([#50](https://github.com/l-ramirez-lopez/resemble/issues/50)) + +* Fixed inconsistent score names between `ortho_projection()` and `ortho_projection.predict()` ([#49](https://github.com/l-ramirez-lopez/resemble/issues/49)). Many thanks to José Lucas Safanelli (zecojls) for reporting this issue. + + `resemble 2.2.2 (sky)` =============== ### New features @@ -8,11 +16,11 @@ avoid observations in the neighbrhoods. ### Fixes * A sanity check was added to `cor_diss()`. Correlation coefficients for -observations with an standard deviation of 0 cannot be computed ([#38]https://github.com/l-ramirez-lopez/resemble/issues/38). +observations with an standard deviation of 0 cannot be computed ([#38](https://github.com/l-ramirez-lopez/resemble/issues/38)). * The `pls_projection()` did not work for more than one response variable and with the methods `'cumvar'` or `'var'` for the selection -of the components. This has been fixed ([#37]https://github.com/l-ramirez-lopez/resemble/issues/37). +of the components. This has been fixed ([#37](https://github.com/l-ramirez-lopez/resemble/issues/37)). `resemble 2.2.1 (Fix-Hodges)` diff --git a/R/RcppExports.R b/R/RcppExports.R index ba8674e..574817b 100644 --- a/R/RcppExports.R +++ b/R/RcppExports.R @@ -245,21 +245,21 @@ get_local_pls_weights <- function(projection_mat, xloadings, coefficients, new_x #' method. Only used if \code{algorithm = 'xls'}. Default is 15 (as in BUCHI NIRWise PLUS software). #' @return a list containing the following elements: #' \itemize{ -#' \item{\code{coefficients}}{ the matrix of regression coefficients.} -#' \item{\code{bo}}{ a matrix of one row containing the intercepts for +#' \item{\code{coefficients}: the matrix of regression coefficients.} +#' \item{\code{bo}: a matrix of one row containing the intercepts for #' each component.} -#' \item{\code{scores}}{ the matrix of scores.} -#' \item{\code{X_loadings}}{ the matrix of X loadings.} -#' \item{\code{Y_loadings}}{ the matrix of Y loadings.} -#' \item{\code{projection_mat}}{ the projection matrix.} -#' \item{\code{Y}}{ the \code{Y} input.} -#' \item{\code{variance}}{ a \code{list} conating two objects: \code{x_var} +#' \item{\code{scores}: the matrix of scores.} +#' \item{\code{X_loadings}: the matrix of X loadings.} +#' \item{\code{Y_loadings}: the matrix of Y loadings.} +#' \item{\code{projection_mat}: the projection matrix.} +#' \item{\code{Y}: the \code{Y} input.} +#' \item{\code{variance}: a \code{list} conating two objects: \code{x_var} #' and \code{y_var}. #' These objects contain information on the explained variance for the \code{X} #' and \code{Y} matrices respectively.} -#' \item{\code{transf}}{ a \code{list} conating two objects: \code{Xcenter} +#' \item{\code{transf}: a \code{list} conating two objects: \code{Xcenter} #' and \code{Xscale}}. -#' \item{\code{weights}}{ the matrix of wheights.} +#' \item{\code{weights}: the matrix of wheights.} #' } #' @author Leonardo Ramirez-Lopez #' @keywords internal @@ -300,19 +300,20 @@ opls_for_projection <- function(X, Y, ncomp, scale, maxiter, tol, pcSelmethod = #' method. Only used if \code{algorithm = 'xls'}. Default is 15 (as in BUCHI NIRWise PLUS software). #' @return a list containing the following elements: #' \itemize{ -#' \item{\code{ncomp}}{ the number of components used.} -#' \item{\code{coefficients}}{ the matrix of regression coefficients.} -#' \item{\code{bo}}{ a matrix of one row containing the intercepts for each component.} -#' \item{\code{scores}}{ the matrix of scores.} -#' \item{\code{X_loadings}}{ the matrix of X loadings.} -#' \item{\code{Y_loadings}}{ the matrix of Y loadings.} -#' \item{\code{vip}}{ the projection matrix.} -#' \item{\code{selectivity_ratio}}{ the matrix of selectivity ratio (see Rajalahti, Tarja, et al. 2009).} -#' \item{\code{Y}}{ the \code{Y} input.} -#' \item{\code{variance}}{ a \code{list} conating two objects: \code{x_var} and \code{y_var}. +#' \item{\code{ncomp}: the number of components used.} +#' \item{\code{coefficients}: the matrix of regression coefficients.} +#' \item{\code{bo}: a matrix of one row containing the intercepts for each component.} +#' \item{\code{scores}: the matrix of scores.} +#' \item{\code{X_loadings}: the matrix of X loadings.} +#' \item{\code{Y_loadings}: the matrix of Y loadings.} +#' \item{\code{vip}: the projection matrix.} +#' \item{\code{selectivity_ratio}: the matrix of selectivity ratio (see Rajalahti, Tarja, et al. 2009).} +#' \item{\code{Y}: the \code{Y} input.} +#' \item{\code{variance}: a \code{list} conating two objects: \code{x_var} and \code{y_var}. #' These objects contain information on the explained variance for the \code{X} and \code{Y} matrices respectively.} -#' \item{\code{transf}}{ a \code{list} conating two objects: \code{Xcenter} and \code{Xscale}}. -#' \item{\code{weights}}{ the matrix of wheights.}} +#' \item{\code{transf}: a \code{list} conating two objects: \code{Xcenter} and \code{Xscale}}. +#' \item{\code{weights}: the matrix of wheights.} +#' } #' @author Leonardo Ramirez-Lopez #' @keywords internal #' @useDynLib resemble @@ -353,15 +354,15 @@ opls_get_all <- function(X, Y, ncomp, scale, maxiter, tol, algorithm = "pls", xl #' method. Only used if \code{algorithm = 'xls'}. Default is 15 (as in BUCHI NIRWise PLUS software). #' @return a list containing the following elements: #' \itemize{ -#' \item{\code{coefficients}}{ the matrix of regression coefficients.} -#' \item{\code{bo}}{ a matrix of one row containing the intercepts for each component.} -#' \item{\code{scores}}{ the matrix of scores.} -#' \item{\code{X_loadings}}{ the matrix of X loadings.} -#' \item{\code{Y_loadings}}{ the matrix of Y loadings.} -#' \item{\code{projection_mat}}{ the projection matrix.} -#' \item{\code{Y}}{ the \code{Y} input.} -#' \item{\code{transf}}{ a \code{list} conating two objects: \code{Xcenter} and \code{Xscale}}. -#' \item{\code{weights}}{ the matrix of wheights.}} +#' \item{\code{coefficients}: the matrix of regression coefficients.} +#' \item{\code{bo}: a matrix of one row containing the intercepts for each component.} +#' \item{\code{scores}: the matrix of scores.} +#' \item{\code{X_loadings}: the matrix of X loadings.} +#' \item{\code{Y_loadings}: the matrix of Y loadings.} +#' \item{\code{projection_mat}: the projection matrix.} +#' \item{\code{Y}: the \code{Y} input.} +#' \item{\code{transf}: a \code{list} conating two objects: \code{Xcenter} and \code{Xscale}}. +#' \item{\code{weights}: the matrix of wheights.}} #' @author Leonardo Ramirez-Lopez #' @keywords internal #' @useDynLib resemble @@ -372,7 +373,7 @@ opls <- function(X, Y, ncomp, scale, maxiter, tol, algorithm = "pls", xls_min_w #' @title fast orthogonal scores algorithn of partial leat squares (opls) #' @description Computes orthogonal socres partial least squares (opls) #' regressions with the NIPALS algorithm. It allows multiple response variables. -#' In contrast to code{opls} function, this one does not compute unnecessary +#' In contrast to \code{opls} function, this one does not compute unnecessary #' data for (local) regression. #' For internal use only! #' @usage @@ -398,11 +399,11 @@ opls <- function(X, Y, ncomp, scale, maxiter, tol, algorithm = "pls", xls_min_w #' method. Only used if \code{algorithm = 'xls'}. Default is 15 (as in BUCHI NIRWise PLUS software). #' @return a list containing the following elements: #' \itemize{ -#' \item{\code{coefficients}}{ the matrix of regression coefficients.} -#' \item{\code{bo}}{ a matrix of one row containing the intercepts for each component.} -#' \item{\code{Y_loadings}}{ the matrix of Y loadings.} -#' \item{\code{projection_mat}}{ the projection matrix.} -#' \item{\code{transf}}{ a \code{list} conating two objects: \code{Xcenter} and \code{Xscale}}. +#' \item{\code{coefficients}: the matrix of regression coefficients.} +#' \item{\code{bo}: a matrix of one row containing the intercepts for each component.} +#' \item{\code{Y_loadings}: the matrix of Y loadings.} +#' \item{\code{projection_mat}: the projection matrix.} +#' \item{\code{transf}: a \code{list} conating two objects: \code{Xcenter} and \code{Xscale}}. #' } #' @author Leonardo Ramirez-Lopez #' @keywords internal @@ -514,18 +515,18 @@ reconstruction_error <- function(x, projection_mat, xloadings, scale, Xcenter, X #' @return #' if \code{statistics = true} a list containing the following one-row matrices: #' \itemize{ -#' \item{\code{rmse_seg}}{ the RMSEs.} -#' \item{\code{st_rmse_seg}}{ the standardized RMSEs.} -#' \item{\code{rsq_seg}}{ the coefficients of determination.} +#' \item{\code{rmse_seg}: the RMSEs.} +#' \item{\code{st_rmse_seg}: the standardized RMSEs.} +#' \item{\code{rsq_seg}: the coefficients of determination.} #' } #' #' if \code{statistics = false} a list containing the following one-row matrices: #' \itemize{ -#' \item{\code{predictions}}{ the predictions of each of the validation +#' \item{\code{predictions}: the predictions of each of the validation #' segments in \code{pindices}. Each column in \code{pindices} contains the #' validation indices of a segment.} -#' \item{\code{st_rmse_seg}}{ the standardized RMSEs.} -#' \item{\code{rsq_seg}}{ the coefficients of determination.} +#' \item{\code{st_rmse_seg}: the standardized RMSEs.} +#' \item{\code{rsq_seg}: the coefficients of determination.} #' } #' #' If \code{method = "wapls"}, data of the pls weights are output in this @@ -574,10 +575,10 @@ opls_cv_cpp <- function(X, Y, scale, method, mindices, pindices, min_component, #' \code{'mpls'} for modified pls (using correlation between X and Y). #' @return a list containing the following elements: #' \itemize{ -#' \item{\code{ncomp}}{ the number of components.} -#' \item{\code{pred_response}}{ the response predictions for \code{Xu}.} -#' \item{\code{rmse_reconstruction}}{ the rmse of the reconstruction for \code{Xu}.} -#' \item{\code{score_dissimilarity}}{ the distance score between \code{Xr} and \code{Xu}.}} +#' \item{\code{ncomp}: the number of components.} +#' \item{\code{pred_response}: the response predictions for \code{Xu}.} +#' \item{\code{rmse_reconstruction}: the rmse of the reconstruction for \code{Xu}.} +#' \item{\code{score_dissimilarity}: the distance score between \code{Xr} and \code{Xu}.}} #' @author Leonardo Ramirez-Lopez #' @keywords internal #' @useDynLib resemble @@ -595,14 +596,14 @@ opls_gs <- function(Xr, Yr, Xu, ncomp, scale, response = FALSE, reconstruction = #' and the response variable must be scaled to zero mean and unit variance. #' @return a list containing the following elements: #' \itemize{ -#' \item{\code{b}}{ the regression coefficients.} -#' \item{\code{Xz}}{ the (final transformed) matrix of predictor variables.} -#' \item{\code{alpha}}{ the alpha matrix.} -#' \item{\code{is.scaled}}{ logical indicating whether both the predictors and response variable were scaled to zero mean and unit variance.} -#' \item{\code{Xcenter}}{ if matrix of predictors was scaled, the centering vector used for \code{X}.} -#' \item{\code{Xscale}}{ if matrix of predictors was scaled, the scaling vector used for \code{X}.} -#' \item{\code{Ycenter}}{ if matrix of predictors was scaled, the centering vector used for \code{Y}.} -#' \item{\code{Yscale}}{ if matrix of predictors was scaled, the scaling vector used for \code{Y}.} +#' \item{\code{b}: the regression coefficients.} +#' \item{\code{Xz}: the (final transformed) matrix of predictor variables.} +#' \item{\code{alpha}: the alpha matrix.} +#' \item{\code{is.scaled}: logical indicating whether both the predictors and response variable were scaled to zero mean and unit variance.} +#' \item{\code{Xcenter}: if matrix of predictors was scaled, the centering vector used for \code{X}.} +#' \item{\code{Xscale}: if matrix of predictors was scaled, the scaling vector used for \code{X}.} +#' \item{\code{Ycenter}: if matrix of predictors was scaled, the centering vector used for \code{Y}.} +#' \item{\code{Yscale}: if matrix of predictors was scaled, the scaling vector used for \code{Y}.} #' } #' @author Leonardo Ramirez-Lopez #' @keywords internal @@ -614,7 +615,6 @@ gaussian_process <- function(X, Y, noisev = 0.001, scale = TRUE) { #' @title Prediction function for the \code{gaussian_process} function (Gaussian process regression with dot product covariance) #' @description Predicts response values based on a model generated by the \code{gaussian_process} function (Gaussian process regression with dot product covariance). For internal use only!. #' @usage predict_gaussian_process(Xz, alpha, newdata, scale, Xcenter, Xscale, Ycenter, Yscale) -#' @param b the regression coefficients. #' @param newdata a matrix containing the predictor variables #' @param scale a logical indicating whether the matrix of predictors used to create the regression model #' (in the \code{gaussian_process} function) was scaled @@ -643,7 +643,6 @@ predict_gaussian_process <- function(Xz, alpha, newdata, scale, Xcenter, Xscale, #' @param pindices a matrix with \code{k} rows and \code{m} columns where \code{m} is equivalent to the number of #' resampling iterations. The elements of each column indicate the indices of the observations to be used for predicting at each #' iteration. -#' @param ncomp an integer indicating the number of pls components. #' @param scale a logical indicating whether both the predictors #' and the response variable must be scaled to zero mean and unit variance. #' @param statistics a logical value indicating whether the precision and @@ -651,9 +650,9 @@ predict_gaussian_process <- function(Xz, alpha, newdata, scale, Xcenter, Xscale, #' validation segment are retrieved. #' @return a list containing the following one-row matrices: #' \itemize{ -#' \item{\code{rmse.seg}}{ the RMSEs.} -#' \item{\code{st.rmse.seg}}{ the standardized RMSEs.} -#' \item{\code{rsq.seg}}{ the coefficients of determination.} +#' \item{\code{rmse.seg}: the RMSEs.} +#' \item{\code{st.rmse.seg}: the standardized RMSEs.} +#' \item{\code{rsq.seg}: the coefficients of determination.} #' } #' @author Leonardo Ramirez-Lopez #' @keywords internal @@ -671,7 +670,6 @@ gaussian_process_cv <- function(X, Y, mindices, pindices, noisev = 0.001, scale #' pcSelmethod = "var", #' pcSelvalue = 0.01) #' @param X a matrix of predictor variables. -#' @param Y a matrix of either a single or multiple response variables. #' @param ncomp the number of pls components. #' @param scale logical indicating whether \code{X} must be scaled. #' @param maxiter maximum number of iterations. @@ -688,10 +686,10 @@ gaussian_process_cv <- function(X, Y, mindices, pindices, noisev = 0.001, scale #' specifying the desired number of principal components to retain. Default is 0.01. #' @return a list containing the following elements: #' \itemize{ -#' \item{\code{pc_scores}}{ a matrix of principal component scores.} -#' \item{\code{pc_loadings}}{ a matrix of of principal component loadings.} -#' \item{\code{variance}}{ a matrix of the variance of the principal components.} -#' \item{\code{scale}}{ a \code{list} conating two objects: \code{center} and \code{scale}, which correspond to the vectors used to center and scale the input matrix.} +#' \item{\code{pc_scores}: a matrix of principal component scores.} +#' \item{\code{pc_loadings}: a matrix of of principal component loadings.} +#' \item{\code{variance}: a matrix of the variance of the principal components.} +#' \item{\code{scale}: a \code{list} conating two objects: \code{center} and \code{scale}, which correspond to the vectors used to center and scale the input matrix.} #' } #' @author Leonardo Ramirez-Lopez #' @keywords internal diff --git a/R/dissimilarity.R b/R/dissimilarity.R index 3b5e29b..994bf8e 100644 --- a/R/dissimilarity.R +++ b/R/dissimilarity.R @@ -20,38 +20,38 @@ #' @param diss_method a character string indicating the method to be used to #' compute the dissimilarities between observations. Options are: #' \itemize{ -#' \item{\code{"pca"}:}{ Mahalanobis distance +#' \item{\code{"pca"}: Mahalanobis distance #' computed on the matrix of scores of a Principal Component (PC) #' projection of \code{Xr} (and \code{Xu} if provided). PC projection is #' done using the singular value decomposition (SVD) algorithm. #' See \code{\link{ortho_diss}} function.} -#' \item{\code{"pca.nipals"}:}{ Mahalanobis distance +#' \item{\code{"pca.nipals"}: Mahalanobis distance #' computed on the matrix of scores of a Principal Component (PC) #' projection of \code{Xr} (and \code{Xu} if provided). PC projection is #' done using the non-linear iterative partial least squares (nipals) #' algorithm. See \code{\link{ortho_diss}} function.} -#' \item{\code{"pls"}}:{ Mahalanobis distance +#' \item{\code{"pls"}: Mahalanobis distance #' computed on the matrix of scores of a partial least squares projection #' of \code{Xr} (and \code{Xu} if provided). In this case, \code{Yr} is #' always required. See \code{\link{ortho_diss}} function.} -#' \item{\code{"mpls"}}:{ Mahalanobis distance +#' \item{\code{"mpls"}: Mahalanobis distance #' computed on the matrix of scores of a modified partial least squares #' projection (Shenk and Westerhaus, 1991; Westerhaus, 2014) #' of \code{Xr} (and \code{Xu} if provided). In this case, \code{Yr} is #' always required. See \code{\link{ortho_diss}} function.} -#' \item{\code{"cor"}:}{ based on the correlation coefficient +#' \item{\code{"cor"}: based on the correlation coefficient #' between observations. See \code{\link{cor_diss}} function.} -#' \item{\code{"euclid"}:}{ Euclidean distance +#' \item{\code{"euclid"}: Euclidean distance #' between observations. See \code{\link{f_diss}} function.} -#' \item{\code{"cosine"}:}{ Cosine distance +#' \item{\code{"cosine"}: Cosine distance #' between observations. See \code{\link{f_diss}} function.} -#' \item{\code{"sid"}:}{ spectral information divergence between +#' \item{\code{"sid"}: spectral information divergence between #' observations. See \code{\link{sid}} function.} #' } #' @param Yr a numeric matrix of `n` observations used as side information of @@ -76,7 +76,7 @@ #' components) and \code{value} (a numerical value that complements the selected #' method). The methods available are: #' \itemize{ -#' \item{\code{"opc"}:} { optimized principal component selection based on +#' \item{\code{"opc"}: optimized principal component selection based on #' Ramirez-Lopez et al. (2013a, 2013b). The optimal number of components #' (of set of observations) is the one for which its distance matrix #' minimizes the differences between the \code{Yr} value of each @@ -87,19 +87,19 @@ #' number of principal components to be tested. See the #' \code{\link{ortho_projection}} function for more details.} -#' \item{\code{"cumvar"}:}{ selection of the principal components based +#' \item{\code{"cumvar"}: selection of the principal components based #' on a given cumulative amount of explained variance. In this case, #' \code{value} must be a value (larger than 0 and below or equal to 1) #' indicating the minimum amount of cumulative variance that the #' combination of retained components should explain.} -#' \item{\code{"var"}:}{ selection of the principal components based +#' \item{\code{"var"}: selection of the principal components based #' on a given amount of explained variance. In this case, #' \code{value} must be a value (larger than 0 and below or equal to 1) #' indicating the minimum amount of variance that a single component #' should explain in order to be retained.} -#' \item{\code{"manual"}:}{ for manually specifying a fix number of +#' \item{\code{"manual"}: for manually specifying a fix number of #' principal components. In this case, \code{value} must be a value #' (larger than 0 and #' below the minimum dimension of \code{Xr} or \code{Xr} and \code{Xu} @@ -158,9 +158,9 @@ #' #' @return A list with the following components: #' \itemize{ -#' \item{\code{dissimilarity}:}{ the resulting dissimilarity matrix.} +#' \item{\code{dissimilarity}: the resulting dissimilarity matrix.} -#' \item{\code{projection}:}{ an \code{ortho_projection} object. Only output +#' \item{\code{projection}: an \code{ortho_projection} object. Only output #' if \code{return_projection = TRUE} and if \code{diss_method = "pca"}, #' \code{diss_method = "pca.nipals"}, \code{diss_method = "pls"} or #' \code{diss_method = "mpls"}. @@ -171,7 +171,7 @@ #' neighborhoods (see \code{\link{ortho_diss}} function for further #' details).} -#' \item{\code{gh}:}{ a list containing the GH distances as well as the +#' \item{\code{gh}: a list containing the GH distances as well as the #' pls projection used to compute the GH.} #' } #' @references diff --git a/R/local_fit.R b/R/local_fit.R index 5457229..6b6f84d 100644 --- a/R/local_fit.R +++ b/R/local_fit.R @@ -42,11 +42,11 @@ #' #' There are three possible options for performing these regressions: #' \itemize{ -#' \item{Partial least squares (pls, \code{local_fit_pls}):}{ It uses the +#' \item{Partial least squares (pls, \code{local_fit_pls}): It uses the #' orthogonal scores (non-linear iterative partial least squares, nipals) #' algorithm. The only parameter which needs to be optimized is the number of #' pls components.} -#' \item{Weighted average pls (\code{local_fit_wapls}):}{ This method was +#' \item{Weighted average pls (\code{local_fit_wapls}): This method was #' developed by Shenk et al. (1997) and it used as the regression method in the #' widely known LOCAL algorithm. It uses multiple models generated by multiple #' pls components (i.e. between a minimum and a maximum number of pls @@ -62,7 +62,7 @@ #' \mjeqn{g_{j}}{g_{j}} is the root mean square of the squared regression #' coefficients corresponding to the \mjeqn{j}{j}th pls component (see #' Shenk et al., 1997 for more details).} -#' \item{Gaussian process with dot product covariance (\code{local_fit_gpr):}{ +#' \item{Gaussian process with dot product covariance (\code{local_fit_gpr}): #' Gaussian process regression is a probabilistic and non-parametric Bayesian #' method. It is commonly described as a collection of random variables which #' have a joint Gaussian distribution and it is characterized by both a mean @@ -70,8 +70,8 @@ #' function used in the implemented method is the dot product. The only #' parameter to be taken into account in this method is the noise. In this #' method, the process for predicting the response variable of a new sample -#' (\mjeqn{y_{u}}{y_{u}}) from its predictor variables -#' (\mjeqn{x_{u}}{x_{u}}) is carried out first by computing a prediction +#' (\mjeqn{y_u}{y_u}) from its predictor variables +#' (\mjeqn{x_u}{x_u}) is carried out first by computing a prediction #' vector (\mjeqn{A}{A}). It is derived from a reference/training observations #' congaing both a response vector (\mjeqn{Y}{Y}) and predictors (\mjeqn{X}{X}) as follows: #' @@ -85,7 +85,7 @@ #' #' } #' } -#' } +#' #' #' The \code{modified} argument in the pls methods (\code{local_fit_pls()} #' and \code{local_fit_wapls()}) is used to indicate if diff --git a/R/local_helpers.R b/R/local_helpers.R index 6db27ba..ee3589f 100644 --- a/R/local_helpers.R +++ b/R/local_helpers.R @@ -388,21 +388,21 @@ get_wapls_weights <- function(pls_model, original_x, type = "w1", new_x = NULL, #' of every Xu found in Xr. This matrix is organized in the same way as #' \code{neighbor_indices}. #' @param diss_xr_xr a dissimilarity matrix between sampes in Xr. -#' @param group a factor representing the group labes of Xr. +#' @param group a factor representing the group labels of Xr. #' @return an object of \code{class} iterator giving the following list: -#' itemize{ -#' \item{ith_xr:}{ the Xr data of the neighbors for the ith observation (if +#' \itemize{ +#' \item{ith_xr: the Xr data of the neighbors for the ith observation (if #' \code{diss_usage = "predictors"}, this data is combined with the local #' dissmilarity scores of the neighbors of Xu (or Xr if Xu was not provided))} -#' \item{ith_yr:}{ the Yr data of the neighbors for the ith observation} -#' \item{ith_xu:}{ the ith Xu observation (or Xr if Xu was not provided). +#' \item{ith_yr: the Yr data of the neighbors for the ith observation} +#' \item{ith_xu: the ith Xu observation (or Xr if Xu was not provided). #' If \code{diss_usage = "predictors"}, this data is combined with the local #' dissmilarity scores to its Xr neighbors.} -#' \item{ith_yu:}{ the ith Yu observation (or Yr observation if Xu was not provided).} -#' \item{ith_neigh_diss:}{ the dissimilarity scores of the neighbors for the ith +#' \item{ith_yu: the ith Yu observation (or Yr observation if Xu was not provided).} +#' \item{ith_neigh_diss: the dissimilarity scores of the neighbors for the ith #' observation.} -#' \item{ith_group:}{ the group labels for ith_xr.} -#' \item{n_k:}{ the number of neighbors.} +#' \item{ith_group: the group labels for ith_xr.} +#' \item{n_k: the number of neighbors.} #' } #' @details isubset will look at the order of knn in each col of D and #' re-organize the rows of x accordingly @@ -515,19 +515,19 @@ ith_mbl_neighbor <- function(Xr, Xu = NULL, Yr, Yu = NULL, #' @param center center the data in the local diss computation? #' @param scale scale the data in the local diss computation? #' @return a list: -#' itemize{ -#' \item{ith_xr:}{ the new Xr data of the neighbors for the ith observation (if +#' \itemize{ +#' \item{ith_xr: the new Xr data of the neighbors for the ith observation (if #' \code{diss_usage = "predictors"}, this data is combined with the local #' dissmilarity scores of the neighbors of Xu)} -#' \item{ith_yr:}{ the new Yr data of the neighbors for the ith observation} -#' \item{ith_xu:}{ the ith Xu observation (if \code{diss_usage = "predictors"}, +#' \item{ith_yr: the new Yr data of the neighbors for the ith observation} +#' \item{ith_xu: the ith Xu observation (if \code{diss_usage = "predictors"}, #' this data is combined with the local dissmilarity scores to its Xr neighbors} -#' \item{ith_yu:}{ the ith Yu observation} -#' \item{ith_neigh_diss:}{ the new dissimilarity scores of the neighbors for the ith +#' \item{ith_yu: the ith Yu observation} +#' \item{ith_neigh_diss: the new dissimilarity scores of the neighbors for the ith #' observation} -#' \item{ith_group:}{ the group labels for the new ith_xr} -#' \item{n_k:}{ the number of neighbors} -#' \item{ith_components:}{ the number of components used} +#' \item{ith_group: the group labels for the new ith_xr} +#' \item{n_k: the number of neighbors} +#' \item{ith_components: the number of components used} #' } #' @author Leonardo Ramirez-Lopez #' @keywords internal diff --git a/R/mbl.R b/R/mbl.R index e258fe4..21d031d 100644 --- a/R/mbl.R +++ b/R/mbl.R @@ -57,33 +57,33 @@ #' metric to be used in the selection of the nearest neighbors of each #' observation. Options are: #' \itemize{ -#' \item{\code{"pca"} (Default):}{ Mahalanobis distance +#' \item{\code{"pca"} (Default): Mahalanobis distance #' computed on the matrix of scores of a Principal Component (PC) #' projection of \code{Xr} and \code{Xu}. PC projection is done using the #' singular value decomposition (SVD) algorithm. #' See \code{\link{ortho_diss}} function.} -#' \item{\code{"pca.nipals"}}{ Mahalanobis distance +#' \item{\code{"pca.nipals"}: Mahalanobis distance #' computed on the matrix of scores of a Principal Component (PC) #' projection of \code{Xr} and \code{Xu}. PC projection is done using the #' non-linear iterative partial least squares (nipals) algorithm. #' See \code{\link{ortho_diss}} function.} -#' \item{\code{"pls"}}{ Mahalanobis distance +#' \item{\code{"pls"}: Mahalanobis distance #' computed on the matrix of scores of a partial least squares projection #' of \code{Xr} and \code{Xu}. In this case, \code{Yr} is always #' required. See \code{\link{ortho_diss}} function.} -#' \item{\code{"cor"}}{ correlation coefficient +#' \item{\code{"cor"}: correlation coefficient #' between observations. See \code{\link{cor_diss}} function.} -#' \item{\code{"euclid"}}{ Euclidean distance +#' \item{\code{"euclid"}: Euclidean distance #' between observations. See \code{\link{f_diss}} function.} -#' \item{\code{"cosine"}}{ Cosine distance +#' \item{\code{"cosine"}: Cosine distance #' between observations. See \code{\link{f_diss}} function.} -#' \item{\code{"sid"}}{ spectral information divergence between +#' \item{\code{"sid"}: spectral information divergence between #' observations. See \code{\link{sid}} function.} #' } #' Alternatively, a matrix of dissimilarities can also be passed to this @@ -124,7 +124,7 @@ #' components) and \code{value} (a numerical value that complements the selected #' method). The methods available are: #' \itemize{ -#' \item{\code{"opc"}:} { optimized principal component selection based +#' \item{\code{"opc"}: optimized principal component selection based #' on Ramirez-Lopez et al. (2013a, 2013b). The optimal number of #' components (of set of observations) is the one for which its distance #' matrix minimizes the differences between the \code{Yr} value of each @@ -135,19 +135,19 @@ #' number of principal components to be tested. See the #' \code{\link{ortho_projection}} function for more details.} -#' \item{\code{"cumvar"}:}{ selection of the principal components based +#' \item{\code{"cumvar"}: selection of the principal components based #' on a given cumulative amount of explained variance. In this case, #' \code{value} must be a value (larger than 0 and below or equal to 1) #' indicating the minimum amount of cumulative variance that the #' combination of retained components should explain.} -#' \item{\code{"var"}:}{ selection of the principal components based +#' \item{\code{"var"}: selection of the principal components based #' on a given amount of explained variance. In this case, #' \code{value} must be a value (larger than 0 and below or equal to 1) #' indicating the minimum amount of variance that a single component #' should explain in order to be retained.} -#' \item{\code{"manual"}:}{ for manually specifying a fix number of +#' \item{\code{"manual"}: for manually specifying a fix number of #' principal components. In this case, \code{value} must be a value #' (larger than 0 and below the minimum dimension of \code{Xr} or #' \code{Xr} and \code{Xu} combined). @@ -269,93 +269,93 @@ #' (sorted either by \code{k} or \code{k_diss}): #' #' \itemize{ -#' \item{\code{call}:}{ the call to mbl.} -#' \item{\code{cntrl_param}:}{ the list with the control parameters passed to +#' \item{\code{call}: the call to mbl.} +#' \item{\code{cntrl_param}: the list with the control parameters passed to #' control.} -#' \item{\code{Xu_neighbors}:}{ a list containing two elements: a matrix of +#' \item{\code{Xu_neighbors}: a list containing two elements: a matrix of #' \code{Xr} indices corresponding to the neighbors of \code{Xu} and a matrix #' of dissimilarities between each \code{Xu} observation and its corresponding #' neighbor in \code{Xr}.} -#' \item{\code{dissimilarities}:}{ a list with the method used to obtain the +#' \item{\code{dissimilarities}: a list with the method used to obtain the #' dissimilarity matrices and the dissimilarity matrix corresponding to #' \mjeqn{D(Xr, Xu)}{D(Xr, Xu)}. This object is returned only if the #' \code{return_dissimilarity} argument in the \code{control} list was set #' to \code{TRUE}.} -#' \item{\code{n_predictions}}{ the total number of observations predicted.} -#' \item{\code{gh}:}{ if \code{gh = TRUE}, a list containing the global +#' \item{\code{n_predictions}: the total number of observations predicted.} +#' \item{\code{gh}: if \code{gh = TRUE}, a list containing the global #' Mahalanobis distance values for the observations in \code{Xr} and \code{Xu} #' as well as the results of the global pls projection object used to obtain #' the GH values.} -#' \item{\code{validation_results}:}{ a list of validation results for +#' \item{\code{validation_results}: a list of validation results for #' "local cross validation" (returned if the \code{validation_type} in #' \code{control} list was set to \code{"local_cv"}), #' "nearest neighbor validation" (returned if the \code{validation_type} #' in \code{control} list was set to \code{"NNv"}) and #' "Yu prediction statistics" (returned if \code{Yu} was supplied).}`` -#' \item{\code{results}:}{ a list of data tables containing the results of the +#' \item{\code{results}: a list of data tables containing the results of the #' predictions for each either \code{k} or \code{k_diss}. Each data table #' contains the following columns:} #' \itemize{ -#' \item{\code{o_index}:}{ The index of the predicted observation.} -#' \item{\code{k_diss}:}{ This column is only output if the \code{k_diss} +#' \item{\code{o_index}: The index of the predicted observation.} +#' \item{\code{k_diss}: This column is only output if the \code{k_diss} #' argument is used. It indicates the corresponding dissimilarity threshold #' for selecting the neighbors.} -#' \item{\code{k_original}:}{ This column is only output if the \code{k_diss} +#' \item{\code{k_original}: This column is only output if the \code{k_diss} #' argument is used. It indicates the number of neighbors that were originally #' found when the given dissimilarity threshold is used.} -#' \item{\code{k}:}{ This column indicates the final number of neighbors +#' \item{\code{k}: This column indicates the final number of neighbors #' used.} -#' \item{\code{npls}:}{ This column is only output if the \code{pls} +#' \item{\code{npls}: This column is only output if the \code{pls} #' regression method was used. It indicates the final number of pls #' components used.} -#' \item{\code{min_pls}:}{ This column is only output if \code{wapls} +#' \item{\code{min_pls}: This column is only output if \code{wapls} #' regression method was used. It indicates the final number of minimum pls #' components used. If no optimization was set, it retrieves the original #' minimum pls components passed to the \code{method} argument.} -#' \item{\code{max_pls}:}{ This column is only output if the \code{wapls} +#' \item{\code{max_pls}: This column is only output if the \code{wapls} #' regression method was used. It indicates the final number of maximum pls #' components used. If no optimization was set, it retrieves the original #' maximum pls components passed to the \code{method} argument.} -#' \item{\code{yu_obs}:}{ The input values given in \code{Yu} (the response +#' \item{\code{yu_obs}: The input values given in \code{Yu} (the response #' variable corresponding to the data to be predicted). If \code{Yu = NULL}, #' then \code{NA}s are retrieved.} -#' \item{\code{pred}:}{ The predicted Yu values.} -#' \item{\code{yr_min_obs}:}{ The minimum reference value (of the response +#' \item{\code{pred}: The predicted Yu values.} +#' \item{\code{yr_min_obs}: The minimum reference value (of the response #' variable) in the neighborhood.} -#' \item{\code{yr_max_obs}:}{ The maximum reference value (of the response +#' \item{\code{yr_max_obs}: The maximum reference value (of the response #' variable) in the neighborhood.} -#' \item{\code{index_nearest_in_Xr}}{ The index of the nearest neighbor found +#' \item{\code{index_nearest_in_Xr}: The index of the nearest neighbor found #' in \code{Xr}.} -#' \item{\code{index_farthest_in_Xr}}{ The index of the farthest neighbor +#' \item{\code{index_farthest_in_Xr}: The index of the farthest neighbor #' found in \code{Xr}.} -#' \item{\code{y_nearest}:}{ The reference value (\code{Yr}) corresponding to +#' \item{\code{y_nearest}: The reference value (\code{Yr}) corresponding to #' the nearest neighbor found in \code{Xr}.} -#' \item{\code{y_nearest_pred}:}{ This column is only output if the +#' \item{\code{y_nearest_pred}: This column is only output if the #' validation method in the object passed to \code{control} was set to #' \code{"NNv"}. It represents the predicted value of the nearest neighbor #' observation found in \code{Xr}. This prediction come from model fitted #' with the remaining observations in the neighborhood of the target #' observation in \code{Xu}.} -#' \item{\code{loc_rmse_cv}:}{ This column is only output if the validation +#' \item{\code{loc_rmse_cv}: This column is only output if the validation #' method in the object passed to \code{control} was set to #' \code{'local_cv'}. It represents the RMSE of the cross-validation #' computed for the neighborhood of the target observation in \code{Xu}.} -#' \item{\code{loc_st_rmse_cv}:}{ This column is only output if the +#' \item{\code{loc_st_rmse_cv}: This column is only output if the #' validation method in the object passed to \code{control} was set to #' \code{'local_cv'}. It represents the standardized RMSE of the #' cross-validation computed for the neighborhood of the target observation #' in \code{Xu}.} -#' \item{\code{dist_nearest}:}{ The distance to the nearest neighbor.} -#' \item{\code{dist_farthest}:}{ The distance to the farthest neighbor.} -#' \item{\code{loc_n_components}:}{ This column is only output if the +#' \item{\code{dist_nearest}: The distance to the nearest neighbor.} +#' \item{\code{dist_farthest}: The distance to the farthest neighbor.} +#' \item{\code{loc_n_components}: This column is only output if the #' dissimilarity method used is one of \code{"pca"}, \code{"pca.nipals"} or #' \code{"pls"} and in addition the dissimilarities are requested to be #' computed locally by passing \code{.local = TRUE} to the \code{mbl} #' function. #' See \code{.local} argument in the \code{\link{ortho_diss}} function.} #' } -#' \item{\code{seed}}{ a value mirroing the one passed to seed.} -#' \item{\code{documentation}:}{ a character string mirroring the one provided +#' \item{\code{seed}: a value mirroring the one passed to seed.} +#' \item{\code{documentation}: a character string mirroring the one provided #' in the \code{documentation} argument.} #' } #' When the \code{k_diss} argument is used, the printed results show a table diff --git a/R/mbl_control.R b/R/mbl_control.R index b562dce..a7642b8 100644 --- a/R/mbl_control.R +++ b/R/mbl_control.R @@ -53,7 +53,7 @@ #' The validation methods available for assessing the predictive performance of #' the memory-based learning method used are described as follows: #' \itemize{ -#' \item{Leave-nearest-neighbor-out cross-validation (\code{"NNv"}):}{ From +#' \item{Leave-nearest-neighbor-out cross-validation (\code{"NNv"}): From #' the group of neighbors of each observation to be predicted, the nearest observation #' (i.e. the most similar observation) is excluded and then a local model is fitted #' using the remaining neighbors. This model is then used to predict the value @@ -61,7 +61,7 @@ #' values are finally cross validated with the actual values (See Ramirez-Lopez #' et al. (2013a) for additional details). This method is faster than #' \code{"local_cv"}.} -#' \item{Local leave-group-out cross-validation (\code{"local_cv"}):}{ The +#' \item{Local leave-group-out cross-validation (\code{"local_cv"}): The #' group of neighbors of each observation to be predicted is partitioned into #' different equal size subsets. Each partition is selected based on a #' stratified random sampling which takes into account the values of the @@ -77,7 +77,7 @@ #' percentage of observations to be selected from the subset of nearest neighbours. #' The global error of the predictions is computed as the average of the local #' root mean square errors.} -#' \item{No validation (\code{"none"}):}{ No validation is carried out. +#' \item{No validation (\code{"none"}): No validation is carried out. #' If \code{"none"} is seleceted along with \code{"NNv"} and/or #' \code{"local_cv"}, then it will be ignored and the respective #' validation(s) will be carried out.} diff --git a/R/ortho_diss.R b/R/ortho_diss.R index 41d0903..1435c3a 100644 --- a/R/ortho_diss.R +++ b/R/ortho_diss.R @@ -45,7 +45,7 @@ #' components) and \code{value} (a numerical value that complements the selected #' method). The methods available are: #' \itemize{ -#' \item{\code{"opc"}:} { optimized principal component selection based on +#' \item{\code{"opc"}: optimized principal component selection based on #' Ramirez-Lopez et al. (2013a, 2013b). The optimal number of components #' (of a given set of observations) is the one for which its distance #' matrix minimizes the differences between the \code{Yr} value of each @@ -55,19 +55,19 @@ #' number of principal components to be tested. See the #' \code{\link{ortho_projection}} function for more details.} -#' \item{\code{"cumvar"}:}{ selection of the principal components based +#' \item{\code{"cumvar"}: selection of the principal components based #' on a given cumulative amount of explained variance. In this case, #' \code{value} must be a value (larger than 0 and below or equal to 1) #' indicating the minimum amount of cumulative variance that the #' combination of retained components should explain.} -#' \item{\code{"var"}:}{ selection of the principal components based +#' \item{\code{"var"}: selection of the principal components based #' on a given amount of explained variance. In this case, #' \code{value} must be a value (larger than 0 and below or equal to 1) #' indicating the minimum amount of variance that a single component #' should explain in order to be retained.} -#' \item{\code{"manual"}:}{ for manually specifying a fix number of +#' \item{\code{"manual"}: for manually specifying a fix number of #' principal components. In this case, \code{value} must be a value #' (larger than 0 and #' below the minimum dimension of \code{Xr} or \code{Xr} and \code{Xu} @@ -88,12 +88,12 @@ #' \code{method} argument in the \code{\link{ortho_projection}} function. #' Options are: #' \itemize{ -#' \item{\code{"pca"}}{: principal component analysis using the singular value +#' \item{\code{"pca"}: principal component analysis using the singular value #' decomposition algorithm)} -#' \item{\code{"pca.nipals"}}{: principal component analysis using +#' \item{\code{"pca.nipals"}: principal component analysis using #' the non-linear iterative partial least squares algorithm.} -#' \item{\code{"pls"}}{: partial least squares.} -#' \item{\code{"mpls"}}{: modified partial least squares (Shenk and Westerhaus, +#' \item{\code{"pls"}: partial least squares.} +#' \item{\code{"mpls"}: modified partial least squares (Shenk and Westerhaus, #' 1991 and Westerhaus, 2014).} #' } #' See the \code{\link{ortho_projection}} function for further details on the @@ -157,22 +157,22 @@ #' #' @return a \code{list} of class \code{ortho_diss} with the following elements: #' \itemize{ -#' \item{\code{n_components}}{ the number of components (either principal +#' \item{\code{n_components}: the number of components (either principal #' components or partial least squares components) used for computing the #' global dissimilarities.} -#' \item{\code{global_variance_info}}{ the information about the expalined +#' \item{\code{global_variance_info}: the information about the expalined #' variance(s) of the projection. When \code{.local = TRUE}, the information #' corresponds to the global projection done prior computing the local #' projections.} -#' \item{\code{local_n_components}}{ if \code{.local = TRUE}, a data.table +#' \item{\code{local_n_components}: if \code{.local = TRUE}, a data.table #' which specifies the number of local components (either principal components #' or partial least squares components) used for computing the dissimilarity #' between each target observation and its neighbor observations.} -#' \item{\code{dissimilarity}}{ the computed dissimilarity matrix. If +#' \item{\code{dissimilarity}: the computed dissimilarity matrix. If #' \code{.local = FALSE} a distance matrix. If \code{.local = TRUE} a matrix of #' class \code{local_ortho_diss}. In this case, each column represent the dissimilarity #' between a target observation and its neighbor observations.} -#' \item{\code{projection}}{if \code{return_projection = TRUE}, +#' \item{\code{projection}: if \code{return_projection = TRUE}, #' an \code{ortho_projection} object.} #' } #' @author \href{https://orcid.org/0000-0002-5369-5120}{Leonardo Ramirez-Lopez} diff --git a/R/ortho_diss_helpers.R b/R/ortho_diss_helpers.R index 92dd502..6fbceff 100644 --- a/R/ortho_diss_helpers.R +++ b/R/ortho_diss_helpers.R @@ -3,8 +3,7 @@ #' @param xu a second matrix #' @param y a matrix of side information #' @param kindx a matrix of nearest neighbor indices -#' @param remove NA indices from kindx (useful when working with dissimilarity -#' thresholds to select the neighbors (instead of fixed number of neighbors). +#' @param na_rm logical indicating whether NAs must be removed. #' @description internal #' @keywords internal ith_subsets_ortho_diss <- function(x, diff --git a/R/ortho_projection.R b/R/ortho_projection.R index fe5e764..1c3f112 100644 --- a/R/ortho_projection.R +++ b/R/ortho_projection.R @@ -42,12 +42,12 @@ #' that case, the kappa index is used. See \code{\link{sim_eval}} function for more details. #' @param method the method for projecting the data. Options are: #' \itemize{ -#' \item{\code{"pca"}:}{ principal component analysis using the singular value +#' \item{\code{"pca"}: principal component analysis using the singular value #' decomposition algorithm.} -#' \item{\code{"pca.nipals"}:}{ principal component analysis using the +#' \item{\code{"pca.nipals"}: principal component analysis using the #' non-linear iterative partial least squares algorithm.} -#' \item{\code{"pls"}:}{ partial least squares.} -#' \item{\code{"mpls"}:}{ modified partial least squares. See details.} +#' \item{\code{"pls"}: partial least squares.} +#' \item{\code{"mpls"}: modified partial least squares. See details.} #' } #' @param pc_selection a list of length 2 which specifies the method to be used #' for optimizing the number of components (principal components or pls factors) @@ -56,7 +56,7 @@ #' components) and \code{value} (a numerical value that complements the selected #' method). The methods available are: #' \itemize{ -#' \item{\code{"opc"}:} { optimized principal component selection based on +#' \item{\code{"opc"}: optimized principal component selection based on #' Ramirez-Lopez et al. (2013a, 2013b). The optimal number of components #' of a given set of observations is the one for which its distance matrix #' minimizes the differences between the \code{Yr} value of each @@ -65,19 +65,19 @@ #' below \code{min(nrow(Xr)} \code{+ nrow(Xu),} \code{ncol(Xr))} indicating #' the maximum number of principal components to be tested. See details.} -#' \item{\code{"cumvar"}:}{ selection of the principal components based +#' \item{\code{"cumvar"}: selection of the principal components based #' on a given cumulative amount of explained variance. In this case, #' \code{value} must be a value (larger than 0 and below or equal to 1) #' indicating the minimum amount of cumulative variance that the #' combination of retained components should explain.} -#' \item{\code{"var"}:}{ selection of the principal components based +#' \item{\code{"var"}: selection of the principal components based #' on a given amount of explained variance. In this case, #' \code{value} must be a value (larger than 0 and below or equal to 1) #' indicating the minimum amount of variance that a single component should #' explain in order to be retained.} -#' \item{\code{"manual"}:}{ for manually specifying a fix number of +#' \item{\code{"manual"}: for manually specifying a fix number of #' principal components. In this case, \code{value} must be a value #' (larger than 0 and #' below the minimum dimension of \code{Xr} or \code{Xr} and \code{Xu} @@ -162,22 +162,22 @@ #' a \code{list} of class \code{ortho_projection} with the following #' components: #' \itemize{ -#' \item{\code{scores}}{ a matrix of scores corresponding to the observations in +#' \item{\code{scores}: a matrix of scores corresponding to the observations in #' \code{Xr} (and \code{Xu} if it was provided). The components retrieved #' correspond to the ones optimized or specified.} -#' \item{\code{X_loadings}}{ a matrix of loadings corresponding to the +#' \item{\code{X_loadings}: a matrix of loadings corresponding to the #' explanatory variables. The components retrieved correspond to the ones #' optimized or specified.} -#' \item{\code{Y_loadings}}{ a matrix of partial least squares loadings +#' \item{\code{Y_loadings}: a matrix of partial least squares loadings #' corresponding to \code{Yr}. The components retrieved correspond to the #' ones optimized or specified. #' This object is only returned if the partial least squares algorithm was used.} -#' \item{\code{weigths}}{ a matrix of partial least squares ("pls") weights. +#' \item{\code{weigths}: a matrix of partial least squares ("pls") weights. #' This object is only returned if the "pls" algorithm was used.} -#' \item{\code{projection_mat}}{ a matrix that can be used to project new data +#' \item{\code{projection_mat}: a matrix that can be used to project new data #' onto a "pls" space. This object is only returned if the "pls" algorithm was #' used.} -#' \item{\code{variance}}{ a list with information on the original variance and +#' \item{\code{variance}: a list with information on the original variance and #' the explained variances. This list contains a matrix indicating the amount of #' variance explained by each component (var), the ratio between explained #' variance by each single component and the original variance (explained_var) and @@ -191,12 +191,12 @@ #' component method is used, the this data is computed on the basis of #' \code{Xr} and \code{Xu} (if it applies) since both matrices are employed in #' the computation of the projection matrix (loadings in this case)}. -#' \item{\code{sdv}}{ the standard deviation of the retrieved scores. This vector +#' \item{\code{sdv}: the standard deviation of the retrieved scores. This vector #' can be different from the "sd" in \code{variance}.} -#' \item{\code{n_components}}{ the number of components (either principal +#' \item{\code{n_components}: the number of components (either principal #' components or partial least squares components) used for computing the #' global dissimilarity scores.} -#' \item{\code{opc_evaluation}}{ a matrix containing the statistics computed +#' \item{\code{opc_evaluation}: a matrix containing the statistics computed #' for optimizing the number of principal components based on the variable(s) #' specified in the \code{Yr} argument. If \code{Yr} was a continuous was a #' continuous vector or matrix then this object indicates the root mean square @@ -205,7 +205,7 @@ #' of components. This object is returned only if \code{"opc"} was used within #' the \code{pc_selection} argument. See the \code{\link{sim_eval}} function for #' more details.} -#' \item{\code{method}}{ the \code{ortho_projection} method used.} +#' \item{\code{method}: the \code{ortho_projection} method used.} #' } #' \code{predict.ortho_projection}, returns a matrix of scores proprojected for #' \code{newdtata}. @@ -867,7 +867,7 @@ predict.ortho_projection <- function(object, newdata, ...) { Xscale = object$scale ) - colnames(predpoj) <- paste0("pls", 1:ncol(predpoj)) + colnames(predpoj) <- paste0("pls_", 1:ncol(predpoj)) rownames(predpoj) <- rownames(newdata) return(predpoj) diff --git a/R/resemble.R b/R/resemble.R index 7413de1..23dacb2 100644 --- a/R/resemble.R +++ b/R/resemble.R @@ -66,7 +66,6 @@ #' \item{\code{\link{plot.mbl}}} #' \item{\code{\link{plot.ortho_projection}}} #' } -#' @docType package #' @name resemble-package #' @aliases resemble-package resemble #' @title Overview of the functions in the resemble package @@ -104,7 +103,7 @@ #' } ###################################################################### # resemble -# Copyright (C) 2022 Leonardo Ramirez-Lopez +# Copyright (C) 2024 Leonardo Ramirez-Lopez # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -116,4 +115,6 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. ###################################################################### +"_PACKAGE" NULL + diff --git a/R/sample_stratified.R b/R/sample_stratified.R index 5196de2..79a8151 100644 --- a/R/sample_stratified.R +++ b/R/sample_stratified.R @@ -363,7 +363,7 @@ optim_sample_strata <- function(y, n) { #' @description for internal use only! This function selects samples #' based on provided strata. #' @param original_order a matrix of one column with the response variable. -#' @param starta the number of strata. +#' @param strata the number of strata. #' @param sampling_for sampling to select the calibration samples ("calibration") #' or sampling to select the validation samples ("validation"). #' @param replacement logical indicating if sampling with replacement must be diff --git a/R/search_neighbors.R b/R/search_neighbors.R index 3d2a1ae..ff050a2 100644 --- a/R/search_neighbors.R +++ b/R/search_neighbors.R @@ -21,40 +21,40 @@ #' @param diss_method a character string indicating the spectral dissimilarity metric #' to be used in the selection of the nearest neighbors of each observation. #' \itemize{ -#' \item{\code{"pca"}:}{ Mahalanobis distance +#' \item{\code{"pca"}: Mahalanobis distance #' computed on the matrix of scores of a Principal Component (PC) #' projection of \code{Xr} (and \code{Xu} if supplied). #' PC projection is done using the singular value decomposition (SVD) #' algorithm. See \code{\link{ortho_diss}} function.} -#' \item{\code{"pca.nipals"}}{ Mahalanobis distance +#' \item{\code{"pca.nipals"}: Mahalanobis distance #' computed on the matrix of scores of a Principal Component (PC) #' projection of \code{Xr} (and \code{Xu} if supplied). #' PC projection is done using the #' non-linear iterative partial least squares (niapls) algorithm. #' See \code{\link{ortho_diss}} function.} -#' \item{\code{"pls"}}{ Mahalanobis distance +#' \item{\code{"pls"}: Mahalanobis distance #' computed on the matrix of scores of a partial least squares projection #' of \code{Xr} (and \code{Xu} if supplied). In this case, \code{Yr} #' is always required. See \code{\link{ortho_diss}} function.} -#' \item{\code{"mpls"}}:{ Mahalanobis distance +#' \item{\code{"mpls"}: Mahalanobis distance #' computed on the matrix of scores of a modified partial least squares #' projection (Shenk and Westerhaus, 1991; Westerhaus, 2014) #' of \code{Xr} (and \code{Xu} if provided). In this case, \code{Yr} is #' always required. See \code{\link{ortho_diss}} function.} -#' \item{\code{"cor"}}{ correlation coefficient +#' \item{\code{"cor"}: correlation coefficient #' between observations. See \code{\link{cor_diss}} function.} -#' \item{\code{"euclid"}}{ Euclidean distance +#' \item{\code{"euclid"}: Euclidean distance #' between observations. See \code{\link{f_diss}} function.} -#' \item{\code{"cosine"}}{ Cosine distance +#' \item{\code{"cosine"}: Cosine distance #' between observations. See \code{\link{f_diss}} function.} -#' \item{\code{"sid"}}{ spectral information divergence between observations. +#' \item{\code{"sid"}: spectral information divergence between observations. #' See \code{\link{sid}} function.} #' } #' @param Yr a numeric matrix of `n` observations used as side information of @@ -89,7 +89,7 @@ #' components) and \code{value} (a numerical value that complements the selected #' method). The methods available are: #' \itemize{ -#' \item{\code{"opc"}:} { optimized principal component selection based on +#' \item{\code{"opc"}: optimized principal component selection based on #' Ramirez-Lopez et al. (2013a, 2013b). The optimal number of components #' (of set of observations) is the one for which its distance matrix #' minimizes the differences between the \code{Yr} value of each @@ -99,19 +99,19 @@ #' indicating the maximum number of principal components to be tested. #' See the \code{\link{ortho_projection}} function for more details.} -#' \item{\code{"cumvar"}:}{ selection of the principal components based +#' \item{\code{"cumvar"}: selection of the principal components based #' on a given cumulative amount of explained variance. In this case, #' \code{value} must be a value (larger than 0 and below or equal to 1) #' indicating the minimum amount of cumulative variance that the #' combination of retained components should explain.} -#' \item{\code{"var"}:}{ selection of the principal components based +#' \item{\code{"var"}: selection of the principal components based #' on a given amount of explained variance. In this case, #' \code{value} must be a value (larger than 0 and below or equal to 1) #' indicating the minimum amount of variance that a single component #' should explain in order to be retained.} -#' \item{\code{"manual"}:}{ for manually specifying a fix number of +#' \item{\code{"manual"}: for manually specifying a fix number of #' principal components. In this case, \code{value} must be a value #' (larger than 0 and below the #' minimum dimension of \code{Xr} or \code{Xr} and \code{Xu} combined) @@ -169,21 +169,21 @@ #' those functions as additional arguments (i.e. \code{...}). #' @return a \code{list} containing the following elements: #' \itemize{ -#' \item{\code{neighbors_diss}}{ a matrix of the \code{Xr} dissimilarity scores +#' \item{\code{neighbors_diss}: a matrix of the \code{Xr} dissimilarity scores #' corresponding to the neighbors of each \code{Xr} observation (or \code{Xu} #' observation, in case \code{Xu} was supplied). #' The neighbor dissimilarity scores are organized by columns and are sorted #' in ascending order.} -#' \item{\code{neighbors}}{ a matrix of the \code{Xr} indices corresponding to +#' \item{\code{neighbors}: a matrix of the \code{Xr} indices corresponding to #' the neighbors of each observation in \code{Xu}. The neighbor indices are #' organized by columns and are sorted in ascending order by their #' dissimilarity score.} -#' \item{\code{unique_neighbors}}{ a vector of the indices in \code{Xr} +#' \item{\code{unique_neighbors}: a vector of the indices in \code{Xr} #' identified as neighbors of any observation in \code{Xr} (or in \code{Xu}, #' in case it was supplied). This is obtained by #' converting the \code{neighbors} matrix into a vector and applying the #' \code{\link[base]{unique}} function.} -#' \item{\code{k_diss_info}}{ a \code{data.table} that is returned only if the +#' \item{\code{k_diss_info}: a \code{data.table} that is returned only if the #' \code{k_diss} argument was used. It comprises three columns, the first one #' (\code{Xr_index} or \code{Xu_index}) indicates the index of the observations #' in \code{Xr} (or in \code{Xu}, in case it was suppplied), @@ -191,10 +191,10 @@ #' \code{Xr} and the third column (\code{final_n_k}) indicates the final number #' of neighbors selected bounded by \code{k_range}. #' argument.} -#' \item{\code{dissimilarity}}{ If \code{return_dissimilarity = TRUE} the +#' \item{\code{dissimilarity}: If \code{return_dissimilarity = TRUE} the #' dissimilarity object used (as computed by the \code{\link{dissimilarity}} #' function.} -#' \item{\code{projection}}{ an \code{ortho_projection} object. Only output if +#' \item{\code{projection}: an \code{ortho_projection} object. Only output if #' \code{return_projection = TRUE} and if \code{diss_method = "pca"}, #' \code{diss_method = "pca.nipals"} or \code{diss_method = "pls"}. \cr #' This object contains the projection used to compute diff --git a/R/sid.R b/R/sid.R index 2a0e51e..3086d26 100644 --- a/R/sid.R +++ b/R/sid.R @@ -108,19 +108,19 @@ #' will be possible. #' @return a \code{list} with the following components: #' \itemize{ -#' \item{\code{sid}}{ if only \code{"X"} is specified (i.e. \code{Xu = NULL}), +#' \item{\code{sid}: if only \code{"X"} is specified (i.e. \code{Xu = NULL}), #' a square symmetric matrix of SID distances between all the components in #' \code{"X"}. If both \code{"X"} and \code{"Xu"} are specified, a matrix #' of SID distances between the components in \code{"X"} and the components #' in \code{"Xu"}) where the rows represent the objects in \code{"X"} and the #' columns represent the objects in \code{"Xu"}} -#' \item{\code{Xr}}{ the (centered and/or scaled if specified) spectral +#' \item{\code{Xr}: the (centered and/or scaled if specified) spectral #' \code{X} matrix} -#' \item{\code{Xu}}{ the (centered and/or scaled if specified) spectral +#' \item{\code{Xu}: the (centered and/or scaled if specified) spectral #' \code{Xu} matrix} -#' \item{\code{densityDisXr}}{ if \code{mode = "density"}, the computed +#' \item{\code{densityDisXr}: if \code{mode = "density"}, the computed #' density distributions of \code{Xr}} -#' \item{\code{densityDisXu}}{ if \code{mode = "density"}, the computed +#' \item{\code{densityDisXu}: if \code{mode = "density"}, the computed #' density distributions of \code{Xu}} #' } #' @references Chang, C.I. 2000. An information theoretic-based approach to diff --git a/R/sim_eval.R b/R/sim_eval.R index 27d9f1e..b856325 100644 --- a/R/sim_eval.R +++ b/R/sim_eval.R @@ -63,9 +63,9 @@ #' #' @return \code{sim_eval} returns a list with the following components: #' \itemize{ -#' \item{"\code{eval}}{ either the RMSD (and the correlation coefficient) or +#' \item{"\code{eval}: either the RMSD (and the correlation coefficient) or #' the kappa index} -#' \item{\code{first_nn}}{ a matrix containing the original side +#' \item{\code{first_nn}: a matrix containing the original side #' informative variable in the first half of the columns, and the side #' informative values of the corresponding nearest neighbors in the second half #' of the columns.} diff --git a/README.Rmd b/README.Rmd index 2a34072..45a9693 100644 --- a/README.Rmd +++ b/README.Rmd @@ -1,7 +1,7 @@ --- title: "README" output: md_document -date: "2023-04-19" +date: "2024-02-15" --- diff --git a/README.md b/README.md index 891f02d..9d9016f 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,9 @@ -*Last update: 2023-04-20* +*Last update: 2024-02-16* -Version: 2.2.2 – Sky +Version: 2.2.3 – embryo

diff --git a/man/dissimilarity.Rd b/man/dissimilarity.Rd index 7498ccb..1784007 100644 --- a/man/dissimilarity.Rd +++ b/man/dissimilarity.Rd @@ -22,32 +22,32 @@ with \code{p} variables/columns.} \item{diss_method}{a character string indicating the method to be used to compute the dissimilarities between observations. Options are: \itemize{ -\item{\code{"pca"}:}{ Mahalanobis distance +\item{\code{"pca"}: Mahalanobis distance computed on the matrix of scores of a Principal Component (PC) projection of \code{Xr} (and \code{Xu} if provided). PC projection is done using the singular value decomposition (SVD) algorithm. See \code{\link{ortho_diss}} function.} -\item{\code{"pca.nipals"}:}{ Mahalanobis distance +\item{\code{"pca.nipals"}: Mahalanobis distance computed on the matrix of scores of a Principal Component (PC) projection of \code{Xr} (and \code{Xu} if provided). PC projection is done using the non-linear iterative partial least squares (nipals) algorithm. See \code{\link{ortho_diss}} function.} -\item{\code{"pls"}}:{ Mahalanobis distance +\item{\code{"pls"}: Mahalanobis distance computed on the matrix of scores of a partial least squares projection of \code{Xr} (and \code{Xu} if provided). In this case, \code{Yr} is always required. See \code{\link{ortho_diss}} function.} -\item{\code{"mpls"}}:{ Mahalanobis distance +\item{\code{"mpls"}: Mahalanobis distance computed on the matrix of scores of a modified partial least squares projection (Shenk and Westerhaus, 1991; Westerhaus, 2014) of \code{Xr} (and \code{Xu} if provided). In this case, \code{Yr} is always required. See \code{\link{ortho_diss}} function.} -\item{\code{"cor"}:}{ based on the correlation coefficient +\item{\code{"cor"}: based on the correlation coefficient between observations. See \code{\link{cor_diss}} function.} -\item{\code{"euclid"}:}{ Euclidean distance +\item{\code{"euclid"}: Euclidean distance between observations. See \code{\link{f_diss}} function.} -\item{\code{"cosine"}:}{ Cosine distance +\item{\code{"cosine"}: Cosine distance between observations. See \code{\link{f_diss}} function.} -\item{\code{"sid"}:}{ spectral information divergence between +\item{\code{"sid"}: spectral information divergence between observations. See \code{\link{sid}} function.} }} @@ -75,7 +75,7 @@ to be retained. This list must contain two elements in the following order: components) and \code{value} (a numerical value that complements the selected method). The methods available are: \itemize{ -\item{\code{"opc"}:} { optimized principal component selection based on +\item{\code{"opc"}: optimized principal component selection based on Ramirez-Lopez et al. (2013a, 2013b). The optimal number of components (of set of observations) is the one for which its distance matrix minimizes the differences between the \code{Yr} value of each @@ -85,17 +85,17 @@ below the minimum dimension of \code{Xr} or \code{Xr} and \code{Xu} combined) indicating the maximum number of principal components to be tested. See the \code{\link{ortho_projection}} function for more details.} -\item{\code{"cumvar"}:}{ selection of the principal components based +\item{\code{"cumvar"}: selection of the principal components based on a given cumulative amount of explained variance. In this case, \code{value} must be a value (larger than 0 and below or equal to 1) indicating the minimum amount of cumulative variance that the combination of retained components should explain.} -\item{\code{"var"}:}{ selection of the principal components based +\item{\code{"var"}: selection of the principal components based on a given amount of explained variance. In this case, \code{value} must be a value (larger than 0 and below or equal to 1) indicating the minimum amount of variance that a single component should explain in order to be retained.} -\item{\code{"manual"}:}{ for manually specifying a fix number of +\item{\code{"manual"}: for manually specifying a fix number of principal components. In this case, \code{value} must be a value (larger than 0 and below the minimum dimension of \code{Xr} or \code{Xr} and \code{Xu} @@ -150,8 +150,8 @@ argument.} \value{ A list with the following components: \itemize{ -\item{\code{dissimilarity}:}{ the resulting dissimilarity matrix.} -\item{\code{projection}:}{ an \code{ortho_projection} object. Only output +\item{\code{dissimilarity}: the resulting dissimilarity matrix.} +\item{\code{projection}: an \code{ortho_projection} object. Only output if \code{return_projection = TRUE} and if \code{diss_method = "pca"}, \code{diss_method = "pca.nipals"}, \code{diss_method = "pls"} or \code{diss_method = "mpls"}. @@ -160,7 +160,7 @@ the dissimilarity matrix. In case of local dissimilarity matrices, the projection corresponds to the global projection used to select the neighborhoods (see \code{\link{ortho_diss}} function for further details).} -\item{\code{gh}:}{ a list containing the GH distances as well as the +\item{\code{gh}: a list containing the GH distances as well as the pls projection used to compute the GH.} } } diff --git a/man/gaussian_process.Rd b/man/gaussian_process.Rd index 68f18fc..37041b6 100644 --- a/man/gaussian_process.Rd +++ b/man/gaussian_process.Rd @@ -19,14 +19,14 @@ and the response variable must be scaled to zero mean and unit variance.} \value{ a list containing the following elements: \itemize{ -\item{\code{b}}{ the regression coefficients.} -\item{\code{Xz}}{ the (final transformed) matrix of predictor variables.} -\item{\code{alpha}}{ the alpha matrix.} -\item{\code{is.scaled}}{ logical indicating whether both the predictors and response variable were scaled to zero mean and unit variance.} -\item{\code{Xcenter}}{ if matrix of predictors was scaled, the centering vector used for \code{X}.} -\item{\code{Xscale}}{ if matrix of predictors was scaled, the scaling vector used for \code{X}.} -\item{\code{Ycenter}}{ if matrix of predictors was scaled, the centering vector used for \code{Y}.} -\item{\code{Yscale}}{ if matrix of predictors was scaled, the scaling vector used for \code{Y}.} +\item{\code{b}: the regression coefficients.} +\item{\code{Xz}: the (final transformed) matrix of predictor variables.} +\item{\code{alpha}: the alpha matrix.} +\item{\code{is.scaled}: logical indicating whether both the predictors and response variable were scaled to zero mean and unit variance.} +\item{\code{Xcenter}: if matrix of predictors was scaled, the centering vector used for \code{X}.} +\item{\code{Xscale}: if matrix of predictors was scaled, the scaling vector used for \code{X}.} +\item{\code{Ycenter}: if matrix of predictors was scaled, the centering vector used for \code{Y}.} +\item{\code{Yscale}: if matrix of predictors was scaled, the scaling vector used for \code{Y}.} } } \description{ diff --git a/man/gaussian_process_cv.Rd b/man/gaussian_process_cv.Rd index 91a335b..e361be2 100644 --- a/man/gaussian_process_cv.Rd +++ b/man/gaussian_process_cv.Rd @@ -27,15 +27,13 @@ and the response variable must be scaled to zero mean and unit variance.} \item{statistics}{a logical value indicating whether the precision and accuracy statistics are to be returned, otherwise the predictions for each validation segment are retrieved.} - -\item{ncomp}{an integer indicating the number of pls components.} } \value{ a list containing the following one-row matrices: \itemize{ -\item{\code{rmse.seg}}{ the RMSEs.} -\item{\code{st.rmse.seg}}{ the standardized RMSEs.} -\item{\code{rsq.seg}}{ the coefficients of determination.} +\item{\code{rmse.seg}: the RMSEs.} +\item{\code{st.rmse.seg}: the standardized RMSEs.} +\item{\code{rsq.seg}: the coefficients of determination.} } } \description{ diff --git a/man/get_ith_local_neighbors.Rd b/man/get_ith_local_neighbors.Rd index 3218470..b5b0dc2 100644 --- a/man/get_ith_local_neighbors.Rd +++ b/man/get_ith_local_neighbors.Rd @@ -64,19 +64,19 @@ at the top of \code{neighbor_indices}.} } \value{ a list: -itemize{ -\item{ith_xr:}{ the new Xr data of the neighbors for the ith observation (if +\itemize{ +\item{ith_xr: the new Xr data of the neighbors for the ith observation (if \code{diss_usage = "predictors"}, this data is combined with the local dissmilarity scores of the neighbors of Xu)} -\item{ith_yr:}{ the new Yr data of the neighbors for the ith observation} -\item{ith_xu:}{ the ith Xu observation (if \code{diss_usage = "predictors"}, +\item{ith_yr: the new Yr data of the neighbors for the ith observation} +\item{ith_xu: the ith Xu observation (if \code{diss_usage = "predictors"}, this data is combined with the local dissmilarity scores to its Xr neighbors} -\item{ith_yu:}{ the ith Yu observation} -\item{ith_neigh_diss:}{ the new dissimilarity scores of the neighbors for the ith +\item{ith_yu: the ith Yu observation} +\item{ith_neigh_diss: the new dissimilarity scores of the neighbors for the ith observation} -\item{ith_group:}{ the group labels for the new ith_xr} -\item{n_k:}{ the number of neighbors} -\item{ith_components:}{ the number of components used} +\item{ith_group: the group labels for the new ith_xr} +\item{n_k: the number of neighbors} +\item{ith_components: the number of components used} } } \description{ diff --git a/man/get_samples_from_strata.Rd b/man/get_samples_from_strata.Rd index 64f1f49..f95136f 100644 --- a/man/get_samples_from_strata.Rd +++ b/man/get_samples_from_strata.Rd @@ -16,13 +16,13 @@ get_samples_from_strata( \arguments{ \item{original_order}{a matrix of one column with the response variable.} +\item{strata}{the number of strata.} + \item{sampling_for}{sampling to select the calibration samples ("calibration") or sampling to select the validation samples ("validation").} \item{replacement}{logical indicating if sampling with replacement must be done.} - -\item{starta}{the number of strata.} } \value{ a list with the indices of the calibration and validation samples. diff --git a/man/ith_mbl_neighbor.Rd b/man/ith_mbl_neighbor.Rd index 3cb9119..779f5ab 100644 --- a/man/ith_mbl_neighbor.Rd +++ b/man/ith_mbl_neighbor.Rd @@ -38,23 +38,23 @@ of every Xu found in Xr. This matrix is organized in the same way as \item{diss_xr_xr}{a dissimilarity matrix between sampes in Xr.} -\item{group}{a factor representing the group labes of Xr.} +\item{group}{a factor representing the group labels of Xr.} } \value{ an object of \code{class} iterator giving the following list: -itemize{ -\item{ith_xr:}{ the Xr data of the neighbors for the ith observation (if +\itemize{ +\item{ith_xr: the Xr data of the neighbors for the ith observation (if \code{diss_usage = "predictors"}, this data is combined with the local dissmilarity scores of the neighbors of Xu (or Xr if Xu was not provided))} -\item{ith_yr:}{ the Yr data of the neighbors for the ith observation} -\item{ith_xu:}{ the ith Xu observation (or Xr if Xu was not provided). +\item{ith_yr: the Yr data of the neighbors for the ith observation} +\item{ith_xu: the ith Xu observation (or Xr if Xu was not provided). If \code{diss_usage = "predictors"}, this data is combined with the local dissmilarity scores to its Xr neighbors.} -\item{ith_yu:}{ the ith Yu observation (or Yr observation if Xu was not provided).} -\item{ith_neigh_diss:}{ the dissimilarity scores of the neighbors for the ith +\item{ith_yu: the ith Yu observation (or Yr observation if Xu was not provided).} +\item{ith_neigh_diss: the dissimilarity scores of the neighbors for the ith observation.} -\item{ith_group:}{ the group labels for ith_xr.} -\item{n_k:}{ the number of neighbors.} +\item{ith_group: the group labels for ith_xr.} +\item{n_k: the number of neighbors.} } } \description{ diff --git a/man/ith_subsets_ortho_diss.Rd b/man/ith_subsets_ortho_diss.Rd index ad3c3a5..aa31027 100644 --- a/man/ith_subsets_ortho_diss.Rd +++ b/man/ith_subsets_ortho_diss.Rd @@ -15,8 +15,7 @@ ith_subsets_ortho_diss(x, xu = NULL, y, kindx, na_rm = FALSE) \item{kindx}{a matrix of nearest neighbor indices} -\item{remove}{NA indices from kindx (useful when working with dissimilarity -thresholds to select the neighbors (instead of fixed number of neighbors).} +\item{na_rm}{logical indicating whether NAs must be removed.} } \description{ internal diff --git a/man/local_fit.Rd b/man/local_fit.Rd index 2ea1286..d4e3e7e 100644 --- a/man/local_fit.Rd +++ b/man/local_fit.Rd @@ -55,11 +55,11 @@ the regression models within the \code{\link{mbl}} function. There are three possible options for performing these regressions: \itemize{ -\item{Partial least squares (pls, \code{local_fit_pls}):}{ It uses the +\item{Partial least squares (pls, \code{local_fit_pls}): It uses the orthogonal scores (non-linear iterative partial least squares, nipals) algorithm. The only parameter which needs to be optimized is the number of pls components.} -\item{Weighted average pls (\code{local_fit_wapls}):}{ This method was +\item{Weighted average pls (\code{local_fit_wapls}): This method was developed by Shenk et al. (1997) and it used as the regression method in the widely known LOCAL algorithm. It uses multiple models generated by multiple pls components (i.e. between a minimum and a maximum number of pls @@ -75,28 +75,27 @@ when a total of \mjeqn{j}{j} pls components are used and \mjeqn{g_{j}}{g_{j}} is the root mean square of the squared regression coefficients corresponding to the \mjeqn{j}{j}th pls component (see Shenk et al., 1997 for more details).} -\item{Gaussian process with dot product covariance (\code{local_fit_gpr):}{ - Gaussian process regression is a probabilistic and non-parametric Bayesian - method. It is commonly described as a collection of random variables which - have a joint Gaussian distribution and it is characterized by both a mean - and a covariance function (Rasmussen and Williams, 2006). The covariance - function used in the implemented method is the dot product. The only - parameter to be taken into account in this method is the noise. In this - method, the process for predicting the response variable of a new sample - (\mjeqn{y_{u}}{y_{u}}) from its predictor variables - (\mjeqn{x_{u}}{x_{u}}) is carried out first by computing a prediction - vector (\mjeqn{A}{A}). It is derived from a reference/training observations - congaing both a response vector (\mjeqn{Y}{Y}) and predictors (\mjeqn{X}{X}) as follows: - - \mjdeqn{A = (X X^{T} + \sigma^2 I)^{-1} Y}{A = (X X^T + sigma^2 I)^{-1} Y} - - where \mjeqn{\sigma^2}{sigma^2} denotes the variance of the noise and \mjeqn{I}{I} the - identity matrix (with dimensions equal to the number of observations in - \mjeqn{X}{X}). The prediction of \mjeqn{y_{u}}{y_u} is then done as follows: - - \mjdeqn{\hat{y}_{u} = (x_{u}x_{u}^{T}) A}{hat y_{u} = (x_{u} x_{u}^T) A} - - } +\item{Gaussian process with dot product covariance (\code{local_fit_gpr}): +Gaussian process regression is a probabilistic and non-parametric Bayesian +method. It is commonly described as a collection of random variables which +have a joint Gaussian distribution and it is characterized by both a mean +and a covariance function (Rasmussen and Williams, 2006). The covariance +function used in the implemented method is the dot product. The only +parameter to be taken into account in this method is the noise. In this +method, the process for predicting the response variable of a new sample +(\mjeqn{y_u}{y_u}) from its predictor variables +(\mjeqn{x_u}{x_u}) is carried out first by computing a prediction +vector (\mjeqn{A}{A}). It is derived from a reference/training observations +congaing both a response vector (\mjeqn{Y}{Y}) and predictors (\mjeqn{X}{X}) as follows: + +\mjdeqn{A = (X X^{T} + \sigma^2 I)^{-1} Y}{A = (X X^T + sigma^2 I)^{-1} Y} + +where \mjeqn{\sigma^2}{sigma^2} denotes the variance of the noise and \mjeqn{I}{I} the +identity matrix (with dimensions equal to the number of observations in +\mjeqn{X}{X}). The prediction of \mjeqn{y_{u}}{y_u} is then done as follows: + +\mjdeqn{\hat{y}_{u} = (x_{u}x_{u}^{T}) A}{hat y_{u} = (x_{u} x_{u}^T) A} + } } diff --git a/man/mbl.Rd b/man/mbl.Rd index 6e88f8b..72dc4ed 100644 --- a/man/mbl.Rd +++ b/man/mbl.Rd @@ -60,27 +60,27 @@ parameters affecting this regression. See \code{\link{local_fit}} function.} metric to be used in the selection of the nearest neighbors of each observation. Options are: \itemize{ -\item{\code{"pca"} (Default):}{ Mahalanobis distance +\item{\code{"pca"} (Default): Mahalanobis distance computed on the matrix of scores of a Principal Component (PC) projection of \code{Xr} and \code{Xu}. PC projection is done using the singular value decomposition (SVD) algorithm. See \code{\link{ortho_diss}} function.} -\item{\code{"pca.nipals"}}{ Mahalanobis distance +\item{\code{"pca.nipals"}: Mahalanobis distance computed on the matrix of scores of a Principal Component (PC) projection of \code{Xr} and \code{Xu}. PC projection is done using the non-linear iterative partial least squares (nipals) algorithm. See \code{\link{ortho_diss}} function.} -\item{\code{"pls"}}{ Mahalanobis distance +\item{\code{"pls"}: Mahalanobis distance computed on the matrix of scores of a partial least squares projection of \code{Xr} and \code{Xu}. In this case, \code{Yr} is always required. See \code{\link{ortho_diss}} function.} -\item{\code{"cor"}}{ correlation coefficient +\item{\code{"cor"}: correlation coefficient between observations. See \code{\link{cor_diss}} function.} -\item{\code{"euclid"}}{ Euclidean distance +\item{\code{"euclid"}: Euclidean distance between observations. See \code{\link{f_diss}} function.} -\item{\code{"cosine"}}{ Cosine distance +\item{\code{"cosine"}: Cosine distance between observations. See \code{\link{f_diss}} function.} -\item{\code{"sid"}}{ spectral information divergence between +\item{\code{"sid"}: spectral information divergence between observations. See \code{\link{sid}} function.} } Alternatively, a matrix of dissimilarities can also be passed to this @@ -119,7 +119,7 @@ This list must contain two elements in the following order: components) and \code{value} (a numerical value that complements the selected method). The methods available are: \itemize{ -\item{\code{"opc"}:} { optimized principal component selection based +\item{\code{"opc"}: optimized principal component selection based on Ramirez-Lopez et al. (2013a, 2013b). The optimal number of components (of set of observations) is the one for which its distance matrix minimizes the differences between the \code{Yr} value of each @@ -129,17 +129,17 @@ below the minimum dimension of \code{Xr} or \code{Xr} and \code{Xu} combined) indicating the maximum number of principal components to be tested. See the \code{\link{ortho_projection}} function for more details.} -\item{\code{"cumvar"}:}{ selection of the principal components based +\item{\code{"cumvar"}: selection of the principal components based on a given cumulative amount of explained variance. In this case, \code{value} must be a value (larger than 0 and below or equal to 1) indicating the minimum amount of cumulative variance that the combination of retained components should explain.} -\item{\code{"var"}:}{ selection of the principal components based +\item{\code{"var"}: selection of the principal components based on a given amount of explained variance. In this case, \code{value} must be a value (larger than 0 and below or equal to 1) indicating the minimum amount of variance that a single component should explain in order to be retained.} -\item{\code{"manual"}:}{ for manually specifying a fix number of +\item{\code{"manual"}: for manually specifying a fix number of principal components. In this case, \code{value} must be a value (larger than 0 and below the minimum dimension of \code{Xr} or \code{Xr} and \code{Xu} combined). @@ -204,93 +204,93 @@ a \code{list} of class \code{mbl} with the following components (sorted either by \code{k} or \code{k_diss}): \itemize{ -\item{\code{call}:}{ the call to mbl.} -\item{\code{cntrl_param}:}{ the list with the control parameters passed to +\item{\code{call}: the call to mbl.} +\item{\code{cntrl_param}: the list with the control parameters passed to control.} -\item{\code{Xu_neighbors}:}{ a list containing two elements: a matrix of +\item{\code{Xu_neighbors}: a list containing two elements: a matrix of \code{Xr} indices corresponding to the neighbors of \code{Xu} and a matrix of dissimilarities between each \code{Xu} observation and its corresponding neighbor in \code{Xr}.} -\item{\code{dissimilarities}:}{ a list with the method used to obtain the +\item{\code{dissimilarities}: a list with the method used to obtain the dissimilarity matrices and the dissimilarity matrix corresponding to \mjeqn{D(Xr, Xu)}{D(Xr, Xu)}. This object is returned only if the \code{return_dissimilarity} argument in the \code{control} list was set to \code{TRUE}.} -\item{\code{n_predictions}}{ the total number of observations predicted.} -\item{\code{gh}:}{ if \code{gh = TRUE}, a list containing the global +\item{\code{n_predictions}: the total number of observations predicted.} +\item{\code{gh}: if \code{gh = TRUE}, a list containing the global Mahalanobis distance values for the observations in \code{Xr} and \code{Xu} as well as the results of the global pls projection object used to obtain the GH values.} -\item{\code{validation_results}:}{ a list of validation results for +\item{\code{validation_results}: a list of validation results for "local cross validation" (returned if the \code{validation_type} in \code{control} list was set to \code{"local_cv"}), "nearest neighbor validation" (returned if the \code{validation_type} in \code{control} list was set to \code{"NNv"}) and "Yu prediction statistics" (returned if \code{Yu} was supplied).}`` -\item{\code{results}:}{ a list of data tables containing the results of the +\item{\code{results}: a list of data tables containing the results of the predictions for each either \code{k} or \code{k_diss}. Each data table contains the following columns:} \itemize{ -\item{\code{o_index}:}{ The index of the predicted observation.} -\item{\code{k_diss}:}{ This column is only output if the \code{k_diss} +\item{\code{o_index}: The index of the predicted observation.} +\item{\code{k_diss}: This column is only output if the \code{k_diss} argument is used. It indicates the corresponding dissimilarity threshold for selecting the neighbors.} -\item{\code{k_original}:}{ This column is only output if the \code{k_diss} +\item{\code{k_original}: This column is only output if the \code{k_diss} argument is used. It indicates the number of neighbors that were originally found when the given dissimilarity threshold is used.} -\item{\code{k}:}{ This column indicates the final number of neighbors +\item{\code{k}: This column indicates the final number of neighbors used.} -\item{\code{npls}:}{ This column is only output if the \code{pls} +\item{\code{npls}: This column is only output if the \code{pls} regression method was used. It indicates the final number of pls components used.} -\item{\code{min_pls}:}{ This column is only output if \code{wapls} +\item{\code{min_pls}: This column is only output if \code{wapls} regression method was used. It indicates the final number of minimum pls components used. If no optimization was set, it retrieves the original minimum pls components passed to the \code{method} argument.} -\item{\code{max_pls}:}{ This column is only output if the \code{wapls} +\item{\code{max_pls}: This column is only output if the \code{wapls} regression method was used. It indicates the final number of maximum pls components used. If no optimization was set, it retrieves the original maximum pls components passed to the \code{method} argument.} -\item{\code{yu_obs}:}{ The input values given in \code{Yu} (the response +\item{\code{yu_obs}: The input values given in \code{Yu} (the response variable corresponding to the data to be predicted). If \code{Yu = NULL}, then \code{NA}s are retrieved.} -\item{\code{pred}:}{ The predicted Yu values.} -\item{\code{yr_min_obs}:}{ The minimum reference value (of the response +\item{\code{pred}: The predicted Yu values.} +\item{\code{yr_min_obs}: The minimum reference value (of the response variable) in the neighborhood.} -\item{\code{yr_max_obs}:}{ The maximum reference value (of the response +\item{\code{yr_max_obs}: The maximum reference value (of the response variable) in the neighborhood.} -\item{\code{index_nearest_in_Xr}}{ The index of the nearest neighbor found +\item{\code{index_nearest_in_Xr}: The index of the nearest neighbor found in \code{Xr}.} -\item{\code{index_farthest_in_Xr}}{ The index of the farthest neighbor +\item{\code{index_farthest_in_Xr}: The index of the farthest neighbor found in \code{Xr}.} -\item{\code{y_nearest}:}{ The reference value (\code{Yr}) corresponding to +\item{\code{y_nearest}: The reference value (\code{Yr}) corresponding to the nearest neighbor found in \code{Xr}.} -\item{\code{y_nearest_pred}:}{ This column is only output if the +\item{\code{y_nearest_pred}: This column is only output if the validation method in the object passed to \code{control} was set to \code{"NNv"}. It represents the predicted value of the nearest neighbor observation found in \code{Xr}. This prediction come from model fitted with the remaining observations in the neighborhood of the target observation in \code{Xu}.} -\item{\code{loc_rmse_cv}:}{ This column is only output if the validation +\item{\code{loc_rmse_cv}: This column is only output if the validation method in the object passed to \code{control} was set to \code{'local_cv'}. It represents the RMSE of the cross-validation computed for the neighborhood of the target observation in \code{Xu}.} -\item{\code{loc_st_rmse_cv}:}{ This column is only output if the +\item{\code{loc_st_rmse_cv}: This column is only output if the validation method in the object passed to \code{control} was set to \code{'local_cv'}. It represents the standardized RMSE of the cross-validation computed for the neighborhood of the target observation in \code{Xu}.} -\item{\code{dist_nearest}:}{ The distance to the nearest neighbor.} -\item{\code{dist_farthest}:}{ The distance to the farthest neighbor.} -\item{\code{loc_n_components}:}{ This column is only output if the +\item{\code{dist_nearest}: The distance to the nearest neighbor.} +\item{\code{dist_farthest}: The distance to the farthest neighbor.} +\item{\code{loc_n_components}: This column is only output if the dissimilarity method used is one of \code{"pca"}, \code{"pca.nipals"} or \code{"pls"} and in addition the dissimilarities are requested to be computed locally by passing \code{.local = TRUE} to the \code{mbl} function. See \code{.local} argument in the \code{\link{ortho_diss}} function.} } -\item{\code{seed}}{ a value mirroing the one passed to seed.} -\item{\code{documentation}:}{ a character string mirroring the one provided +\item{\code{seed}: a value mirroring the one passed to seed.} +\item{\code{documentation}: a character string mirroring the one provided in the \code{documentation} argument.} } When the \code{k_diss} argument is used, the printed results show a table diff --git a/man/mbl_control.Rd b/man/mbl_control.Rd index 7ddede6..1f5200c 100644 --- a/man/mbl_control.Rd +++ b/man/mbl_control.Rd @@ -70,7 +70,7 @@ learning process in the \code{mbl} function. The validation methods available for assessing the predictive performance of the memory-based learning method used are described as follows: \itemize{ -\item{Leave-nearest-neighbor-out cross-validation (\code{"NNv"}):}{ From +\item{Leave-nearest-neighbor-out cross-validation (\code{"NNv"}): From the group of neighbors of each observation to be predicted, the nearest observation (i.e. the most similar observation) is excluded and then a local model is fitted using the remaining neighbors. This model is then used to predict the value @@ -78,7 +78,7 @@ of the target response variable of the nearest observation. These predicted values are finally cross validated with the actual values (See Ramirez-Lopez et al. (2013a) for additional details). This method is faster than \code{"local_cv"}.} -\item{Local leave-group-out cross-validation (\code{"local_cv"}):}{ The +\item{Local leave-group-out cross-validation (\code{"local_cv"}): The group of neighbors of each observation to be predicted is partitioned into different equal size subsets. Each partition is selected based on a stratified random sampling which takes into account the values of the @@ -94,7 +94,7 @@ subsets is controlled by the \code{p} argument which indicates the percentage of observations to be selected from the subset of nearest neighbours. The global error of the predictions is computed as the average of the local root mean square errors.} -\item{No validation (\code{"none"}):}{ No validation is carried out. +\item{No validation (\code{"none"}): No validation is carried out. If \code{"none"} is seleceted along with \code{"NNv"} and/or \code{"local_cv"}, then it will be ignored and the respective validation(s) will be carried out.} diff --git a/man/opls.Rd b/man/opls.Rd index 01f388a..bfe62fe 100644 --- a/man/opls.Rd +++ b/man/opls.Rd @@ -42,15 +42,15 @@ method. Only used if \code{algorithm = 'xls'}. Default is 15 (as in BUCHI NIRWis \value{ a list containing the following elements: \itemize{ -\item{\code{coefficients}}{ the matrix of regression coefficients.} -\item{\code{bo}}{ a matrix of one row containing the intercepts for each component.} -\item{\code{scores}}{ the matrix of scores.} -\item{\code{X_loadings}}{ the matrix of X loadings.} -\item{\code{Y_loadings}}{ the matrix of Y loadings.} -\item{\code{projection_mat}}{ the projection matrix.} -\item{\code{Y}}{ the \code{Y} input.} -\item{\code{transf}}{ a \code{list} conating two objects: \code{Xcenter} and \code{Xscale}}. -\item{\code{weights}}{ the matrix of wheights.}} +\item{\code{coefficients}: the matrix of regression coefficients.} +\item{\code{bo}: a matrix of one row containing the intercepts for each component.} +\item{\code{scores}: the matrix of scores.} +\item{\code{X_loadings}: the matrix of X loadings.} +\item{\code{Y_loadings}: the matrix of Y loadings.} +\item{\code{projection_mat}: the projection matrix.} +\item{\code{Y}: the \code{Y} input.} +\item{\code{transf}: a \code{list} conating two objects: \code{Xcenter} and \code{Xscale}}. +\item{\code{weights}: the matrix of wheights.}} } \description{ Computes orthogonal socres partial least squares (opls) diff --git a/man/opls_cv_cpp.Rd b/man/opls_cv_cpp.Rd index adced0a..ee896c4 100644 --- a/man/opls_cv_cpp.Rd +++ b/man/opls_cv_cpp.Rd @@ -60,18 +60,18 @@ validation segment are retrieved.} \value{ if \code{statistics = true} a list containing the following one-row matrices: \itemize{ -\item{\code{rmse_seg}}{ the RMSEs.} -\item{\code{st_rmse_seg}}{ the standardized RMSEs.} -\item{\code{rsq_seg}}{ the coefficients of determination.} +\item{\code{rmse_seg}: the RMSEs.} +\item{\code{st_rmse_seg}: the standardized RMSEs.} +\item{\code{rsq_seg}: the coefficients of determination.} } if \code{statistics = false} a list containing the following one-row matrices: \itemize{ -\item{\code{predictions}}{ the predictions of each of the validation +\item{\code{predictions}: the predictions of each of the validation segments in \code{pindices}. Each column in \code{pindices} contains the validation indices of a segment.} -\item{\code{st_rmse_seg}}{ the standardized RMSEs.} -\item{\code{rsq_seg}}{ the coefficients of determination.} +\item{\code{st_rmse_seg}: the standardized RMSEs.} +\item{\code{rsq_seg}: the coefficients of determination.} } If \code{method = "wapls"}, data of the pls weights are output in this diff --git a/man/opls_for_projection.Rd b/man/opls_for_projection.Rd index 1087e3b..9a4e05c 100644 --- a/man/opls_for_projection.Rd +++ b/man/opls_for_projection.Rd @@ -58,21 +58,21 @@ method. Only used if \code{algorithm = 'xls'}. Default is 15 (as in BUCHI NIRWis \value{ a list containing the following elements: \itemize{ -\item{\code{coefficients}}{ the matrix of regression coefficients.} -\item{\code{bo}}{ a matrix of one row containing the intercepts for +\item{\code{coefficients}: the matrix of regression coefficients.} +\item{\code{bo}: a matrix of one row containing the intercepts for each component.} -\item{\code{scores}}{ the matrix of scores.} -\item{\code{X_loadings}}{ the matrix of X loadings.} -\item{\code{Y_loadings}}{ the matrix of Y loadings.} -\item{\code{projection_mat}}{ the projection matrix.} -\item{\code{Y}}{ the \code{Y} input.} -\item{\code{variance}}{ a \code{list} conating two objects: \code{x_var} +\item{\code{scores}: the matrix of scores.} +\item{\code{X_loadings}: the matrix of X loadings.} +\item{\code{Y_loadings}: the matrix of Y loadings.} +\item{\code{projection_mat}: the projection matrix.} +\item{\code{Y}: the \code{Y} input.} +\item{\code{variance}: a \code{list} conating two objects: \code{x_var} and \code{y_var}. These objects contain information on the explained variance for the \code{X} and \code{Y} matrices respectively.} -\item{\code{transf}}{ a \code{list} conating two objects: \code{Xcenter} +\item{\code{transf}: a \code{list} conating two objects: \code{Xcenter} and \code{Xscale}}. -\item{\code{weights}}{ the matrix of wheights.} +\item{\code{weights}: the matrix of wheights.} } } \description{ diff --git a/man/opls_get_all.Rd b/man/opls_get_all.Rd index e4bb581..1828435 100644 --- a/man/opls_get_all.Rd +++ b/man/opls_get_all.Rd @@ -42,19 +42,20 @@ method. Only used if \code{algorithm = 'xls'}. Default is 15 (as in BUCHI NIRWis \value{ a list containing the following elements: \itemize{ -\item{\code{ncomp}}{ the number of components used.} -\item{\code{coefficients}}{ the matrix of regression coefficients.} -\item{\code{bo}}{ a matrix of one row containing the intercepts for each component.} -\item{\code{scores}}{ the matrix of scores.} -\item{\code{X_loadings}}{ the matrix of X loadings.} -\item{\code{Y_loadings}}{ the matrix of Y loadings.} -\item{\code{vip}}{ the projection matrix.} -\item{\code{selectivity_ratio}}{ the matrix of selectivity ratio (see Rajalahti, Tarja, et al. 2009).} -\item{\code{Y}}{ the \code{Y} input.} -\item{\code{variance}}{ a \code{list} conating two objects: \code{x_var} and \code{y_var}. +\item{\code{ncomp}: the number of components used.} +\item{\code{coefficients}: the matrix of regression coefficients.} +\item{\code{bo}: a matrix of one row containing the intercepts for each component.} +\item{\code{scores}: the matrix of scores.} +\item{\code{X_loadings}: the matrix of X loadings.} +\item{\code{Y_loadings}: the matrix of Y loadings.} +\item{\code{vip}: the projection matrix.} +\item{\code{selectivity_ratio}: the matrix of selectivity ratio (see Rajalahti, Tarja, et al. 2009).} +\item{\code{Y}: the \code{Y} input.} +\item{\code{variance}: a \code{list} conating two objects: \code{x_var} and \code{y_var}. These objects contain information on the explained variance for the \code{X} and \code{Y} matrices respectively.} -\item{\code{transf}}{ a \code{list} conating two objects: \code{Xcenter} and \code{Xscale}}. -\item{\code{weights}}{ the matrix of wheights.}} +\item{\code{transf}: a \code{list} conating two objects: \code{Xcenter} and \code{Xscale}}. +\item{\code{weights}: the matrix of wheights.} +} } \description{ Computes orthogonal socres partial least squares (opls_get_all) diff --git a/man/opls_get_basics.Rd b/man/opls_get_basics.Rd index 4a7c27b..c144a0e 100644 --- a/man/opls_get_basics.Rd +++ b/man/opls_get_basics.Rd @@ -38,17 +38,17 @@ method. Only used if \code{algorithm = 'xls'}. Default is 15 (as in BUCHI NIRWis \value{ a list containing the following elements: \itemize{ -\item{\code{coefficients}}{ the matrix of regression coefficients.} -\item{\code{bo}}{ a matrix of one row containing the intercepts for each component.} -\item{\code{Y_loadings}}{ the matrix of Y loadings.} -\item{\code{projection_mat}}{ the projection matrix.} -\item{\code{transf}}{ a \code{list} conating two objects: \code{Xcenter} and \code{Xscale}}. +\item{\code{coefficients}: the matrix of regression coefficients.} +\item{\code{bo}: a matrix of one row containing the intercepts for each component.} +\item{\code{Y_loadings}: the matrix of Y loadings.} +\item{\code{projection_mat}: the projection matrix.} +\item{\code{transf}: a \code{list} conating two objects: \code{Xcenter} and \code{Xscale}}. } } \description{ Computes orthogonal socres partial least squares (opls) regressions with the NIPALS algorithm. It allows multiple response variables. -In contrast to code{opls} function, this one does not compute unnecessary +In contrast to \code{opls} function, this one does not compute unnecessary data for (local) regression. For internal use only! } diff --git a/man/opls_gs.Rd b/man/opls_gs.Rd index 83f574f..f6cfce0 100644 --- a/man/opls_gs.Rd +++ b/man/opls_gs.Rd @@ -42,10 +42,10 @@ what method to use. Options are: \value{ a list containing the following elements: \itemize{ -\item{\code{ncomp}}{ the number of components.} -\item{\code{pred_response}}{ the response predictions for \code{Xu}.} -\item{\code{rmse_reconstruction}}{ the rmse of the reconstruction for \code{Xu}.} -\item{\code{score_dissimilarity}}{ the distance score between \code{Xr} and \code{Xu}.}} +\item{\code{ncomp}: the number of components.} +\item{\code{pred_response}: the response predictions for \code{Xu}.} +\item{\code{rmse_reconstruction}: the rmse of the reconstruction for \code{Xu}.} +\item{\code{score_dissimilarity}: the distance score between \code{Xr} and \code{Xu}.}} } \description{ Computes orthogonal scores partial least squares (opls) diff --git a/man/ortho_diss.Rd b/man/ortho_diss.Rd index 4526d88..4583bcf 100644 --- a/man/ortho_diss.Rd +++ b/man/ortho_diss.Rd @@ -47,7 +47,7 @@ to be retained. This list must contain two elements (in the following order): components) and \code{value} (a numerical value that complements the selected method). The methods available are: \itemize{ -\item{\code{"opc"}:} { optimized principal component selection based on +\item{\code{"opc"}: optimized principal component selection based on Ramirez-Lopez et al. (2013a, 2013b). The optimal number of components (of a given set of observations) is the one for which its distance matrix minimizes the differences between the \code{Yr} value of each @@ -56,17 +56,17 @@ case, \code{value} must be a value (larger than 0 and below \code{min(nrow(Xr)} \code{+ nrow(Xu),} \code{ncol(Xr))} indicating the maximum number of principal components to be tested. See the \code{\link{ortho_projection}} function for more details.} -\item{\code{"cumvar"}:}{ selection of the principal components based +\item{\code{"cumvar"}: selection of the principal components based on a given cumulative amount of explained variance. In this case, \code{value} must be a value (larger than 0 and below or equal to 1) indicating the minimum amount of cumulative variance that the combination of retained components should explain.} -\item{\code{"var"}:}{ selection of the principal components based +\item{\code{"var"}: selection of the principal components based on a given amount of explained variance. In this case, \code{value} must be a value (larger than 0 and below or equal to 1) indicating the minimum amount of variance that a single component should explain in order to be retained.} -\item{\code{"manual"}:}{ for manually specifying a fix number of +\item{\code{"manual"}: for manually specifying a fix number of principal components. In this case, \code{value} must be a value (larger than 0 and below the minimum dimension of \code{Xr} or \code{Xr} and \code{Xu} @@ -88,12 +88,12 @@ the dissimilarities must be computed. This argument is equivalent to \code{method} argument in the \code{\link{ortho_projection}} function. Options are: \itemize{ -\item{\code{"pca"}}{: principal component analysis using the singular value +\item{\code{"pca"}: principal component analysis using the singular value decomposition algorithm)} -\item{\code{"pca.nipals"}}{: principal component analysis using +\item{\code{"pca.nipals"}: principal component analysis using the non-linear iterative partial least squares algorithm.} -\item{\code{"pls"}}{: partial least squares.} -\item{\code{"mpls"}}{: modified partial least squares (Shenk and Westerhaus, +\item{\code{"pls"}: partial least squares.} +\item{\code{"mpls"}: modified partial least squares (Shenk and Westerhaus, 1991 and Westerhaus, 2014).} } See the \code{\link{ortho_projection}} function for further details on the @@ -138,22 +138,22 @@ via \code{\link[foreach]{foreach}} function of the 'foreach' package.} \value{ a \code{list} of class \code{ortho_diss} with the following elements: \itemize{ -\item{\code{n_components}}{ the number of components (either principal +\item{\code{n_components}: the number of components (either principal components or partial least squares components) used for computing the global dissimilarities.} -\item{\code{global_variance_info}}{ the information about the expalined +\item{\code{global_variance_info}: the information about the expalined variance(s) of the projection. When \code{.local = TRUE}, the information corresponds to the global projection done prior computing the local projections.} -\item{\code{local_n_components}}{ if \code{.local = TRUE}, a data.table +\item{\code{local_n_components}: if \code{.local = TRUE}, a data.table which specifies the number of local components (either principal components or partial least squares components) used for computing the dissimilarity between each target observation and its neighbor observations.} -\item{\code{dissimilarity}}{ the computed dissimilarity matrix. If +\item{\code{dissimilarity}: the computed dissimilarity matrix. If \code{.local = FALSE} a distance matrix. If \code{.local = TRUE} a matrix of class \code{local_ortho_diss}. In this case, each column represent the dissimilarity between a target observation and its neighbor observations.} -\item{\code{projection}}{if \code{return_projection = TRUE}, +\item{\code{projection}: if \code{return_projection = TRUE}, an \code{ortho_projection} object.} } } diff --git a/man/ortho_projection.Rd b/man/ortho_projection.Rd index 173f07a..17d032b 100644 --- a/man/ortho_projection.Rd +++ b/man/ortho_projection.Rd @@ -45,12 +45,12 @@ that case, the kappa index is used. See \code{\link{sim_eval}} function for more \item{method}{the method for projecting the data. Options are: \itemize{ -\item{\code{"pca"}:}{ principal component analysis using the singular value +\item{\code{"pca"}: principal component analysis using the singular value decomposition algorithm.} -\item{\code{"pca.nipals"}:}{ principal component analysis using the +\item{\code{"pca.nipals"}: principal component analysis using the non-linear iterative partial least squares algorithm.} -\item{\code{"pls"}:}{ partial least squares.} -\item{\code{"mpls"}:}{ modified partial least squares. See details.} +\item{\code{"pls"}: partial least squares.} +\item{\code{"mpls"}: modified partial least squares. See details.} }} \item{pc_selection}{a list of length 2 which specifies the method to be used @@ -60,7 +60,7 @@ to be retained. This list must contain two elements (in the following order): components) and \code{value} (a numerical value that complements the selected method). The methods available are: \itemize{ -\item{\code{"opc"}:} { optimized principal component selection based on +\item{\code{"opc"}: optimized principal component selection based on Ramirez-Lopez et al. (2013a, 2013b). The optimal number of components of a given set of observations is the one for which its distance matrix minimizes the differences between the \code{Yr} value of each @@ -68,17 +68,17 @@ observation and the \code{Yr} value of its closest observation. In this case \code{value} must be a value (larger than 0 and below \code{min(nrow(Xr)} \code{+ nrow(Xu),} \code{ncol(Xr))} indicating the maximum number of principal components to be tested. See details.} -\item{\code{"cumvar"}:}{ selection of the principal components based +\item{\code{"cumvar"}: selection of the principal components based on a given cumulative amount of explained variance. In this case, \code{value} must be a value (larger than 0 and below or equal to 1) indicating the minimum amount of cumulative variance that the combination of retained components should explain.} -\item{\code{"var"}:}{ selection of the principal components based +\item{\code{"var"}: selection of the principal components based on a given amount of explained variance. In this case, \code{value} must be a value (larger than 0 and below or equal to 1) indicating the minimum amount of variance that a single component should explain in order to be retained.} -\item{\code{"manual"}:}{ for manually specifying a fix number of +\item{\code{"manual"}: for manually specifying a fix number of principal components. In this case, \code{value} must be a value (larger than 0 and below the minimum dimension of \code{Xr} or \code{Xr} and \code{Xu} @@ -125,22 +125,22 @@ same number of columns, to be used in the same order.} a \code{list} of class \code{ortho_projection} with the following components: \itemize{ -\item{\code{scores}}{ a matrix of scores corresponding to the observations in +\item{\code{scores}: a matrix of scores corresponding to the observations in \code{Xr} (and \code{Xu} if it was provided). The components retrieved correspond to the ones optimized or specified.} -\item{\code{X_loadings}}{ a matrix of loadings corresponding to the +\item{\code{X_loadings}: a matrix of loadings corresponding to the explanatory variables. The components retrieved correspond to the ones optimized or specified.} -\item{\code{Y_loadings}}{ a matrix of partial least squares loadings +\item{\code{Y_loadings}: a matrix of partial least squares loadings corresponding to \code{Yr}. The components retrieved correspond to the ones optimized or specified. This object is only returned if the partial least squares algorithm was used.} -\item{\code{weigths}}{ a matrix of partial least squares ("pls") weights. +\item{\code{weigths}: a matrix of partial least squares ("pls") weights. This object is only returned if the "pls" algorithm was used.} -\item{\code{projection_mat}}{ a matrix that can be used to project new data +\item{\code{projection_mat}: a matrix that can be used to project new data onto a "pls" space. This object is only returned if the "pls" algorithm was used.} -\item{\code{variance}}{ a list with information on the original variance and +\item{\code{variance}: a list with information on the original variance and the explained variances. This list contains a matrix indicating the amount of variance explained by each component (var), the ratio between explained variance by each single component and the original variance (explained_var) and @@ -154,12 +154,12 @@ information on \code{Yr} (i.e. the \code{Xr} data). If the principal component method is used, the this data is computed on the basis of \code{Xr} and \code{Xu} (if it applies) since both matrices are employed in the computation of the projection matrix (loadings in this case)}. -\item{\code{sdv}}{ the standard deviation of the retrieved scores. This vector +\item{\code{sdv}: the standard deviation of the retrieved scores. This vector can be different from the "sd" in \code{variance}.} -\item{\code{n_components}}{ the number of components (either principal +\item{\code{n_components}: the number of components (either principal components or partial least squares components) used for computing the global dissimilarity scores.} -\item{\code{opc_evaluation}}{ a matrix containing the statistics computed +\item{\code{opc_evaluation}: a matrix containing the statistics computed for optimizing the number of principal components based on the variable(s) specified in the \code{Yr} argument. If \code{Yr} was a continuous was a continuous vector or matrix then this object indicates the root mean square @@ -168,7 +168,7 @@ categorical variable this object indicates the kappa values for each number of components. This object is returned only if \code{"opc"} was used within the \code{pc_selection} argument. See the \code{\link{sim_eval}} function for more details.} -\item{\code{method}}{ the \code{ortho_projection} method used.} +\item{\code{method}: the \code{ortho_projection} method used.} } \code{predict.ortho_projection}, returns a matrix of scores proprojected for \code{newdtata}. diff --git a/man/pca_nipals.Rd b/man/pca_nipals.Rd index 2b4a39f..62652dd 100644 --- a/man/pca_nipals.Rd +++ b/man/pca_nipals.Rd @@ -31,16 +31,14 @@ amount of cumulative variance that the retained components should explain. If \c it must be a value (larger than 0 and below 1) indicating that components that explain (individually) a variance lower than this threshold must be excluded. If \code{"manual"} is chosen, it must be a value specifying the desired number of principal components to retain. Default is 0.01.} - -\item{Y}{a matrix of either a single or multiple response variables.} } \value{ a list containing the following elements: \itemize{ -\item{\code{pc_scores}}{ a matrix of principal component scores.} -\item{\code{pc_loadings}}{ a matrix of of principal component loadings.} -\item{\code{variance}}{ a matrix of the variance of the principal components.} -\item{\code{scale}}{ a \code{list} conating two objects: \code{center} and \code{scale}, which correspond to the vectors used to center and scale the input matrix.} +\item{\code{pc_scores}: a matrix of principal component scores.} +\item{\code{pc_loadings}: a matrix of of principal component loadings.} +\item{\code{variance}: a matrix of the variance of the principal components.} +\item{\code{scale}: a \code{list} conating two objects: \code{center} and \code{scale}, which correspond to the vectors used to center and scale the input matrix.} } } \description{ diff --git a/man/predict_gaussian_process.Rd b/man/predict_gaussian_process.Rd index 95998f3..6baa2f5 100644 --- a/man/predict_gaussian_process.Rd +++ b/man/predict_gaussian_process.Rd @@ -19,8 +19,6 @@ predict_gaussian_process(Xz, alpha, newdata, scale, Xcenter, Xscale, Ycenter, Ys \item{Ycenter}{if \code{center = TRUE} a matrix of one row with the values that must be used for accounting for the centering of the response variable.} \item{Yscale}{if \code{scale = TRUE} a matrix of one row with the values that must be used for accounting for the scaling of the response variable.} - -\item{b}{the regression coefficients.} } \value{ a matrix of predicted values diff --git a/man/resemble-package.Rd b/man/resemble-package.Rd index 33dd11d..314cc32 100644 --- a/man/resemble-package.Rd +++ b/man/resemble-package.Rd @@ -14,7 +14,7 @@ Functions for memory-based learning } \details{ This is the version -2.2.2 -- Sky +2.2.3 -- embryo of the package. It implements a number of functions useful for modeling complex spectral spectra (e.g. NIR, IR). The package includes functions for dimensionality reduction, diff --git a/man/search_neighbors.Rd b/man/search_neighbors.Rd index e20f97f..0b80c8b 100644 --- a/man/search_neighbors.Rd +++ b/man/search_neighbors.Rd @@ -24,33 +24,33 @@ neighbors are to be searched in \code{Xr}. Default is \code{NULL}. See details.} \item{diss_method}{a character string indicating the spectral dissimilarity metric to be used in the selection of the nearest neighbors of each observation. \itemize{ -\item{\code{"pca"}:}{ Mahalanobis distance +\item{\code{"pca"}: Mahalanobis distance computed on the matrix of scores of a Principal Component (PC) projection of \code{Xr} (and \code{Xu} if supplied). PC projection is done using the singular value decomposition (SVD) algorithm. See \code{\link{ortho_diss}} function.} -\item{\code{"pca.nipals"}}{ Mahalanobis distance +\item{\code{"pca.nipals"}: Mahalanobis distance computed on the matrix of scores of a Principal Component (PC) projection of \code{Xr} (and \code{Xu} if supplied). PC projection is done using the non-linear iterative partial least squares (niapls) algorithm. See \code{\link{ortho_diss}} function.} -\item{\code{"pls"}}{ Mahalanobis distance +\item{\code{"pls"}: Mahalanobis distance computed on the matrix of scores of a partial least squares projection of \code{Xr} (and \code{Xu} if supplied). In this case, \code{Yr} is always required. See \code{\link{ortho_diss}} function.} -\item{\code{"mpls"}}:{ Mahalanobis distance +\item{\code{"mpls"}: Mahalanobis distance computed on the matrix of scores of a modified partial least squares projection (Shenk and Westerhaus, 1991; Westerhaus, 2014) of \code{Xr} (and \code{Xu} if provided). In this case, \code{Yr} is always required. See \code{\link{ortho_diss}} function.} -\item{\code{"cor"}}{ correlation coefficient +\item{\code{"cor"}: correlation coefficient between observations. See \code{\link{cor_diss}} function.} -\item{\code{"euclid"}}{ Euclidean distance +\item{\code{"euclid"}: Euclidean distance between observations. See \code{\link{f_diss}} function.} -\item{\code{"cosine"}}{ Cosine distance +\item{\code{"cosine"}: Cosine distance between observations. See \code{\link{f_diss}} function.} -\item{\code{"sid"}}{ spectral information divergence between observations. +\item{\code{"sid"}: spectral information divergence between observations. See \code{\link{sid}} function.} }} @@ -91,7 +91,7 @@ to be retained. This list must contain two elements in the following order: components) and \code{value} (a numerical value that complements the selected method). The methods available are: \itemize{ -\item{\code{"opc"}:} { optimized principal component selection based on +\item{\code{"opc"}: optimized principal component selection based on Ramirez-Lopez et al. (2013a, 2013b). The optimal number of components (of set of observations) is the one for which its distance matrix minimizes the differences between the \code{Yr} value of each @@ -100,17 +100,17 @@ case \code{value} must be a value (larger than 0 and below the minimum dimension of \code{Xr} or \code{Xr} and \code{Xu} combined) indicating the maximum number of principal components to be tested. See the \code{\link{ortho_projection}} function for more details.} -\item{\code{"cumvar"}:}{ selection of the principal components based +\item{\code{"cumvar"}: selection of the principal components based on a given cumulative amount of explained variance. In this case, \code{value} must be a value (larger than 0 and below or equal to 1) indicating the minimum amount of cumulative variance that the combination of retained components should explain.} -\item{\code{"var"}:}{ selection of the principal components based +\item{\code{"var"}: selection of the principal components based on a given amount of explained variance. In this case, \code{value} must be a value (larger than 0 and below or equal to 1) indicating the minimum amount of variance that a single component should explain in order to be retained.} -\item{\code{"manual"}:}{ for manually specifying a fix number of +\item{\code{"manual"}: for manually specifying a fix number of principal components. In this case, \code{value} must be a value (larger than 0 and below the minimum dimension of \code{Xr} or \code{Xr} and \code{Xu} combined) @@ -163,21 +163,21 @@ function. See details.} \value{ a \code{list} containing the following elements: \itemize{ -\item{\code{neighbors_diss}}{ a matrix of the \code{Xr} dissimilarity scores +\item{\code{neighbors_diss}: a matrix of the \code{Xr} dissimilarity scores corresponding to the neighbors of each \code{Xr} observation (or \code{Xu} observation, in case \code{Xu} was supplied). The neighbor dissimilarity scores are organized by columns and are sorted in ascending order.} -\item{\code{neighbors}}{ a matrix of the \code{Xr} indices corresponding to +\item{\code{neighbors}: a matrix of the \code{Xr} indices corresponding to the neighbors of each observation in \code{Xu}. The neighbor indices are organized by columns and are sorted in ascending order by their dissimilarity score.} -\item{\code{unique_neighbors}}{ a vector of the indices in \code{Xr} +\item{\code{unique_neighbors}: a vector of the indices in \code{Xr} identified as neighbors of any observation in \code{Xr} (or in \code{Xu}, in case it was supplied). This is obtained by converting the \code{neighbors} matrix into a vector and applying the \code{\link[base]{unique}} function.} -\item{\code{k_diss_info}}{ a \code{data.table} that is returned only if the +\item{\code{k_diss_info}: a \code{data.table} that is returned only if the \code{k_diss} argument was used. It comprises three columns, the first one (\code{Xr_index} or \code{Xu_index}) indicates the index of the observations in \code{Xr} (or in \code{Xu}, in case it was suppplied), @@ -185,10 +185,10 @@ the second column (\code{n_k}) indicates the number of neighbors found in \code{Xr} and the third column (\code{final_n_k}) indicates the final number of neighbors selected bounded by \code{k_range}. argument.} -\item{\code{dissimilarity}}{ If \code{return_dissimilarity = TRUE} the +\item{\code{dissimilarity}: If \code{return_dissimilarity = TRUE} the dissimilarity object used (as computed by the \code{\link{dissimilarity}} function.} -\item{\code{projection}}{ an \code{ortho_projection} object. Only output if +\item{\code{projection}: an \code{ortho_projection} object. Only output if \code{return_projection = TRUE} and if \code{diss_method = "pca"}, \code{diss_method = "pca.nipals"} or \code{diss_method = "pls"}. \cr This object contains the projection used to compute diff --git a/man/sid.Rd b/man/sid.Rd index e284942..b92f0b1 100644 --- a/man/sid.Rd +++ b/man/sid.Rd @@ -66,19 +66,19 @@ value for numerical stability. Default is 1e-4.} \value{ a \code{list} with the following components: \itemize{ -\item{\code{sid}}{ if only \code{"X"} is specified (i.e. \code{Xu = NULL}), +\item{\code{sid}: if only \code{"X"} is specified (i.e. \code{Xu = NULL}), a square symmetric matrix of SID distances between all the components in \code{"X"}. If both \code{"X"} and \code{"Xu"} are specified, a matrix of SID distances between the components in \code{"X"} and the components in \code{"Xu"}) where the rows represent the objects in \code{"X"} and the columns represent the objects in \code{"Xu"}} -\item{\code{Xr}}{ the (centered and/or scaled if specified) spectral +\item{\code{Xr}: the (centered and/or scaled if specified) spectral \code{X} matrix} -\item{\code{Xu}}{ the (centered and/or scaled if specified) spectral +\item{\code{Xu}: the (centered and/or scaled if specified) spectral \code{Xu} matrix} -\item{\code{densityDisXr}}{ if \code{mode = "density"}, the computed +\item{\code{densityDisXr}: if \code{mode = "density"}, the computed density distributions of \code{Xr}} -\item{\code{densityDisXu}}{ if \code{mode = "density"}, the computed +\item{\code{densityDisXu}: if \code{mode = "density"}, the computed density distributions of \code{Xu}} } } diff --git a/man/sim_eval.Rd b/man/sim_eval.Rd index 4887d9e..44e5ed5 100644 --- a/man/sim_eval.Rd +++ b/man/sim_eval.Rd @@ -24,9 +24,9 @@ variable, then the kappa index is used. See details.} \value{ \code{sim_eval} returns a list with the following components: \itemize{ -\item{"\code{eval}}{ either the RMSD (and the correlation coefficient) or +\item{"\code{eval}: either the RMSD (and the correlation coefficient) or the kappa index} -\item{\code{first_nn}}{ a matrix containing the original side +\item{\code{first_nn}: a matrix containing the original side informative variable in the first half of the columns, and the side informative values of the corresponding nearest neighbors in the second half of the columns.} diff --git a/my-comments.md b/my-comments.md index 05a43f4..515950a 100644 --- a/my-comments.md +++ b/my-comments.md @@ -1,12 +1,77 @@ # resemble +# version 2.2.3 + +# submission message: +Dear CRAN maintainers, +I am resubmitting my package "resemble" to CRAN. This version fixes problems with the documentation which were reported in the CRAN checks. I have addressed a small problem with one of the help pages that was detected in a previous submission. +Prior to this submission, this tarball has been checked with in the winbuilder service. Apart from that it has been also submitted to extensive tests in rhub. +For this second submission the package passed all the tests in the above platforms. +Reverse dependencies have also been checked. +Best regards, +Leonardo + + + +## Package was built using: +``` +devtools::build( + pkg = ".", + path = NULL, + binary = FALSE, + vignettes = TRUE, + manual = TRUE, + args = NULL, + quiet = FALSE +) +``` + +# R win builder checks for release of `resemble 2.2.3` (`embryo`) 15.02.2024 +passed all the checks without notes. + +# Rhub checks for release of `resemble 2.2.3` (`embryo`) 15.02.2024 +The checks were conducted in the following platforms through rhub: + +``` +rhub::check(paste0(gsub("/resemble$", "/", getwd()), "resemble_2.2.3.tar.gz"), + platform = c("fedora-gcc-devel"), + email = "ramirez.lopez.leo@gmail.com") +``` +- "fedora-gcc-devel" NOTE +* checking installed package size ... NOTE + installed size is 10.1Mb + sub-directories of 1Mb or more: + doc 1.9Mb + libs 7.6Mb + +- "windows-x86_64-devel" OK + +- "macos-highsierra-release-cran" (not tested) + +- "windows-x86_64-release" OK + +- "ubuntu-gcc-release" OK +" + + +The suggested packages are required for a complete check. +Checking can be attempted without them by setting the environment +variable _R_CHECK_FORCE_SUGGESTS_ to a false value. + +See section ‘The DESCRIPTION file’ in the ‘Writing R Extensions’ +manual. + + + + + # version 2.2.2 # submission message: Dear CRAN maintainers, I am submitting my package "resemble" to CRAN. This version introduces a new feature in one of the functions and one bug fix. -In a previous submission, the date in DESCRIPTION was not in the correct format. This has been fixed. +In previous submissions, the date in DESCRIPTION was not in the correct format and there were some broken URL links. These issues have been fixed. Prior to this submission, this tarball has been checked with in the winbuilder service. Apart from that it has been also submitted to extensive tests in rhub. A first submission of this version failed (for "r-devel-linux-x86_64-debian-gcc"), therefore following platforms were tested for a second submission using Rhub: diff --git a/src/regression_methods.cpp b/src/regression_methods.cpp index 7cf06aa..a552206 100644 --- a/src/regression_methods.cpp +++ b/src/regression_methods.cpp @@ -282,21 +282,21 @@ arma::mat get_weights(arma::mat X, //' method. Only used if \code{algorithm = 'xls'}. Default is 15 (as in BUCHI NIRWise PLUS software). //' @return a list containing the following elements: //' \itemize{ -//' \item{\code{coefficients}}{ the matrix of regression coefficients.} -//' \item{\code{bo}}{ a matrix of one row containing the intercepts for +//' \item{\code{coefficients}: the matrix of regression coefficients.} +//' \item{\code{bo}: a matrix of one row containing the intercepts for //' each component.} -//' \item{\code{scores}}{ the matrix of scores.} -//' \item{\code{X_loadings}}{ the matrix of X loadings.} -//' \item{\code{Y_loadings}}{ the matrix of Y loadings.} -//' \item{\code{projection_mat}}{ the projection matrix.} -//' \item{\code{Y}}{ the \code{Y} input.} -//' \item{\code{variance}}{ a \code{list} conating two objects: \code{x_var} +//' \item{\code{scores}: the matrix of scores.} +//' \item{\code{X_loadings}: the matrix of X loadings.} +//' \item{\code{Y_loadings}: the matrix of Y loadings.} +//' \item{\code{projection_mat}: the projection matrix.} +//' \item{\code{Y}: the \code{Y} input.} +//' \item{\code{variance}: a \code{list} conating two objects: \code{x_var} //' and \code{y_var}. //' These objects contain information on the explained variance for the \code{X} //' and \code{Y} matrices respectively.} -//' \item{\code{transf}}{ a \code{list} conating two objects: \code{Xcenter} +//' \item{\code{transf}: a \code{list} conating two objects: \code{Xcenter} //' and \code{Xscale}}. -//' \item{\code{weights}}{ the matrix of wheights.} +//' \item{\code{weights}: the matrix of wheights.} //' } //' @author Leonardo Ramirez-Lopez //' @keywords internal @@ -554,19 +554,20 @@ List opls_for_projection(arma::mat X, //' method. Only used if \code{algorithm = 'xls'}. Default is 15 (as in BUCHI NIRWise PLUS software). //' @return a list containing the following elements: //' \itemize{ -//' \item{\code{ncomp}}{ the number of components used.} -//' \item{\code{coefficients}}{ the matrix of regression coefficients.} -//' \item{\code{bo}}{ a matrix of one row containing the intercepts for each component.} -//' \item{\code{scores}}{ the matrix of scores.} -//' \item{\code{X_loadings}}{ the matrix of X loadings.} -//' \item{\code{Y_loadings}}{ the matrix of Y loadings.} -//' \item{\code{vip}}{ the projection matrix.} -//' \item{\code{selectivity_ratio}}{ the matrix of selectivity ratio (see Rajalahti, Tarja, et al. 2009).} -//' \item{\code{Y}}{ the \code{Y} input.} -//' \item{\code{variance}}{ a \code{list} conating two objects: \code{x_var} and \code{y_var}. +//' \item{\code{ncomp}: the number of components used.} +//' \item{\code{coefficients}: the matrix of regression coefficients.} +//' \item{\code{bo}: a matrix of one row containing the intercepts for each component.} +//' \item{\code{scores}: the matrix of scores.} +//' \item{\code{X_loadings}: the matrix of X loadings.} +//' \item{\code{Y_loadings}: the matrix of Y loadings.} +//' \item{\code{vip}: the projection matrix.} +//' \item{\code{selectivity_ratio}: the matrix of selectivity ratio (see Rajalahti, Tarja, et al. 2009).} +//' \item{\code{Y}: the \code{Y} input.} +//' \item{\code{variance}: a \code{list} conating two objects: \code{x_var} and \code{y_var}. //' These objects contain information on the explained variance for the \code{X} and \code{Y} matrices respectively.} -//' \item{\code{transf}}{ a \code{list} conating two objects: \code{Xcenter} and \code{Xscale}}. -//' \item{\code{weights}}{ the matrix of wheights.}} +//' \item{\code{transf}: a \code{list} conating two objects: \code{Xcenter} and \code{Xscale}}. +//' \item{\code{weights}: the matrix of wheights.} +//' } //' @author Leonardo Ramirez-Lopez //' @keywords internal //' @useDynLib resemble @@ -812,15 +813,15 @@ List opls_get_all(arma::mat X, //' method. Only used if \code{algorithm = 'xls'}. Default is 15 (as in BUCHI NIRWise PLUS software). //' @return a list containing the following elements: //' \itemize{ -//' \item{\code{coefficients}}{ the matrix of regression coefficients.} -//' \item{\code{bo}}{ a matrix of one row containing the intercepts for each component.} -//' \item{\code{scores}}{ the matrix of scores.} -//' \item{\code{X_loadings}}{ the matrix of X loadings.} -//' \item{\code{Y_loadings}}{ the matrix of Y loadings.} -//' \item{\code{projection_mat}}{ the projection matrix.} -//' \item{\code{Y}}{ the \code{Y} input.} -//' \item{\code{transf}}{ a \code{list} conating two objects: \code{Xcenter} and \code{Xscale}}. -//' \item{\code{weights}}{ the matrix of wheights.}} +//' \item{\code{coefficients}: the matrix of regression coefficients.} +//' \item{\code{bo}: a matrix of one row containing the intercepts for each component.} +//' \item{\code{scores}: the matrix of scores.} +//' \item{\code{X_loadings}: the matrix of X loadings.} +//' \item{\code{Y_loadings}: the matrix of Y loadings.} +//' \item{\code{projection_mat}: the projection matrix.} +//' \item{\code{Y}: the \code{Y} input.} +//' \item{\code{transf}: a \code{list} conating two objects: \code{Xcenter} and \code{Xscale}}. +//' \item{\code{weights}: the matrix of wheights.}} //' @author Leonardo Ramirez-Lopez //' @keywords internal //' @useDynLib resemble @@ -963,7 +964,7 @@ List opls(arma::mat X, //' @title fast orthogonal scores algorithn of partial leat squares (opls) //' @description Computes orthogonal socres partial least squares (opls) //' regressions with the NIPALS algorithm. It allows multiple response variables. -//' In contrast to code{opls} function, this one does not compute unnecessary +//' In contrast to \code{opls} function, this one does not compute unnecessary //' data for (local) regression. //' For internal use only! //' @usage @@ -989,11 +990,11 @@ List opls(arma::mat X, //' method. Only used if \code{algorithm = 'xls'}. Default is 15 (as in BUCHI NIRWise PLUS software). //' @return a list containing the following elements: //' \itemize{ -//' \item{\code{coefficients}}{ the matrix of regression coefficients.} -//' \item{\code{bo}}{ a matrix of one row containing the intercepts for each component.} -//' \item{\code{Y_loadings}}{ the matrix of Y loadings.} -//' \item{\code{projection_mat}}{ the projection matrix.} -//' \item{\code{transf}}{ a \code{list} conating two objects: \code{Xcenter} and \code{Xscale}}. +//' \item{\code{coefficients}: the matrix of regression coefficients.} +//' \item{\code{bo}: a matrix of one row containing the intercepts for each component.} +//' \item{\code{Y_loadings}: the matrix of Y loadings.} +//' \item{\code{projection_mat}: the projection matrix.} +//' \item{\code{transf}: a \code{list} conating two objects: \code{Xcenter} and \code{Xscale}}. //' } //' @author Leonardo Ramirez-Lopez //' @keywords internal @@ -1311,18 +1312,18 @@ Rcpp::NumericMatrix reconstruction_error(arma::mat x, //' @return //' if \code{statistics = true} a list containing the following one-row matrices: //' \itemize{ -//' \item{\code{rmse_seg}}{ the RMSEs.} -//' \item{\code{st_rmse_seg}}{ the standardized RMSEs.} -//' \item{\code{rsq_seg}}{ the coefficients of determination.} +//' \item{\code{rmse_seg}: the RMSEs.} +//' \item{\code{st_rmse_seg}: the standardized RMSEs.} +//' \item{\code{rsq_seg}: the coefficients of determination.} //' } //' //' if \code{statistics = false} a list containing the following one-row matrices: //' \itemize{ -//' \item{\code{predictions}}{ the predictions of each of the validation +//' \item{\code{predictions}: the predictions of each of the validation //' segments in \code{pindices}. Each column in \code{pindices} contains the //' validation indices of a segment.} -//' \item{\code{st_rmse_seg}}{ the standardized RMSEs.} -//' \item{\code{rsq_seg}}{ the coefficients of determination.} +//' \item{\code{st_rmse_seg}: the standardized RMSEs.} +//' \item{\code{rsq_seg}: the coefficients of determination.} //' } //' //' If \code{method = "wapls"}, data of the pls weights are output in this @@ -1652,10 +1653,10 @@ List opls_cv_cpp(arma::mat X, //' \code{'mpls'} for modified pls (using correlation between X and Y). //' @return a list containing the following elements: //' \itemize{ -//' \item{\code{ncomp}}{ the number of components.} -//' \item{\code{pred_response}}{ the response predictions for \code{Xu}.} -//' \item{\code{rmse_reconstruction}}{ the rmse of the reconstruction for \code{Xu}.} -//' \item{\code{score_dissimilarity}}{ the distance score between \code{Xr} and \code{Xu}.}} +//' \item{\code{ncomp}: the number of components.} +//' \item{\code{pred_response}: the response predictions for \code{Xu}.} +//' \item{\code{rmse_reconstruction}: the rmse of the reconstruction for \code{Xu}.} +//' \item{\code{score_dissimilarity}: the distance score between \code{Xr} and \code{Xu}.}} //' @author Leonardo Ramirez-Lopez //' @keywords internal //' @useDynLib resemble @@ -1826,14 +1827,14 @@ List opls_gs(arma::mat Xr, //' and the response variable must be scaled to zero mean and unit variance. //' @return a list containing the following elements: //' \itemize{ -//' \item{\code{b}}{ the regression coefficients.} -//' \item{\code{Xz}}{ the (final transformed) matrix of predictor variables.} -//' \item{\code{alpha}}{ the alpha matrix.} -//' \item{\code{is.scaled}}{ logical indicating whether both the predictors and response variable were scaled to zero mean and unit variance.} -//' \item{\code{Xcenter}}{ if matrix of predictors was scaled, the centering vector used for \code{X}.} -//' \item{\code{Xscale}}{ if matrix of predictors was scaled, the scaling vector used for \code{X}.} -//' \item{\code{Ycenter}}{ if matrix of predictors was scaled, the centering vector used for \code{Y}.} -//' \item{\code{Yscale}}{ if matrix of predictors was scaled, the scaling vector used for \code{Y}.} +//' \item{\code{b}: the regression coefficients.} +//' \item{\code{Xz}: the (final transformed) matrix of predictor variables.} +//' \item{\code{alpha}: the alpha matrix.} +//' \item{\code{is.scaled}: logical indicating whether both the predictors and response variable were scaled to zero mean and unit variance.} +//' \item{\code{Xcenter}: if matrix of predictors was scaled, the centering vector used for \code{X}.} +//' \item{\code{Xscale}: if matrix of predictors was scaled, the scaling vector used for \code{X}.} +//' \item{\code{Ycenter}: if matrix of predictors was scaled, the centering vector used for \code{Y}.} +//' \item{\code{Yscale}: if matrix of predictors was scaled, the scaling vector used for \code{Y}.} //' } //' @author Leonardo Ramirez-Lopez //' @keywords internal @@ -1905,7 +1906,6 @@ List gaussian_process(arma::mat X, //' @title Prediction function for the \code{gaussian_process} function (Gaussian process regression with dot product covariance) //' @description Predicts response values based on a model generated by the \code{gaussian_process} function (Gaussian process regression with dot product covariance). For internal use only!. //' @usage predict_gaussian_process(Xz, alpha, newdata, scale, Xcenter, Xscale, Ycenter, Yscale) -//' @param b the regression coefficients. //' @param newdata a matrix containing the predictor variables //' @param scale a logical indicating whether the matrix of predictors used to create the regression model //' (in the \code{gaussian_process} function) was scaled @@ -1957,7 +1957,6 @@ NumericVector predict_gaussian_process(arma::mat Xz, //' @param pindices a matrix with \code{k} rows and \code{m} columns where \code{m} is equivalent to the number of //' resampling iterations. The elements of each column indicate the indices of the observations to be used for predicting at each //' iteration. -//' @param ncomp an integer indicating the number of pls components. //' @param scale a logical indicating whether both the predictors //' and the response variable must be scaled to zero mean and unit variance. //' @param statistics a logical value indicating whether the precision and @@ -1965,9 +1964,9 @@ NumericVector predict_gaussian_process(arma::mat Xz, //' validation segment are retrieved. //' @return a list containing the following one-row matrices: //' \itemize{ -//' \item{\code{rmse.seg}}{ the RMSEs.} -//' \item{\code{st.rmse.seg}}{ the standardized RMSEs.} -//' \item{\code{rsq.seg}}{ the coefficients of determination.} +//' \item{\code{rmse.seg}: the RMSEs.} +//' \item{\code{st.rmse.seg}: the standardized RMSEs.} +//' \item{\code{rsq.seg}: the coefficients of determination.} //' } //' @author Leonardo Ramirez-Lopez //' @keywords internal @@ -2062,7 +2061,6 @@ List gaussian_process_cv(arma::mat X, //' pcSelmethod = "var", //' pcSelvalue = 0.01) //' @param X a matrix of predictor variables. -//' @param Y a matrix of either a single or multiple response variables. //' @param ncomp the number of pls components. //' @param scale logical indicating whether \code{X} must be scaled. //' @param maxiter maximum number of iterations. @@ -2079,10 +2077,10 @@ List gaussian_process_cv(arma::mat X, //' specifying the desired number of principal components to retain. Default is 0.01. //' @return a list containing the following elements: //' \itemize{ -//' \item{\code{pc_scores}}{ a matrix of principal component scores.} -//' \item{\code{pc_loadings}}{ a matrix of of principal component loadings.} -//' \item{\code{variance}}{ a matrix of the variance of the principal components.} -//' \item{\code{scale}}{ a \code{list} conating two objects: \code{center} and \code{scale}, which correspond to the vectors used to center and scale the input matrix.} +//' \item{\code{pc_scores}: a matrix of principal component scores.} +//' \item{\code{pc_loadings}: a matrix of of principal component loadings.} +//' \item{\code{variance}: a matrix of the variance of the principal components.} +//' \item{\code{scale}: a \code{list} conating two objects: \code{center} and \code{scale}, which correspond to the vectors used to center and scale the input matrix.} //' } //' @author Leonardo Ramirez-Lopez //' @keywords internal diff --git a/vignettes/resemble.bib b/vignettes/resemble.bib index a7f52ff..1155981 100644 --- a/vignettes/resemble.bib +++ b/vignettes/resemble.bib @@ -106,9 +106,9 @@ @article{rossel2010using @article{stevens2020introduction, title={An introduction to the prospectr package}, author={Stevens, Antoine and Ramirez-Lopez, Leonardo}, - journal={R Package Vignette, Report No.: R Package Version 0.2.1}, + journal={R Package Vignette, Report No.: R Package Version 0.2.7}, volume={3}, - year={2020} + year={2024} } @inproceedings{wold1983multivariate,