Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

version 2.2.3 on CRAN #53

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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],
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
YEAR: 2014 - 2020
YEAR: 2014 - 2024
COPYRIGHT HOLDER: Leonardo Ramirez Lopez
14 changes: 11 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)`
Expand Down
128 changes: 63 additions & 65 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -643,17 +643,16 @@ 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
#' accuracy statistics are to be returned, otherwise the predictions for each
#' 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
Expand All @@ -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.
Expand All @@ -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
Expand Down
Loading