pyhdfe.Algorithm¶
-
class
pyhdfe.
Algorithm
¶ Algorithm for absorbing fixed effects. Class attributes contain counts of observations and fixed effect dimensions, and if computed, singletons and degrees of freedom used by the fixed effects.
An algorithm is initialized by
create()
with one or more dimensions of fixed effects specified byids
. Once initialized,Algorithm.residualize()
absorbs the fixed effects into a matrix and returns the residuals from a regression of each matrix column on the fixed effects.-
observations
¶ Number of observations in the data (i.e., the number of rows in
ids
).- Type
int
-
dimensions
¶ Number of fixed effect dimensions (i.e., the number of columns in
ids
).- Type
int
-
singletons
¶ Number of singleton groups or observations. This will be
None
if there was no need to identify singletons (i.e., ifdrop_singletons
andcompute_degrees
were bothFalse
increate()
).- Type
int or None
-
singleton_indices
¶ Indices of any singleton observations. This will be
None
if there was no need to identify singletons.- Type
array or None
-
degrees
¶ Exact or approximate number of degrees of freedom used by the fixed effects computed according to
degrees_method
increate()
. This will beNone
ifcompute_degrees
wasFalse
increate()
.- Type
int or None
Examples
Methods
residualize
(matrix[, weights])Absorb the fixed effects into a matrix and return the residuals from a regression of each column of the matrix on the fixed effects.
-