BrokenAdaptiveRidge is part of HADES.
BrokenAdaptiveRidge
is an R
package for performing L_0-based regressions using Cyclops
p <- 30 # number of covariates n <- 200 # sample size
itcpt <- 0.2 # intercept true.beta <- c(1, 0, 0, -1, 1, rep(0, p - 5))
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)))
cyclopsData <- createCyclopsData(y ~ x, modelType = "lr") barPrior <- createBarPrior(penalty = 0.1, exclude = c("(Intercept)"), initialRidgeVariance = 1)
cyclopsFit <- fitCyclopsModel(cyclopsData, prior = barPrior) fit1 <- coef(cyclopsFit)
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)
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 ```
BrokenAdaptiveRidge is an R package.
Requires R
(version 3.2.0 or higher).
Cyclops
To install the latest stable version, install from CRAN:
install.packages("BrokenAdaptiveRidge")
Documentation can be found on the package website.
PDF versions of the documentation are also available:
BrokenAdaptiveRidge
is licensed under Apache License 2.0.
BrokenAdaptiveRidge
is being developed in R Studio.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.