selective-inference / R-software

R software for selective inference
GNU General Public License v2.0
34 stars 18 forks source link

Error in seq.default(gridrange[1] * sd, gridrange[2] * sd, length = gridpts) : 'from' must be a finite number #49

Open Dweepobotee opened 6 years ago

Dweepobotee commented 6 years ago

Hi I am trying to use the fixedLassoInf function and I keep getting the following error for some values of lambda generated by 'glmnet'.

"Error in seq.default(gridrange[1] sd, gridrange[2] sd, length = gridpts) : 'from' must be a finite number"

Here's the code I was trying to run.

sigmahat<-estimateSigma(newdata,z)$sigmahat n<-nrow(newdata) gfit<-glmnet(newdata, z, family="gaussian", standardize = FALSE, thresh=1e-12) beta<-coef(gfit,s=gfit$lambda[80]/n, exact=TRUE, x=newdata, y=z)[-1] out<-fixedLassoInf(x=newdata, y=z,beta, gfit$lambda[80], sigma=sigmahat)

Any leads on what could be causing this error?

JohannesGessner commented 5 years ago

Had the same error using fixedLassoInf. Seems like it is caused by sth. random, as it sometimes appeared and sometimes not when I runned the same piece of code with the same data...

Dweepobotee commented 5 years ago

Is that even after setting the same seed before running the code? Thanks!

On Thu, Jul 25, 2019 at 10:53 AM JohannesGessner notifications@github.com wrote:

Had the same error using fixedLassoInf. Seems like it is caused by sth. random, as it sometimes appeared and sometimes not when I runned the same piece of code with the same data...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/selective-inference/R-software/issues/49?email_source=notifications&email_token=AHUKKZBYHG5WFRYQ5TO645TQBG5AJA5CNFSM4FK5PJZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2ZXIYA#issuecomment-515077216, or mute the thread https://github.com/notifications/unsubscribe-auth/AHUKKZAVWMQ3WTVTGCKA3PLQBG5AJANCNFSM4FK5PJZA .