Description Usage Arguments Value Examples
View source: R/FunctionsALasso.R
Function for soft-thresholding
1 |
Xstd |
n x p design matrix X scaled according to LARS algorithm and centered to mean 0 |
Ystd |
n x 1 centered output vector |
beta |
p x 1 vector of parameters |
lambda |
tuning parameter(scalar) |
Objective function for adaplasso
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | X <- matrix(rnorm(500), 50, 10)
Y <- rnorm(50)
gamma <- 2
#Standardizing X and Y
std <- standardize(X , Y , gamma)
#Deriving weighted and centered design matrix
Xstd <- std$Xstd
#Deriving centered Y
Ystd <- std$Ystd
#Defining beta
beta <- solve(crossprod(X)) %*% t(X) %*% Y
#Lambda value
lambda <- 2
#Objective function
obj <- adaplasso(Xstd, Ystd, beta, lambda)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.