@@ -86,8 +86,8 @@ function regife(
86
86
converged = false
87
87
# get two dimensions
88
88
89
- id = FixedEffects . group (df[esample, m. id])
90
- time = FixedEffects . group (df[esample, m. time])
89
+ id = GroupedArray (df[esample, m. id])
90
+ time = GroupedArray (df[esample, m. time])
91
91
92
92
# #############################################################################
93
93
# #
@@ -135,26 +135,26 @@ function regife(
135
135
# #############################################################################
136
136
137
137
# initialize factor models at 0.1
138
- idpool = fill (0.1 , id. n , m. rank)
139
- timepool = fill (0.1 , time. n , m. rank)
138
+ idpool = fill (0.1 , id. ngroups , m. rank)
139
+ timepool = fill (0.1 , time. ngroups , m. rank)
140
140
141
141
y .= y .* sqrtw
142
142
X .= X .* sqrtw
143
143
if ! has_regressors
144
144
# factor model
145
- fp = FactorModel (y, sqrtw, id. refs , time. refs , m. rank)
145
+ fp = FactorModel (y, sqrtw, id. groups , time. groups , m. rank)
146
146
fs = FactorSolution (idpool, timepool)
147
147
(fs, iterations, converged) =
148
148
fit! (Val{method}, fp, fs; maxiter = maxiter, tol = tol, lambda = lambda)
149
149
else
150
150
# interactive fixed effect
151
151
coef = X \ y
152
- fp = FactorModel (y - X * coef, sqrtw, id. refs , time. refs , m. rank)
152
+ fp = FactorModel (y - X * coef, sqrtw, id. groups , time. groups , m. rank)
153
153
fs = FactorSolution (idpool, timepool)
154
154
fit! (Val{:levenberg_marquardt }, fp, fs; maxiter = 100 , tol = 1e-3 , lambda = lambda)
155
155
156
156
fs = InteractiveFixedEffectsSolution (coef, fs. idpool, fs. timepool)
157
- fp = InteractiveFixedEffectsModel (y, sqrtw, X, id. refs , time. refs , m. rank)
157
+ fp = InteractiveFixedEffectsModel (y, sqrtw, X, id. groups , time. groups , m. rank)
158
158
159
159
160
160
ym = copy (y)
@@ -193,7 +193,7 @@ function regife(
193
193
# #############################################################################
194
194
195
195
# compute residuals
196
- fp = FactorModel (copy (y), sqrtw, id. refs , time. refs , m. rank)
196
+ fp = FactorModel (copy (y), sqrtw, id. groups , time. groups , m. rank)
197
197
if has_regressors
198
198
LinearAlgebra. BLAS. gemm! (' N' , ' N' , - 1.0 , X, fs. b, 1.0 , fp. y)
199
199
end
@@ -261,7 +261,7 @@ function regife(
261
261
if has_regressors
262
262
LinearAlgebra. BLAS. gemm! (' N' , ' N' , - 1.0 , oldX, coef, 1.0 , oldresiduals)
263
263
end
264
- fp = FactorModel (oldresiduals, sqrtw, id. refs , time. refs , m. rank)
264
+ fp = FactorModel (oldresiduals, sqrtw, id. groups , time. groups , m. rank)
265
265
subtract_factor! (fp, fs)
266
266
axpy! (- 1.0 , residuals, oldresiduals)
267
267
# get fixed effect
0 commit comments