rlassologit: rlassologit: Function for logistic Lasso estimation

Description Usage Arguments Details Value References Examples

View source: R/rlassologit.R

Description

The function estimates the coefficients of a logistic Lasso regression with data-driven penalty. The method of the data-driven penalty can be chosen. The object which is returned is of the S3 class rlassologit

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
rlassologit(x, ...)

## S3 method for class 'formula'
rlassologit(formula, data = NULL, post = TRUE,
  intercept = TRUE, model = TRUE, penalty = list(lambda = NULL, c = 1.1,
  gamma = 0.1/log(n)), control = list(threshold = NULL), ...)

## S3 method for class 'character'
rlassologit(x, data = NULL, post = TRUE,
  intercept = TRUE, model = TRUE, penalty = list(lambda = NULL, c = 1.1,
  gamma = 0.1/log(n)), control = list(threshold = NULL), ...)

## Default S3 method:
rlassologit(x, y, post = TRUE, intercept = TRUE,
  model = TRUE, penalty = list(lambda = NULL, c = 1.1, gamma = 0.1/log(n)),
  control = list(threshold = NULL), ...)

Arguments

x

regressors (matrix)

...

further parameters passed to glmnet

formula

an object of class 'formula' (or one that can be coerced to that class): a symbolic description of the model to be fitted in the form y~x.

data

an optional data frame, list or environment.

post

logical. If TRUE, post-lasso estimation is conducted.

intercept

logical. If TRUE, intercept is included which is not penalized.

model

logical. If TRUE (default), model matrix is returned.

penalty

list with options for the calculation of the penalty. c and gamma constants for the penalty.

control

list with control values. threshold is applied to the final estimated lasso coefficients. Absolute values below the threshold are set to zero.

y

dependent variable (vector or matrix)

Details

The function estimates the coefficients of a Logistic Lasso regression with data-driven penalty. The option post=TRUE conducts post-lasso estimation, i.e. a refit of the model with the selected variables.

Value

rlassologit returns an object of class rlassologit. An object of class rlassologit is a list containing at least the following components:

coefficients

parameter estimates

beta

parameter estimates (without intercept)

intercept

value of intercept

index

index of selected variables (logicals)

lambda

penalty term

residuals

residuals

sigma

root of the variance of the residuals

call

function call

options

options

References

Belloni, A., Chernozhukov and Y. Wei (2013). Honest confidence regions for logistic regression with a large number of controls. arXiv preprint arXiv:1304.3969.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: 
library(hdm)
## DGP
set.seed(2)
n <- 250
p <- 100
px <- 10
X <- matrix(rnorm(n*p), ncol=p)
beta <- c(rep(2,px), rep(0,p-px))
intercept <- 1
P <- exp(intercept + X %*% beta)/(1+exp(intercept + X %*% beta))
y <- rbinom(length(y), size=1, prob=P)
## fit rlassologit object
rlassologit.reg <- rlassologit(y~X)
## methods
summary(rlassologit.reg, all=F)
print(rlassologit.reg)
predict(rlassologit.reg, type='response')
X3 <- matrix(rnorm(n*p), ncol=p)
predict(rlassologit.reg, newdata=X3)

## End(Not run)

hdm documentation built on May 1, 2019, 7:56 p.m.