Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/predict.PCLasso.R
Similar to other predict methods, this function returns predictions from a
fitted PCLasso
object.
1 2 3 4 |
object |
Fitted |
x |
Matrix of values at which predictions are to be made. The features (genes)
contained in |
type |
Type of prediction: "link" returns the linear predictors; "response" gives the risk (i.e., exp(link)); "vars" returns the indices for the nonzero coefficients; "vars.unique" returns unique features (genes) with nonzero coefficients (If a feature belongs to multiple groups and multiple groups are selected, the feature will be repeatedly selected. Compared with "var", "var.unique" will filter out repeated features.); "groups" returns the groups with at least one nonzero coefficient; "nvars" returns the number of nonzero coefficients; "nvars.unique" returens the number of unique features (genes) with nonzero coefficients; "ngroups" returns the number of groups with at least one nonzero coefficient; "norm" returns the L2 norm of the coefficients in each group."survival" returns the estimated survival function; "median" estimates median survival times. |
lambda |
Values of the regularization parameter |
... |
Arguments to be passed to |
See predict.grpsurv
in the R package grpreg
for details.
The object returned depends on type
.
Wei Liu
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | library("survival")
# load data
data(ExpMatrix)
data(survData)
data(PCGroup)
set.seed(429006)
train.Idx <- sample(nrow(ExpMatrix), floor(2/3*nrow(ExpMatrix)))
x.train <- ExpMatrix[train.Idx ,]
x.test <- ExpMatrix[-train.Idx ,]
y.train <- survData[train.Idx,]
y.test <- survData[-train.Idx,]
fit1 <- PCLasso(x = x.train,
y = Surv(time=y.train[,"time"], event=y.train[,"status"]),
group = PCGroup)
# predict risk scores of samples in x.test
s <- predict(object = fit1, x = x.test, type="link", lambda=fit1$fit$lambda)
s <- predict(object = fit1, x = x.test, type="link", lambda=fit1$fit$lambda[10])
s <- predict(object = fit1, x = x.test, type="link", lambda=c(0.1, 0.01))
# Nonzero coefficients
sel.groups <- predict(object = fit1, type="groups",
lambda = fit1$fit$lambda)
sel.ngroups <- predict(object = fit1, type="ngroups",
lambda = fit1$fit$lambda)
sel.vars.unique <- predict(object = fit1, type="vars.unique",
lambda = fit1$fit$lambda)
sel.nvars.unique <- predict(object = fit1, type="nvars.unique",
lambda = fit1$fit$lambda)
sel.vars <- predict(object = fit1, type="vars",
lambda=fit1$fit$lambda)
sel.nvars <- predict(object = fit1, type="nvars",
lambda=fit1$fit$lambda)
# For values of lambda not in the sequence of fitted models,
# linear interpolation is used.
sel.groups <- predict(object = fit1, type="groups",
lambda = c(0.1, 0.01))
sel.ngroups <- predict(object = fit1, type="ngroups",
lambda = c(0.1, 0.01))
sel.vars.unique <- predict(object = fit1, type="vars.unique",
lambda = c(0.1, 0.01))
sel.nvars.unique <- predict(object = fit1, type="nvars.unique",
lambda = c(0.1, 0.01))
sel.vars <- predict(object = fit1, type="vars",
lambda=c(0.1, 0.01))
sel.nvars <- predict(object = fit1, type="nvars",
lambda=c(0.1, 0.01))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.