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

glm fails with Float32 offset and data #562

Closed
salbalkus opened this issue Jul 10, 2024 · 1 comment
Closed

glm fails with Float32 offset and data #562

salbalkus opened this issue Jul 10, 2024 · 1 comment

Comments

@salbalkus
Copy link

I recently ran into an issue where the glm function failed in the following code:

using GLM
n = 10
data = (X = rand(n) .+ 0.5, y = rand(n))
offset = Float32.(rand(n))
GLM.glm(@GLM.formula(y ~ 0 + X), data, Binomial(); offset = offset)

with the error

MethodError: no method matching GLM.GlmResp(::Vector{…}, ::Binomial{…}, ::LogitLink, ::Vector{…}, ::Vector{…}, ::Vector{…}, ::Vector{…}

This is presumably because the offset is of a different numeric type than the other data. However, even without an offset and switching the data to Float32 like so:

data = (X = Float32.(rand(n) .+ 0.5), y = Float32.(rand(n)))
GLM.glm(@GLM.formula(y ~ 0 + X), data, Binomial())

the code above still throws an error, namely:

MethodError: no method matching delbeta!(::GLM.DensePredChol{Float64, LinearAlgebra.CholeskyPivoted{…}}, ::Vector{Float32}, ::Vector{Float32})

Given that the method works when all variables are left as Float64 and the non-descriptive error message, it seems this may not be intentional behavior.

@andreasnoack
Copy link
Member

This is mostly a dup of Float32. I'll add a comment there about the offset.

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