Fits network regressions over the grid of values of penalty parameters \(\lambda\)1 and \(\lambda\)2, stores connection signs, number of iterations until convergence and convergence outcome.
lasso.net.grid(x,y ,beta.0,lambda1,lambda2,M1,m.iter,n.iter,iscpp=TRUE,tol,alt.num)\(n \times p\) input data matrix
response vector or size \(n \times 1\)
initial value for \(\beta\). default - zero vector of size \(n \times 1\)
lasso penalty coefficient
network penalty coefficient
penalty matrix
maximum number of iterations for sign matrix updating; default - 100
maximum number of iterations for \(\beta\) updating; default - 1e5
binary choice for using cpp function in coordinate updates; 1 - use C++ (default), 0 - use R
convergence in \(\beta\) tolerance level; default - 1e-6
alt.num remaining iterataions are stored; default - 12
matrix of \(\beta\) coefficients, columns are for different \(\lambda\)1 parameters, rows \(\lambda\)2 parameters
mean squared error value
array of connection signs. \(M[,,i,j]\) is the connection sign matrix for j-th \(\lambda\)1 value and i-th \(\lambda\)2 value
matrix with stored number of steps for sign matrix to converge
matrix with stored number of steps for \(\beta\) updates to converge. (only stores the last values from connection signs iterations)
matrix with stored values for convergence in sign matrix
matrix with stored values for convergence in \(\beta\) coefficients. If at least one \(\beta\) did not converge in sign matrix iterations, 0 (false) is stored, otherwise 1 (true)
array with stored connection signs changes in each iteration
array of coefficient vectors in case connection signs alternate
Fits network regression for the grid values of \(\lambda\)1 and \(\lambda\)2 using warm starts.
Weber, M., Striaukas, J., Schumacher, M., Binder, H. "Network-Constrained Covariate Coefficient and Connection Sign Estimation" (2018) <doi:10.2139/ssrn.3211163>
# NOT RUN {
p=200
n=100
beta.0=array(1,c(p,1))
x=matrix(rnorm(n*p),n,p)
y=rnorm(n,mean=0,sd=1)
lambda1=c(0,1)
lambda2=c(0,1)
M1=diag(p)
lasso.net.grid(x, y, beta.0, lambda1, lambda2, M1)
# }
Run the code above in your browser using DataLab