Closed oxinabox closed 4 years ago
Note that this only happens if number of features >= number observations -1 see
using Lasso
X = rand(20,8)
y = rand(20)
# this is to run this step: https://github.com/JuliaStats/Lasso.jl/blob/9d099f512afb6042b1094714e0ab280cf10f3863/src/segselect.jl#L276
# I set λ to a single variable to simplify things
path = fit(LassoPath, X,y; λ=[0.005])
# select model to replicate this step: https://github.com/JuliaStats/Lasso.jl/blob/9d099f512afb6042b1094714e0ab280cf10f3863/src/segselect.jl#L278
m1 = selectmodel(path, MinAICc());
show(m1)
m2 = selectmodel(path, MinAICc());
show(m2)
show(m1)
works completely fine
Calculating standard errors for a lasso selected model are not a resolved problem AFAIK.
I think show
fails the first time because the standard errors are all 0
. You can check by running stderror(m1)
.
That it works on subsequent tries is a bug, that can be fixed by deep copying m.rr
used in https://github.com/JuliaStats/Lasso.jl/blob/9d099f512afb6042b1094714e0ab280cf10f3863/src/segselect.jl#L169
instead of changing it with each call.
Is there a way to make show
display something sensible without taking a stand on standard errors?
A researcher came to me with a weird problem. It seems that the first model they get from
selectmodel
is invalid -- callingshow
on ti makes it throw an error. but if they callselectmodel
again not only does the new model the get backshow
correctly but the first one starts working right too!Setup
demo of errors
I have verified this with
selectmodel(path, MinBIC())
andselectmodel(path, MinCVmse(path, 5))
also.Here is the line that is erroring in GLM.jl GLM.jl: https://github.com/JuliaStats/GLM.jl/blob/master/src/lm.jl#L186
but I think this is not GLMs fault, I think it is right to be erroring?