The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [glmnet]

R package for lasso and elastic-net regularized generalized linear models.

Filter by
Sorted by
Tagged with
0
votes
1answer
17 views

Glmnet() returns different coefficients [on hold]

I want to get the regression weights from glmnet(). However, I get different coefficients with different methods. ...
1
vote
0answers
22 views

Multinomial logistic regression on document-topic probabilities with user rating

I am analyzing a dataset of customer reviews with topic modeling and am trying to quantify which topics have a positive/negative influence on the given ratings. I have computed a topic model using LDA ...
2
votes
2answers
31 views

Combining results of multiple Lasso runs / Variable selection

I would appreciate your opinion on an analysis approach I have in mind. The idea is to do the variable selection with multiple runs of Lasso regression (by glmnet in R). Basically, the workflow would ...
3
votes
1answer
37 views

Why glmnet 's $\lambda$ value is so small? Does it strictly implement the loss function under the hood?

I am running a glmnet fit with 1200000 samples. According to the glmnet doc, $\lambda$ value is the coefficient controlling how much the regularization term contributes to the total loss function. ...
0
votes
0answers
15 views

What is considered as a good fit using the fraction deviance?

I am using the fraction deviance given by Hastie et. al (2015), $\mathcal{D}_{\lambda}^{2}=\frac{\mathcal{D}\mathrm{ev}_{\mathrm{null}}-\mathcal{D}\mathrm{ev}_{\lambda}}{\mathcal{D}\mathrm{ev}_{\...
0
votes
1answer
15 views

Selected variables varies depending on whether or not standardization is in lasso regression (glmnet)

The paper often suggests both standardized and unstandardized coefficients in the lasso model (glmnet in R). However, when I run glmnet, the selected variable is different depending on standardized =...
0
votes
1answer
24 views

High odds ratio for composite score created by ridge regression

This question is a follow up to one of my previous questions asked on this site. The goal was to create a composite score for biomarkers related to a binary outcome and then use that in a regression ...
0
votes
0answers
10 views

Working Response variable and Weights for Logistic Regression (glmnet)

I am trying to figure out how the intercept is calculated for logistic regression lasso using coordinate descent algorithm based on this seminal paper: https://www.ncbi.nlm.nih.gov/pmc/articles/...
2
votes
0answers
39 views

Checking non linear effects in LASSO regression

This might be a weird question and I understand that LASSO is mainly using as a variable selection method. But I want to know that is it possible to check non-linear effects of a LASSO logistic ...
3
votes
0answers
36 views

Why does LASSO predict random data “well” during leave-one-out cross validation?

pre-amble: While investigating different cross validation strategies for small sample size dataset's with relatively large number of features I came across this peculiar result. While making a simple ...
4
votes
1answer
53 views

How to interpret coefficients of a multinomial elastic net (glmnet) regression

I'm trying to model a membership in one of three well-being clusters (flourisher, normative, languisher) based on a set of predictors, using elastic net for both variable selection & modelling. I ...
0
votes
0answers
15 views

Log Likelihood Glmnet

I am not exactly sure if I understood the glmnet algorithm correctly (https://web.stanford.edu/~hastie/glmnet/glmnet_alpha.html). It says it uses a maximum likelihood approach to find a solution. ...
1
vote
1answer
51 views

Why standardization of design matrix $X$ with factor $\frac{1}{n}$ instead of $\frac{1}{n-1}$ in lasso/glmnet?

I'm a little bit puzzled by the default standardization of the lasso/elastic net/ridge regression algorithms implemented in the (great!) glmnet package. In most other applications, people would ...
0
votes
1answer
24 views

Logistic Regression in MATLAB glmnet always returns 0 vector as coefficients [closed]

I am using glmnet in MATLAB 2019a on my Macbook to do logistic regression. Algorithm: $log(\frac{\pi_i}{1-\pi_i})=\beta_0+X_i^T\beta$ $\pi_i=P(Y=2|X_i)=1-P(Y=1|X_i)$ Code: ...
0
votes
0answers
34 views

Shrinkage Parameter for LASSO (glmnet package in R)

I am using glmnet package in R-software to build a Binary Logistic Regression with the LASSO. I have used the following link as ...
0
votes
1answer
36 views

glmnet models comparison

I'm trying to compare several GLMs realized using glmnet function. However, I do not understand which parameter I have to consider in order to define de best model which describe the relation among ...
2
votes
0answers
19 views

Practical advice for identifying important interactions terms (with glinternet, or other approaches)

I work with scientists who supply experimental data (often that doesn't come from deliberate Design of Experiments). I am comfortable addressing the question of "which predictor variables are the ...
0
votes
1answer
45 views

R's glmnet (Standardize) vs Sci-kit Elastic Net (Normalize)

I was using Hastie's 2005 Elastic Net to fit a linear regression model with corrected penalization using a 12MM x 769 observations. I experimented in both R and Python. I was fitting the models using ...
0
votes
0answers
115 views

caret() and glmnet() give different coefficients

I have understood from this post (https://stackoverflow.com/questions/48653465/r-coefficients-from-glmnet-and-caret-are-different-for-the-same-lambda) that caret() and glmnet() may not use the same ...
3
votes
1answer
57 views

Combining many sparse binary variables

Based on kjetil b halvorsen suggestion, I rephrased my problem: My problem is analogous to the following: i am supposed to predict if a high school student will go to university (Yes/No). I have ...
0
votes
0answers
27 views

Adaptive Lasso:msgps, glmnet, or glmaag?

To perform Adaptive lasso, which is the best package: msgps, or glmnet or glmaag? What's the difference among the three packages: algorithm, results?
0
votes
0answers
15 views

robust regression in glmnet?

I have data with many errors in the input. However, I also have much more independent variables than samples. I have been using glmnet for penalized regression. Is there a good algorithm like glmnet ...
0
votes
0answers
37 views

Creating a risk score from Cox Regression

I have two datasets with palliative cancer patients including 106 and 60 patients, respectively. I have biomarkers of inflammation and coagulation, as well as clinical characteristics for all patients....
0
votes
0answers
33 views

Quadratic Approximation of the binary logistic regression

I am using https://web.stanford.edu/~hastie/Papers/glmnet.pdf package to solve my optimization problem for the Binary Logistic Regression. On page 10 it is stated that the quadratic approximation of ...
1
vote
2answers
147 views

Minimum and maximum regularization in L0 (pseudo)norm penalized regression

L0-pseudonorm penalized least squares regression (aka best subset regression) solves $\widehat{\beta}(\lambda)$ as $$\min_\beta \frac{1}{2}||y-X\beta||_2^2 +\lambda||\beta||_0.$$ where $||\beta||_0$ ...
2
votes
1answer
66 views

Can Park & Casella's Bayesian LASSO be applied to generalized linear models?

In Park & Casella's Bayesian LASSO model the LASSO is estimated through a scale mixture of normals: ...
0
votes
0answers
21 views

Solving the Binary Logistic Regression with LASSO penalty

The objective function of the Binary logistic regression with the LASSO penalty is given by, $argmin_{\beta_0,\beta}$ { $-{1}/{n}$ $\sum_{i=1}^n (Y_i({\beta_0}+{\beta^T}x_i)-log(1+exp({\beta_0}+{\...
0
votes
0answers
47 views

Specificity decreasing when new features are added to glmnet model for case/control prediction

I'm using glmnet for prediction of case/control, which I created with the function train with additional parameters for cross ...
0
votes
0answers
59 views

Should we penalize dummy variables? [duplicate]

Using glmnet we run the following regression cvfit = cv.glmnet(x,y, alpha = 0, intercept = FALSE) where $y$ is the response variable and $x$ is the input matrix....
0
votes
0answers
34 views

Plot interpretation for underfitting/overfitting - Lass cv.glmnet

I ran a logistic Lasso Regression in R using the cv.glmnet package and get the plot below. I understand that the left dotted line is lambda.min and the right dotted line is lambda.1se. I also see ...
0
votes
0answers
33 views

Lasso regression with lasso2 (l1ce) vs glmnet

I'm struggling to get the same results from a lasso regression when using glmnet as when using l1ce from the lasso2 package. I've set a specific tuning parameter value for both, and tried to set all ...
1
vote
1answer
171 views

lasso with *extended* cox regression (time-varying covariates using counting process notation)

I'm trying to find a way to build a predictive model the development of a disease. However, some of our predictors are time-varying (aka time-dependent) -- for example, the appearance of other, age-...
0
votes
0answers
52 views

LOOCV in Caret works with Glmnet and not ElasticNet

I'm a phd student learning about different machine learning and cv methods so i apologize if this is a silly question. I have a decent understanding of lasso and am using the ...
0
votes
1answer
276 views

glmnet cox regression and survival prediction

I want to use glmnet cox regression approach to predict survival from methylation data for cancer patients. But I couldn't find any proper reference except this one https://cran.r-project.org/web/...
5
votes
2answers
237 views

One-to-one correspondence between penalty parameters of equivalent formulations of penalised regression methods

Ridge, LASSO and Elastic Net are three very popular methods of penalised regressions. All of these have more than one formulations. For example, two formulations for Ridge are: minimise $\lVert Y - X ...
0
votes
1answer
29 views

Understanding the logistic regression model from glmnet in R when the binary response is -1 or 1

I compared the results for the cases with y = {0,1} and y = {-1,1}. The estimated coefficients and probability from the method are different. How to understand these results? ...
2
votes
0answers
17 views

Lasso acts differently for a large (1mi obs) sample? [closed]

I am fitting Lasso using the glmnet package in R. The data contains 1 million observations and 1500 predictors. We have a survival outcome (time to death) ...
1
vote
0answers
34 views

Why does `sklearn.linear_model.enet_path` give different results than `glmnet_python`?

The results alpha path from enet_path and the lambda path from ...
0
votes
0answers
48 views

Performing lasso - Differential Expression of genes

I have a data set of dimensions 19000 x 288, where there are 19000 transcripts (variables) and 288 observations. The observations correspond to 32 individuals from two countries (16 from Kenya, 16 ...
0
votes
1answer
40 views

Is repeated propensity score matching over many 0-1-features a valid procedure?

I would like to do a simple linear model where the outcome $y$ is real-valued, but my data matrix $X$ consists of several hundred features that all are $0$-$1$-valued. The number of observations $n$ ...
2
votes
1answer
995 views

How to obtain Confidence Intervals for a LASSO regression?

I'm very new from R. I have this code for a LASSO regression: ...
2
votes
0answers
122 views

How to calculate the survival function in R for a glmnet cox family?

I have a sample data of 583 type 2 diabetes patients and want to calculate the 5 year incidence probability of an event for every patient. Variables which were collected are time to an event variable ...
1
vote
0answers
25 views

R glmnet package: why is elasticnet parametrized like that? [duplicate]

The documentation for glmnet in R here states that it solves the following minimization problem: Why did the authors choose to ...
0
votes
0answers
60 views

GLMNET LASSO - interpretation problem

We have a sample artificial dataset. The response variable y is binomial categorical: ...
0
votes
1answer
23 views

How to record performance of a glmnet model on a new dataset

I used cv.glmnet to create a model using one dataset ("Dataset 1"), but now I would like to look at performance (e.g., AUC) when predicting outcomes for new data ("Dataset 2"). I know that I can use ...
1
vote
0answers
89 views

Is adaptive lasso still unbiased for glm(such as Logistics)?

I'm doing something about penalized Logistics regression with adaptive LASSO recently. But I found that the coefficients from Logisitcs+adaptive LASSO is quite different from the normal Logistics ...
0
votes
0answers
98 views

Do I need to do glmnet after doing a cv.glmnet?

I'm studying now about the model selection from the ISLR book. I'm don't understand about whether should I do glmnet() after I do ...
1
vote
1answer
131 views

glmnet package: “mgaussian” vs “gaussian” for $\alpha = 0$

In multiresponse Gaussian family the objective function when $\alpha = 0$: \begin{align} \frac{1}{2n}||Y-XB||_F^2 + \frac{\lambda}{2}||B||_F^2. \end{align} This can also mathematically solved as \...
0
votes
0answers
297 views

Tuning glmnet hyperparameters in MLR

I want to estimate LASSO using glmnet in MLR with spatial cross-validation to tune lambda. Questions: In makeParamSet, do I specify ...
0
votes
1answer
344 views

Clarification for LASSO based Cox model using glmnet

I am trying to find a variable signature associated with a characteristic. Particularly I am looking to get a prognostic model from multi-variable data for gene expression. I have the "Time (survival ...