def locscale_grad(y, loc, scale, dlldy, *args):
    """derivative of log-likelihood with respect to location and scale

    Parameters
    ----------
    y : array_like
        data points of random variable at which loglike is evaluated
    loc : float
        location parameter of distribution
    scale : float
        scale parameter of distribution
    dlldy : function
        derivative of loglikelihood fuction wrt. random variable x
    args : array_like
        shape parameters of log-likelihood function

    Returns
    -------
    dlldloc : ndarray
        derivative of loglikelihood wrt location evaluated at the
        points given in y
    dlldscale : ndarray
        derivative of loglikelihood wrt scale evaluated at the
        points given in y

    """
    yst = (y - loc) / scale
    dlldloc = -dlldy(yst, *args) / scale
    dlldscale = -1.0 / scale - dlldy(yst, *args) * (y - loc) / scale ** 2
    return dlldloc, dlldscale
