@contract
def loess_robust_parameter_estimates(data):
    """ Calculate Loess robust parameter estimates.

    :param data: A data set.
     :type data: list(float)

    :return: The parameter estimates.
     :rtype: list(float)
    """
    def f(p, x, y, weights):
        return weights * (y - (p[0] + p[1] * x))

    n = len(data)
    x = np.array(range(1, n + 1))
    y = np.array(data)
    weights = np.array(tricube_weights(n))
    estimates, _ = leastsq(f, [1., 1.], args=(x, y, weights))

    p = estimates.tolist()
    residuals = (y - (p[0] + p[1] * x))

    weights2 = np.array(tricube_bisquare_weights(residuals.tolist()))
    estimates2, _ = leastsq(f, [1., 1.], args=(x, y, weights2))

    return estimates2.tolist()
dataset/ETHPy150Open beloglazov/openstack-neat/neat/locals/overload/statistics.py/loess_robust_parameter_estimates/original