# Discrimprob

### Purpose

Calculate discriminate probabilities of discrete classes for continuous predicted values.

### Synopsis

- [prob,classes] = discrimprob(y,ypred,prior)

### Description

DISCRIMPROB examines the predictions of a PLS-D model (PLS-D models are trained on a standard x-block but with a y-block containing discrete class assignments for each sample). The predicted y-value from the PLS-D model will be a continuous variable that can be interpreted as a class similarity index. DISCRIMPROB uses the actual class asignments and the model y-value predictions to create a probability table that indicates, for a given predicted y-value, the probability that the given value belongs to each of the original classes.

Inputs are y the original logical classes for each sample, ypred the observed continuous predicted values for those samples and prior an optional input of the prior probabilities for each class. prior should be a vector representing the probability of observing each class in the entire population. Default prior probabilities is 1.

Output prob is a lookup matrix consisting of an index of observed y-values in the first column, and the probability of that value being of each class in the subsequent columns. The second output classes is the discrete classes observed in y, corresponding to the additional columns of prob.

To predict the probability that the observed value ypred is in class classes(n) use:

- classprob = interp1(prob(:,1),prob(:,n+1),ypred)

#### Inputs

**y**- original logical classes for each sample**ypred**- observed continuous predicted values for those samples**prior**- vector representing the probability of observing each class in the entire population

#### Outputs

**prob**- lookup matrix containing an index of observed y-values in the first column, and the probability of that value being of each class in subsequent columns**classes**- discrete classes observed in y