Title: | 3CoSE Algorithm |
---|---|
Description: | Contains functions to estimate a penalized regression model using 3CoSE algorithm, see Weber, Striaukas, Schumacher Binder (2018) <doi:10.2139/ssrn.3211163>. |
Authors: | Jonas Striaukas [aut, trl, cre] and Matthias Weber [aut] |
Maintainer: | Jonas Striaukas <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.8.3 |
Built: | 2024-11-22 03:50:51 UTC |
Source: | https://github.com/cran/LassoNet |
LassoNet contains functions to estimate a penalized regression model using 3CoSE algorithm described in the paper Weber, Striaukas, Schumacher and Binder (2018). The main function of the package is the function lasso.net.grid, see the example below.
Package: | LassoNet |
Type: | Package |
Version: | 0.8.3 |
Date: | 2019-12-16 |
License: | Open source |
Maintainer: Jonas Striaukas <[email protected]>
Weber, M., Striaukas, J., Schumacher, M., Binder, H. "Network-Constrained Covariate Coefficient and Connection Sign Estimation" (2018) <doi:10.2139/ssrn.3211163>
coefficients.
This function updates for given penalty parameters.
beta.update.net(x,y,beta,lambda1,lambda2,M1,n.iter,iscpp,tol)
beta.update.net(x,y,beta,lambda1,lambda2,M1,n.iter,iscpp,tol)
x |
input data matrix of size |
y |
response vector or size |
beta |
initial value for |
lambda1 |
lasso penalty parameter |
lambda2 |
network penalty parameter |
M1 |
penalty matrix |
n.iter |
maximum number of iterations for |
iscpp |
binary choice for using cpp function in coordinate updates; 1 - use C++ (default), 0 - use R |
tol |
convergence tolerance level; default - 1e-6 |
Updates the coefficient vector given the data and penalty parameters
1 and
2.
Convergence criterion is defined as
to.
beta |
updated |
convergence |
binary variable; 1 - yes |
steps |
number of steps until convergence |
Maintainer: Jonas Striaukas <[email protected]>
Weber, M., Striaukas, J., Schumacher, M., Binder, H. "Network-Constrained Covariate Coefficient and Connection Sign Estimation" (2018) <doi:10.2139/ssrn.3211163>
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<-1 lambda2<-1 M1<-diag(p) updates<-beta.update.net(x, y, beta.0, lambda1, lambda2, M1)
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<-1 lambda2<-1 M1<-diag(p) updates<-beta.update.net(x, y, beta.0, lambda1, lambda2, M1)
coefficients.
This function updates for given penalty parameters.
betanew_lasso_cpp(xx, xy, beta, M, y, Lambda1, Lambda2, iter, tol)
betanew_lasso_cpp(xx, xy, beta, M, y, Lambda1, Lambda2, iter, tol)
xx |
Bx matrix |
xy |
By vector |
beta |
initial value for |
M |
penalty matrix |
y |
response vector or size |
Lambda1 |
lasso penalty parameter |
Lambda2 |
network penalty parameter |
iter |
maximum number of iterations for |
tol |
convergence tolerance level |
See beta.update.net
beta |
updated |
steps |
number of steps until convergence |
Maintainer: Jonas Striaukas <[email protected]>
Weber, M., Striaukas, J., Schumacher, M., Binder, H. "Network-Constrained Covariate Coefficient and Connection Sign Estimation" (2018) <doi:10.2139/ssrn.3211163>
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<-1 lambda2<-1 M1<-diag(p) updates<-beta.update.net(x, y, beta.0, lambda1, lambda2, M1)
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<-1 lambda2<-1 M1<-diag(p) updates<-beta.update.net(x, y, beta.0, lambda1, lambda2, M1)
Computes least squares estimate in an efficient way.
fastols(y, x)
fastols(y, x)
y |
dependent variable |
x |
response variable |
Maintainer: Jonas Striaukas <[email protected]>
p<-10 n<-100 x<-matrix(rnorm(n*p),n,p) beta<-array(5, c(p,1)) y<-x%*%beta + rnorm(n,mean=0,sd=0.1) fastols(y,x)
p<-10 n<-100 x<-matrix(rnorm(n*p),n,p) beta<-array(5, c(p,1)) y<-x%*%beta + rnorm(n,mean=0,sd=0.1) fastols(y,x)
Computes matrices and
to speed up estimation of connection signs. These matrices are stored only for indices that have non zero entries in penalty matrix M.
get.BxBy(x, y, M)
get.BxBy(x, y, M)
x |
Input data matrix of size |
y |
y Response vector or size |
M |
penalty matrix |
Calculates matrices all for i and j indices that have non zero values in a given penalty matrix.
Bx |
array of |
By |
array of |
Maintainer: Jonas Striaukas <[email protected]>
Weber, M., Striaukas, J., Schumacher, M., Binder, H. "Network-Constrained Covariate Coefficient and Connection Sign Estimation" (2018) <doi:10.2139/ssrn.3211163>
p<-200 n<-100 x<-matrix(rnorm(n*p),n,p) y<-rnorm(n,mean=0,sd=1) M<-diag(p) get.BxBy(x, y, M)
p<-200 n<-100 x<-matrix(rnorm(n*p),n,p) y<-rnorm(n,mean=0,sd=1) M<-diag(p) get.BxBy(x, y, M)
Stores a matrix of connection signs to a vector.
get.signs.M(MAT)
get.signs.M(MAT)
MAT |
matrix of connection signs that contains -1, 1 or 0 |
vec.out |
vectorized MAT matrix |
Maintainer: Jonas Striaukas <[email protected]>
Updates connection signs .
get.xi(Bx,By,beta,xi,M)
get.xi(Bx,By,beta,xi,M)
Bx |
Bx element |
By |
By element |
beta |
|
xi |
|
M |
penalty matrix |
xi |
|
Maintainer: Jonas Striaukas <[email protected]>
Weber, M., Striaukas, J., Schumacher, M., Binder, H. "Network-Constrained Covariate Coefficient and Connection Sign Estimation" (2018) <doi:10.2139/ssrn.3211163>
See lasso.net.grid
lasso.net.fixed(x,y,beta.0,lambda1,lambda2,M1,n.iter,iscpp,tol)
lasso.net.fixed(x,y,beta.0,lambda1,lambda2,M1,n.iter,iscpp,tol)
x |
|
y |
response vector or size |
beta.0 |
initial value for |
lambda1 |
lasso penalty coefficient |
lambda2 |
network penalty coefficient |
M1 |
penalty matrix |
n.iter |
maximum number of iterations for |
iscpp |
binary choice for using cpp function in coordinate updates; 1 - use C++ (default), 0 - use R. |
tol |
convergence in |
Function loops through the grid of values of penalty parameters 1 and
2 until convergence is reached. Warm starts are stored for each iterator. The warm starts are stored once the coordinate updating converges.
beta |
Matrix of |
mse |
Mean squared error value |
iterations |
matrix with stored number of steps for sign matrix to converge |
update.steps |
matrix with stored number of steps for |
convergence.in.grid |
matrix with stored values for convergence in |
Maintainer: Jonas Striaukas <[email protected]>
Weber, M., Striaukas, J., Schumacher, M., Binder, H. "Network-Constrained Covariate Coefficient and Connection Sign Estimation" (2018) <doi:10.2139/ssrn.3211163>
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.fixed(x, y, beta.0, lambda1, lambda2, M1)
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.fixed(x, y, beta.0, lambda1, lambda2, M1)
1 and
2.
Fits network regressions over the grid of values of penalty parameters 1 and
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)
lasso.net.grid(x,y ,beta.0,lambda1,lambda2,M1,m.iter,n.iter,iscpp=TRUE,tol,alt.num)
x |
|
y |
response vector or size |
beta.0 |
initial value for |
lambda1 |
lasso penalty coefficient |
lambda2 |
network penalty coefficient |
M1 |
penalty matrix |
m.iter |
maximum number of iterations for sign matrix updating; default - 100 |
n.iter |
maximum number of iterations for |
iscpp |
binary choice for using cpp function in coordinate updates; 1 - use C++ (default), 0 - use R |
tol |
convergence in |
alt.num |
alt.num remaining iterataions are stored; default - 12 |
Fits network regression for the grid values of 1 and
2 using warm starts.
beta |
matrix of |
mse |
mean squared error value |
M |
array of connection signs. |
iterations |
matrix with stored number of steps for sign matrix to converge |
update.steps |
matrix with stored number of steps for |
convergence.in.M |
matrix with stored values for convergence in sign matrix |
convergence.in.grid |
matrix with stored values for convergence in |
xi.conv |
array with stored connection signs changes in each iteration |
beta.alt |
array of coefficient vectors in case connection signs alternate |
Maintainer: Jonas Striaukas <[email protected]>
Weber, M., Striaukas, J., Schumacher, M., Binder, H. "Network-Constrained Covariate Coefficient and Connection Sign Estimation" (2018) <doi:10.2139/ssrn.3211163>
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)
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)
Computes Laplacian matrix.
mat.to.laplacian(M1,type)
mat.to.laplacian(M1,type)
M1 |
|
type |
Laplacian types: 1) "normalized" (default) - normalized Laplacian, 2) "combinatorial" - combinatorial Laplacian |
L |
Laplacian |
Maintainer: Jonas Striaukas <[email protected]>
Updates M using relation .
matrix.M.update(M, xi)
matrix.M.update(M, xi)
M |
penalty matrix |
xi |
estimated |
Updates M
M |
updated M |
Maintainer: Jonas Striaukas <[email protected]>
Weber, M., Striaukas, J., Schumacher, M., Binder, H. "Network-Constrained Covariate Coefficient and Connection Sign Estimation" (2018) <doi:10.2139/ssrn.3211163>
p<-100 M<-diag(p) xi<-matrix(rnorm(p*p), p, p) matrix.M.update(M,xi)
p<-100 M<-diag(p) xi<-matrix(rnorm(p*p), p, p) matrix.M.update(M,xi)
Soft thresholding operator.
soft.thresh(x, kappa)
soft.thresh(x, kappa)
x |
|
kappa |
|
Soft thresholding definition:
x |
value after applying soft thresholding operator |
Maintainer: Jonas Striaukas <[email protected]>
kappa<-0.2 x<-0.7 soft.thresh(x, kappa)
kappa<-0.2 x<-0.7 soft.thresh(x, kappa)