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" 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.1) is available both from GitHub and CRAN (from 07.07.2018).

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.1.tar.gz and it is located in a current working directory, just run the following:

install.packages('mdatools_0.9.1.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.1

License

MIT + file LICENSE

Maintainer

Sergey Kucheryavskiy

Last Published

July 6th, 2018

Functions in mdatools (0.9.1)

classres

Results of classification
as.matrix.plsdares

as.matrix method for PLS-DA results
getConfusionMatrix.classres

Confusion matrix for classification results
as.matrix.plsres

as.matrix method for PLS results
getProbabilities.simca

Probability of class belonging for PCA/SIMCA results
getRegcoeffs

Get regression coefficients
mda.inclrows

include/unhide the excluded rows
getCalibrationData.simcam

Get calibration data
getClassificationPerformance

Calculation of classification performance parameters
mda.rbind

A wrapper for rbind() method with proper set of attributes
mdaplot.getAxesLim

Calculate axes limits
mdaplot.getColors

Color values for plot elements
mdaplot.showRegressionLine

Regression line for data points
bars

Show bars on axes
getRegcoeffs.pls

Regression coefficients for PLS model'
mdaplotg

Plotting function for several sets of objects
classify.plsda

PLS-DA classification
pcares

Results of PCA decomposition
pellets

Image data
getSelectedComponents

Get selected components
getCalibrationData

Calibration data
ldecomp.getVariances

Explained variance for linear decomposition
ldecomp.getDistances

Residuals distances for linear decomposition
plot.pca

Model overview plot for PCA
plot.regres

plot method for regression results
plot.pcares

Plot method for PCA results object
mda.exclcols

Exclude/hide columns in a dataset
getCalibrationData.pca

Get calibration data
plot.simca

Model overview plot for SIMCA
as.matrix.regcoeffs

as.matrix method for regression coefficients class
getSelectivityRatio.pls

Selectivity ratio for PLS model
plotPerformance

Classification performance plot
getVIPScores

VIP scores
as.matrix.regres

as.matrix method for regression results
mda.exclrows

Exclude/hide rows in a dataset
crossval.str

String with description of cross-validation method
ipls.forward

Runs the forward iPLS algorithm
plotPerformance.classmodel

Performance plot for classification model
ldecomp

Linear decomposition of data
mda.setattr

Set data attributes
plotProbabilities.classres

Plot for class belonging probability
mda.show

Wrapper for show() method
plotRMSE

RMSE plot
erfinv

Inverse error function
getVIPScores.pls

VIP scores for PLS model
imshow

show image data as an image
mda.im2data

Convert image to data matrix
mda.subset

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

Specificity plot
plotSpecificity.classmodel

Specificity plot for classification model
plotXYScores.pls

XY scores plot for PLS
mdaplot.plotAxes

Create axes plane
pls.calculateVIPScores

VIP scores calculation for PLS model
plotXYLoadings.pls

XY loadings plot for PLS
mdaplot.showColorbar

Plot colorbar
mda.inclcols

Include/unhide the excluded columns
plotXYScores

XY scores plot
plotXYScores.plsres

XY scores plot for PLS results
pls.crossval

Cross-validation of a PLS model
mdaplot.showGrid

Plot grid
plsres

PLS results
pca.mvreplace

Replace missing values in data
mdaplot.showLabels

Plot labels Shows labels for data elements (points, bars) on a plot.
as.matrix.ldecomp

as.matrix method for ldecomp object
as.matrix.classres

as.matrix method for classification results
mda.setimbg

Remove background pixels from image data
pca.nipals

NIPALS based PCA algorithm
mdatools

Package for Multivariate Data Analysis (Chemometrics)
getB

Low-dimensional approximation of data matrix X
errorbars

Show error bars on a plot
pca

Principal Component Analysis
getSelectedComponents.classres

Get selected components
people

People data
pca.cal

PCA model calibration
getSelectivityRatio

Selectivity ratio
plot.classres

Plot function for classification results
pinv

Pseudo-inverse matrix
plot.ipls

Overview plot for iPLS results
predict.pca

PCA predictions
pca.crossval

Cross-validation of a PCA model
plotBiplot

Biplot
plot.plsdares

Overview plot for PLS-DA results
plotBiplot.pca

PCA biplot
print.pcares

Print method for PCA results object
ipls

Variable selection with interval PLS
print.pca

Print method for PCA model object
mda.data2im

Convert data matrix to an image
ipls.backward

Runs the backward iPLS algorithm
plotCorr.randtest

Correlation plot for randomization test results
plot.plsres

Overview plot for PLS results
plotCumVariance

Variance plot
print.plsdares

Print method for PLS-DA results object
plotCooman.simcamres

Cooman's plot for SIMCAM results
plotModellingPower.simca

Modelling power plot for SIMCA model
plot.randtest

Plot for randomization test results
plotCorr

Correlation plot
plot.regcoeffs

Regression coefficients plot
mda.df2mat

Convert data frame to a matrix
plotDiscriminationPower.simcam

Discrimination power plot for SIMCAM model
plotDiscriminationPower

Discrimination power plot
plot.simcamres

Model overview plot for SIMCAM results
plotLoadings

Loadings plot
plot.simcam

Model overview plot for SIMCAM
getMainTitle

Get main title
print.plsres

print method for PLS results object
plotCumVariance.ldecomp

Cumulative explained variance plot for linear decomposition
getProbabilities

Get class belonging probability
plotLoadings.pca

Loadings plot for PCA
plotPredictions.pls

Predictions plot for PLS
ldecomp.plotLimits

Shows lines with critical limits on residuals plot
plotModellingPower.simcam

Modelling power plot for SIMCAM model
mda.cbind

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

Check color values
regres.r2

Determination coefficient
plotCumVariance.pca

Cumulative explained variance plot for PCA
mda.getattr

Get data attributes
pca.run

Runs one of the selected PCA methods
mdaplot.formatValues

Format vector with numeric values
plotModelDistance

Model distance plot
pca.svd

Singular Values Decomposition based PCA algorithm
plotMisclassified.classres

Misclassified ratio plot for classification results
mda.getexclind

Get indices of excluded rows or columns
plotRMSE.ipls

RMSE development plot
plotPredictions.plsres

Predictions plot for PLS results
mda.t

A wrapper for t() method with proper set of attributes
plotPredictions.classmodel

Predictions plot for classification model
regres.rmse

RMSE
mdaplot

Plotting function for a single set of objects
plotRMSE.pls

RMSE plot for PLS
simca

SIMCA one-class classification
plotPerformance.classres

Performance plot for classification results
plotExtreme

Shows extreme plot for SIMCA model
plotPredictions

Predictions plot
plotPredictions.classres

Prediction plot for classification results
plotResiduals.ldecomp

Residuals plot for linear decomposition
simca.classify

SIMCA classification
plotSensitivity

Sensitivity plot
plotExtreme.simca

Shows extreme plot for SIMCA model
plotSelectivityRatio.pls

Selectivity ratio plot for PLS model
plotScores.ldecomp

Scores plot for linear decomposition
plotXCumVariance.pls

Cumulative explained X variance plot for PLS
mdaplot.showLegend

Plot legend
plotMisclassified

Misclassification ratio plot
plotScores

Scores plot
plotXCumVariance.plsres

Explained cumulative X variance plot for PLS results
plotXVariance.plsres

Explained X variance plot for PLS results
plotXYLoadings

X loadings plot
summary.pcares

Summary method for PCA results object
mdaplot.showLines

Plot lines
plotScores.pca

Scores plot for PCA
plotResiduals.pca

Residuals plot for PCA
summary.pls

Summary method for PLS model object
plotVIPScores.pls

VIP scores plot for PLS model
plotVariance

Variance plot
plotMisclassified.classmodel

Misclassified ratio plot for classification model
plot.pls

Model overview plot for PLS
plotSelection

Selected intervals plot
plotCooman

Cooman's plot
plot.plsda

Model overview plot for PLS-DA
plotPredictions.regres

Predictions plot for regression results
plotResiduals.simcam

Residuals plot for SIMCAM model
plotResiduals.pcares

Residuals plot for PCA results
plotCooman.simcam

Cooman's plot for SIMCAM model
plotHist

Statistic histogram
plotXLoadings

X loadings plot
plotYCumVariance.plsres

Explained cumulative Y variance plot for PLS results
plotHist.randtest

Histogram plot for randomization test results
plotXLoadings.pls

X loadings plot for PLS
plotModelDistance.simcam

Modelling distance plot for SIMCAM model
plotYCumVariance

Y cumulative variance plot
plotYResiduals

Y residuals plot
plotRMSE.regres

RMSE plot for regression results
plotProbabilities

Plot for class belonging probability
plotRegcoeffs

Regression coefficients plot
plotVariance.ldecomp

Explained variance plot for linear decomposition
plotYCumVariance.pls

Cumulative explained Y variance plot for PLS
plotModellingPower

Modelling power plot
plsda

Partial Least Squares Discriminant Analysis
plsda.cal

Calibrate PLS-DA model
pls.cal

PLS model calibration
predict.pls

PLS predictions
plotRegcoeffs.pls

Regression coefficient plot for PLS
pls.calculateSelectivityRatio

Selectivity ratio calculation
predict.plsda

PLS-DA predictions
plotResiduals

Residuals plot
plotResiduals.simcamres

Residuals plot for SIMCAM results
plsda.crossval

Cross-validation of a PLS-DA model
plotResiduals.simcares

Residuals plot for SIMCA results
print.ldecomp

Print method for linear decomposition
plotSelection.ipls

iPLS performance plot
print.ipls

Print method for iPLS
print.simcam

Print method for SIMCAM model object
plotSelectivityRatio

Selectivity ratio plot
plotSpecificity.classres

Specificity plot for classification results
plsdares

PLS-DA results
plotSensitivity.classmodel

Sensitivity plot for classification model
print.pls

Print method for PLS model object
print.simcamres

Print method for SIMCAM results object
print.plsda

Print method for PLS-DA model object
plotSensitivity.classres

Sensitivity plot for classification results
plotXVariance

X variance plot
plotVariance.pca

Explained variance plot for PCA
plotVariance.pls

Variance plot for PLS
regres.slope

Slope
reslim.chisq

Calculates critical limits or statistic values for Q-residuals using Chi-squared distribution
plotVIPScores

VIP scores plot
plotXVariance.pls

Explained X variance plot for PLS
plotYVariance

Y variance plot
plotYVariance.pls

Explained Y variance plot for PLS
plotXCumVariance

X cumulative variance plot
plotXResiduals.plsres

X residuals plot for PLS results
plotYVariance.plsres

Explained Y variance plot for PLS results
plotXScores

X scores plot
prep.norm

Normalization
prep.savgol

Savytzky-Golay filter
pls

Partial Least Squares regression
plotXResiduals

X residuals plot
print.regres

print method for regression results object
predict.simca

SIMCA predictions
print.simcares

Print method for SIMCA results object
randtest

Randomization test for PLS regression
plotXScores.pls

X scores plot for PLS
setResLimits

Set residual limits for PCA model
plotXResiduals.pls

X residuals plot for PLS
regcoeffs

Regression coefficients
predict.simcam

SIMCA multiple classes predictions
regcoeffs.getStat

Confidence intervals and p-values for regression coeffificents
reslim.jm

Calculates critical limits for Q-residuals using classic JM approach
print.randtest

Print method for randtest object
print.simca

Print method for SIMCA model object
setResLimits.pca

Set statistical limits for Q and T2 residuals for PCA model
print.regcoeffs

print method for regression coefficients class
plotXScores.plsres

X scores plot for PLS results
reslim.dd

Statistical limits for Q and T2 residuals using Data Driven approach
summary.ldecomp

Summary statistics for linear decomposition
reslim.hotelling

Calculates critical limits for T2-residuals using Hotelling T2 distribution
selectCompNum.pca

Select optimal number of components for PCA model
summary.pca

Summary method for PCA model object
regres

Regression results
selectCompNum.pls

Select optimal number of components for PLS model
simcam.getPerformanceStatistics

Performance statistics for SIMCAM model
plotYResiduals.pls

Y residuals plot for PLS
regres.bias

Prediction bias
summary.plsda

Summary method for PLS-DA model object
simcamres

Results of SIMCA multiclass classification
summary.plsdares

Summary method for PLS-DA results object
plotYResiduals.regres

Residuals plot for regression results
pls.run

Runs selected PLS algorithm
selectCompNum

Select optimal number of components for a model
pls.simpls

SIMPLS algorithm
prep.autoscale

Autoscale values
summary.classres

Summary statistics about classification result object
showPredictions

Predictions
showPredictions.classres

Show predicted class values
prep.msc

Multiplicative Scatter Correction transformation
summary.ipls

Summary for iPLS results
summary.simcamres

Summary method for SIMCAM results object
prep.snv

Standard Normal Variate transformation
print.classres

Print information about classification result object
simca.crossval

Cross-validation of a SIMCA model
summary.simcares

Summary method for SIMCA results object
simcares

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

summary method for PLS results object
summary.randtest

Summary method for randtest object
simdata

Spectral data of polyaromatic hydrocarbons mixing
summary.simca

Summary method for SIMCA model object
summary.simcam

Summary method for SIMCAM model object
simcam

SIMCA multiclass classification
summary.regcoeffs

Summary method for regcoeffs object
summary.regres

summary method for regression results object
getConfusionMatrix

Confusion matrix for classification results
crossval

Generate sequence of indices for cross-validation