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

Error occurs with constant responses #46

Closed
mynanshan opened this issue Aug 11, 2021 · 1 comment
Closed

Error occurs with constant responses #46

mynanshan opened this issue Aug 11, 2021 · 1 comment

Comments

@mynanshan
Copy link

I have the following example:

xx <- seq(0.01,1,0.01)
zz <- cbind(sin(xx*2*pi), cos(xx*2*pi))
y <- rep(1, 100)

grpreg::grpreg(zz, y, group = c(1,2), lambda = 10^seq(-3,20,1))
#> Error: Algorithm failed to converge for any values of lambda.  This indicates a combination of (a) an ill-conditioned feature matrix X and (b) insufficient penalization.  You must fix one or the other for your model to be identifiable.

Created on 2021-08-11 by the reprex package (v2.0.0)

The grpreg throws an error rather than fit every coefficient to zero. What might cause such problem?

@pbreheny
Copy link
Owner

For linear regression, grpreg checks convergence by comparing coefficient changes relative to the standard deviation of y. This was coded as:

maxChange < eps*sdy

for a constant response, however, the RHS is zero, so convergence could never be reached. Easy fix, replacing the < with <=. Should be working now. Thanks for bringing this to my attention!

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