Title: | Flexible Regularized Estimating Equations |
---|---|
Description: | Unified regularized estimating equation solver. Currently the package includes one solver with the l1 penalty only. More solvers and penalties are under development. Reference: Yi Yang, Yuwen Gu, Yue Zhao, Jun Fan (2021) <doi:10.48550/arXiv.2110.11074>. |
Authors: | Yi Lian [aut, cre], Yi Yang [aut, cph], Yuwen Gu [aut], Jun Fan [aut], Yue Zhao [aut], Robert W. Platt [aut] |
Maintainer: | Yi Lian <[email protected]> |
License: | GPL-3 |
Version: | 1.0.2 |
Built: | 2024-11-21 03:34:12 UTC |
Source: | https://github.com/cran/free |
free
Main solver of free
free_lasso( p, lambda, est_func, par_init, alpha, tau, maxit = 1000L, tol_ee = 1e-06, tol_par = 1e-06, verbose = FALSE )
free_lasso( p, lambda, est_func, par_init, alpha, tau, maxit = 1000L, tol_ee = 1e-06, tol_par = 1e-06, verbose = FALSE )
p |
The dimension of the dataset |
lambda |
Lasso regularization coefficient |
est_func |
R function, the estimating function specified by the user |
par_init |
Optional, initial value for parameter update |
alpha |
Tuning parameter |
tau |
Tuning parameter |
maxit |
Maximum iterations |
tol_ee |
Convergence criterion based on the update of the estimating function |
tol_par |
Convergence criterion based on the update of the parameter |
verbose |
logical, print updates |
A list containing the regularized estimating equation estimates and the number of iterations it takes to converge.
# Standardize data dat <- scale(mtcars) x <- as.matrix(dat[, -1]) y <- as.vector(dat[, 1]) n <- nrow(x) p <- ncol(x) # Specify estimating function ufunc <- function(b) { 1/n * crossprod(x, (x %*% b - y) ) } # Set hyperparameters tau <- 0.6 alpha <- 0.5 # Set regularization coefficient lambda1 <- 0 free_R1 <- free_lasso(p = p, lambda = lambda1, est_func = ufunc, par_init = rep(0, p), alpha = alpha, tau = tau, maxit = 10000L, tol_ee = 1e-20, tol_par = 1e-10, verbose = FALSE) free_R1$coefficients # Compare with lm() - very close lm(y~x-1)$coefficients # Set regularization coefficient lambda2 <- 0.7 free_R2 <- free_lasso(p = p, lambda = lambda2, est_func = ufunc, par_init = rep(0, p), alpha = alpha, tau = tau, maxit = 10000L, tol_ee = 1e-20, tol_par = 1e-10, verbose = FALSE) free_R2$coefficients
# Standardize data dat <- scale(mtcars) x <- as.matrix(dat[, -1]) y <- as.vector(dat[, 1]) n <- nrow(x) p <- ncol(x) # Specify estimating function ufunc <- function(b) { 1/n * crossprod(x, (x %*% b - y) ) } # Set hyperparameters tau <- 0.6 alpha <- 0.5 # Set regularization coefficient lambda1 <- 0 free_R1 <- free_lasso(p = p, lambda = lambda1, est_func = ufunc, par_init = rep(0, p), alpha = alpha, tau = tau, maxit = 10000L, tol_ee = 1e-20, tol_par = 1e-10, verbose = FALSE) free_R1$coefficients # Compare with lm() - very close lm(y~x-1)$coefficients # Set regularization coefficient lambda2 <- 0.7 free_R2 <- free_lasso(p = p, lambda = lambda2, est_func = ufunc, par_init = rep(0, p), alpha = alpha, tau = tau, maxit = 10000L, tol_ee = 1e-20, tol_par = 1e-10, verbose = FALSE) free_R2$coefficients