estimation.feols_compressed_.FeolsCompressed
estimation.feols_compressed_.FeolsCompressed(self
FixestFormula
data
ssc_dict
drop_singletons
drop_intercept
weights
weights_type
collin_tol
fixef_tol
lookup_demeaned_data='np.linalg.solve'
solver=True
store_data=True
copy_data=False
lean=100
reps=None
seed=None
sample_split_var=None
sample_split_value )
Non-user-facing class for compressed regression with fixed effects.
See the paper “You only compress once” by Wong et al (https://arxiv.org/abs/2102.11297) for details on regression compression.
Parameters
Name | Type | Description | Default |
---|---|---|---|
FixestFormula | FixestFormula | The formula object. | required |
data | pd.DataFrame | The data. | required |
ssc_dict | dict[str, Union[str, bool]] | The ssc dictionary. | required |
drop_singletons | bool | Whether to drop columns with singleton fixed effects. | required |
drop_intercept | bool | Whether to include an intercept. | required |
weights | Optional[str] | The column name of the weights. None if no weights are used. For this method, weights needs to be None. | required |
weights_type | Optional[str] | The type of weights. For this method, weights_type needs to be ‘fweights’. | required |
collin_tol | float | The tolerance level for collinearity. | required |
fixef_tol | float | The tolerance level for the fixed effects. | required |
lookup_demeaned_data | dict[str, pd.DataFrame] | The lookup table for demeaned data. | required |
solver | str | The solver to use. | 'np.linalg.solve' |
store_data | bool | Whether to store the data. | True |
copy_data | bool | Whether to copy the data. | True |
lean | bool | Whether to keep memory-heavy objects as attributes or not. | False |
reps | int | The number of bootstrap repetitions. Default is 100. Only used for CRV1 inference, where a wild cluster bootstrap is used. | 100 |
seed | Optional[int] | The seed for the random number generator. Only relevant for CRV1 inference, where a wild cluster bootstrap is used. | None |
Methods
Name | Description |
---|---|
predict | Compute predicted values. |
prepare_model_matrix | Prepare model inputs for estimation. |
vcov | Compute the variance-covariance matrix for the compressed regression. |
predict
estimation.feols_compressed_.FeolsCompressed.predict(=None
newdata=1e-06
atol=1e-06
btoltype='link'
)
Compute predicted values.
Parameters
Name | Type | Description | Default |
---|---|---|---|
newdata | Optional[DataFrameType] | The new data. If None, makes a prediction based on the uncompressed data set. | None |
atol | float | The absolute tolerance. | 1e-06 |
btol | float | The relative tolerance. | 1e-06 |
type | str | The type of prediction. | 'link' |
Returns
Name | Type | Description |
---|---|---|
np.ndarray | The predicted values. If newdata is None, the predicted values are based on the uncompressed data set. |
prepare_model_matrix
estimation.feols_compressed_.FeolsCompressed.prepare_model_matrix()
Prepare model inputs for estimation.
vcov
=None) estimation.feols_compressed_.FeolsCompressed.vcov(vcov, data
Compute the variance-covariance matrix for the compressed regression.