predict.pelora {supclust} | R Documentation |
Predict Method for Pelora
Description
Yields fitted values, predicted class labels and
conditional probability estimates for training and test data, which
are based on the gene groups pelora
found, and on its internal
penalized logistic regression classifier.
Usage
## S3 method for class 'pelora'
predict(object, newdata = NULL, newclin = NULL,
type = c("fitted", "probs", "class"), noc = object$noc, ...)
Arguments
object |
An R object of |
newdata |
Numeric matrix with the same number of explanatory
variables as the original |
newclin |
Numeric matrix with the same number of additional
(clinical) explanatory variables as the original |
type |
Character string, describing whether fitted values
|
noc |
Integer, saying with how many clusters the fitted values, probability estimates or class labels should be determined. Also numeric vectors are allowed as an argument. The output is then a numeric matrix with fitted values, probability estimates or class labels for a multiple number of clusters. |
... |
Further arguments passed to and from methods. |
Details
If newdata = NULL
, then the in-sample fitted values,
probability estimates and class label predictions are returned.
Value
Depending on whether noc
is a single number or a numeric
vector. In the first case, a numeric vector of length r
is
returned, which contains fitted values for noc
clusters, or
probability estimates/class label predictions with noc
clusters.
In the latter case, a numeric matrix with length(noc)
columns,
each containing fitted values for noc
clusters, or
probability estimates/class label predictions with noc
clusters, is returned.
Author(s)
Marcel Dettling, dettling@stat.math.ethz.ch
See Also
pelora
, also for references.
Examples
## Working with a "real" microarray dataset
data(leukemia, package="supclust")
## Generating random test data: 3 observations and 250 variables (genes)
set.seed(724)
xN <- matrix(rnorm(750), nrow = 3, ncol = 250)
## Fitting Pelora
fit <- pelora(leukemia.x, leukemia.y, noc = 3)
## Fitted values and class probabilities for the training data
predict(fit, type = "cla")
predict(fit, type = "prob")
## Predicting fitted values and class labels for the random test data
predict(fit, newdata = xN)
predict(fit, newdata = xN, type = "cla", noc = c(1,2,3))
predict(fit, newdata = xN, type = "pro", noc = c(1,3))
## Fitting Pelora such that the first 70 variables (genes) are not grouped
fit <- pelora(leukemia.x[, -(1:70)], leukemia.y, leukemia.x[,1:70])
## Fitted values and class probabilities for the training data
predict(fit, type = "cla")
predict(fit, type = "prob")
## Predicting fitted values and class labels for the random test data
predict(fit, newdata = xN[, -(1:70)], newclin = xN[, 1:70])
predict(fit, newdata = xN[, -(1:70)], newclin = xN[, 1:70], "cla", noc = 1:10)
predict(fit, newdata = xN[, -(1:70)], newclin = xN[, 1:70], type = "pro")