glm_grad: A first-order solution for the GLM maximum likelihood problem

Description Usage Arguments Value Examples

View source: R/glm_grad.R

Description

a first-order solution for the GLM maximum likelihood problem using only gradient information without the Hessian matrix

Usage

1
2
3
4
5
6
7
8
9
glm_grad(
  X,
  y,
  family = poisson(link = "log"),
  niter = 1000,
  lambda = 1e-05,
  update = FALSE,
  gamma = 0.95
)

Arguments

X

The predictors of the glm

y

The response variable of the glm

family

The link function

niter

The number of iterations

lambda

The learning rate

update

Either a constant step size or an adaptive step size

gamma

The momentum step size

Value

The estimated coefficients for the glm

Examples

1
2
3
4
5
#reference CASL 5.3
n = 1000; p = 5
X <- cbind(1, matrix(rnorm(n*(p-1)), ncol=p-1))
y = sample(c(0,1), replace=TRUE, size=n)
glm(X, Y, update=FALSE)

wuyinfeistella/bis557 documentation built on Jan. 1, 2021, 12:52 p.m.