R/defaults.R

Defines functions plotXYResiduals plotWeights plotCorr plotHist plotXYLoadings plotXLoadings plotEigenvalues plotVariance plotResiduals plotRegcoeffs plotPredictions plotLoadings plotYCumVariance plotXCumVariance plotCumVariance plotRMSE plotSelection plotXYScores plotXScores plotScores plotBiplot plotYVariance plotXVariance plotYResiduals plotXResiduals showPredictions plotPerformance plotSensitivity plotSpecificity plotMisclassified plotModellingPower getCalibrationData plotDiscriminationPower plotModelDistance plotCooman selectCompNum getSelectivityRatio plotSelectivityRatio getVIPScores plotVIPScores getRegcoeffs plotExtremes plotExtreme showDistanceLimits setDistanceLimits getProbabilities plotProbabilities getConfusionMatrix categorize plotContributions plotSpectra plotPurity plotPuritySpectra plotRMSERatio writeCSV writeJSON asvector asjson plotAcceptance plotDistances plotAliens plotSelectivityArea setParams plotFoM plotFoMs

Documented in asjson asvector categorize getCalibrationData getConfusionMatrix getProbabilities getRegcoeffs getSelectivityRatio getVIPScores plotAcceptance plotAliens plotBiplot plotContributions plotCooman plotCorr plotCumVariance plotDiscriminationPower plotDistances plotEigenvalues plotExtreme plotExtremes plotFoM plotFoMs plotHist plotLoadings plotMisclassified plotModelDistance plotModellingPower plotPerformance plotPredictions plotProbabilities plotPurity plotPuritySpectra plotRegcoeffs plotResiduals plotRMSE plotRMSERatio plotScores plotSelection plotSelectivityArea plotSelectivityRatio plotSensitivity plotSpecificity plotSpectra plotVariance plotVIPScores plotWeights plotXCumVariance plotXLoadings plotXResiduals plotXScores plotXVariance plotXYLoadings plotXYResiduals plotXYScores plotYCumVariance plotYResiduals plotYVariance selectCompNum setDistanceLimits setParams showDistanceLimits showPredictions writeCSV writeJSON

#' Show plot with several figures of merit vs. number of components (generic function).
#'
#' @param obj
#' result object, e.g. \code{ddsimcares}
#' @param ...
#' other parameters relevant for the method
#'
#' @export
plotFoMs <- function(obj, ...) {
   UseMethod("plotFoMs")
}


#' Show plot with figure of merit vs. number of components (generic function).
#'
#' @param obj
#' result object, e.g. \code{ddsimcares}
#' @param ...
#' other parameters relevant for the method
#'
#' @export
plotFoM <- function(obj, ...) {
   UseMethod("plotFoM")
}


#' Set model parameters other than number of components (generic function)
#'
#' @param obj
#' model object, e.g. \code{ddsimca}
#' @param ...
#' other parameters relevant for the method
#'
#' @export
setParams <- function(obj, ...) {
   UseMethod("setParams")
}


#' Selectivity vs sensitivity plot for DD-SIMCA results (generic function)
#'
#' @param obj
#' result object, e.g. \code{ddsimcares}
#' @param ...
#' other parameters relevant for the plot
#'
#' @export
plotSelectivityArea <- function(obj, ...) {
   UseMethod("plotSelectivityArea")
}

#' Aliens plot for DD-SIMCA results (generic function)
#'
#' @param obj
#' result object, e.g. \code{ddsimcares}
#' @param ...
#' other parameters relevant for the plot
#'
#' @export
plotAliens <- function(obj, ...) {
   UseMethod("plotAliens")
}


#' Distance plot for model and results (generic function)
#'
#' @param obj
#' model or result object, e.g. \code{ddsimcares}
#' @param ...
#' other parameters relevant for the plot
#'
#' @export
plotDistances <- function(obj, ...) {
   UseMethod("plotDistances")
}


#' Acceptance plot for DDSIMCA model and results (generic function)
#'
#' @param obj
#' model or result object, e.g. \code{ddsimcares}
#' @param ...
#' other parameters relevant for the plot
#'
#' @export
plotAcceptance <- function(obj, ...) {
   UseMethod("plotAcceptance")
}


#' S3 implementation of asjson() method
#'
#' @param obj
#' object of any class, e.g. \code{pca}
#' @param ...
#' other parameters relevant for the method
#'
#' @export
asjson <- function(obj, ...) {
   UseMethod("asjson")
}


#' S3 implementation of as.vector() method
#'
#' @param obj
#' object of any class, e.g. \code{pca}
#'
#' @export
asvector <- function(obj) {
   UseMethod("asvector")
}


