# NMath User's Guide

48.4 Analysis of Variance (.NET, C#, CSharp, VB, Visual Basic, F#)

NMath Stats provides the classes PLS1Anova and PLS2Anova for performing a classic analysis of variance (ANOVA) for PLS1 and PLS2 regression models. These classes calculate the sum of squares total, sum of squares residual, mean square error for prediction, and the coefficient of determination. For instance:

Code Example – C# partial least squares (PLS)

```var plsAnova = new PLS2Anova(pls);
```
```DoubleVector ssTotal = plsAnova.SumOfSquaresTotal;
```
```DoubleVector ssResiduals = plsAnova.SumOfSquaresResiduals;
```
```DoubleVector se = plsAnova.StandardError;
```
```DoubleVector rms = plsAnova.RootMeanSqrErrorPrediction;
```
```DoubleVector rSquared = plsAnova.CoefficientOfDetermination;
```

Code Example – VB partial least squares (PLS)

```Dim PlsAnova As New PLS2Anova(PLS)
```
```Dim SSTotal As DoubleVector = PlsAnova.SumOfSquaresTotal
```
```Dim SSResiduals As DoubleVector = PlsAnova.SumOfSquaresResiduals
```
```Dim SE As DoubleVector = PlsAnova.StandardError
```
```Dim RMS As DoubleVector = PlsAnova.RootMeanSqrErrorPrediction
```
```Dim RSquared As DoubleVector = PlsAnova.CoefficientOfDetermination
```

Top

Top