Description Usage Arguments Value Examples
Computes the coefficient estimates for logistic regression. ridge regularization and bridge regularization optional.
| 1 2 3 4 | 
| X | matrix or data frame | 
| y | matrix or vector of response values 0,1 | 
| lam | optional tuning parameter(s) for ridge regularization term. If passing a list of values, the function will choose optimal value based on K-fold cross validation. Defaults to 'lam = seq(0, 2, 0.1)' | 
| alpha | optional tuning parameter for bridge regularization term. If passing a list of values, the function will choose the optimal value based on K-fold cross validation. Defaults to 'alpha = 1.5' | 
| penalty | choose from c('none', 'ridge', 'bridge'). Defaults to 'none' | 
| intercept | Defaults to TRUE | 
| method | optimization algorithm. Choose from 'IRLS' or 'MM'. Defaults to 'IRLS' | 
| tol | tolerance - used to determine algorithm convergence. Defaults to 10^-5 | 
| maxit | maximum iterations. Defaults to 10^5 | 
| vec | optional vector to specify which coefficients will be penalized | 
| init | optional initialization for MM algorithm | 
| criteria | specify the criteria for cross validation. Choose from c('mse', 'logloss', 'misclass'). Defauls to 'logloss' | 
| K | specify number of folds for cross validation, if necessary | 
returns selected tuning parameters, beta estimates (includes intercept), MSE, log loss, misclassification rate, total iterations, and gradients.
| 1 2 3 4 5 6 7 8 9 10 11 | library(dplyr)
X = dplyr::select(iris, -Species)
y = dplyr::select(iris, Species)
y$Species = ifelse(y$Species == 'setosa', 1, 0)
logisticr(X, y)
# ridge Logistic Regression with IRLS
logisticr(X, y, lam = 0.1, penalty = 'ridge')
# ridge Logistic Regression with MM
logisticr(X, y, lam = 0.1, penalty = 'ridge', method = 'MM')
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.