#' Save model as JSON file
#'
#' @param obj
#' model object, e.g. \code{pca}
#' @param fileName
#' name (or full path) to JSON file to be created.
#'
#' @export
writeJSON <- function(obj, fileName) {
   UseMethod("writeJSON")
}


#' Method to write outcomes of any result object to CSV file
#'
#' @param res
#' result object (\code{plsres}, \code{pcares}, etc.).
#' @param fileName
#' name (or full path) to CSV file to be created.
#' @param name
#' short name of the result object (e.g. \code{"cal"}, \code{"test"}. etc.).
#' @param sep
#' values separator (either \code{","} or \code{";"}).
#' @param dataFile
#' optional, name of the data file used to create the results.
#' @param ...
#' other optional parameters
#'
#' @export
writeCSV <- function(res, fileName, name, sep = ",", dataFile = "", ...) {
   UseMethod("writeCSV")
}



#' Plot for ratio RMSEC/RMSECV vs RMSECV
#' @param obj
#' object with any regression model
#' @param ...
#' other parameters
#'
#' @export
plotRMSERatio <- function(obj, ...) {
   UseMethod("plotRMSERatio")
}

#' Plot purity spectra
#' @param obj
#' object with mcr pure case
#' @param ...
#' other parameters
#'
#' @export
plotPuritySpectra <- function(obj, ...) {
   UseMethod("plotPuritySpectra")
}

#' Plot purity values
#' @param obj
#' object with mcr pure case
#' @param ...
#' other parameters
#'
#' @export
plotPurity <- function(obj, ...) {
   UseMethod("plotPurity")
}

#' Plot resolved spectra
#' @param obj
#' object with mcr case
#' @param ...
#' other parameters
#'
#' @export
plotSpectra <- function(obj, ...) {
   UseMethod("plotSpectra")
}

#' Plot resolved contributions
#' @param obj
#' object with mcr case
#' @param ...
#' other parameters
#'
#' @export
plotContributions <- function(obj, ...) {
   UseMethod("plotContributions")
}

#' Categorize PCA results
#' @param obj
#' object with PCA model
#' @param ...
#' other parameters
#'
#' @export
categorize <- function(obj, ...) {
   UseMethod("categorize")
}

#' Confusion matrix for classification results
#'
#' @details
#' Returns confusion matrix for classification results represented by the object.
#'
#' @param obj
#' classification results (object of class \code{simcares}, \code{simcamres}, etc)
#' @param ...
#' other parameters.
#'
#' @export
getConfusionMatrix <- function(obj, ...) {
   UseMethod("getConfusionMatrix")
}

#' Plot for class belonging probability
#'
#' @description
#' Makes a plot with class belonging probabilities for each object of the classification results.
#' Works only with classification methods, which compute this probability (e.g. SIMCA).
#'
#' @param obj
#' an object with classification results (e.g. SIMCA)
#' @param ...
#' other parameters
#'
#' @export
plotProbabilities <- function(obj, ...) {
   UseMethod("plotProbabilities")
}

#' Get class belonging probability
#'
#' @description
#' Compute class belonging probabilities for classification results.
#'
#' @param obj
#' an object with classification results (e.g. SIMCA)
#' @param ...
#' other parameters
#'
#' @export
getProbabilities <- function(obj, ...) {
   UseMethod("getProbabilities")
}

#' Set residual distance limits
#'
#' @description
#' Calculates and sets critical limits for residuals of PCA model
#'
#' @param obj
#' a model object
#' @param ...
#' other parameters
#'
#' @export
setDistanceLimits <- function(obj, ...) {
   UseMethod("setDistanceLimits")
}

#' Show residual distance limits
#'
#' @description
#' Shows critical limits for residuals of PCA model
#'
#' @param obj
#' a model object
#' @param ...
#' other parameters
#'
#' @export
showDistanceLimits <- function(obj, ...) {
   UseMethod("showDistanceLimits")
}

#' Shows extreme plot for PCA and DD-SIMCA models
#'
#' @description
#' Generic function for creating extreme plot for PCA and DD-SIMCA models
#'
#' @param obj
#' a PCA or DD-SIMCA model
#' @param ...
#' other parameters
#'
#' @export
plotExtreme <- function(obj, ...) {
   UseMethod("plotExtreme")
}

#' Shows extreme plot for PCA and DD-SIMCA models
#'
#' @description
#' Generic function for creating extreme plot for PCA and DD-SIMCA models
#'
#' @param obj
#' a PCA or DD-SIMCA model
#' @param ...
#' other parameters
#'
#' @export
plotExtremes <- function(obj, ...) {
   UseMethod("plotExtremes")
}

