@@ -8,11 +8,6 @@ function regife(df::AbstractDataFrame, m::Model; kwargs...)
8
8
regife (df, m. f; m. dict... , kwargs... )
9
9
end
10
10
11
- #= salue
12
-
13
- efe
14
- =#
15
-
16
11
function regife (df:: AbstractDataFrame ,
17
12
f:: Formula ;
18
13
ife:: Union{Symbol, Expr, Nothing} = nothing ,
@@ -83,22 +78,24 @@ function regife(df::AbstractDataFrame,
83
78
# Compute data needed for errors
84
79
vcov_method_data = VcovMethod (df[esample, unique (Symbol .(vcov_vars))], vcovformula)
85
80
86
- # Compute weights
87
- sqrtw = get_weights (df, esample, weights)
88
-
81
+
89
82
# # Compute factors, an array of AbtractFixedEffects
90
83
if has_absorb
91
- subdf = df[esample, unique (Symbol .(absorb_vars))]
92
- fes = FixedEffect (subdf, feformula, sqrtw)
84
+ sqrtw = get_weights (df, trues (length (esample)), weights)
85
+ fixedeffects = FixedEffect (df, Terms (@eval (@formula (nothing ~ $ (feformula)))), sqrtw)
86
+ fixedeffects = FixedEffect[x[esample] for x in fixedeffects]
93
87
# in case some FixedEffect is a FixedEffectIntercept, remove the intercept
94
- if any ([typeof (f. interaction ) <: Ones for f in fes ])
88
+ if any ([typeof (f. interactionname ) <: Nothing for f in fixedeffects ])
95
89
rt. intercept = false
96
90
end
97
- pfe = FixedEffectProblem (fes , Val{:lsmr })
91
+ pfe = FixedEffectProblem (fixedeffects , Val{:lsmr })
98
92
else
99
93
pfe = nothing
100
94
end
101
95
96
+ # Compute weights
97
+ sqrtw = get_weights (df, esample, weights)
98
+
102
99
iterations = 0
103
100
converged = false
104
101
# get two dimensions
@@ -144,7 +141,9 @@ function regife(df::AbstractDataFrame,
144
141
end
145
142
y .= y .* sqrtw
146
143
oldy = copy (y)
147
- residualize! (y, pfe, Int[], Bool[])
144
+ v1 = Int[]
145
+ v2 = Bool[]
146
+ residualize! (y, pfe, v1, v2)
148
147
149
148
# #############################################################################
150
149
# #
@@ -226,7 +225,7 @@ function regife(df::AbstractDataFrame,
226
225
df_absorb_fe = 0
227
226
if has_absorb
228
227
# # poor man adjustement of df for clustedered errors + fe: only if fe name != cluster name
229
- for fe in fes
228
+ for fe in fixedeffects
230
229
if isa (vcovformula, VcovClusterFormula) && in (fe. factorname, vcov_vars)
231
230
df_absorb_fe += 0
232
231
else
0 commit comments