glmfo: first-order solution for the GLM maximum likelihood

Description Usage Arguments Examples

View source: R/HW3.R

Description

implementation of a first-order solution for the GLM maximum likelihood problem using only gradient information.

Usage

1
2
glmfo(x, y, family, method = "constant", lr = 1e-04, maxit = 10000,
  er = 1e-12, print = FALSE)

Arguments

x

feature variables

y

response variables

family

family object and link function

method

optimization method

lr

learning rate

maxit

Maximum number of iterations

er

allowed errors

print

whether to print to track progress

Examples

1
2
3
4
5
6
set.seed(100)
n <- 1000
X <- cbind(1, matrix(rnorm(n * 3), ncol = 3))
beta <- c(-1, 0.2, 0.5, 0.6 )
Y = rpois(n,exp(X %*% beta))
glmfo(X,Y,poisson(link='log'))

importbq/bis557 documentation built on Dec. 21, 2020, 3:05 a.m.