#' Get regression coefficients
#'
#' @description
#' Generic function for getting regression coefficients from PLS model
#'
#' @param obj
#' a PLS model
#' @param ...
#' other parameters
#'
#' @export
getRegcoeffs <- function(obj, ...) {
   UseMethod("getRegcoeffs")
}

#' VIP scores plot
#'
#' @description
#' Generic function for plotting VIP scores values for regression model (PCR, PLS, etc)
#'
#' @param obj
#' a regression model
#' @param ...
#' other parameters
#'
#' @export
plotVIPScores <- function(obj, ...) {
   UseMethod("plotVIPScores")
}

#' VIP scores
#'
#' @description
#' Generic function for returning VIP scores values for regression model (PCR, PLS, etc)
#'
#' @param obj
#' a regression model
#' @param ...
#' other parameters
#'
#' @export
getVIPScores <- function(obj, ...) {
   UseMethod("getVIPScores")
}

#' Selectivity ratio plot
#'
#' @description
#' Generic function for plotting selectivity ratio values for regression model (PCR, PLS, etc)
#'
#' @param obj
#' a regression model
#' @param ...
#' other parameters
#'
#' @export
plotSelectivityRatio <- function(obj, ...) {
   UseMethod("plotSelectivityRatio")
}

#' Selectivity ratio
#'
#' @description
#' Generic function for returning selectivity ratio values for regression model (PCR, PLS, etc)
#'
#' @param obj
#' a regression model
#' @param ...
#' other parameters
#'
#' @export
getSelectivityRatio <- function(obj, ...) {
   UseMethod("getSelectivityRatio")
}

#' Select optimal number of components for a model
#'
#' @description
#' Generic function for selecting number of components for multivariate models (e.g. PCA, PLS, ...)
#'
#' @param obj
#' a model object
#' @param ncomp
#' number of components to select
#' @param ...
#' other arguments
#'
#' @export
selectCompNum <- function(obj, ncomp = NULL, ...) {
   UseMethod("selectCompNum")
}

#' Cooman's plot
#'
#' @details
#' Generic function for Cooman's plot
#'
#' @param obj
#' classification model or result object
#' @param ...
#' other arguments
#'
#' @export
plotCooman <- function(obj, ...) {
   UseMethod("plotCooman")
}

#' Model distance plot
#'
#' @details
#' Generic function for plotting distance from object to a multivariate model
#'
#' @param obj
#' a model object
#' @param ...
#' other arguments
#'
#' @export
plotModelDistance <- function(obj, ...) {
   UseMethod("plotModelDistance")
}

#' Discrimination power plot
#'
#' @details
#' Generic function for plotting discrimination power values for classification model
#'
#' @param obj
#' a model object
#' @param ...
#' other arguments
#'
#' @export
plotDiscriminationPower <- function(obj, ...) {
   UseMethod("plotDiscriminationPower")
}

#' Calibration data
#'
#' @details
#' Generic function getting calibration data from a linear decomposition model (e.g. PCA)
#'
#' @param obj
#' a model object
#'
#' @export
getCalibrationData <- function(obj) {
   UseMethod("getCalibrationData")
}

#' Modelling power plot
#'
#' @details
#' Generic function for plotting modelling power values for classification model
#'
#' @param obj
#' a model object
#' @param ...
#' other arguments
#'
#' @export
plotModellingPower <- function(obj, ...) {
   UseMethod("plotModellingPower")
}

#' Misclassification ratio plot
#'
#' @details
#' Generic function for plotting misclassification values for classification model or results
#'
#' @param obj
#' a model or a result object
#' @param ...
#' other arguments
#'
#' @export
plotMisclassified <- function(obj, ...) {
   UseMethod("plotMisclassified")
}

#' Specificity plot
#'
#' @details
#' Generic function for plotting specificity values for classification model or results
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotSpecificity <- function(obj, ...) {
   UseMethod("plotSpecificity")
}

#' Sensitivity plot
#'
#' @details
#' Generic function for plotting sensitivity values for classification model or results
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotSensitivity <- function(obj, ...) {
   UseMethod("plotSensitivity")
}

#' Classification performance plot
#'
#' @details
#' Generic function for plotting classification performance for model or results
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotPerformance <- function(obj, ...) {
   UseMethod("plotPerformance")
}

#' Predictions
#'
#' @details
#' Generic function for showing predicted values for classification or regression model or results
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
showPredictions <- function(obj, ...) {
   UseMethod("showPredictions")
}

#' X residuals plot
#'
#' @details
#' Generic function for plotting x residuals for classification or regression model or results
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotXResiduals <- function(obj, ...) {
   UseMethod("plotXResiduals")
}

#' Y residuals plot
#'
#' @details
#' Generic function for plotting y residuals for classification or regression model or results
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotYResiduals <- function(obj, ...) {
   UseMethod("plotYResiduals")
}

