cv.sparse.mediation.old: Conduct K-fold cross validation for sparse mediation with...

Description Usage Arguments Value Author(s) References Examples

View source: R/cv.sparse.mediation.old.R

Description

Conduct K-fold cross validation for sparse mediation with elastic net with multiple tuning parameters (old version)

Usage

1
2
3
cv.sparse.mediation.old(X, M, Y, tol = 10^(-10), K = 5, max.iter = 100,
  lambda = log(1 + (1:15)/50), alpha = (0:4)/4, figure = NULL,
  multicore = 1, seednum = 1e+06, display = TRUE)

Arguments

X

One-dimensional predictor

M

Multivariate mediator

Y

Outcome

tol

(default -10^(-10)) convergence criterion

K

(default=5) number of cross-validation folds

max.iter

(default=100) maximum iteration

lambda

(default=log(1+(1:30)/100)) tuning parameter for L1 penalization

alpha

(defult=c(1:4)/4) tuning parameter for L2 penalization

figure

(defult=NULL) print figures for mean predictive errors by tuning parameters alpha and lambda

multicore

(default=1) number of multicore

seednum

(default=10000) seed number for cross validation

glmnet.penalty.factor

(default=c(0,rep(1,2*V))) give different weight of penalization for the 2V mediation paths.

disply

devault=FALSE

Value

re list of sparse.mediation per each alpha

Author(s)

Seonjoo Lee, [email protected]

References

TBA

Examples

1
2
3
4
5
6
7
8
N=100
V=50
set.seed(1234)
a = rbinom(V,1,0.1)*5;b<-a
X = rnorm(N)
M =  X %*% t(a)+ matrix(rnorm(N*V),N,V)
Y =  X + M %*% b + rnorm(N)
cv.sparse.mediation.old(X,M,Y,tol=10^(-10),max.iter=100,lambda = log(1+(1:15)/50))

seonjoo/sparsemediation documentation built on May 13, 2018, 2:53 a.m.