Predict survival summaries from legacy Cox-PLS fits
Source:R/predict-cox-legacy.R
predict_cox_pls.RdThese methods extend stats::predict() for Cox models fitted with the
original PLS engines exposed by coxgpls(), coxsgpls(), and their
deviance-residual or kernel variants. They provide access to latent component
scores alongside linear predictors and risk estimates, ensuring consistent
behaviour with the newer big-memory solvers.
Usage
# S3 method for class 'coxgpls'
predict(
object,
newdata = NULL,
type = c("link", "risk", "response", "components"),
comps = NULL,
coef = NULL,
...
)
# S3 method for class 'coxgplsDR'
predict(
object,
newdata = NULL,
type = c("link", "risk", "response", "components"),
comps = NULL,
coef = NULL,
...
)
# S3 method for class 'coxsgpls'
predict(
object,
newdata = NULL,
type = c("link", "risk", "response", "components"),
comps = NULL,
coef = NULL,
...
)
# S3 method for class 'coxsgplsDR'
predict(
object,
newdata = NULL,
type = c("link", "risk", "response", "components"),
comps = NULL,
coef = NULL,
...
)
# S3 method for class 'coxspls_sgpls'
predict(
object,
newdata = NULL,
type = c("link", "risk", "response", "components"),
comps = NULL,
coef = NULL,
...
)
# S3 method for class 'coxDKgplsDR'
predict(
object,
newdata = NULL,
type = c("link", "risk", "response", "components"),
comps = NULL,
coef = NULL,
...
)
# S3 method for class 'coxDKsgplsDR'
predict(
object,
newdata = NULL,
type = c("link", "risk", "response", "components"),
comps = NULL,
coef = NULL,
...
)
# S3 method for class 'coxDKspls_sgplsDR'
predict(
object,
newdata = NULL,
type = c("link", "risk", "response", "components"),
comps = NULL,
coef = NULL,
...
)Arguments
- object
A fitted model returned by
coxgpls(),coxsgpls(),coxspls_sgpls(), or any of their deviance-residual/kernel counterparts withallres = TRUE.- newdata
Optional matrix or data frame of predictors. When
NULL, the training components stored inobjectare reused.- type
Type of prediction requested:
"link"for linear predictors,"risk"/"response"for exponentiated scores, or"components"to return latent PLS scores.- comps
Optional integer vector specifying which latent components to retain. Defaults to all available components.
- coef
Optional coefficient vector overriding the Cox model coefficients stored in
object.- ...
Unused arguments for future extensions.
Value
When type is "components", a matrix of latent scores; otherwise a
numeric vector containing the requested prediction with names inherited from
the supplied data.
References
Bastien, P., Bertrand, F., Meyer, N., & Maumy-Bertrand, M. (2015). Deviance residuals-based sparse PLS and sparse kernel PLS for censored data. Bioinformatics, 31(3), 397–404. doi:10.1093/bioinformatics/btu660
Bertrand, F., Bastien, P., & Maumy-Bertrand, M. (2018). Cross validating extensions of kernel, sparse or regular partial least squares regression models to censored data. https://arxiv.org/abs/1810.01005.
Examples
if (requireNamespace("survival", quietly = TRUE)) {
data(micro.censure, package = "bigPLScox")
data(Xmicro.censure_compl_imp, package = "bigPLScox")
X <- as.matrix(Xmicro.censure_compl_imp[1:60, 1:10])
time <- micro.censure$survyear[1:60]
status <- micro.censure$DC[1:60]
set.seed(321)
fit <- coxgpls(
Xplan = X,
time = time,
status = status,
ncomp = 2,
allres = TRUE
)
predict(fit, newdata = X[1:5, ], type = "risk")
head(predict(fit, type = "components"))
}
#> dim.1 dim.2
#> [1,] 0.8180843 1.0402867
#> [2,] -1.6095533 0.0997729
#> [3,] 0.1280324 -0.5407040
#> [4,] -0.1346531 -1.9098214
#> [5,] 0.8531046 -0.3185590
#> [6,] 0.2168484 -0.3475775