Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SL.ridge leads to no weights estimated #26

Open
mleipzig opened this issue May 28, 2021 · 1 comment
Open

SL.ridge leads to no weights estimated #26

mleipzig opened this issue May 28, 2021 · 1 comment

Comments

@mleipzig
Copy link

mleipzig commented May 28, 2021

I tried to use SuperLearner with WeightIt using this code and everything worked just fine with Sl.glm, but ridge led to some errors.

W.out <- weightit(treat ~ age + educ + race + married + nodegree + re74 + re75, data = lalonde, estimand = "ATE", method = "super", SL.method = "method.balance", SL.library = c("SL.glm", "SL.ridge" ))

and got this

Error in (function (Y, X, newX, family, lambda = seq(1, 20, 0.1), ...)  : 
  Currently only works with gaussian data
Error in (function (Y, X, newX, family, lambda = seq(1, 20, 0.1), ...)  : 
  Currently only works with gaussian data
In addition: Warning message:
In FUN(X[[i]], ...) : Error in algorithm SL.ridge 
  The Algorithm will be removed from the Super Learner (i.e. given weight 0) 

Error in (function (Y, X, newX, family, lambda = seq(1, 20, 0.1), ...)  : 
  Currently only works with gaussian data
In addition: Warning message:
In FUN(X[[i]], ...) : Error in algorithm SL.ridge 
  The Algorithm will be removed from the Super Learner (i.e. given weight 0) 

Error in (function (Y, X, newX, family, lambda = seq(1, 20, 0.1), ...)  : 
  Currently only works with gaussian data
In addition: Warning messages:
1: In FUN(X[[i]], ...) : Error in algorithm SL.ridge 
  The Algorithm will be removed from the Super Learner (i.e. given weight 0) 

2: In predict.lm(object, newdata, se.fit, scale = 1, type = if (type ==  :
  prediction from a rank-deficient fit may be misleading
Error in (function (Y, X, newX, family, lambda = seq(1, 20, 0.1), ...)  : 
  Currently only works with gaussian data
In addition: Warning message:
In FUN(X[[i]], ...) : Error in algorithm SL.ridge 
  The Algorithm will be removed from the Super Learner (i.e. given weight 0) 

Error in (function (Y, X, newX, family, lambda = seq(1, 20, 0.1), ...)  : 
  Currently only works with gaussian data
In addition: Warning message:
In FUN(X[[i]], ...) : Error in algorithm SL.ridge 
  The Algorithm will be removed from the Super Learner (i.e. given weight 0) 

Error in (function (Y, X, newX, family, lambda = seq(1, 20, 0.1), ...)  : 
  Currently only works with gaussian data
In addition: Warning message:
In FUN(X[[i]], ...) : Error in algorithm SL.ridge 
  The Algorithm will be removed from the Super Learner (i.e. given weight 0) 

Error in (function (Y, X, newX, family, lambda = seq(1, 20, 0.1), ...)  : 
  Currently only works with gaussian data
In addition: Warning message:
In FUN(X[[i]], ...) : Error in algorithm SL.ridge 
  The Algorithm will be removed from the Super Learner (i.e. given weight 0) 

Error in (function (Y, X, newX, family, lambda = seq(1, 20, 0.1), ...)  : 
  Currently only works with gaussian data
In addition: Warning message:
In FUN(X[[i]], ...) : Error in algorithm SL.ridge 
  The Algorithm will be removed from the Super Learner (i.e. given weight 0) 

Error in (function (Y, X, newX, family, lambda = seq(1, 20, 0.1), ...)  : 
  Currently only works with gaussian data
In addition: Warning message:
In FUN(X[[i]], ...) : Error in algorithm SL.ridge 
  The Algorithm will be removed from the Super Learner (i.e. given weight 0) 

Error in (function (Y, X, newX, family, lambda = seq(1, 20, 0.1), ...)  : 
  Currently only works with gaussian data
In addition: Warning message:
In FUN(X[[i]], ...) : Error in algorithm SL.ridge 
  The Algorithm will be removed from the Super Learner (i.e. given weight 0) 

Warning messages:
1: In FUN(X[[i]], ...) : Error in algorithm SL.ridge  on full data 
  The Algorithm will be removed from the Super Learner (i.e. given weight 0) 

2: In (function (Y, X, newX = NULL, family = gaussian(), SL.library,  :
  Re-running estimation of coefficients removing failed algorithm(s)
Original coefficients are: 
0.00934546386419807, 0.990654536135802

3: No weights were estimated. This is probably a bug,
     and you should report it at https://github.com/ngreifer/WeightIt/issues. 
4: Some weights were estimated as NA, which means a value was impossible to compute (e.g., Inf). Check for extreme values of the treatment or covariates and try removing them. Non-finite weights will be set to 0. 
5: All weights are 0, possibly indicating an estimation failure. 
@ngreifer
Copy link
Owner

The error from SuperLearner says "Currently only works with gaussian data". This means you cannot use SL.ridge with a binary treatment; it can only be used with a continuous treatment. I'll look into making the WeightIt warnings better in this scenario and see if I can make it fail more gracefully.

@ngreifer ngreifer closed this as completed Nov 4, 2021
@ngreifer ngreifer reopened this Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants