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

    A stratum is a group of observations that share common information. Each
    stratum can be constructed based on age, gender, education, region, etc.
    The function runs the same formulation for cluster_robust_se for each
    stratum and returns the sum. Each stratum contain primary sampling units
    (psu) or clusters. If observations are independent, but wish to have to
    strata, make the psu column take the values of the index.

    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:
        strata_robust_se (np.array): a 1d array of k + 1 standard errors
        strata_robust_var (np.array): 2d variance-covariance matrix

    """
    _jac, _hess, names = process_pandas_arguments(jac=jac, hess=hess)
    strata_meat = _stratification(_jac, design_info)
    cov = _sandwich_step(_hess, strata_meat)

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

    return cov
Cluster robust standard errors.

    A stratum is a group of observations that share common information. Each
    stratum can be constructed based on age, gender, education, region, etc.
    The function runs the same formulation for cluster_robust_se for each
    stratum and returns the sum. Each stratum contain primary sampling units
    (psu) or clusters. If observations are independent, but wish to have to
    strata, make the psu column take the values of the index.

    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:
        strata_robust_se (np.array): a 1d array of k + 1 standard errors
        strata_robust_var (np.array): 2d variance-covariance matrix

    
Cluster robust standard errors.
A stratum is a group of observations that share common information. Each
stratum can be constructed based on age, gender, education, region, etc.
The function runs the same formulation for cluster_robust_se for each
stratum and returns the sum. Each stratum contain primary sampling units
(psu) or clusters. If observations are independent, but wish to have to
strata, make the psu column take the values of the index.
Cluster robust standard errors . A stratum is a group of observations that share common information . Each stratum can be constructed based on age gender education region etc . The function runs the same formulation for cluster_robust_se for each stratum and returns the sum . Each stratum contain primary sampling units ( psu ) or clusters . If observations are independent but wish to have to strata make the psu column take the values of the index .
def cov_strata_robust(jac, hess, design_info):
    _jac, _hess, names = process_pandas_arguments(jac=jac, hess=hess)
    strata_meat = _stratification(_jac, design_info)
    cov = _sandwich_step(_hess, strata_meat)
    if "params" in names:
        cov = pd.DataFrame(cov, columns=names["params"], index=names["params"])
    return cov
def cov_strata_robust ( jac , hess , design_info ) : _jac , _hess , names = process_pandas_arguments ( jac = jac , hess = hess ) strata_meat = _stratification ( _jac , design_info ) cov = _sandwich_step ( _hess , strata_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 stratum is a group of observations that share common information. Each
    stratum can be constructed based on age, gender, education, region, etc.
    The function runs the same formulation for cluster_robust_se for each
    stratum and returns the sum. Each stratum contain primary sampling units
    (psu) or clusters. If observations are independent, but wish to have to
    strata, make the psu column take the values of the index.

    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:
        strata_robust_se (np.array): a 1d array of k + 1 standard errors
        strata_robust_var (np.array): 2d variance-covariance matrix

    """
strata_robust_se (np.array): a 1d array of k + 1 standard errors
strata_robust_var (np.array): 2d variance-covariance matrix
strata_robust_se ( np . array ) : a 1d array of k + 1 standard errors strata_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 )