jmboehm / GLFixedEffectModels.jl

Fast estimation of generalized linear models with high dimensional categorical variables in Julia
Other
33 stars 6 forks source link

fix residuals, add predictions, etc #30

Closed jmboehm closed 3 years ago

jmboehm commented 3 years ago

This PR does the following:

  1. fix a bug in the construction of the (generalized) residuals. Previously, eta was used, whereas mu should have been used. @caibengbu this causes the bias correction tests to fail, so I've temporarily commented out the bias correction tests. Could you please look over this to see whether you agree that my correction makes sense, and think about the implications of this change for the bias correction code/tests?
  2. changed the save kwarg to save::Vector{Symbol}, and defaulting to Symbol[]. Can contain any subset of [:residuals,:eta,:mu,:fe]. This is breaking, but I think it makes much more sense than a boolean.
  3. Changed default rho_tol to 1.0e-8.
  4. Implemented StatsBase.predict(x) and StatsBase.residuals(x).
codecov[bot] commented 3 years ago

Codecov Report

Merging #30 (f162492) into master (8511b71) will decrease coverage by 12.69%. The diff coverage is 58.82%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master      #30       +/-   ##
===========================================
- Coverage   80.00%   67.30%   -12.70%     
===========================================
  Files          13       13               
  Lines         565      624       +59     
===========================================
- Hits          452      420       -32     
- Misses        113      204       +91     
Impacted Files Coverage Δ
src/GLFixedEffectModel.jl 80.46% <0.00%> (-1.59%) :arrow_down:
src/fit.jl 79.35% <71.42%> (-2.85%) :arrow_down:
src/utils/biascorr.jl 0.00% <0.00%> (-100.00%) :arrow_down:
src/vcov/vcovcluster.jl 94.64% <0.00%> (-1.36%) :arrow_down:
src/utils/fixedeffects.jl 96.42% <0.00%> (+0.59%) :arrow_up:
src/utils/formula.jl 50.00% <0.00%> (+1.66%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 8511b71...f162492. Read the comment docs.

jmboehm commented 3 years ago

f162492 adds a way to detect and deal with statistical separation, namely by truncating mu at particular interval bounds.