Learn R Programming

xyz (version 0.1)

xyz_regression: Elasticnet with interactions (glmnet)

Description

Elasticnet with interactions (glmnet)

Usage

xyz_regression(X, Y, lambdas = NULL, n_lambda = 10, alpha = 0.9, L = 10, standardize = TRUE, standardize_response = TRUE)

Arguments

X
A matrix.
Y
A vector.
lambdas
A vector of decreasing real numbers containing user specified values of lambda.
n_lambda
A natural number indicating how long the path of lambdas should be.
alpha
A real number between 0 and 1 (the elastic net parameter)
L
An integer indicating how many projection steps are performed.
standardize
A boolean indicating if X should be scaled and centered.
standardize_response
A boolean indicating if Y should be scaled and centered.

Value

N strongest interactions (of type type) between X and Y after L projections.

References

G. Thanei, N. Meinshausen and R. Shah (2016). The xyz algorithm for fast interaction search in high-dimensional data.

Examples

Run this code
n<-300
p<-1000
#build matrix of predictors
X<-matrix(rnorm(n*p),n,p)
#build a main effect and an interaction into Y
Y<-4*X[,1]*X[,2]-5*X[,4]+rnorm(n)
result<-xyz_regression(X,Y,n_lambda=10,alpha=0.9,L=10)
#print the result
print(result)
#plot the result
plot(result)

Run the code above in your browser using DataLab