Learn R Programming

oem (version 2.0.12)

logLik.oem: log likelihood function for fitted oem objects

Description

log likelihood function for fitted oem objects

log likelihood function for fitted cross validation oem objects

log likelihood function for fitted cross validation oem objects

Usage

# S3 method for oem
logLik(object, which.model = 1, ...)

# S3 method for cv.oem logLik(object, which.model = 1, ...)

# S3 method for xval.oem logLik(object, which.model = 1, ...)

Arguments

object

fitted "oem" model object.

which.model

If multiple penalties are fit and returned in the same oem object, the which.model argument is used to specify which model to plot. For example, if the oem object "oemobj" was fit with argument penalty = c("lasso", "grp.lasso"), then which.model = 2 provides a plot for the group lasso model.

...

not used

Examples

Run this code
set.seed(123)
n.obs <- 2000
n.vars <- 50

true.beta <- c(runif(15, -0.25, 0.25), rep(0, n.vars - 15))
x <- matrix(rnorm(n.obs * n.vars), n.obs, n.vars)
y <- rnorm(n.obs, sd = 3) + x %*% true.beta

fit <- oem(x = x, y = y, penalty = c("lasso", "mcp"), compute.loss = TRUE)

logLik(fit)

logLik(fit, which.model = "mcp")


fit <- cv.oem(x = x, y = y, penalty = c("lasso", "mcp"), compute.loss = TRUE,
              nlambda = 25)

logLik(fit)

logLik(fit, which.model = "mcp")


fit <- xval.oem(x = x, y = y, penalty = c("lasso", "mcp"), compute.loss = TRUE, 
                nlambda = 25)

logLik(fit)

logLik(fit, which.model = "mcp")

Run the code above in your browser using DataLab