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

Difference between passing data directly or via formula for glm #450

Closed
rikhuijzer opened this issue Oct 11, 2021 · 1 comment
Closed

Difference between passing data directly or via formula for glm #450

rikhuijzer opened this issue Oct 11, 2021 · 1 comment

Comments

@rikhuijzer
Copy link

Does it make sense that glm(X, y, ...) passes here, but glm(formula, data, ...) fails?

julia> using GLM

julia> data = (a = [1, 4, 9], b = [2, 5, 7], c = [3, 6, 11], y = [1, 1, 0])
(a = [1, 4, 9], b = [2, 5, 7], c = [3, 6, 11], y = [1, 1, 0])

julia> X = [data.a data.b data.c]
3×3 Matrix{Int64}:
 1  2   3
 4  5   6
 9  7  11

julia> glm(X, data.y, Bernoulli(), LogitLink());

julia> form = @formula(y ~ a + b + c);

julia> glm(form, data, Bernoulli(), LogitLink());
ERROR: PosDefException: matrix is not positive definite; Cholesky factorization failed.
[...]

Version: GLM v1.5.1

@andreasnoack
Copy link
Member

The formula based version adds a constant so the two are not equivalent.

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