Learn R Programming

⚠️There's a newer version (0.14.2) of this package.Take me there.

Multivariate Data Analysis Tools

mdatools is an R package for preprocessing, exploring and analysis of multivariate data. The package provides methods mostly common for Chemometrics. It was created for an introductory PhD course on Chemometrics given at Section of Chemical Engineering, Aalborg University.

The general idea of the package is to collect most widespread chemometric methods and give a similar "user interface" (or rather API) for using them. So if a user knows how to make a model and visualise results for one method, he or she can easily do this for the others.

For more details and examples read a Bookdown tutorial.

What is new

New minor release (0.9.4) is available both from GitHub and CRAN (from 24.05.2019).

The latest major release (0.9.0) brings a set of new features, including methods for computing of critical limits for PCA/SIMCA residuals, adjuested residuals plot, and randomized algorithms for fast PCA decomposition of dataset with large number of rows. The text of tutorial has been amended correspondingly and now also includes a new chapter with detailed explanation of calculation of the critical limits.

A full list of changes is available here

How to install

The package is available from CRAN by usual installing procedure. However due to restrictions in CRAN politics regarding number of submissions (one in 3-4 month) only major releases will be published there (with 2-3 weeks delay after GitHub release as more thorought testing is needed). To get the latest release plase use GitHub sources. You can download a zip-file with source package and install it using the install.packages command, e.g. if the downloaded file is mdatools_0.9.4.tar.gz and it is located in a current working directory, just run the following:

install.packages('mdatools_0.9.4.tar.gz')

If you have devtools package installed, the following command will install the latest release from the master branch of GitHub repository (do not forget to load the devtools package first):

install_github('svkucheryavski/mdatools')

Copy Link

Version

Install

install.packages('mdatools')

Monthly Downloads

852

Version

0.9.4

License

MIT + file LICENSE

Maintainer

Sergey Kucheryavskiy

Last Published

May 24th, 2019

Functions in mdatools (0.9.4)

classres

Results of classification
getClassificationPerformance

Calculation of classification performance parameters
getCalibrationData.simcam

Get calibration data
getSelectedComponents.classres

Get selected components
getSelectivityRatio

Selectivity ratio
crossval

Generate sequence of indices for cross-validation
as.matrix.plsdares

as.matrix method for PLS-DA results
ipls

Variable selection with interval PLS
ipls.backward

Runs the backward iPLS algorithm
as.matrix.plsres

as.matrix method for PLS results
as.matrix.classres

as.matrix method for classification results
getConfusionMatrix

Confusion matrix for classification results
as.matrix.ldecomp

as.matrix method for ldecomp object
mda.getattr

Get data attributes
errorbars

Show error bars on a plot
getConfusionMatrix.classres

Confusion matrix for classification results
getCalibrationData

Calibration data
as.matrix.regcoeffs

as.matrix method for regression coefficients class
as.matrix.regres

as.matrix method for regression results
getB

Low-dimensional approximation of data matrix X
getVIPScores

VIP scores
getSelectivityRatio.pls

Selectivity ratio for PLS model
ldecomp.getDistances

Residuals distances for linear decomposition
ldecomp.getVariances

Explained variance for linear decomposition
mda.inclrows

include/unhide the excluded rows
mda.rbind

A wrapper for rbind() method with proper set of attributes
mda.t

A wrapper for t() method with proper set of attributes
mdaplot

Plotting function for a single set of objects
getCalibrationData.pca

Get calibration data
getRegcoeffs.pls

Regression coefficients for PLS model'
getSelectedComponents

Get selected components
getProbabilities

Get class belonging probability
getMainTitle

Get main title
mda.inclcols

Include/unhide the excluded columns
ipls.forward

Runs the forward iPLS algorithm
ldecomp

Linear decomposition of data
mda.im2data

Convert image to data matrix
mda.getexclind

Get indices of excluded rows or columns
ldecomp.plotLimits

