Description Usage Arguments Details Value Author(s) Examples
weighted.sparsenet
is a function to fit the penalized weighted least square regression using coordinate descent algorithm.
1 | weighted.sparsenet(X, y, delta = 1, n_lambda = 100, n_kappa = 1, kappa0 = 1/3, lambda0 = -1, eps = 1e-06, max.iter = 1000, method = "include", name.list = NA, weight = NA, AFT = TRUE, penalty = "MCP")
|
X |
Design matrix of size n by p, where n is the sample size and p is the number of variables. |
y |
response vector of length n. |
delta |
indicator vector of length n. Useful when |
n_lambda |
number of lambda values in the grid. Default value is
100. Either |
n_kappa |
number of kappa values in the grid. Default value is 1. |
kappa0 |
Maximum value of κ. If |
lambda0 |
Maximum value of λ. Default value is -1. If |
eps |
Convergence threshhold. The algorithm iterates until the relative change in any coefficient is less than eps. Default is 1e-6. |
max.iter |
Maximum number of iteration. Default is 100. |
method |
Character. Either "exclude" or "include". If |
name.list |
vector to specify the names of rows of matrix |
weight |
Only useful when |
AFT |
logical. If |
penalty |
The penalty to be added to the objective function. Values could be "MCP" (the default), "SCAD" or "adaptive" for MCP, SCAD and adaptive LASSO penalties, respectively. LASSO result is automatically computed. |
The function weighted.sparsenet
computes the solutions
to the penalized least square problem. It minimizes
L_{λ, γ}(β_0, β) = 1/2∑_{i=1}^nω_{ni}(Y_i-β_0 -X'_iβ)^2+∑\limits_{j=1}^pρ(r_{nj}|β_j|;λ, γ),
where ω_{n1}=δ_{(1)}/n, ω_{ni}=δ_{(i)}/(n-i+1)∏_{j=1}^{i-1}((n-j)/(n-j+1))^{δ_{(j)}} for i=2, 3, …, n, and r_{nj}=√{∑\limits_{i=1}^nω_{ni}(X_{ij}-\bar X_{ω j})^2}.
For t>0, when the penalty is LASSO,
ρ(t;λ)=|t|. When the penalty is MCP,
ρ(t;λ,κ)=\int_0^tλ(1-\frac{κ
x}{λ})_+dx. In the first step, it computes the solutions with LASSO penalty along λ. In the second step, it uses the LASSO solution as a warm start value to compute the solution with MCP penalty. At each point on the λ - κ surface, the function will return the corresponding solutions. To form the grid, a sequence of values of length n_lambda
is computed, equally spaced on the log scale and is assigned to λ, and a sequence of values of length n_kappa
is computed, equally spaced and is assigned to λ. The minimum of λ is 0 and the maximum of λ is lambda0
. The minimum of κ is 0 and the maximum of κ is kappa0
.
A list of results.
omega |
vector of length n. It contains the weights associated with n observations. |
X |
normalized design matrix. Useful when use the |
betalasso |
The fitted matrix of coefficients with LASSO penalty. The number of rows is equal to the number of coefficients in the model, and the number of columns is the number of λ. |
betamcp |
The fitted matrix of coefficients with MCP penalty if |
betascad |
The fitted matrix of coefficients with SCAD penalty if |
betaadap |
The fitted matrix of coefficients with adaptive LASSO penalty if |
iter |
number of iterations in each MCP/SCAD solution. |
lambda |
vector of length |
kappa |
vector of length |
n_lambda |
number of lambda values in the grid. |
n_kappa |
number of kappa values in the grid. |
r |
vector of length p. It contains normlizing constants for each column of design matrix X. |
n |
number of rows of matrix X. |
p |
number of columsn of matrix X. |
name |
The names associated with the selected variables. |
Hao Chai <hao.chai@yale.edu>
1 2 3 4 5 6 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.