logistic_reg: Logistic Regression

Description Usage Arguments Value

View source: R/full_logistic_reg.R

Description

logistic_reg function that performs logistic regression, implemented here for baseline unit testing. This is almost identical to RcppNumerical::fastLR.

Usage

1
2
3
4
5
6
7
8
logistic_reg(
  x,
  y,
  start = rep(0, ncol(x)),
  eps_f = 1e-08,
  eps_g = 1e-05,
  maxit = 300
)

Arguments

x

the design matrix, with predictors as columns.

y

the response vector.

start

The initial guess of the coefficient vector.

eps_f

Iteration stops if |f-f'|/|f|<eps_f, where f and f' are the current and previous value of the objective function (negative log likelihood) respectively.

eps_g

Iteration stops if ||g|| < eps_g * max(1, ||beta||), where beta is the current coefficient vector and g is the gradient.

maxit

Maximum number of iterations.

Value

a list with the following components:

coefficients

Coefficient vector

fitted.values

The fitted probability values

linear.predictors

The fitted values of the linear part, i.e., X * beta_hat

loglikelihood

The maximized log likelihood

converged

Whether the optimization algorithm has converged


CCGill/LRpadding documentation built on May 11, 2020, 12:21 a.m.