spectrumClassifier {transite} | R Documentation

## Simple spectrum classifier based on empirical thresholds

### Description

Spectra can be classified based on the aggregate spectrum classifier score. If `sum(score) == 3` spectrum considered non-random, random otherwise.

### Usage

    spectrumClassifier(adj.r.squared, degree, slope, consistency.score.n,
      n.significant, n.bins)

### Arguments

`adj.r.squared` | adjusted R^2 of polynomial model, returned by scoreSpectrum
`degree` | degree of polynomial, returned by scoreSpectrum
`slope` | coefficient of the linear term of the polynomial model (spectrum "direction"), returned by scoreSpectrum
`consistency.score.n` | number of performed permutations before early stopping, returned by scoreSpectrum
`n.significant` | number of bins with statistically significant enrichment
`n.bins` | number of bins

### Value

a three-dimensional binary vector with the following components:

`coordinate 1` | `adj.r.squared >= 0.4`
`coordinate 2` | `consistency.score.n > 1000000`
`coordinate 3` | `n.significant >= floor(n.bins / 10)`

### See Also

Other SPMA functions: `runKmerSPMA`, `runMatrixSPMA`, `scoreSpectrum`, `subdivideData`

### Examples

    n.bins <- 40

    # random spectrum
    random.sp <- scoreSpectrum(runif(n = n.bins, min = -1, max = 1),
      max.model.degree = 1)
    score <- spectrumClassifier(
      spectrumAdjRSquared(random.sp), spectrumDegree(random.sp),
      spectrumSlope(random.sp), spectrumConsistencyScoreN(random.sp), 0, n.bins
    )
    sum(score)

    # non-random linear spectrum with strong noise component
    signal <- seq(-1, 0.99, 2 / 40)
    noise <- rnorm(n = 40, mean = 0, sd = 0.5)
    linear.sp <- scoreSpectrum(signal + noise, max.model.degree = 1,
      max.cs.permutations = 100000)
    score <- spectrumClassifier(
      spectrumAdjRSquared(linear.sp), spectrumDegree(linear.sp),
      spectrumSlope(linear.sp), spectrumConsistencyScoreN(linear.sp), 10, n.bins
    )
    sum(score)
    ## Not run:
    # non-random linear spectrum with weak noise component
    signal <- seq(-1, 0.99, 2 / 40)
    noise <- rnorm(n = 40, mean = 0, sd = 0.2)
    linear.sp <- scoreSpectrum(signal + noise, max.model.degree = 1,
      max.cs.permutations = 100000)
    score <- spectrumClassifier(
      spectrumAdjRSquared(linear.sp), spectrumDegree(linear.sp),
      spectrumSlope(linear.sp), spectrumConsistencyScoreN(linear.sp), 10, n.bins
    )
    sum(score)

    ## End(Not run)

    # non-random quadratic spectrum with strong noise component
    signal <- seq(-1, 0.99, 2 / 40)^2 - 0.5
    noise <- rnorm(n = 40, mean = 0, sd = 0.2)
    quadratic.sp <- scoreSpectrum(signal + noise, max.model.degree = 2,
      max.cs.permutations = 100000)
    score <- spectrumClassifier(
      spectrumAdjRSquared(quadratic.sp), spectrumDegree(quadratic.sp),
      spectrumSlope(quadratic.sp), spectrumConsistencyScoreN(quadratic.sp), 10, n.bins
    )
    sum(score)
    ## Not run:
    # non-random quadratic spectrum with weak noise component
    signal <- seq(-1, 0.99, 2 / 40)^2 - 0.5
    noise <- rnorm(n = 40, mean = 0, sd = 0.1)
    quadratic.sp <- scoreSpectrum(signal + noise, max.model.degree = 2)
    score <- spectrumClassifier(
      spectrumAdjRSquared(quadratic.sp), spectrumDegree(quadratic.sp),
      spectrumSlope(quadratic.sp), spectrumConsistencyScoreN(quadratic.sp), 10, n.bins
    )
    sum(score)

    ## End(Not run)

[Package transite version 1.0.2 Index]