knitr::opts_chunk$set(echo = TRUE, cache = TRUE)

Build Status CRAN_Status_Badge

***This package is experimental and not regularly maintained. It is recommended to use {glmnet} instead!

Overview

logitr is an R package for linear and logistic regression with optional ridge and bridge regularization penalties. A (possibly incomplete) list of functions contained in the package can be found below:

See vignette or manual.

Installation

# The easiest way to install is from the development version from GitHub:
# install.packages("devtools")
devtools::install_github("MGallow/logitr")

If there are any issues/bugs, please let me know: github. You can also contact me via my website. Pull requests are welcome!

Usage

library(logitr)

#we will use the iris data set
X = dplyr::select(iris, -c(Species, Sepal.Length))
y = dplyr::select(iris, Sepal.Length)
y_class = ifelse(dplyr::select(iris, Species) == "setosa", 1, 0)

#ridge regression (use CV for optimal lambda)
linearr(X, y, penalty = "ridge")

#ridge logistic regression (IRLS) (use CV for optimal lambda)
logisticr(X, y_class, penalty = "ridge")

#ridge logistic regression (MM)
logisticr(X, y_class, lam = 0.1, penalty = "ridge", method = "MM")

#bridge logistic regression (MM)
fit = logisticr(X, y_class, lam = 0.1, alpha = 1.2, penalty = "bridge")
fit

#predict using bridge logistic regression estimates
predict(fit, X[1:3,], y_class[1:3])


MGallow/logitr documentation built on May 6, 2019, 12:06 a.m.