fisherDiscriminant {ClassifyR} | R Documentation

## Classification Using Fisher's LDA

### Description

Finds the decision boundary using the training set, and gives predictions for the test set.

### Usage

      ## S4 method for signature 'matrix'
    fisherDiscriminant(measurements, classes, test, ...)
      ## S4 method for signature 'DataFrame'
    fisherDiscriminant(measurements, classes, test, returnType = c("class", "score", "both"),
                       verbose = 3)
      ## S4 method for signature 'MultiAssayExperiment'
    fisherDiscriminant(measurements, test, targets = names(measurements), ...)

### Arguments

`measurements` | Either a `matrix`, `DataFrame` or `MultiAssayExperiment` containing the training data. For a `matrix`, the rows are features, and the columns are samples.
`classes` | Either a vector of class labels of class `factor` of the same length as the number of samples in `measurements` or if the measurements are of class `DataFrame` a character vector of length 1 containing the column name in `measurement` is also permitted. Not used if `measurements` is a `MultiAssayExperiment` object.
`test` | An object of the same class as `measurements` with no samples in common with `measurements` and the same number of features as it.
`targets` | If `measurements` is a `MultiAssayExperiment`, the names of the data tables to be used. `"clinical"` is also a valid value and specifies that integer variables from the clinical data table will be used.
`...` | Variables not used by the `matrix` nor the `MultiAssayExperiment` method which are passed into and used by the `DataFrame` method.
`returnType` | Default: `"class"`. Either `"class"`, `"score"`, or `"both"`. Sets the return value from the prediction to either a vector of class labels, score for a sample belonging to the second class, as determined by the factor levels, or both labels and scores in a `data.frame`.
`verbose` | Default: 3. A number between 0 and 3 for the amount of progress messages to give. This function only prints progress messages if the value is 3.

### Details

Unlike ordinary LDA, Fisher's version does not have assumptions about the normality of the features.

Data tables which consist entirely of non-numeric data cannot be analysed. If `measurements` is an object of class `MultiAssayExperiment`, the factor of sample classes must be stored in the DataFrame accessible by the `colData` function with column name `"class"`.

### Value

A vector or `data.frame` of class prediction information, as long as the number of samples in the test data.

### Author(s)

Dario Strbenac

### Examples

      trainMatrix <- matrix(rnorm(1000, 8, 2), ncol = 10)
      classes <- factor(rep(c("Poor", "Good"), each = 5))

      # Make first 30 genes increased in value for poor samples.
      trainMatrix[1:30, 1:5] <- trainMatrix[1:30, 1:5] + 5

      testMatrix <- matrix(rnorm(1000, 8, 2), ncol = 10)

      # Make first 30 genes increased in value for sixth to tenth samples.
      testMatrix[1:30, 6:10] <- testMatrix[1:30, 6:10] + 5

      fisherDiscriminant(trainMatrix, classes, testMatrix)

[Package ClassifyR version 2.4.4 Index]