Description Usage Arguments Value Examples
Fits regularization paths for longitudinal compositional data with group-lasso penalty at a sequence of regularization parameters lambda and fixed degree of freedom of basis.
1 2 3 4 5 6 7 8 | FuncompCGL(y, X, Zc = NULL, intercept = TRUE, ref = NULL, k, degree = 3,
basis_fun = c("bs", "OBasis", "fourier"), insert = c("FALSE", "X",
"basis"), method = c("trapezoidal", "step"), interval = c("Original",
"Standard"), Trange, T.name = "TIME", ID.name = "Subject_ID", W = rep(1,
times = p - length(ref)), dfmax = p - length(ref), pfmax = min(dfmax *
1.5, p - length(ref)), lam = NULL, nlam = 100, lambda.factor = ifelse(n
< p1, 0.05, 0.001), tol = 0, mu_ratio = 1.01, outer_maxiter = 1e+08,
outer_eps = 1e-08, inner_maxiter = 10000, inner_eps = 1e-08)
|
y |
a vector of response variable. |
X |
a data frame or matrix.
|
Zc |
A design matrix for control variables, could be missing. Default is NULL. No penalty is imposed. |
intercept |
whether to include intercept. Default is TRUE. |
ref |
reference variable. If |
k |
a scaler, degree of freedom of basis. |
degree |
degree of basis - default value is 3. |
basis_fun |
a function of basis. For now one of the following three types,
Default is |
insert |
way to interpolation. If
Default is |
method |
method used to approximate integral.
Default is |
interval |
a character string sepcifying domain of integral
Default is |
Trange |
range of time points |
T.name, ID.name |
characters specifying names of time varaible and Subject ID respectively in X,
only needed as X is data frame of longitudinal compositinal varaibles.
Default are |
W |
a vector in length of p (the total number of groups), matrix with dimension
Default value is rep(1, times = p). |
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 |
lam |
a user supplied lambda sequence. Typically, by leaving this option unspecified users can have the
program compute its own |
nlam |
the length of |
lambda.factor |
the factor for getting the minimal lambda in |
tol |
tolerance for vectors beta'ss to be considered as none zero's. For example, coefficient
β_j for group j, if max(abs(β_j)) < |
mu_ratio |
|
outer_maxiter |
|
outer_eps |
|
inner_maxiter |
|
inner_eps |
|
An object with S3 calss FuncompCGL
Z |
integral matrix for longitudinal compositinal predictors with dimension n*(p*k). |
lam |
the actual sequence of |
df |
the number of non-zero groups in estimated coefficients for |
beta |
a matrix of coefficients for |
dim |
dimension of coefficient matrix |
call |
the call that produced this object. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | df_beta = 5
p = 30
beta_C_true = matrix(0, nrow = p, ncol = df_beta)
beta_C_true[3, ] <- c(-0.8, -0.8 , 0.4 , 1 , 1)
beta_C_true[4, ] <- c(0.5, 0.5, -0.6 ,-0.6, -0.6)
beta_C_true[1, ] <- c(-0.5, -0.5, -0.5 , -1, -1)
beta_C_true[2, ] <- c(0.8, 0.8, 0.7, 0.6, 0.6)
Data <- Model(n = 50, p = p, m = 2, intercept = TRUE,
SNR = 2, sigma = 2,
rho_X = 0, rho_W = 0,
df_W = 5, df_beta = df_beta,
ns = 100, obs_spar = 0.2, theta.add = c(3,4,5),
beta_C = as.vector(t(beta_C_true)))
y <- Data$data$y
X <- Data$data$Comp
Zc <- Data$data$Zc
intercept <- Data$data$intercept
k_use <- df_beta
m1 <- FuncompCGL(y = y, X = X , Zc = Zc, intercept = intercept,
k = k_use, basis_fun = "bs",
insert = "FALSE", method = "t",
dfmax = p, tol = 1e-6)
beta <- coef(m1, s = m1$lam[20])
#beta <- coef(m1)
beta_C <- matrix(beta[1:(p*k_use)], nrow = p, byrow = TRUE)
colSums(beta_C)
Non.zero <- apply(beta_C, 1, function(x) ifelse(max(abs(x)) == 0, FALSE, TRUE))
Non.zero <- (1:p)[Non.zero]
Non.zero
plot(m1, ylab = "L2", p = p , k = k_use)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.