(Y, Ygrid, X, m, num_resamples, conf_level)
return (d.mean(), norm.ppf(0.5 + conf_level / 2) * d.std(ddof=1))
Plischke et al. 2013 bias reduction technique (eqn 30)
Plischke et al. 2013 bias reduction technique (eqn 30)
Plischke et al . 2013 bias reduction technique ( eqn 30 )
def bias_reduced_delta(Y, Ygrid, X, m, num_resamples, conf_level):
    """Plischke et al. 2013 bias reduction technique (eqn 30)"""
    d = np.zeros(num_resamples)
    d_hat = calc_delta(Y, Ygrid, X, m)

    N = len(Y)
    r = np.random.randint(N, size=(num_resamples, N))
    for i in range(num_resamples):
        r_i = r[i, :]
        d[i] = calc_delta(Y[r_i], Ygrid, X[r_i], m)

    d = 2 * d_hat - d
    return (d.mean(), norm.ppf(0.5 + conf_level / 2) * d.std(ddof=1))
def bias_reduced_delta ( Y , Ygrid , X , m , num_resamples , conf_level ) : d = np . zeros ( num_resamples ) d_hat = calc_delta ( Y , Ygrid , X , m ) N = len ( Y ) r = np . random . randint ( N , size = ( num_resamples , N ) ) for i in range ( num_resamples ) : r_i = r [ i , : ] d [ i ] = calc_delta ( Y [ r_i ] , Ygrid , X [ r_i ] , m ) d = 2 * d_hat - d return ( d . mean ( ) , norm . ppf ( 0.5 + conf_level / 2 ) * d . std ( ddof = 1 ) )