macrosynergy.learning.random_effects#
- class RandomEffects(group_col='real_date', fit_intercept=True)[source]#
Bases:
BaseEstimator
Random effects model for inference on panel data.
- Parameters:
Notes
A random effects model is a way of attributing variance in a dependent variable to variance in a group of observations (i.e. error variance), in a structured manner. In the context of panel data, we often use this to account for cross-sectional correlations by imposing period-specific effects. However, this model is solely for inference and is not predictive.
- fit(X, y)[source]#
Fit the random effects model.
- Parameters:
X (Pandas DataFrame or Series) – Input feature matrix.
y (Pandas DataFrame or Series) – Target values with the same index as X.
- Returns:
The fitted estimator.
- Return type:
self
- check_X_y(X, y)[source]#
Checks for the input data.
- Parameters:
X (pd.DataFrame or pd.Series) – Input feature matrix
y (pd.DataFrame or pd.Series) – Target values with the same index as X.
- Returns:
The input data.
- Return type:
pd.DataFrame, pd.DataFrame
- property pvals#
Compute the p-values for the parameter estimates.
- Returns:
The p-values.
- Return type:
pd.Series