Learn R Programming

BeSS (version 2.0.2)

deviance.bess: Extract the deviance from a "bess.one" object.

Description

Similar to other deviance methods, which returns deviance from a fitted "bess.one" object.

Usage

# S3 method for bess
deviance(object, best.model = TRUE, ...)

Arguments

object

A "bess" object.

best.model

Whether only return the loglikelihood of the best model. Default is TRUE. If best.model = FALSE, the loglikelihood of the best models with model size and \(\lambda\) in the original s.list and lambda.list (for method = "sequential") or in the iteration path (for method = "gsection", method = "pgsection", and method = "psequential") is returned.

additional arguments

Value

A matrix or vector containing the deviance for each model is returned. For bess object fitted by sequantial method, values in each row in the returned matrix corresponding to the model size in s.list, and each column the shrinkage parameters in lambda.list.

For bess object fitted by gsection, pgsection and psequential, the returned vector contains deviance for fitted models in each iteration. The coefficients of those model can be extracted from beta.all and coef0.all in the bess object.

References

Wen, C., Zhang, A., Quan, S. and Wang, X. (2020). BeSS: An R Package for Best Subset Selection in Linear, Logistic and Cox Proportional Hazards Models, Journal of Statistical Software, Vol. 94(4). doi:10.18637/jss.v094.i04.

See Also

bess, summary.bess.

Examples

Run this code
# NOT RUN {
# Generate simulated data
n <- 200
p <- 20
k <- 5
rho <- 0.4
seed <- 10
Tbeta <- rep(0, p)
Tbeta[1:k*floor(p/k):floor(p/k)] <- rep(1, k)
Data <- gen.data(n, p, k, rho, family = "gaussian", seed = seed)
lm.bss <- bess(Data$x, Data$y, method = "sequential")

deviance(lm.bss)
deviance(lm.bss, best.model = FALSE)
# }

Run the code above in your browser using DataLab