train: Training function for binary predictors

Description Usage Arguments Value Author(s) See Also Examples

View source: R/train.R

Description

This function build a model from data to predict class in classify.

Usage

1
  train(peakMatrix, group, filter.p = 0.05, ...)

Arguments

peakMatrix

Numeric matrix of normalized peak heights with samples in rows and peaks in columns.

group

Two-level factor defining the group of every samples in peaks.

filter.p

Single numeric value, if not NA only genes for which the t-test p is lower than this will be used in the model.

...

Further arguments to be passed to model.

Value

Returns an S3 object of class fsaModel.

Author(s)

Sylvain Mareschal

See Also

model, classify

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
  # Underlying truth for pseudo-data (10 genes)
  geneNames <- paste("gene", LETTERS[1:10], sep=".")
  geneMean <- abs(rnorm(10))
  groupShift <- rnorm(10, sd=0.1)
  
  # Generate pseudo-data for 50 samples
  mtx <- NULL
  for(g in 1:10) {
    x <- rnorm(n=50, mean=geneMean[g], sd=0.1)
    x[1:25] <- x[1:25] + groupShift[g]
    x[26:50] <- x[26:50] - groupShift[g]
    mtx <- cbind(mtx, x)
  }
  colnames(mtx) <- geneNames
  rownames(mtx) <- c(
    paste("group1", 1:25, sep="."),
    paste("group2", 26:50, sep=".")
  )
  
  # Train model
  group <- c(
    rep("group1", 25),
    rep("group2", 25)
  )
  model <- train(mtx, group)
  plot(model)
  
  # Compare model to truth
  i <- match(geneNames, model$geneNames)
  out <- data.frame(
    gene = geneNames,
    true.M = geneMean,
    model.M = model$geneMs[i],
    true.shift = groupShift,
    model.T = model$geneTs[i]
  )
  print(out)

MLPA documentation built on May 2, 2020, 1:06 a.m.

Related to train in MLPA...