compCL: Fits regularization paths for longitudinal compositional data...

Description Usage Arguments Value Examples

Description

Fits regularization paths for longitudinal compositional data with lasso penalty at a sequence of regularization parameters lambda.

Usage

1
2
3
4
5
compCL(y, Z, Zc = NULL, intercept = TRUE, pf = rep(1, times = p),
  lam = NULL, nlam = 100, lambda.factor = ifelse(n < p, 0.05, 0.001),
  dfmax = p, pfmax = min(dfmax * 1.5, p), u = 1, mu_ratio = 1.01,
  tol = 1e-10, outer_maxiter = 1e+08, outer_eps = 1e-08,
  inner_maxiter = 1000, inner_eps = 1e-06)

Arguments

y

a vector of response variable with length n.

Z

a n*p matrix after taking log transformation on compositional data.

Zc

a design matrix of other covariates considered. Default is NULL.

intercept

Whether to include intercept in the model. Default is TRUE.

pf

penalty factor, a vector in length of p. Separate penalty weights can be applied to each coefficience β for composition variates to allow differential shrinkage. Can be 0 for some β's, which implies no shrinkage, and results in that composition always being included in the model. Default value for each entry is the 1.

lam

a user supplied lambda sequence. Typically, by leaving this option unspecified users can have the program compute its own lam sequence based on nlam and lambda.factor If lam is provided but a scaler, lam sequence is also created starting from lam. Supplying a value of lambda overrides this. It is better to supply a decreasing sequence of lambda values, if not, the program will sort user-defined lambda sequence in decreasing order automatically.

nlam

the length of lam sequence - default is 100.

lambda.factor

the factor for getting the minimal lambda in lam sequence, where min(lam) = lambda.factor * max(lam). max(lam) is the smallest value of lam for which all penalized group are zero's. The default depends on the relationship between n and p1 If n >= p1 the default is 0.001, close to zero. If n < p1, the default is 0.05. A very small value of lambda.factor will lead to a saturated fit. It takes no effect if there is user-defined lambda sequence.

dfmax

limit the maximum number of groups in the model. Useful for very large p, if a partial path is desired - default is p.

pfmax

limit the maximum number of groups ever to be nonzero. For example once a group enters the model along the path, no matter how many times it exits or re-enters model through the path, it will be counted only once. Default is min(dfmax*1.5, p).

u

u is the inital value for penalty parameter of augmented Lanrange method. Default value is 1.

mu_ratio

mu_ratio is the increasing ratio for u - default value is 1.01. Inital values for scaled Lagrange multipliers are set as 0's. If mu_ratio < 1, there is no linear constraints included. Group lasso coefficients are estimated.

tol

tolerance for vectors beta'ss to be considered as none zero's. For example, coefficient β_j for group j, if max(abs(β_j)) < tol, set β_j as 0's. Default value is 0.

outer_maxiter

outer_maxiter is the maximun munber of loops allowed for Augmented Lanrange method; and outer_eps is the convergence termination tolerance.

outer_eps

outer_maxiter is the maximun munber of loops allowed for Augmented Lanrange method; and outer_eps is the convergence termination tolerance.

inner_maxiter

inner_maxiter is the maximun munber of loops allowed for blockwise-GMD; and inner_eps is the convergence termination tolerance.

inner_eps

inner_maxiter is the maximun munber of loops allowed for blockwise-GMD; and inner_eps is the convergence termination tolerance.

Value

An object with S3 calss compCL

beta

a matrix of coefficients for cbind{Z, Zc, 1_n}, with nlam rows.

lam

the actual sequence of lam values used.

df

the number of non-zero β's in estimated coefficients for Z at each value of lam

npass

total iteration conducted in computation.

error

error message for path at each each value of lam. If 0, no error occurs.

call

the call that produced this object.

dim

dimension of coefficient matrix

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
p = 30
n = 50
beta = c(1, -0.8, 0.6, 0, 0, -1.5, -0.5, 1.2)
beta = c( beta, rep(0, times = p - length(beta)) )
Comp_data = comp_simulation(n = n, p = p, rho = 0.2, sigma = 0.5, gamma  = 0.5, add.on = 1:5,
                            beta = beta, intercept = FALSE)
Comp_data$Zc
m1 <- compCL(y = Comp_data$y, Z = Comp_data$X.comp, Zc = Comp_data$Zc,
             intercept = Comp_data$intercept,
             pf = rep(1, times = p),
             lam = NULL, nlam = 100,lambda.factor = ifelse(n < p, 0.05, 0.001),
             dfmax = 20, #pfmax = min(dfmax * 1.5, p),
             mu_ratio = 1, tol = 1e-10,
             outer_maxiter = 1e8, outer_eps = 1e-10,
             inner_maxiter = 1e3, inner_eps = 1e-6)
drop(m1$lam)
coef(m1, s = c(1, 0.5, 0.1))
#coef(m1)
Znew <- Comp_data$Z[1:5,]
print(predict(m1, Znew = Znew[1:5, ], s = m1$lam[15:20]))

jiji6454/Rpac_compReg documentation built on May 31, 2019, 5:01 a.m.