MyNixOS website logo
Description

Broken Adaptive Ridge Regression with Cyclops.

Approximates best-subset selection (L0) regression with an iteratively adaptive Ridge (L2) penalty for large-scale models. This package uses Cyclops for an efficient implementation and the iterative method is described in Kawaguchi et al (2020) <doi:10.1002/sim.8438> and Li et al (2021) <doi:10.1016/j.jspi.2020.12.001>.

BrokenAdaptiveRidge

Build Status codecov.io

Introduction

BrokenAdaptiveRidge is an R package for performing L_0-based regressions using Cyclops

Features

Examples

  • Generalized Linear Model
library(Cyclops)
library(BrokenAdaptiveRidge)

## data dimension
p <- 30    # number of covariates
n <- 200   # sample size

## logistic model parameters 
itcpt     <- 0.2 # intercept
true.beta <- c(1, 0, 0, -1, 1, rep(0, p - 5))

## simulate data from logistic model
set.seed(100)

x <- matrix(rnorm(p * n, mean = 0, sd = 1), ncol = p)
x <- ifelse(abs(x) > 1., 1, 0)
y <- rbinom(n, 1, 1 / (1 + exp(-itcpt - x%*%true.beta)))


# fit BAR model
cyclopsData <- createCyclopsData(y ~ x, modelType = "lr")
barPrior    <- createBarPrior(penalty = 0.1, exclude = c("(Intercept)"), 
                             initialRidgeVariance = 1) 

cyclopsFit <- fitCyclopsModel(cyclopsData,
                             prior = barPrior)
fit1 <- coef(cyclopsFit) 

# fit BAR using sparse-represented covariates
tmp <- apply(x, 1, function(x) which(x != 0))

y.df <- data.frame(rowId = 1:n, y = y)
x.df <- data.frame(rowId = rep(1:n, lengths(tmp)), covariateId = unlist(tmp), covariateValue = 1)

cyclopsData <- convertToCyclopsData(outcomes = y.df, covariates = x.df, modelType = "lr")
barPrior    <- createFastBarPrior(penalty = 0.1, exclude = c("(Intercept)"), 
                                 initialRidgeVariance = 1) 

fit2 <- coef(cyclopsFit) 

# fit BAR using cyclic algorithm
cyclopsData <- createCyclopsData(y ~ x, modelType = "lr")
barPrior    <- createFastBarPrior(penalty = 0.1, exclude = c("(Intercept)"), 
                             initialRidgeVariance = 1) 

cyclopsFit <- fitCyclopsModel(cyclopsData,
                             prior = barPrior)
fit3 <- coef(cyclopsFit) 

fit1
fit2
fit3

Technology

System Requirements

Requires R (version 3.2.0 or higher).

Dependencies

  • Cyclops

Getting Started

  1. On Windows, make sure RTools is installed.
  2. In R, use the following commands to download and install BrokenAdaptiveRidge:
install.packages("devtools")
library(devtools)
install.packages("ohdsi/Cyclops") 
install_github("ohdsi/BrokenAdaptiveRidge") 
  1. To perform a L_0-based Cyclops model fit, use the following commands in R:
library(BrokenAdaptiveRidge)
cyclopsData <- createCyclopsData(formula, modelType = "modelType") ## TODO: Update
barPrior    <- createBarPrior(penalty = lambda / 2, initialRidgeVariance = 2 / xi) 
cyclopsFit  <- fitCyclopsModel(cyclopsData, prior = barPrior)
coef(cyclopsFit) #Extract coefficients

Getting Involved

License

BrokenAdaptiveRidge is licensed under Apache License 2.0.

Development

BrokenAdaptiveRidge is being developed in R Studio.

Acknowledgements

  • This project is supported in part through the National Institutes of Health grant R01 HG006139.
Metadata

Version

1.0.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows