Closed dpabon closed 1 year ago
Julia Version 1.8.5 Commit 17cfb8e65ea (2023-01-08 06:45 UTC) Platform Info: OS: Linux (x86_64-linux-gnu) CPU: 8 × Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-13.0.1 (ORCJIT, skylake) Threads: 1 on 8 virtual cores Environment: JULIA_EDITOR = code JULIA_NUM_THREADS = 0 [38e38edf] GLM v1.8.1 [a93c6f00] DataFrames v1.3.6
Here a MWE where ols2 fail:
using DataFrames using GLM X1 = rand(100,1) X2 = rand(100,1) Y1 = rand(100,1) data_f = DataFrame(X1 = vec(X1), Y1 = vec(Y1)) ols = GLM.lm(@formula(Y1 ~ X1), data_f) # works as expected ols2 = GLM.lm(X1,Y1) # Fail!!
error:
ERROR: MethodError: no method matching fit(::Type{LinearModel}, ::Matrix{Float64}, ::Matrix{Float64}, ::Nothing) Closest candidates are: fit(::Type{T}, ::FormulaTerm, ::Any, ::Any...; contrasts, kwargs...) where T<:RegressionModel at ~/.julia/packages/StatsModels/fK0P3/src/statsmodel.jl:78 fit(::Type{StatsBase.Histogram}, ::Any...; kwargs...) at ~/.julia/packages/StatsBase/XgjIN/src/hist.jl:407 fit(::Type{LinearModel}, ::AbstractMatrix{<:Real}, ::AbstractVector{<:Real}, ::Union{Nothing, Bool}; wts, dropcollinear) at ~/.julia/packages/GLM/zj7GL/src/lm.jl:134 ... Stacktrace: [1] lm(X::Matrix{Float64}, y::Matrix{Float64}, allowrankdeficient_dep::Nothing; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) @ GLM ~/.julia/packages/GLM/zj7GL/src/lm.jl:157 [2] lm(X::Matrix{Float64}, y::Matrix{Float64}, allowrankdeficient_dep::Nothing) (repeats 2 times) @ GLM ~/.julia/packages/GLM/zj7GL/src/lm.jl:157 [3] top-level scope @ Untitled-1:11
Your response has to be a Vector, i.e. ols2 = GLM.lm(X1, vec(Y1))
Vector
ols2 = GLM.lm(X1, vec(Y1))
Please follow up, if needed, on https://discourse.julialang.org/
Here a MWE where ols2 fail:
error: