pamrML: Wrapper function around the pamr.* functions

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/pamrI.R

Description

The pamrML functions are wrappers around pamr.train and pamr.predict that provide a more classical R modelling interface than the original versions.

Usage

1

Arguments

formula

model formula

data

data frame

...

argument for the parmTrain function

Details

The name of the response variable is kept as an attribute in the pamrML object to allow for predict methods that can be easily used for writing converter functions for use in the MLInterfaces framework.

Value

For pamrML an object of class pamrML which adds an attribute to the original object returned by pamr.train (or pamrTrain).

The print method lists the names of the different components of the pamrML object.

The predict method returns a vector of predicted values

Author(s)

Tobias Verbeke

See Also

pamr.train, pamr.predict

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
  set.seed(120)
  x <- matrix(rnorm(1000*20), ncol=20)
  y <- sample(c(1:4), size=20, replace=TRUE)
  # for original pam
  mydata <- list(x=x, y=y)
  mytraindata <- list(x=x[,1:15],y=factor(y[1:15]))
  mytestdata <-  list(x = x[,16:20], y = factor(y[16:20]))

  # for formula-based methods including pamrML
  alldf <- cbind.data.frame(t(mydata$x), y)
  traindf <- cbind.data.frame(t(mytraindata$x), y = mytraindata$y)
  testdf <- cbind.data.frame(t(mytestdata$x), y = mytestdata$y)

  ### create pamrML object
  pamrMLObj <- pamrML(y ~ ., traindf)
  pamrMLObj

  ### test predict method
  predict(object = pamrMLObj, newdata = testdf, 
      threshold = 1) # threshold compulsory

nlcv documentation built on July 2, 2018, 1:03 a.m.