Logistic regression using penalized likelihood (lasso?) in Matlab/R I am trying to use logistic regression in a scenario where there are very few positives.  I'm aware that maximum likelihood suffers from small sample bias.  So MATLAB's glmfit doesn't work for me.  I tried using firth regression in R but it simply hangs up my powerful PC (150,000 observations, 9 dummy variables, 1500 positives).  MATLAB also has the function lassoglm but I'm not sure if it can be used for logistic regression with few positives.  Can you please confirm/suggest alternative?  
Some useful links - here and here. 
 A: Given the stated sample size (150,000), why do you think there will be bias due to "small sample" size? You have 1500 observations of the positive case, which I wouldn't normally think of as being small.
An alternative in R is the brglm package, which also implements Firth's method.
However, I was recently pointed to a paper (Gelman et al 2008) which showed Firth's method performing quite badly compared to other methods for bias reduction, in a Bayesian context. The authors of that paper wrote the bayesglm() function in R package arm to provide a range of priors on the model coefficients (Firth's method boils down to a particular choice of prior in the model; a Jeffreys prior). My main reason for mentioning it is that it may also work more efficiently than the options considered thus far.
A: With 1% positives, you have unbalanced classes. You do not have a small-sample problem as some have pointed out. Instead, you have a rare-event scenario (aka class imbalance). Logistic regression optimized with vanilla MLE will be dominated by the major class (99%).
In such a case, alternatives to vanilla logistic regression include:

*

*Rare events logistic regression (Zelig::relogit in R implementing King, Leng 2001) which uses weighting and bias correction to address the imbalance.

*Firth regression which uses a penalized MLE instead. (brglm and the newer brglm2 may be faster implementations.)

Note that the lasso penalty reduces the model dimensionality and may help with MLE convergence. However, it does not address the biases driven by the class imbalance.