#' X variance plot
#'
#' @details
#' Generic function for plotting explained variance for decomposition of x data
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotXVariance <- function(obj, ...) {
   UseMethod("plotXVariance")
}

#' Y variance plot
#'
#' @details
#' Generic function for plotting explained variance for decomposition of y data
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotYVariance <- function(obj, ...) {
   UseMethod("plotYVariance")
}

#' Biplot
#'
#' @details
#' Generic function for biplot
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotBiplot <- function(obj, ...) {
   UseMethod("plotBiplot")
}

#' Scores plot
#'
#' @details
#' Generic function for scores values for data decomposition
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotScores <- function(obj, ...) {
   UseMethod("plotScores")
}

#' X scores plot
#'
#' @details
#' Generic function for plotting scores values for decomposition of x data
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotXScores <- function(obj, ...) {
   UseMethod("plotXScores")
}

#' XY scores plot
#'
#' @details
#' Generic function for plotting scores values for decomposition of x and y data
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotXYScores <- function(obj, ...) {
   UseMethod("plotXYScores")
}

#' Selected intervals plot
#'
#' @details
#' Generic function for plotting selected intervals or variables
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotSelection <- function(obj, ...) {
   UseMethod("plotSelection")
}

#' RMSE plot
#'
#' @details
#' Generic function for plotting RMSE values vs. complexity of a regression model
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotRMSE <- function(obj, ...) {
   UseMethod("plotRMSE")
}

#' Variance plot
#'
#' @details
#' Generic function for plotting explained variance for data decomposition
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotCumVariance <- function(obj, ...) {
   UseMethod("plotCumVariance")
}

#' X cumulative variance plot
#'
#' @details
#' Generic function for plotting cumulative explained variance for decomposition of x data
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotXCumVariance <- function(obj, ...) {
   UseMethod("plotXCumVariance")
}

#' Y cumulative variance plot
#'
#' @details
#' Generic function for plotting cumulative explained variance for decomposition of y data
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotYCumVariance <- function(obj, ...) {
   UseMethod("plotYCumVariance")
}

#' Loadings plot
#'
#' @details
#' Generic function for plotting loadings values for data decomposition
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotLoadings <- function(obj, ...) {
   UseMethod("plotLoadings")
}

#' Predictions plot
#'
#' @details
#' Generic function for plotting predicted values for classification or regression model or results
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotPredictions <- function(obj, ...) {
   UseMethod("plotPredictions")
}

#' Regression coefficients plot
#'
#' @details
#' Generic function for plotting regression coefficients values for a regression model
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotRegcoeffs <- function(obj, ...) {
   UseMethod("plotRegcoeffs")
}

#' Residuals plot
#'
#' @details
#' Generic function for plotting residual values for data decomposition
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotResiduals <- function(obj, ...) {
   UseMethod("plotResiduals")
}

#' Variance plot
#'
#' @details
#' Generic function for plotting explained variance for data decomposition
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotVariance <- function(obj, ...) {
   UseMethod("plotVariance")
}

#' Eigenvalues plot
#'
#' @details
#' Generic function for plotting eigenvalues vs. number of components
#'
#' @param obj
#' a model object
#' @param ...
#' other arguments
#'
#' @export
plotEigenvalues <- function(obj, ...) {
   UseMethod("plotEigenvalues")
}

#' X loadings plot
#'
#' @details
#' Generic function for plotting loadings values for decomposition of x data
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotXLoadings <- function(obj, ...) {
   UseMethod("plotXLoadings")
}

#' XY loadings plot
#'
#' @details
#' Generic function for plotting loadings values for decomposition of x and y data
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotXYLoadings <- function(obj, ...) {
   UseMethod("plotXYLoadings")
}

#' Statistic histogram
#'
#' @details
#' Generic function for plotting statistic histogram plot
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotHist <- function(obj, ...) {
   UseMethod("plotHist")
}

#' Correlation plot
#'
#' @details
#' Generic function for correlation plot
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotCorr <- function(obj, ...) {
   UseMethod("plotCorr")
}

#' Plot for PLS weights
#'
#' @details
#' Generic function for weight plot
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotWeights <- function(obj, ...) {
   UseMethod("plotWeights")
}

#' Plot for XY-residuals
#'
#' @details
#' Generic function for XY-residuals plot
#'
#' @param obj
#' a model or result object
#' @param ...
#' other arguments
#'
#' @export
plotXYResiduals <- function(obj, ...) {
   UseMethod("plotXYResiduals")
}

Try the mdatools package in your browser

Any scripts or data that you put into this service are public.

mdatools documentation built on March 6, 2026, 5:08 p.m.