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

lm does not work with Float32 #403

Closed
kingjosephm opened this issue Feb 9, 2021 · 1 comment
Closed

lm does not work with Float32 #403

kingjosephm opened this issue Feb 9, 2021 · 1 comment

Comments

@kingjosephm
Copy link

kingjosephm commented Feb 9, 2021

julia> using DataFrames, GLM, Pkg

julia> Pkg.status("GLM")
Status `C:\Users\jking\.julia\environments\v1.5\Project.toml`
  [38e38edf] GLM v1.3.11

julia> Pkg.status("DataFrames")
Status `C:\Users\jking\.julia\environments\v1.5\Project.toml`
  [a93c6f00] DataFrames v0.21.8

julia> df = DataFrame(rand(Float32, (100, 2)))
100×2 DataFrame
│ Row │ x1       │ x2       │
│     │ Float32  │ Float32  │
├─────┼──────────┼──────────┤
│ 10.7611210.593105 │
│ 20.1742330.625339980.6218270.485921 │
│ 990.3409330.130693 │
│ 1000.787950.380114 │

julia> ols = lm(@formula(x1 ~ x2), df)
ERROR: MethodError: no method matching delbeta!(::GLM.DensePredChol{Float64,LinearAlgebra.Cholesky{Float64,Array{Float64,2}}}, ::Array{Float32,1})
Closest candidates are:
  delbeta!(::GLM.DensePredQR{T}, ::Array{T,1}) where T<:Union{Float32, Float64} at C:\Users\jking\.julia\packages\GLM\dbJFe\src\linpred.jl:75
  delbeta!(::GLM.DensePredChol{T,var"#s19"} where var"#s19"<:LinearAlgebra.Cholesky, ::Array{T,1}) where T<:Union{Float32, Float64} at C:\Users\jking\.julia\packages\GLM\dbJFe\src\linpred.jl:129
  delbeta!(::GLM.DensePredChol{T,var"#s19"} where var"#s19"<:LinearAlgebra.CholeskyPivoted, ::Array{T,1}) where T<:Union{Float32, Float64} at C:\Users\jking\.julia\packages\GLM\dbJFe\src\linpred.jl:134
  ...
Stacktrace:
 [1] fit!(::LinearModel{GLM.LmResp{Array{Float32,1}},GLM.DensePredChol{Float64,LinearAlgebra.Cholesky{Float64,Array{Float64,2}}}}) at C:\Users\jking\.julia\packages\GLM\dbJFe\src\lm.jl:116
 [2] fit(::Type{LinearModel}, ::Array{Float64,2}, ::Array{Float32,1}, ::Bool; wts::Array{Float32,1}) at C:\Users\jking\.julia\packages\GLM\dbJFe\src\lm.jl:127
 [3] fit(::Type{LinearModel}, ::Array{Float64,2}, ::Array{Float32,1}, ::Bool) at C:\Users\jking\.julia\packages\GLM\dbJFe\src\lm.jl:127
 [4] fit(::Type{LinearModel}, ::FormulaTerm{Term,Term}, ::DataFrame, ::Bool; contrasts::Dict{Symbol,Any}, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}}) at C:\Users\jking\.julia\packages\StatsModels\rlTon\src\statsmodel.jl:88
 [5] fit at C:\Users\jking\.julia\packages\StatsModels\rlTon\src\statsmodel.jl:82 [inlined]
 [6] #lm#2 at C:\Users\jking\.julia\packages\GLM\dbJFe\src\lm.jl:144 [inlined]
 [7] lm at C:\Users\jking\.julia\packages\GLM\dbJFe\src\lm.jl:144 [inlined] (repeats 2 times)
 [8] top-level scope at REPL[5]:1
@nalimilan
Copy link
Member

Duplicate of #260.

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