src/estimagic/examples/logit.py
def logit_derivative(params, y, x):
    """Derivative of the log-likelihood for each observation of a logit model.

    Args:
        params (pd.DataFrame): The index consists of the parmater names,
            the "value" column are the parameter values.
        y (np.array): 1d numpy array with the dependent variable
        x (np.array): 2d numpy array with the independent variables

    Returns:
        jac : array-like
            The derivative of the loglikelihood for each observation evaluated
            at `params`.
    """
    c = 1 / (1 + np.exp(-(np.dot(x, params["value"]))))
    jac = (y - c)[:, None] * x
    grad = jac.sum(axis=0)
    out = {"value": grad, "contributions": jac}
    return out
Derivative of the log-likelihood for each observation of a logit model.

    Args:
        params (pd.DataFrame): The index consists of the parmater names,
            the "value" column are the parameter values.
        y (np.array): 1d numpy array with the dependent variable
        x (np.array): 2d numpy array with the independent variables

    Returns:
        jac : array-like
            The derivative of the loglikelihood for each observation evaluated
            at `params`.
    
Derivative of the log-likelihood for each observation of a logit model.
Derivative of the log - likelihood for each observation of a logit model .
def logit_derivative(params, y, x):
    c = 1 / (1 + np.exp(-(np.dot(x, params["value"]))))
    jac = (y - c)[:, None] * x
    grad = jac.sum(axis=0)
    out = {"value": grad, "contributions": jac}
    return out
def logit_derivative ( params , y , x ) : c = 1 / ( 1 + np . exp ( - ( np . dot ( x , params [ "value" ] ) ) ) ) jac = ( y - c ) [ : , None ] * x grad = jac . sum ( axis = 0 ) out = { "value" : grad , "contributions" : jac } return out
Derivative of the log-likelihood for each observation of a logit model.
Derivative of the log - likelihood for each observation of a logit model .
"""Derivative of the log-likelihood for each observation of a logit model.

    Args:
        params (pd.DataFrame): The index consists of the parmater names,
            the "value" column are the parameter values.
        y (np.array): 1d numpy array with the dependent variable
        x (np.array): 2d numpy array with the independent variables

    Returns:
        jac : array-like
            The derivative of the loglikelihood for each observation evaluated
            at `params`.
    """
jac : array-like
The derivative of the loglikelihood for each observation evaluated
at `params`.
jac : array - like The derivative of the loglikelihood for each observation evaluated at ` params ` .
params
The index consists of the parmater names,
the "value" column are the parameter values.
The index consists of the parmater names the " value " column are the parameter values .
y
1d numpy array with the dependent variable
1d numpy array with the dependent variable
x
2d numpy array with the independent variables
2d numpy array with the independent variables