codedthinking / Kezdi.jl

Julia package for data manipulation and analysis
https://codedthinking.github.io/Kezdi.jl/
Other
21 stars 0 forks source link

bug: handle missing in @if condition #122

Open korenmiklos opened 4 days ago

korenmiklos commented 4 days ago
julia> @regress log(final_netgep) N treatment fe(id) fe(feor)&fe(year) @if final_netgep > 0 && !ismissing(final_netgep), cluster(id)
ERROR: TypeError: non-boolean (Missing) used in boolean context
Stacktrace:

vs

julia> @drop @if ismissing(final_netgep)
931515×36 DataFrame
...
julia> @regress log(final_netgep) N treatment fe(id) fe(feor)&fe(year) @if final_netgep > 0 && !ismissing(final_netgep), cluster(id)
                              FixedEffectModel                              
============================================================================
Number of obs:                 895173  Converged:                       true
dof (model):                        2  dof (residuals):                 3203
R²:                             0.814  R² adjusted:                    0.813
F-statistic:                  81.5128  P-value:                        0.000
R² within:                      0.001  Iterations:                        10
============================================================================
             Estimate  Std. Error    t-stat  Pr(>|t|)   Lower 95%  Upper 95%
────────────────────────────────────────────────────────────────────────────
N          0.00452251  0.00133763   3.38099    0.0007  0.00189981  0.0071452
treatment  0.102467    0.00907612  11.2897     <1e-28  0.084671    0.120262
============================================================================