Prepare for the Society of Actuaries PA Exam with a comprehensive quiz. Test your knowledge with flashcards and multiple choice questions that provide hints and explanations. Get set for success on your exam!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


Which R function is used to perform Lasso Regression?

  1. lm

  2. glmnet

  3. stepAIC

  4. cv.glmnet

The correct answer is: glmnet

The function used to perform Lasso Regression in R is glmnet. This function is specifically designed for fitting generalized linear models with elastic net penalties, which includes Lasso as a special case when the penalty for the L1 norm is applied. Lasso Regression is popular for model selection and regularization because it can shrink some coefficients to zero, effectively selecting a simpler model that may generalize better to unseen data. The glmnet function efficiently handles large datasets and can fit models to input data structured in a matrix format for ease of computation. It allows users to specify the alpha parameter, where an alpha of 1 corresponds to Lasso Regression. While cv.glmnet is also related to Lasso Regression, as it performs cross-validation to help determine the best lambda (the penalty term), it does not fit the model directly. Instead, it uses glmnet internally. The lm function fits a linear model without regularization, and stepAIC is used for model selection based on the Akaike Information Criterion, neither of which are appropriate for Lasso Regression.