src/estimagic/examples/logit.py
def logit_loglike(params, y, x):
    """Log-likelihood function of a logit model.

    Args:
        params (pd.DataFrame): The index consists of the parameter 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:
        loglike (np.array): 1d numpy array with likelihood contribution  per individual

    """
    q = 2 * y - 1
    contribs = np.log(1 / (1 + np.exp(-(q * np.dot(x, params["value"])))))

    out = {"value": contribs.sum(), "contributions": contribs}

    return out
Log-likelihood function of a logit model.

    Args:
        params (pd.DataFrame): The index consists of the parameter 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:
        loglike (np.array): 1d numpy array with likelihood contribution  per individual

    
Log-likelihood function of a logit model.
Log - likelihood function of a logit model .
def logit_loglike(params, y, x):
    q = 2 * y - 1
    contribs = np.log(1 / (1 + np.exp(-(q * np.dot(x, params["value"])))))
    out = {"value": contribs.sum(), "contributions": contribs}
    return out
def logit_loglike ( params , y , x ) : q = 2 * y - 1 contribs = np . log ( 1 / ( 1 + np . exp ( - ( q * np . dot ( x , params [ "value" ] ) ) ) ) ) out = { "value" : contribs . sum ( ) , "contributions" : contribs } return out
Log-likelihood function of a logit model.
Log - likelihood function of a logit model .
"""Log-likelihood function of a logit model.

    Args:
        params (pd.DataFrame): The index consists of the parameter 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:
        loglike (np.array): 1d numpy array with likelihood contribution  per individual

    """
loglike (np.array): 1d numpy array with likelihood contribution  per individual
loglike ( np . array ) : 1d numpy array with likelihood contribution per individual
params
The index consists of the parameter names,
the "value" column are the parameter values.
The index consists of the parameter 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