stephenslab / susieR

R package for "sum of single effects" regression.
https://stephenslab.github.io/susieR
Other
176 stars 45 forks source link

check for non-varying X (at least when standardize=TRUE?) #11

Closed stephens999 closed 6 years ago

stephens999 commented 6 years ago

if an intercept is included in X this creates errors. we should probably at least check for this.

glmnet I believe simply sets the coefficients of those X to 0. it would be even better to mimic that behavior.

aksarkar commented 6 years ago

Failing to do this creates a cryptic error downstream.

Minimum example:

x <- matrix(0, 500, 1)
y <- rnorm(500)
res <- susieR::susie(x, y)

Output:

[1] "objective:NaN"
[1] "objective:NaN"
Error in if ((elbo[i + 1] - elbo[i]) < tol) break (from susie.R#120) : missing value where TRUE/FALSE needed

This happens because standardize = TRUE by default and scale introduces NaN entries into X.

pcarbo commented 6 years ago

@aksarkar Thanks. I think this would be helpful.

There are probably more checks that need to be done to ensure that X is suitable for SuSiE, but comprehensive checking is probably too much to ask for. So this is a good start.

Also, as you may remember from an NHS meting, scale is terribly inefficient---the longer term may be better to implement our own function to handle this.