adapt_glmnet {adaptMT} | R Documentation

## Adaptive P-value Thresholding with L1/L2 Penalized Generalized Linear Models

### Description

`adapt_glmnet` is a wrapper of `adapt` that fits pi(x) and mu(x) by `glmnet` from `glmnet` package.

### Usage

    adapt_glmnet(x, pvals, piargs = list(), muargs = list(),
      dist = beta_family(), s0 = rep(0.45, length(pvals)), alphas = seq(0.01,
      1, 0.01), ...)

### Arguments

`x` | covariates (i.e. side-information). Should be compatible to `models`. See Details
`pvals` | a vector of values in [0, 1]. P-values
`piargs` | a list. Other arguments passed to glmnet for fitting pi(x)
`muargs` | a list. Other arguments passed to glmnet for fitting mu(x)
`dist` | an object of class "`gen_exp_family`". `beta_family()` as default
`s0` | a vector of values in [0, 0.5). Initial threshold.
`alphas` | a vector of values in (0, 1). Target FDR levels.
`...` | other arguments passed to `adapt` (except `models`)

### Details

`adapt_glmnet` by default implements LASSO on `x` with lambda selected by cross-validation. Specify in `piargs` and `muargs` if ridge or elastic-net penalty is needed.

### See Also

`adapt`, `adapt_glm`, `adapt_gam`, `glmnet`

### Examples

    # Generate a 100-dim covariate x
    set.seed(0)
    m <- 100
    n <- 1000
    x <- matrix(runif(n * m), n, m)

    # Generate the parameters from a conditional two-group
    # logistic-Gamma GLM  where pi(x) and mu(x) are both
    # linear in x. pi(x) has an intercept so that the average
    # of pi(x) is 0.3
    inv_logit <- function(x) {exp(x) / (1 + exp(x))}
    pi1 <- 0.3
    beta.pi <- c(3, 3, rep(0, m-2))
    beta0.pi <- uniroot(function(b){
        mean(inv_logit(x %*% beta.pi + b)) - pi1
    }, c(-100, 100))$root
    pi <- inv_logit(x %*% beta.pi + beta0.pi)
    beta.mu <- c(2, 2, rep(0, m-2))
    beta0.mu <- 0
    mu <- pmax(1, x %*% beta.mu + beta0.mu)

    # Generate p-values
    H0 <- as.logical(ifelse(runif(n) < pi, 1, 0))
    y <- ifelse(H0, rexp(n, 1/mu), rexp(n, 1))
    pvals <- exp(-y)

    # Run adapt_glmnet
    res <- adapt_glmnet(x, pvals, s0 = rep(0.15, n), nfits = 5)

[Package adaptMT version 1.0.0 Index]