NSCpredictInterface {ClassifyR} | R Documentation

## Interface for `pamr.predict` Function from `pamr` CRAN Package

### Description

Restructures variables from ClassifyR framework to be compatible with `pamr.predict` definition.

### Usage

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

### Arguments

`trained` | An object of class `pamrtrained`.
`test` | An object of the same class as `measurements` with no samples in common with `measurements` used in the training stage and the same number of features as it. Also, if a `DataFrame`, the `class` column must be absent.
`classes` | Either NULL or a character vector of length 1, specifying the column name to remove.
`targets` | If `test` is a `MultiAssayExperiment`, the names of the data tables to be used. `"clinical"` is also a valid value and specifies that numeric 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 or optional settings that are passed to `pamr.predict`.
`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

This function is an interface between the ClassifyR framework and `pamr.predict`. It selects the highest threshold that gives the minimum error rate in the training data.

### Value

Either a factor vector of predicted classes, a matrix of scores for each class, or a table of both the class labels and class scores, depending on the setting of `returnType`.

### Author(s)

Dario Strbenac

### See Also

`pamr.predict` for the function that was interfaced to.

### Examples

      if(require(pamr))
      {
        # Samples in one class with differential expression to other class.
        genesMatrix <- sapply(1:25, function(geneColumn) c(rnorm(100, 9, 1)))
        genesMatrix <- cbind(genesMatrix, sapply(1:25, function(geneColumn)
                                     c(rnorm(75, 9, 1), rnorm(25, 14, 1))))
        classes <- factor(rep(c("Poor", "Good"), each = 25))

        fit <- NSCtrainInterface(genesMatrix[, c(1:20, 26:45)], classes[c(1:20, 26:45)])
        NSCpredictInterface(fit, genesMatrix[, c(21:25, 46:50)])
      }

[Package ClassifyR version 2.8.0 Index]