Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

FamaMacBeth kernel covariance over-rejects in short panels

Abierto
#817 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
18/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
numpy, pandas, python
Área
data

Línea de trabajo

Start by running the reproduction script in the issue, which fits FamaMacBeth with cov_type="kernel" and counts rejections of the x coefficient at the 5% level. Then read the cov_type handling in FamaMacBeth.fit and the f_statistic_robust method, along with the docstrings the issue says describe the problem. The issue leaves the fix open between fixed-b critical values and a cosine estimator, so the work needs a maintainer decision first. Done means the kernel-covariance tests reach roughly nominal size at T = 10 and T = 40.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement

With cov_type="kernel", the t-tests of FamaMacBeth reject a true null far more often than their nominal level, even when the cross-sectional estimates are independent.

import numpy as np
import pandas as pd
from linearmodels import FamaMacBeth

rng = np.random.default_rng(0)
n, t, reps = 100, 10, 2000
idx = pd.MultiIndex.from_product([range(n), range(t)])
rejections = 0
for _ in range(reps):
    data = pd.DataFrame(
        {"y": rng.standard_normal(n * t), "x": rng.standard_normal(n * t), "const": 1.0},
        index=idx,
    )
    res = FamaMacBeth(data.y, data[["const", "x"]]).fit(cov_type="kernel")
    rejections += res.pvalues["x"] < 0.05
print(rejections / reps)  # 0.174

The 5% test rejects in 17.4% of the samples with T = 10 and in about 12% with T = 40. With cov_type="unadjusted" both are about 5%. The joint test in f_statistic_robust is worse with more parameters: about 37% with 3 parameters and T = 10.

A kernel estimate of the long-run variance from T estimates is much noisier than the sample variance, and the t(T - 1) and F reference distributions ignore this. The docstrings describe the problem as of 7.1.

Deferred from 7.1. Possible fixes are fixed-b critical values (Kiefer and Vogelsang, 2005) or an equal-weighted cosine estimator with t and F reference distributions (Lazarus, Lewis, Stock and Watson, 2018).

Lenguaje dominante
Python
Estrellas
1.1k
Forks
203
Merge medio
3 h 26 min
PR fusionados (30 d)
115

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de bashtage/linearmodels

Todos los issues de bashtage/linearmodels

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.