pamrML: Wrapper function around the pamr.* functions

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

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
2
3
4
5
pamrML(formula, data, ...)
## S3 method for class 'pamrML'
print(x, ...)
## S3 method for class 'pamrML'
predict(object, newdata, ...)

Arguments

formula

model formula

data

data frame

x

object of class pamrML

object

object of class pamrML

newdata

data frame containing new observations for which predicted values will be estimated based on the model contained in object

...

further arguments to the print method

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 May 2, 2019, 4:56 p.m.

Related to pamrML in nlcv...