groupedpaneldatamodels.models.bonhomme_manresa

Functions

grouped_fixed_effects(y, x, G[, max_iter, ...])

Internal function to estimate grouped fixed effects as described by Bonhomme and Manresa (2015).

groupedpaneldatamodels.models.bonhomme_manresa.grouped_fixed_effects(y: ndarray, x: ndarray, G: int, max_iter: int = 10000, tol: float = 1e-06, gfe_iterations: int = 100, unit_specific_effects: bool = False, enable_vns: bool = False, hetrogeneous_theta: bool = True)[source]

Internal function to estimate grouped fixed effects as described by Bonhomme and Manresa (2015).

Parameters:
  • y (np.ndarray) – Dependent variable, shape (N, T, 1).

  • x (np.ndarray) – Explanatory variables, shape (N, T, K).

  • G (int) – Number of groups.

  • max_iter (int, optional) – Maximum number of iterations. Defaults to 10000.

  • tol (float, optional) – Acceptable tolerance for stopping condition. Defaults to 1e-6.

  • gfe_iterations (int, optional) – Number of unique starting points for the algorithm. Defaults to 100.

  • unit_specific_effects (bool, optional) – Enables individual effects. Defaults to False.

  • enable_vns (bool, optional) – Enables VNS algorithm. Defaults to False.

  • hetrogeneous_theta (bool, optional) – Enables heterogeneous beta. Defaults to True.

Returns:

  • best_theta: Estimated group-specific coefficients, shape (K,) or (K, G)

  • best_alpha: Estimated group-level fixed effects, shape (G,) or (G, T)

  • best_g: Group assignments for each unit, shape (N,)

  • eta: Unit-specific effects if enabled, shape (N, 1) or None

  • best_iterations_used: Number of iterations used in the best run

  • best_objective_value: Objective function value of the best run

  • best_resid: Residuals of the model, shape (N, T)

Return type:

tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray | None, int, float, np.ndarray]