Learn R Programming

SIS (version 0.6)

wtlassoglm: Weighted L1 regularized loglikelihood for generalized linear models

Description

This functions solves weighted L1 regularized loglikelihood for generalized linear models.

Usage

wtlassoglm(x, y, lassoweight=NULL, initsoln=NULL,   family = binomial(), 
weight = NULL, offset = NULL, lambda2=0, function.precision=1e-10)

Arguments

x
an (n * p) matrix of features.
y
an (n) vector of response.
lassoweight
a (p) vector of weights specifying the weighted L1 penalty.
initsoln
a (p+1) vector of initial solution.
family
a description of the error distribution and link function to be used in the model.
weight
an optional (n) vector of weights to be used in the fitting process.
offset
this can be used to specify an a priori known component to be included in the linear predictor during fitting.
lambda2
regularization parameter for the L2 norm of the coefficients. Default is 0.
function.precision
function.precision parameter used in the internal solver. Default is 1e-10.

Value

  • An object is returned with
  • lambda2$\lambda_2$ used.
  • xnamescolumn names of x.
  • familya description of the error distribution and link function to be used in the model.
  • weightan optional (n) vector of weights to be used in the fitting process.
  • offsetthis can be used to specify an a priori known component to be included in the linear predictor during fitting.
  • lassoweighta (p) vector of weights specifying the weighted L1 penalty.
  • initsolna (p+1) vector of initial solution.
  • wa (p+1) vector of weight L1 solution.

Details

This function solves weighted L1 regularized loglikelihood for generalized linear models. It is based on the source code of R package glmpath.

See Also

scadglm, fullscadglm

Examples

Run this code
set.seed(0)
b <- c(2,2,2,-3*sqrt(2))
n=400
p=30
truerho=0.5
x=matrix(rnorm(n*p, mean=0, sd=1), n, p)
feta=x[, 1:4]%*%b
fprob=exp(feta)/(1+exp(feta))
y=rbinom(n, 1, fprob)
lassoweight<-rep(0.6,30)
wtlassoglm(x,y,lassoweight)$w
coef(glm(y~x,family=binomial()))

Run the code above in your browser using DataLab