The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
This package provides functions for performing split robust least angle regression.
You can install the stable version on R CRAN.
{r installation, eval = FALSE} install.packages("srlars", dependencies = TRUE)
You can install the development version from GitHub
library(devtools)
::install_github("AnthonyChristidis/srlars") devtools
# Simulation parameters
<- 50
n <- 500
p <- 0.5
rho <- 0.2
rho.inactive <- 25
group.size <- 100
p.active <- 1
snr <- 0.2
contamination.prop
# Setting the seed
set.seed(0)
# Block Correlation
<- matrix(0, p, p)
sigma.mat 1:p.active, 1:p.active] <- rho.inactive
sigma.mat[for(group in 0:(p.active/group.size - 1))
*group.size+1):(group*group.size+group.size),(group*group.size+1):(group*group.size+group.size)] <- rho
sigma.mat[(groupdiag(sigma.mat) <- 1
# Simulation of beta vector
<- c(runif(p.active, 0, 5)*(-1)^rbinom(p.active, 1, 0.7), rep(0, p - p.active))
true.beta
# Setting the SD of the variance
<- as.numeric(sqrt(t(true.beta) %*% sigma.mat %*% true.beta)/sqrt(snr))
sigma
# Simulation of test data
<- 2e3
m <- mvnfast::rmvn(m, mu = rep(0, p), sigma = sigma.mat)
x_test <- x_test %*% true.beta + rnorm(m, 0, sigma)
y_test
# Simulation of uncontaminated data
<- mvnfast::rmvn(n, mu = rep(0, p), sigma = sigma.mat)
x <- x %*% true.beta + rnorm(n, 0, sigma)
y
# Contamination of data
<- 1:floor(n*contamination.prop)
contamination_indices <- 2
k_lev <- 100
k_slo <- x
x_train <- y
y_train <- true.beta
beta_cont !=0] <- beta_cont[true.beta!=0]*(1 + k_slo)
beta_cont[true.beta==0] <- k_slo*max(abs(true.beta))
beta_cont[true.betafor(cont_id in contamination_indices){
<- runif(p, min = -1, max = 1)
a <- a - as.numeric((1/p)*t(a) %*% rep(1, p))
a <- mvnfast::rmvn(1, rep(0, p), 0.1^2*diag(p)) + k_lev * a / as.numeric(sqrt(t(a) %*% solve(sigma.mat) %*% a))
x_train[cont_id,] <- t(x_train[cont_id,]) %*% beta_cont
y_train[cont_id]
}
# srlars models
<- srlars(x_train, y_train,
srlars_fit n_models = 5,
model_saturation = c("fixed", "p-value")[1],
alpha = 0.05, model_size = n-1,
robust = TRUE,
compute_coef = TRUE,
en_alpha = 1/4)
<- predict(srlars_fit, newx = x_test,
srlars_preds group_index = 1:srlars_fit$n_models,
dynamic = FALSE)
<- coef(srlars_fit, group_index = 1:srlars_fit$n_models)
srlars_coefs <- sum(which((srlars_coefs[-1]!=0)) <= p.active)/p.active
sens_srlars <- sum(which((srlars_coefs[-1]!=0)) <= p.active)/sum(srlars_coefs[-1]!=0)
spec_srlars <- mean((y_test - srlars_preds)^2)/sigma^2 mspe_srlars
This package is free and open source software, licensed under GPL (>= 2).
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.