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

# 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

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)
#> [1] -2837.877 -2836.417 -2833.402 -2829.310 -2825.089 -2821.048 -2817.215 #> [8] -2813.585 -2810.516 -2807.961 -2805.669 -2803.452 -2801.252 -2798.981 #> [15] -2796.811 -2794.807 -2793.121 -2791.659 -2790.394 -2789.300 -2788.361 #> [22] -2787.538 -2786.807 -2786.177 -2785.630 -2785.172 -2784.764 -2784.422 #> [29] -2784.133 -2783.894 -2783.695 -2783.530 -2783.392 -2783.279 -2783.183 #> [36] -2783.103 -2783.036 -2782.979 -2782.931 -2782.891 -2782.859 -2782.831 #> [43] -2782.809 -2782.789 -2782.773 -2782.760 -2782.748 -2782.738 -2782.730 #> [50] -2782.723 -2782.718 -2782.713 -2782.709 -2782.705 -2782.702 -2782.700 #> [57] -2782.698 -2782.696 -2782.695 -2782.694 -2782.693 -2782.692 -2782.692 #> [64] -2782.691 -2782.691 -2782.690 -2782.690 -2782.690 -2782.690 -2782.689 #> [71] -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 #> [78] -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 #> [85] -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 #> [92] -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 #> [99] -2782.689 -2782.689
logLik(fit, which.model = "mcp")
#> [1] -2837.877 -2835.706 -2831.482 -2825.771 -2820.093 -2814.971 -2810.260 #> [8] -2805.966 -2802.664 -2800.206 -2798.250 -2796.593 -2794.667 -2792.844 #> [15] -2791.017 -2789.464 -2788.148 -2787.061 -2786.232 -2785.546 -2784.937 #> [22] -2784.454 -2784.050 -2783.730 -2783.493 -2783.308 -2783.134 -2783.010 #> [29] -2782.923 -2782.858 -2782.809 -2782.775 -2782.753 -2782.739 -2782.731 #> [36] -2782.722 -2782.714 -2782.709 -2782.705 -2782.703 -2782.701 -2782.699 #> [43] -2782.697 -2782.696 -2782.695 -2782.694 -2782.693 -2782.692 -2782.691 #> [50] -2782.691 -2782.690 -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 #> [57] -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 #> [64] -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 #> [71] -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 #> [78] -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 #> [85] -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 #> [92] -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 #> [99] -2782.689 -2782.689
fit <- cv.oem(x = x, y = y, penalty = c("lasso", "mcp"), compute.loss = TRUE, nlambda = 25) logLik(fit)
#> [1] -2837.877 -2824.568 -2809.833 -2800.414 -2792.359 -2787.831 -2785.280 #> [8] -2783.921 -2783.279 -2782.972 -2782.825 -2782.755 -2782.720 -2782.703 #> [15] -2782.695 -2782.692 -2782.690 -2782.689 -2782.689 -2782.689 -2782.689 #> [22] -2782.689 -2782.689 -2782.689 -2782.689
logLik(fit, which.model = "mcp")
#> [1] -2837.877 -2819.409 -2801.977 -2794.011 -2787.571 -2784.622 -2783.353 #> [8] -2782.866 -2782.739 -2782.708 -2782.698 -2782.694 -2782.690 -2782.689 #> [15] -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 -2782.689 #> [22] -2782.689 -2782.689 -2782.689 -2782.689
fit <- xval.oem(x = x, y = y, penalty = c("lasso", "mcp"), compute.loss = TRUE, nlambda = 25) logLik(fit)
#> [1] -5078.090 -5064.995 -5050.184 -5040.747 -5032.648 -5028.086 -5025.515 #> [8] -5024.146 -5023.497 -5023.188 -5023.040 -5022.969 -5022.934 -5022.916 #> [15] -5022.909 -5022.905 -5022.903 -5022.902 -5022.902 -5022.902 -5022.902 #> [22] -5022.902 -5022.902 -5022.902 -5022.902
logLik(fit, which.model = "mcp")
#> [1] -5078.090 -5059.896 -5042.319 -5034.317 -5027.839 -5024.857 -5023.575 #> [8] -5023.082 -5022.953 -5022.922 -5022.912 -5022.907 -5022.903 -5022.902 #> [15] -5022.902 -5022.902 -5022.902 -5022.902 -5022.902 -5022.902 -5022.902 #> [22] -5022.902 -5022.902 -5022.902 -5022.902