Displaying 20 results from an estimated 1000 matches similar to: "Double Cross validation for LASSO"
2011 Jun 06
1
Lasso for k-subset regression
Dear R-users
I'm trying to use lasso in lars package for subset regression, I have a
large matrix of size 1000x100 and my aim is to select a subset k of the 100
variables.
Is there any way in lars to fix the number k (i.e. to select the best 10
variables)
library(lars)
aa=lars(X,Y,type="lasso",max.steps=200)
plot(aa,plottype="Cp")
aa$RSS
which.min(aa$RSS)
2007 Jul 06
1
about R, RMSEP, R2, PCR
Hi,
I want to calculate PLS package in R. Now I want to calculate R, MSEP,
RMSEP and R2 of PLSR and PCR using this.
I also add this in library of R. How I can calculate R, MSEP, RMSEP and R2
of PLSR and PCR in R.
I s any other method then please also suggest me. Simply I want to
calculate these value.
Thanking you.
--
Nitish Kumar Mishra
Junior Research Fellow
BIC, IMTECH, Chandigarh, India
2009 Jun 13
2
How to write loop
Dear all,
I want to do the following process as a loop ( to run
automatically with dimension of X, here 50). How can I do that? Your
cooments will be highly appreciable.
Alex
*# Code:*
library(lars)
library(chemometrics)
X<-matrix(rnorm(2500),ncol=50)
dim(X)
# [1] 50 50
X1<-X[,2:dim(X)[2]] # I have taken out first column
dim(X1)
#[1] 50 49
X2<-X1[2:dim(X1)[1],] #
2010 Dec 06
2
How to get lasso fit coefficient(given penalty tuning parameter \lambda) using lars package
Hi, all,
I am using the lars package for lasso estimate. So I get a lasso
fit first:
lassofit = lars(x,y,type ="lasso",normalize=T, intercept=T)
Then I want to get coefficient with respect to a certain value of \lambda
(the tuning parameter), I know lars has three mode options c("step",
"fraction", "norm"), but can I use the \lambda value instead
2009 May 07
2
lasso based selection for mixed model
Dear useRs (called Frank Harrell, most likely),
after having preached for years to my medical colleagues to be cautious
with stepwise selection procedures, they chanted back asking for an
alternative when using mixed models.
There is a half dozen laXXX packages around for all types of linear models,
but as far I see there is none for mixed models such as lme. Even
boot.stepAIC (which I
2007 Jun 12
1
LASSO coefficients for a specific s
Hello,
I have a question about the lars package. I am using this package to get the coefficients at a specific LASSO parameter s.
data(diabetes)
attach(diabetes)
object <- lars(x,y,type="lasso")
cvres<-cv.lars(x,y,K=10,fraction = seq(from = 0, to = 1, length = 100))
fits <- predict.lars(object, type="coefficients", s=0.1, mode="fraction")
Can I assign
2013 May 04
2
Lasso Regression error
Hi all,
I have a data set containing variables LOSS, GDP, HPI and UE.
(I have attached it in case it is required).
Having renamed the variables as l,g,h and u, I wish to run a Lasso
Regression with l as the dependent variable and all the other 3 as the
independent variables.
data=read.table("data.txt", header=T)
l=data$LOSS
h=data$HPI
u=data$UE
g=data$GDP
matrix=data.frame(l,g,h,u)
2011 Jul 12
7
FW: lasso regression
Hi,
I am trying to do a lasso regression using the lars package with the following data (see attached):
FastestTime
WinPercentage
PlacePercentage
ShowPercentage
BreakAverage
FinishAverage
Time7Average
Time3Average
Finish
116.90
0.14
0.14
0.29
4.43
3.29
117.56
117.77
5.00
116.23
0.29
0.43
0.14
6.14
2.14
116.84
116.80
2.00
116.41
0.00
0.14
0.29
5.71
3.71
117.24
2010 Jan 27
1
Step and AIC
Hello everybody,
I would need some help from you.
I am trying to fit a logistic model to some presence absence data of
animals living on river islands. I have got 12 predictor variables and I am
trying to use a stepwise forward method to fit the best logistic model to
my data. I am using the function STEP (stats).
I have a question for you. Can I use step function if my variables have a
2007 Aug 02
2
lasso/lars error
I'm having the exact problem outlined in a previous post from 2005 -
unfortunately the post was never answered:
http://tolstoy.newcastle.edu.au/R/help/05/10/15055.html
When running:
lm2=lars(x2,y,type="lasso",use.Gram=F)
I get an error:
Error in if (zmin < gamhat) { : missing value where TRUE/FALSE needed
...when running lasso via lars() on a 67x3795 set of predictors. I
2009 Aug 21
1
LASSO: glmpath and cv.glmpath
Hi,
perhaps you can help me to find out, how to find the best Lambda in a
LASSO-model.
I have a feature selection problem with 150 proteins potentially
predicting Cancer or Noncancer. With a lasso model
fit.glm <- glmpath(x=as.matrix(X), y=target, family="binomial")
(target is 0, 1 <- Cancer non cancer, X the proteins, numerical in
expression), I get following path (PICTURE
2012 Jun 05
1
Piecewise Lasso Regression
Hi All,
I am trying to fit a piecewise lasso regression, but package Segmented does not work with Lars objects.
Does any know of any package or implementation of piecewise lasso regression?
Thanks,
Lucas
2012 Mar 27
2
lasso constraint
In the package lasso2, there is a Prostate Data. To find coefficients in the
prostate cancer example we could impose L1 constraint on the parameters.
code is:
data(Prostate)
p.mean <- apply(Prostate, 5,mean)
pros <- sweep(Prostate, 5, p.mean, "-")
p.std <- apply(pros, 5, var)
pros <- sweep(pros, 5, sqrt(p.std),"/")
pros[, "lpsa"] <-
2010 Jul 31
1
Feature selection via glmnet package (LASSO)
Hello,
I'm trying to select features of cetain numbers(like 100 out of 1000) via
LASSO, based on multinomial model, however, it seems the glmnet package
provides a very sparse estimation of coefficients(most of coefficients are
0), which selects very few number of variables, like only 10, based on my
easy dataset.
I try to connect the choice of lambda to the selecting
2010 Dec 22
1
code of applying lasso method in cox model
I also hope to get the code of using lasso method in the cox model.Could you please send me one?
Thank you so much!!!
2008 May 11
1
Fundamental formula and dataframe question.
There is a very useful and apparently fundamental feature of R (or of
the package pls) which I don't understand.
For datasets with many independent (X) variables such as chemometric
datasets there is a convenient formula and dataframe construction that
allows one to access the entire X matrix with a single term.
Consider the gasoline dataset available in the pls package. For the
model
2011 May 02
2
Lasso with Categorical Variables
Hi! This is my first time posting. I've read the general rules and
guidelines, but please bear with me if I make some fatal error in
posting. Anyway, I have a continuous response and 29 predictors made
up of continuous variables and nominal and ordinal categorical
variables. I'd like to do lasso on these, but I get an error. The way
I am using "lars" doesn't allow for the
2006 Apr 23
1
help! A quetion about the Elasticnet package in R
Can anybody help me to run the Elasticnet package of R to build some model,
i am a freshman to R language , when i use the Elasticnet package to my
data, it always reture a error, but i can't settle that problem. I
consider if there is any constrant of the data to that package? Can anyone
help me to run the elasticnet and check my data as you convenient? I put
the data in attachment.
Thank
Please help me!!!! Error in `[.data.frame`(x, , retained, drop = FALSE) : undefined columns selected
2010 Jan 02
1
Please help me!!!! Error in `[.data.frame`(x, , retained, drop = FALSE) : undefined columns selected
I am learning the package "caret", after I do the "rfe" function, I get the
error ,as follows:
Error in `[.data.frame`(x, , retained, drop = FALSE) :
undefined columns selected
In addition: Warning message:
In predict.lm(object, x) :
prediction from a rank-deficient fit may be misleading
I try to that manual example, that is good, my data is wrong. I do not know
what
2010 Apr 06
1
Caret package and lasso
Dear all,
I have used following code but everytime I encounter a problem of not having
coefficients for all the variables in the predictor set.
# code
rm(list=ls())
library(caret)
# generating response and design matrix
X<-matrix(rnorm(50*100),nrow=50)
y<-rnorm(50*1)
# Applying caret package
con<-trainControl(method="cv",number=10)
data<-NULL
data<- train(X,y,