I need to do penalized likelihood regression model. I tried to use glmnet, but this code is really unstable. I need to do simulation work. But a lot of times, it gives me all sorts of warning messages. This is really annoying and frustrating.

My set-up is that I have the column vector Y and the vectors X_1,...,X_k. I have n observations. Then I need to find \theta_0, \theta_1,...,\theta_k to minimize

$$ \frac 1n \sum\limits_{i=1}^n [-Y_i (\theta_0 + \sum\limits_j \theta_j X_{ij} ) + \exp (\theta_0 + \sum\limits_j \theta_j X_{ij}) ] + \lambda \sum\limits_j |\theta_j| $$

where j=1,2,...,k

The \lambda is the turning parameter, which needs to be estimated by cross-validation first.

How to design the above codes? Is it too difficult? Or any other built-in package in R?