src/estimagic/inference/msm_covs.py
def cov_optimal(jac, weights):
    """Calculate the cov of msm estimates with asymptotically efficient weights.

    Note that asymptotically efficient weights have substantial finite sample
    bias and are typically not a good choice.

    Args:
        jac (np.ndarray or pandas.DataFrame): Numpy array or DataFrame with the jacobian
            of simulate_moments with respect to params. The derivative needs to be taken
            at the estimated parameters. Has shape n_moments, n_params.
        weights (np.ndarray): The weighting matrix for msm estimation.
        moments_cov (np.ndarray): The covariance matrix of the empirical moments.

    Returns:
        numpy.ndarray: numpy array with covariance matrix.

    """
    _jac, _weights, names = process_pandas_arguments(jac=jac, weights=weights)

    cov = robust_inverse(_jac.T @ _weights @ _jac, msg=INVALID_INFERENCE_MSG)

    if names:
        cov = pd.DataFrame(cov, columns=names.get("params"), index=names.get("params"))

    return cov
Calculate the cov of msm estimates with asymptotically efficient weights.

    Note that asymptotically efficient weights have substantial finite sample
    bias and are typically not a good choice.

    Args:
        jac (np.ndarray or pandas.DataFrame): Numpy array or DataFrame with the jacobian
            of simulate_moments with respect to params. The derivative needs to be taken
            at the estimated parameters. Has shape n_moments, n_params.
        weights (np.ndarray): The weighting matrix for msm estimation.
        moments_cov (np.ndarray): The covariance matrix of the empirical moments.

    Returns:
        numpy.ndarray: numpy array with covariance matrix.

    
Calculate the cov of msm estimates with asymptotically efficient weights.
Note that asymptotically efficient weights have substantial finite sample
bias and are typically not a good choice.
Calculate the cov of msm estimates with asymptotically efficient weights . Note that asymptotically efficient weights have substantial finite sample bias and are typically not a good choice .
def cov_optimal(jac, weights):
    _jac, _weights, names = process_pandas_arguments(jac=jac, weights=weights)
    cov = robust_inverse(_jac.T @ _weights @ _jac, msg=INVALID_INFERENCE_MSG)
    if names:
        cov = pd.DataFrame(cov, columns=names.get("params"), index=names.get("params"))
    return cov
def cov_optimal ( jac , weights ) : _jac , _weights , names = process_pandas_arguments ( jac = jac , weights = weights ) cov = robust_inverse ( _jac . T @ _weights @ _jac , msg = INVALID_INFERENCE_MSG ) if names : cov = pd . DataFrame ( cov , columns = names . get ( "params" ) , index = names . get ( "params" ) ) return cov
Calculate the cov of msm estimates with asymptotically efficient weights.
Calculate the cov of msm estimates with asymptotically efficient weights .
"""Calculate the cov of msm estimates with asymptotically efficient weights.

    Note that asymptotically efficient weights have substantial finite sample
    bias and are typically not a good choice.

    Args:
        jac (np.ndarray or pandas.DataFrame): Numpy array or DataFrame with the jacobian
            of simulate_moments with respect to params. The derivative needs to be taken
            at the estimated parameters. Has shape n_moments, n_params.
        weights (np.ndarray): The weighting matrix for msm estimation.
        moments_cov (np.ndarray): The covariance matrix of the empirical moments.

    Returns:
        numpy.ndarray: numpy array with covariance matrix.

    """
numpy array with covariance matrix.
numpy array with covariance matrix .
numpy.ndarray
jac
Numpy array or DataFrame with the jacobian
of simulate_moments with respect to params. The derivative needs to be taken
at the estimated parameters. Has shape n_moments, n_params.
Numpy array or DataFrame with the jacobian of simulate_moments with respect to params . The derivative needs to be taken at the estimated parameters . Has shape n_moments n_params .
weights
The weighting matrix for msm estimation.
The weighting matrix for msm estimation .
moments_cov
The covariance matrix of the empirical moments.
The covariance matrix of the empirical moments .