1
#' Functions related to eta parameter used in optim and kkt checks
2
#'
3
#' @description Used for gradient of eta. Currently being passed to optim in
4
#'   \code{\link{lmmlasso}} and used in \code{\link{kkt_check}}
5
#' @seealso \code{\link{logliklasso}}, \code{\link{kkt_check}}, \code{\link{lmmlasso}}
6
#' @inheritParams logliklasso
7
#' @inheritParams kkt_check
8
gr_eta_lasso_fullrank <- function(eta, sigma2, beta, eigenvalues, x, y, nt) {
9 4
  di <- 1 + eta * (eigenvalues - 1)
10

11 4
  (1 / 2) * sum(((eigenvalues - 1) / di) * (1 - (((y - x %*% beta)^2) / (sigma2 * di))))
12
}
13

14

15

16
#' @rdname gr_eta_lasso_fullrank
17
fn_eta_lasso_fullrank <- function(eta, sigma2, beta, eigenvalues, x, y, nt) {
18

19
  # this is based on the negative log-lik
20

21 4
  di <- 1 + eta * (eigenvalues - 1)
22

23 4
  (nt / 2) * log(2 * pi) +
24 4
    (nt / 2) * log(sigma2) +
25 4
    0.5 * sum(log(di)) +
26 4
    (1 / (2 * sigma2)) * sum((y - x %*% beta)^2 / di)
27
}

Read our documentation on viewing source code .

Loading