pamrML {nlcv} | R Documentation |
Wrapper function around the pamr.* functions
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
pamrML(formula, data, ...)
Arguments
formula |
model formula |
data |
data frame |
... |
argument for the |
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
Examples
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
[Package nlcv version 0.3.5 Index]