Shows lines with critical limits on residuals plot
mdaplot.plotAxes

Create axes plane
mda.setattr

Set data attributes
mda.cbind

A wrapper for cbind() method with proper set of attributes
mdaplot.showColorbar

Plot colorbar
mda.df2mat

Convert data frame to a matrix
mdaplot.getAxesLim

Calculate axes limits
mda.data2im

Convert data matrix to an image
pca.mvreplace

Replace missing values in data
pca.nipals

NIPALS based PCA algorithm
mdaplot.getColors

Color values for plot elements
mdaplot.showLegend

Plot legend
mda.setimbg

Remove background pixels from image data
crossval.str

String with description of cross-validation method
plot.classres

Plot function for classification results
mdaplot.showLines

Plot lines
plot.ipls

Overview plot for iPLS results
plot.regres

plot method for regression results
mda.show

Wrapper for show() method
mda.subset

A wrapper for subset() method with proper set of attributed
mdatools

Package for Multivariate Data Analysis (Chemometrics)
mdaplot.showGrid

Plot grid
plot.simca

Model overview plot for SIMCA
pcares

Results of PCA decomposition
plotCorr.randtest

Correlation plot for randomization test results
plot.plsdares

Overview plot for PLS-DA results
erfinv

Inverse error function
pca

Principal Component Analysis
plot.plsres

Overview plot for PLS results
pellets

Image data
pca.run

Runs one of the selected PCA methods
getProbabilities.simca

Probability of class belonging for PCA/SIMCA results
pca.svd

Singular Values Decomposition based PCA algorithm
plotHist.randtest

Histogram plot for randomization test results
plotBiplot.pca

PCA biplot
plotModelDistance.simcam

Modelling distance plot for SIMCAM model
plot.pca

Model overview plot for PCA
plotBiplot

Biplot
plot.pcares

Plot method for PCA results object
plotHist

Statistic histogram
plotModellingPower

Modelling power plot
getRegcoeffs

Get regression coefficients
plotProbabilities

Plot for class belonging probability
plotPredictions.regres

Predictions plot for regression results
plotDiscriminationPower.simcam

Discrimination power plot for SIMCAM model
plotCorr

Correlation plot
plotCooman.simcamres

Cooman's plot for SIMCAM results
plotDiscriminationPower

Discrimination power plot
plotScores

Scores plot
plotProbabilities.classres

Plot for class belonging probability
plotRMSE

RMSE plot
plotScores.ldecomp

Scores plot for linear decomposition
mdaplot.showLabels

Plot labels Shows labels for data elements (points, bars) on a plot.
plotModellingPower.simca

Modelling power plot for SIMCA model
plotLoadings

Loadings plot
plotPredictions.pls

Predictions plot for PLS
plotCumVariance

Variance plot
plotLoadings.pca

Loadings plot for PCA
plotPredictions.plsres

Predictions plot for PLS results
getVIPScores.pls

VIP scores for PLS model
imshow

show image data as an image
plotModellingPower.simcam

Modelling power plot for SIMCAM model
plotPerformance.classres

Performance plot for classification results
plotRegcoeffs.pls

Regression coefficient plot for PLS
plotRMSE.pls

RMSE plot for PLS
plotResiduals.pcares

Residuals plot for PCA results
plotRMSE.ipls

RMSE development plot
pca.cal

PCA model calibration
plotPredictions

Predictions plot
plotVIPScores.pls

VIP scores plot for PLS model
plotVariance

Variance plot
plotXCumVariance.pls

Cumulative explained X variance plot for PLS
plotXCumVariance.plsres

Explained cumulative X variance plot for PLS results
plotXResiduals.plsres

X residuals plot for PLS results
plotXScores

X scores plot
plotCooman

Cooman's plot
plot.regcoeffs

Regression coefficients plot
plot.randtest

Plot for randomization test results
pca.crossval

Cross-validation of a PCA model
plotYResiduals.pls

