Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [glmnet]

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

0
votes
0answers
10 views

Glmnet default values [on hold]

I am using the glmnet package to find biomarkers from a dataset. I only tell the function my x and y vectors and my alpha but no family (such as binomial, gaussian etc.). What would be the default ...
0
votes
0answers
7 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
63 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
18 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
63 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
217 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
16 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
16 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) ...
0
votes
0answers
17 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
20 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
28 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
306 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
66 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
27 views

GLMNET LASSO - interpretation problem

We have a sample artificial dataset. The response variable y is binomial categorical: ...
0
votes
1answer
20 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 ...
0
votes
0answers
40 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
40 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
47 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
110 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
126 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 ...
0
votes
0answers
16 views

Choosing prediction model with regularization, spatial cross-validation and bounded predictions

I am new to machine learning and R. I want to run a statistical model to predict daily hours of supply of electricity (y). I have several x variables to use for prediction. I have three goals to ...
3
votes
0answers
74 views

Why does cv.glmnet not use the same lambda sequence across different folds to find the hypertuning parameter lambda?

I assumed that cv.glmnet works as follows: Generate multiple glmnet fits for the entire data, presumably for automated lambda sequence using coordinate descent Use the lambdas gotten in step 1, and ...
0
votes
1answer
125 views

Interpreting glmnet cox coefficients

There have been similar questions regarding interpretation of glmnet results. However this is more specific to the cox part of the package. I am trying to create a prognostic score for cancer ...
0
votes
1answer
129 views

Lasso cox regression with bootstrap

I'm looking at building a nomogram for cancer prognosis based on 20 variables. This will be derived from a cox ph model. In the past I used poor methodology including dichotomization and stepwise ...
0
votes
1answer
127 views

COX model with Lasso using one dataset and predicting in a different dataset

I am very new to R. I am performing Cox model with LASSO variable selection in one group. I am using the coefficients of the selected variables and apply to another dataset. My goal is to produce ...
0
votes
0answers
10 views

Why with glmnet I obtain different coefficients for the different categories I want to classify?

I am performing a multinomial logistic regression using glmnet. I have 7 classes of trees to predict and different predictors. What I do not understand is why when I plot the coefficents vs. log ...
0
votes
0answers
40 views

Confused about hyperparameter selection for elastic net regularization using glmnet

I am following the glmnet tutorial here and confused about the statement: We see that lasso (alpha=1) does about the best here. We also see that the range of ...
1
vote
0answers
148 views

R squared / deviance explained for elastic net glmnet

I am using R glmnet function for the elastic net for logistic regression with binary outcome and would like to calculate the R-square value. I am getting different results when I use the dev.ratio ...
2
votes
1answer
31 views

What value of alpha should I choose regularization

What value of alpha should I choose in glmnet? Should I use one which minimizes the cross-validation error, one which is one standard deviation above or below the one which gives the best error (like ...
0
votes
2answers
175 views

k-fold cross validation: Force at least m instances in each fold

I'm dealing with a multi-output regression problem (~ 800 dependent variables, ~ 1300 observations). My current approach is to train a single model for each output. To select an "optimal" lambda I ...
0
votes
0answers
25 views

How to give a represantation to veriables from each group using LASSO

I'm trying to apply LASSO regression on my data set in order to choose the best variables. However, my variables (44 to be accurate) come from 7 different groups, is there any option to give a "...
0
votes
0answers
123 views

glmnet: Nested cross validation, tuning alpha and lambda

I am trying to perform the nested cross validation with glmnet and I want to tune both alpha and lambda. I want to pass the algorithm a sequence of possible alphas and let it decide for the lambda ...
0
votes
0answers
23 views

Ridge analytically vs glmnet [duplicate]

With an outcome variable and two correlated regressors... ...
0
votes
0answers
59 views

Spline regression with many features in R

I have high-dimensional data that I'd like to fit a spline to then predict values given a held out set. I am currently fitting a linear regression model on my data via the ...
2
votes
0answers
604 views

How do I compute the residuals from glmnet in r? [closed]

I am working with glmnet and i would like to compute the residuals for the model with lasso penalty. I've simulated data split into training and testing set. My ...
1
vote
0answers
181 views

How to use Elastic Net Model to Reduce Collinearity

I am using R to perform a linear regression with a dataset that has clearly correlated independent variables (collinearity). I am using the vif (variance inflation factor) function from the car ...
1
vote
0answers
36 views

How can I use the coefficient and important variables obtained from elastic net modelling [closed]

I have a big question here. Although I search over internet and also in research papers but couldn't find an answer to it. I ran elastic net over a dataset that had close to 300 variables and a ...
-1
votes
1answer
231 views

cv.glmnet vs glm vs lm.ridge

I am currently trying to build a ridge regression model, and knows that the lm.ridge, glm and cv.glmnet functions can enable me to do so. However, I really do not know what are the differences between ...
1
vote
1answer
699 views

ridge and lasso models in caret with lambda=0

As far as I know, if I run a lasso model and a ridge model on the same data, and if i keep lambda=0, I'm getting the OLS. Then, how is it possible that I get different results? ...
2
votes
1answer
124 views

Ridge/Lasso for correlated response

I want to try a penalised linear regression (ridge/lasso) as a comparison to standard OLS for its predictive ability. My response variable is a continuous measure of an eye parameter, so there is (...
1
vote
0answers
153 views

cv.glmnet, minimal MSEis higher than OLS MSE

I have a data with multicollinearity. I can't exclude the correlated variable as they are my variable of interest. I therefore Used Ridge regression, and tried to find optimal lambda with CV. I face ...
0
votes
1answer
298 views

Multivariate Elastic Net with glmnet [closed]

I am using glmnet package for elastic net. I'd like to perform variable selection and classification on a 50x41 data set with 3 response variables (one continuous and two categorical), but I have not ...
0
votes
1answer
304 views

how to use method lasso in cox model using glmnet?

I have the survival data includes 252 patients, 25 independent variables and 35 events. I want to use lasso method in cox model to these data. I use glmnet for it. ...
0
votes
1answer
302 views

GLMNET: Weights and imbalanced data

I have a multinomial regression problem using glmnet. The training data is imbalanced (1:5:10 roughly). I tried over and undersampling already. Would providing ...
1
vote
0answers
584 views

Glmnet: How to select Lambda and Alpha

I'd like to pick the optimal lambda and alpha using the Glmnet package. I'm open to all models (Ridge, Lasso, Elastic). I'm assuming some out of sample error/cross validation is the best model ...
1
vote
0answers
139 views

Variable importance in the glmnet

I'm using R for machine learning. The objective is to classify the onset of disease (Two-class). Before conducting a machine learning algorithm, I ran the glmnet (to utilize elastic net) to reduce ...
0
votes
1answer
49 views

Predicting a Numeric value in Future Years

I have this data set, and I want to predict number of PTS beyond 2018: ...
0
votes
2answers
258 views

Possible to optimize for area under the precision-recall curve in glmnet logistic regression?

tl;dr with the R glmnet package, is it possible to optimize for the area under the precision-recall curve, rather than the area ...
0
votes
0answers
33 views

A confirmation about elastic-net and lasso

I would like to confirm numerically that elastic-net and lasso are equivalent under a transformation on the data set using glmnet package in ...