Closed andreasnoack closed 1 year ago
Patch coverage: 100.00
% and project coverage change: +0.02
:tada:
Comparison is base (
ef8bb98
) 90.46% compared to head (305f221
) 90.48%.:exclamation: Current head 305f221 differs from pull request most recent head 4734433. Consider uploading reports for the commit 4734433 to get more accurate results
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
To give an example of the issue with the current behavior
julia> X = [ones(10) randn(10)];
julia> y = X*ones(2) + randn(10)*0.1;
julia> myp = GLM.DensePredChol(X, false);
julia> myr = GLM.LmResp(y);
julia> coef(fit!(LinearModel(myr, myp, nothing)))
2-element Vector{Float64}:
0.966074297502665
1.0104887004807501
julia> coef(fit!(LinearModel(myr, myp, nothing)))
2-element Vector{Float64}:
1.93214859500533
2.0209774009615002
julia> coef(fit!(LinearModel(myr, myp, nothing)))
2-element Vector{Float64}:
2.898222892507995
3.03146610144225
julia> coef(fit!(LinearModel(myr, myp, nothing)))
2-element Vector{Float64}:
3.86429719001066
4.0419548019230005
When looking at https://github.com/JuliaStats/GLM.jl/issues/534 I noticed that
fit!(::LinearModel)
depended on the state ofbeta0
stored in the linear predictor. The reason was that the solution stored indelbeta
was transferred tobeta0
by theinstallbeta!
method which updated the current value. This is important for GLMs but not LMs. Furthermore, the operations are so simple to do with broadcasting that I think we should rather just do that. (I thinkinstallbeta!
might predate broadcasting in Julia.)