Y residuals plot for PLS
mda.exclcols

Exclude/hide columns in a dataset
plotYResiduals.regres

Residuals plot for regression results
plotResiduals

Residuals plot
mda.exclrows

Exclude/hide rows in a dataset
plotYVariance.plsres

Explained Y variance plot for PLS results
plotVariance.pls

Variance plot for PLS
plotSelectivityRatio

Selectivity ratio plot
plotSpecificity.classres

Specificity plot for classification results
plotVIPScores

VIP scores plot
plotXCumVariance

X cumulative variance plot
plotSelection.ipls

iPLS performance plot
plotCooman.simcam

Cooman's plot for SIMCAM model
plotCumVariance.ldecomp

Cumulative explained variance plot for linear decomposition
plotCumVariance.pca

Cumulative explained variance plot for PCA
pls

Partial Least Squares regression
plotMisclassified

Misclassification ratio plot
plotMisclassified.classmodel

Misclassified ratio plot for classification model
plotXVariance.plsres

Explained X variance plot for PLS results
plotXYLoadings

X loadings plot
plotYVariance.pls

Explained Y variance plot for PLS
plotYVariance

Y variance plot
pls.run

Runs selected PLS algorithm
mdaplot.areColors

Check color values
pls.simpls

SIMPLS algorithm
prep.autoscale

Autoscale values
plotPredictions.classmodel

Predictions plot for classification model
prep.msc

Multiplicative Scatter Correction transformation
predict.pls

PLS predictions
mdaplotg

Plotting function for several sets of objects
mdaplot.formatValues

Format vector with numeric values
mdaplot.showRegressionLine

Regression line for data points
prep.snv

Standard Normal Variate transformation
print.classres

Print information about classification result object
print.regres

print method for regression results object
plotResiduals.simcam

Residuals plot for SIMCAM model
people

People data
print.simca

Print method for SIMCA model object
plotSensitivity.classmodel

Sensitivity plot for classification model
plotVariance.ldecomp

Explained variance plot for linear decomposition
plotSensitivity.classres

Sensitivity plot for classification results
plotVariance.pca

Explained variance plot for PCA
reslim.dd

Statistical limits for Q and T2 residuals using Data Driven approach
predict.plsda

PLS-DA predictions
pinv

Pseudo-inverse matrix
reslim.hotelling

Calculates critical limits for T2-residuals using Hotelling T2 distribution
plotXVariance

X variance plot
print.pls

Print method for PLS model object
print.plsda

Print method for PLS-DA model object
print.randtest

Print method for randtest object
plotXVariance.pls

Explained X variance plot for PLS
plotYCumVariance.plsres

Explained cumulative Y variance plot for PLS results
plotYResiduals

Y residuals plot
plotPredictions.classres

Prediction plot for classification results
plot.pls

Model overview plot for PLS
pls.calculateVIPScores

VIP scores calculation for PLS model
setResLimits

Set residual limits for PCA model
plotResiduals.ldecomp

Residuals plot for linear decomposition
print.regcoeffs

print method for regression coefficients class
regres.slope

Slope
setResLimits.pca

Set statistical limits for Q and T2 residuals for PCA model
reslim.chisq

Calculates critical limits or statistic values for Q-residuals using Chi-squared distribution
pls.crossval

Cross-validation of a PLS model
predict.simca

SIMCA predictions
summary.ldecomp

Summary statistics for linear decomposition
reslim.jm

Calculates critical limits for Q-residuals using classic JM approach
plot.plsda

Model overview plot for PLS-DA
plotResiduals.pca

Residuals plot for PCA
plot.simcam

Model overview plot for SIMCAM
print.ipls

Print method for iPLS
predict.simcam

SIMCA multiple classes predictions
print.ldecomp

Print method for linear decomposition
plotScores.pca

Scores plot for PCA
print.simcam

Print method for SIMCAM model object
plot.simcamres

Model overview plot for SIMCAM results
selectCompNum

Select optimal number of components for a model
plotExtreme

Shows extreme plot for SIMCA model
plotExtreme.simca

Shows extreme plot for SIMCA model
summary.pca

Summary method for PCA model object
simcam.getPerformanceStatistics

Performance statistics for SIMCAM model
simcamres

Results of SIMCA multiclass classification
print.simcamres

Print method for SIMCAM results object
summary.simca

Summary method for SIMCA model object
plotSelection

Selected intervals plot
plotMisclassified.classres

Misclassified ratio plot for classification results
summary.pcares

Summary method for PCA results object
summary.simcam

Summary method for SIMCAM model object
plotModelDistance

Model distance plot
summary.pls

Summary method for PLS model object
plotSpecificity

Specificity plot
summary.simcamres

Summary method for SIMCAM results object
plotPerformance

Classification performance plot
plotSpecificity.classmodel

Specificity plot for classification model
regres

Regression results
regres.bias

Prediction bias
selectCompNum.pca

Select optimal number of components for PCA model
summary.simcares

Summary method for SIMCA results object
plotPerformance.classmodel

Performance plot for classification model
plotRMSE.regres

RMSE plot for regression results
selectCompNum.pls

Select optimal number of components for PLS model
plotXLoadings

X loadings plot
plotRegcoeffs

Regression coefficients plot
plotXLoadings.pls

X loadings plot for PLS
plotXYLoadings.pls

XY loadings plot for PLS
plotResiduals.simcamres

Residuals plot for SIMCAM results
simcares

Results of SIMCA one-class classification @description simcares is used to store results for SIMCA one-class classification.
simdata

Spectral data of polyaromatic hydrocarbons mixing
plotResiduals.simcares

Residuals plot for SIMCA results
summary.regres

summary method for regression results object
summary.regcoeffs

Summary method for regcoeffs object
plotSelectivityRatio.pls

Selectivity ratio plot for PLS model
plotXYScores

XY scores plot
plotSensitivity

Sensitivity plot
plotXYScores.pls

XY scores plot for PLS
plotXYScores.plsres

XY scores plot for PLS results
plotXResiduals

X residuals plot
plotXResiduals.pls

X residuals plot for PLS
plotXScores.pls

X scores plot for PLS
plotXScores.plsres

X scores plot for PLS results
plotYCumVariance

Y cumulative variance plot
pls.cal

PLS model calibration
plotYCumVariance.pls

Cumulative explained Y variance plot for PLS
pls.calculateSelectivityRatio

Selectivity ratio calculation
plsda

Partial Least Squares Discriminant Analysis
plsda.cal

Calibrate PLS-DA model
plsda.crossval

Cross-validation of a PLS-DA model
plsdares

PLS-DA results
plsres

PLS results
predict.pca

PCA predictions
print.pca

Print method for PCA model object
print.pcares

Print method for PCA results object
print.simcares

Print method for SIMCA results object
randtest

Randomization test for PLS regression
prep.norm

Normalization
prep.savgol

Savytzky-Golay filter
print.plsdares

Print method for PLS-DA results object
regcoeffs

Regression coefficients
print.plsres

print method for PLS results object
regcoeffs.getStat

Confidence intervals and p-values for regression coeffificents
showPredictions

Predictions
regres.r2

Determination coefficient
showPredictions.classres

Show predicted class values
regres.rmse

RMSE
simca

SIMCA one-class classification
simca.classify

SIMCA classification
summary.classres

Summary statistics about classification result object
summary.ipls

Summary for iPLS results
simca.crossval

Cross-validation of a SIMCA model
summary.plsres

summary method for PLS results object
simcam

SIMCA multiclass classification
summary.plsda

Summary method for PLS-DA model object
summary.randtest

Summary method for randtest object
summary.plsdares

Summary method for PLS-DA results object
bars

Show bars on axes
classify.plsda

PLS-DA classification