Have you tried: pen <- rep(1,ncol(X)) pen[c(1,5,7)] <- 0 fit <- glmnet(X,y,penalty.factor=pen)
-----Original Message----- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Brian H. Chen Sent: Wednesday, April 27, 2011 12:01 PM To: r-help@r-project.org Subject: [R] glmnet package: penalty.factor option Anyone have experience specifying the "penalty.factor" option in the "glmnet" command? I have 3 variables (out of a million genotype variables) that I want to force into the model (i.e., set penalty factor to 0), but I can't figure out how to do that. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.