Lasso regression is a form of regression analysis used for variable selection and regularization. Use this tag for programming questions related to Lasso regression only. You can ask statistical questions on Cross Validated instead
Questions tagged [lasso-regression]
457 questions
2
votes
0 answers
How to use LASSO with categorical and continuous variables to predict a continuous variable?
I have a data base witch has 5000 observations (rows) and 40 variables (columns). The number of categorical variables is 25 and the number of continuous variables is 15. I want to use a regression model to predict a continuous variable using…
far
2
votes
1 answer
Lasso Logistic Regression suitable for imbalanced data?
I am analyzing the Secom dataset from the UCI Machine Learning repository by lasso-regularized logistic regression, but the results are bad.
https://archive.ics.uci.edu/ml/datasets/SECOM
Characteristics:
1546 data samples with 590 numeric…

CodingButStillAlive
- 733
- 2
- 8
- 22
2
votes
3 answers
Lasso or Ridge for correlated variables
I am trying to understand a quote "In presence of correlated variables, ridge regression might be the preferred choice. "
Lets say we have variables a1,a2,b1,c2,and the 2 a"s are correlated .
If we use Lasso it can eliminate one of a"s. Both Lasso…

mcelikkaya
- 315
- 4
- 13
2
votes
0 answers
How to compute log-predictive scores in R
I am using Bayesian Model Averaging and Bayesian Lasso regression for prediction and I want to evaluate the accuracy of the density forecasts using predictive log-scores.
I am using the bms package for Bayesian Model Averaging and monomvn package…

yahsin
- 21
- 4
2
votes
0 answers
R logistic glmnet penalty.factor
I am trying to run logistic regression by using LASSO in glmnet package. And I need to force the model to include certain parameters. However, I got an error.
> cv.lasso = cv.glmnet(x,y,family="binomial",alpha = 1,penalty.factor = penalty)
Error:…

Z. Zhang
- 501
- 8
- 20
2
votes
0 answers
the way to get model coefficient after building Lasso using glmnet
After building the Lasso model as follows, I would like to get see the model coefficient.
fit<-glmnet(as.matrix(x),y,alpha=1)
The Glmnet website http://web.stanford.edu/~hastie/glmnet/glmnet_alpha.html shows the following command. I do not…

user785099
- 5,323
- 10
- 44
- 62
2
votes
0 answers
Coefficient and confidence interval of lasso selection
I conducted a feature selection using lasso method as well as a covariance test using covTest::covTest to retrieve the p.values. I borrow an example from covTest such…

David Z
- 6,641
- 11
- 50
- 101
2
votes
1 answer
How to obtain coefficients from Lasso Regression in R?
Can someone tell me how to get the coefficients for lasso regression in package lars in R?
For example if the code is like:
test_lasso=lars(A,B)
Thank you.
user3999495
2
votes
1 answer
Get z-scores of coefficients using glmnet
I am using the glmnet package to get LASSO estimates, as follows:
model <- cv.glmnet(data, return, standardize = TRUE)
I am able to extract the coefficients using coef(model), however, I couldn't figure out a way of getting the standard error and…

Mayou
- 8,498
- 16
- 59
- 98
2
votes
1 answer
predict.lars command for lasso regression: what are the "s" and "p" parameters?
In help(predict.lars) we can read that the parameter s is "a value, or vector of values, indexing the path. Its values depends on the mode= argument. By default (mode="step"), s should take on values between 0 and p (e.g., a step of 1.3 means .3 of…

Dr. Beeblebrox
- 838
- 2
- 13
- 30
2
votes
1 answer
Lasso and Ridge estimator
I have a txt file containing a large set of data.
How do I go about using the lasso or the ridge estimator to fit a regression equation?
I got as far as using:
gridge
However, I am unsure of what that lambda section is doing. I found it on a…

math11
- 537
- 2
- 6
- 8
1
vote
1 answer
Advice on implementing L1 regularisation in logistic model for feature selection
I am working on an academic project where the aim is to understand which features predict a binary outcome. I have therefore used a logistic model. However, there is a problem with colinearity as several of the features are highly correlated. I was…

SeanC
- 37
- 3
1
vote
1 answer
How to use CAST package for a shapefile (polygons) in R?
any help with the following is really appreciated!!
My goal: I need to run a lasso model for variable selection for my data (which is in sf polygon format).
My data: As said above, is a sf object. Specifically, is a shapefile with polygons.
I have…

Adriana Castillo Castillo
- 170
- 1
- 9
1
vote
1 answer
Is there a way to get the beta coefficients from a lasso model using spatial (polygons) data?
I'm trying to run a lasso model for spatial (polygons) data in R. It has been very very difficult to find a package that allows me to do run the spatial lasso model and at the same time allows me to get the Beta coefficients for my independent…

Adriana Castillo Castillo
- 170
- 1
- 9
1
vote
0 answers
the goodness of fit to the elasticnet model looks bad
import os
import pandas as pd
from sklearn.linear_model import ElasticNet
from sklearn.model_selection import train_test_split, GridSearchCV, cross_validate
from sklearn.metrics import mean_squared_error, r2_score
import numpy as np
# Set the…

Toiba
- 11
- 2