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