rk_fit {kko}R Documentation

nonparametric additive model seleciton via random kernel

Description

The function selects additive components via applying group lasso on random feature expansion of data and knockoffs.

Usage

rk_fit(
  X,
  y,
  X_k,
  rfn,
  cv_folds,
  rkernel = "laplacian",
  rk_scale = 1,
  rseed = NULL
)

Arguments

X

design matrix of additive model; rows are observations and columns are variables.

y

response of addtive model.

X_k

knockoffs matrix of design; the same size as X.

rfn

random feature expansion number.

cv_folds

the folds of cross-validation for tuning group lasso penalty.

rkernel

kernel choices. Default is "laplacian". Other choices are "cauchy" and "gaussian".

rk_scale

scaling parameter of sampling distribution for random feature expansion. For gaussian kernel, it is standard deviation of gaussian sampling distribution.

rseed

seed for random feature expansion.

Value

a 0/1 vector indicating selected components.

Author(s)

Xiaowu Dai, Xiang Lyu, Lexin Li

Examples

library(knockoff)
p=5 # number of predictors
sig_mag=100 # signal strength
n= 200 # sample size
rkernel="laplacian" # kernel choice
s=2  # sparsity, number of nonzero component functions
rk_scale=1  # scaling paramtere of kernel
rfn= 3  # number of random features
cv_folds=15  # folds of cross-validation in group lasso
X=matrix(rnorm(n*p),n,p)%*%chol(toeplitz(0.3^(0:(p-1))))   # generate design
X_k = create.second_order(X) # generate knockoff
reg_coef=c(rep(1,s),rep(0,p-s))  # regression coefficient
reg_coef=reg_coef*(2*(rnorm(p)>0)-1)*sig_mag
y=X%*% reg_coef + rnorm(n) # response

# the first half is variables of design X, and the latter is knockoffs X_k
rk_fit(X,y,X_k,rfn,cv_folds,rkernel,rk_scale)



[Package kko version 1.0.1 Index]