src/estimagic/inference/ml_covs.py
def cov_cluster_robust(jac, hess, design_info):
    """Cluster robust standard errors.

    A cluster is a group of observations that correlate amongst each other,
    but not between groups. Each cluster is seen as independent. As the number
    of clusters increase, the standard errors approach robust standard errors.

    Args:
        jac (np.array): "jacobian" - an n x k + 1-dimensional array of first
            derivatives of the pseudo-log-likelihood function w.r.t. the parameters
        hess (np.array): "hessian" - a k + 1 x k + 1-dimensional array of
            second derivatives of the pseudo-log-likelihood function w.r.t.
            the parameters
        design_info (pd.DataFrame): dataframe containing psu, stratum,
            population/design weight and/or a finite population corrector (fpc)

    Returns:
        cluster_robust_se (np.array): a 1d array of k + 1 standard errors
        cluster_robust_var (np.array): 2d variance-covariance matrix

    """
    _jac, _hess, names = process_pandas_arguments(jac=jac, hess=hess)

    cluster_meat = _clustering(_jac, design_info)
    cov = _sandwich_step(_hess, cluster_meat)

    if "params" in names:
        cov = pd.DataFrame(cov, columns=names["params"], index=names["params"])

    return cov
Cluster robust standard errors.

    A cluster is a group of observations that correlate amongst each other,
    but not between groups. Each cluster is seen as independent. As the number
    of clusters increase, the standard errors approach robust standard errors.

    Args:
        jac (np.array): "jacobian" - an n x k + 1-dimensional array of first
            derivatives of the pseudo-log-likelihood function w.r.t. the parameters
        hess (np.array): "hessian" - a k + 1 x k + 1-dimensional array of
            second derivatives of the pseudo-log-likelihood function w.r.t.
            the parameters
        design_info (pd.DataFrame): dataframe containing psu, stratum,
            population/design weight and/or a finite population corrector (fpc)

    Returns:
        cluster_robust_se (np.array): a 1d array of k + 1 standard errors
        cluster_robust_var (np.array): 2d variance-covariance matrix

    
Cluster robust standard errors.
A cluster is a group of observations that correlate amongst each other,
but not between groups. Each cluster is seen as independent. As the number
of clusters increase, the standard errors approach robust standard errors.
Cluster robust standard errors . A cluster is a group of observations that correlate amongst each other but not between groups . Each cluster is seen as independent . As the number of clusters increase the standard errors approach robust standard errors .
def cov_cluster_robust(jac, hess, design_info):
    _jac, _hess, names = process_pandas_arguments(jac=jac, hess=hess)
    cluster_meat = _clustering(_jac, design_info)
    cov = _sandwich_step(_hess, cluster_meat)
    if "params" in names:
        cov = pd.DataFrame(cov, columns=names["params"], index=names["params"])
    return cov
def cov_cluster_robust ( jac , hess , design_info ) : _jac , _hess , names = process_pandas_arguments ( jac = jac , hess = hess ) cluster_meat = _clustering ( _jac , design_info ) cov = _sandwich_step ( _hess , cluster_meat ) if "params" in names : cov = pd . DataFrame ( cov , columns = names [ "params" ] , index = names [ "params" ] ) return cov
Cluster robust standard errors.
Cluster robust standard errors .
"""Cluster robust standard errors.

    A cluster is a group of observations that correlate amongst each other,
    but not between groups. Each cluster is seen as independent. As the number
    of clusters increase, the standard errors approach robust standard errors.

    Args:
        jac (np.array): "jacobian" - an n x k + 1-dimensional array of first
            derivatives of the pseudo-log-likelihood function w.r.t. the parameters
        hess (np.array): "hessian" - a k + 1 x k + 1-dimensional array of
            second derivatives of the pseudo-log-likelihood function w.r.t.
            the parameters
        design_info (pd.DataFrame): dataframe containing psu, stratum,
            population/design weight and/or a finite population corrector (fpc)

    Returns:
        cluster_robust_se (np.array): a 1d array of k + 1 standard errors
        cluster_robust_var (np.array): 2d variance-covariance matrix

    """
cluster_robust_se (np.array): a 1d array of k + 1 standard errors
cluster_robust_var (np.array): 2d variance-covariance matrix
cluster_robust_se ( np . array ) : a 1d array of k + 1 standard errors cluster_robust_var ( np . array ) : 2d variance - covariance matrix
jac
"jacobian" - an n x k + 1-dimensional array of first
derivatives of the pseudo-log-likelihood function w.r.t. the parameters
" jacobian " - an n x k + 1 - dimensional array of first derivatives of the pseudo - log - likelihood function w . r . t . the parameters
hess
"hessian" - a k + 1 x k + 1-dimensional array of
second derivatives of the pseudo-log-likelihood function w.r.t.
the parameters
" hessian " - a k + 1 x k + 1 - dimensional array of second derivatives of the pseudo - log - likelihood function w . r . t . the parameters
design_info
dataframe containing psu, stratum,
population/design weight and/or a finite population corrector (fpc)
dataframe containing psu stratum population / design weight and / or a finite population corrector ( fpc )