smooth_L0_lambda: CIV_smooth solution given lambda. (Internal function)

Description Usage Arguments Value Examples

View source: R/CIVMR_function.R

Description

This function finds a CIV_smooth solution of u given a value of λ. This function is mostly for internal use. smooth_CIV() is suggested for users to obtain optimal solutions of CIV_smooth.

Usage

1
2
3
4
smooth_L0_lambda(initial = NULL, null_space, G, X, GTG, lambda,
  sigma_min = 0.01, sigma_up = 0.5, stepsize = 0.1, conv_iters = 5,
  stepsize_last = 1e-04, last_conv_iters = 2000, GTMG, ZTG, GTZ, ZTG_ginv,
  accuracy_par = 1e-10)

Arguments

initial:

the initial point of u for updating. The CIV solution will be used as the initial point if no choice is made.

G:

SNP matrix with dimension n \times p.

X:

phenotype of interest.

Z:

pleiotropic phenotype Z.

GTG:

G`G

GTMG:

G`X(X`X)^{-1}X`G.

ZTG:

Z`G

GTZ:

G`Z

ZTG_ginv:

general inverse of Z`G (ginv(Z`G)).

null_space:

null space of matrices G'Z (null(G'Z)).

lambda:

a given value (must be specified) for regularization parameter λ.

accuracy_par:

the accuracy threshold parameter to determine if the algorithm converged to a local maximum. Default is 1e-10.

last_conv_iters:

the maximum iterations to run. Default is 2000.

......:

default values for other tuning parameters.

Value

mat_u: the trace of all updated iterations of u.

opt_solution: the final solution of u.

value_list: the iteration values of target function (penalized correlation).

unstrained_val_list: the iteration values of correlation between X and Gu.

dev_list: the iteration values of deviance between updated vector of u.

n_iters_stage: the number of iterations before finishing updating. If this value < last_conv_iters, then the algorithm stopped at a solution of u without using up its updating quota.

sigma_stage: the updating values of σ that are used in each iteration.

stepsize_list: the updating values of stepsize that are used in each iteration.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
data(simulation)
G <- simulation$G
X <- simulation$X
Z <- simulation$Z
GTG <- crossprod(G,G)
M <- tcrossprod ( tcrossprod ( X , solve(crossprod(X,X) ) ), X )
GTMG <- crossprod(G, crossprod(M,G))
ZTG <- crossprod(Z,G)
GTZ <- crossprod(G,Z)
null_space <- Null( GTZ)
ZTG_ginv <- ginv(ZTG)
lambda <- 1
smooth.lambda1 <- smooth_L0_lambda(null_space = null_space, G = G, X = X, GTG = GTG, lambda = lambda,
GTMG = GTMG, ZTG = ZTG, GTZ = GTZ, ZTG_ginv = ZTG_ginv )
plot(smooth.lambda1$opt_solution)  #plot the final solution u

LaiJiang/CIVMR documentation built on July 16, 2020, 12:45 a.m.