Skip to content

Instantly share code, notes, and snippets.

@brandonwillard
Created August 23, 2016 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brandonwillard/867f92de102de4b68cdf77c4ad76dad4 to your computer and use it in GitHub Desktop.
Save brandonwillard/867f92de102de4b68cdf77c4ad76dad4 to your computer and use it in GitHub Desktop.
Plot SURE estimates
import numpy as np
from hsplus.special_funcs import sure_hib
alpha_d_range = np.linspace(-100, 100, 200)
sigma = 1.
tau = 1.
from timeit import default_timer as timer
start = timer()
sure_range = sure_hib(alpha_d_range, sigma, tau)
end = timer()
print(end - start)
sure_range_re = np.fromiter((float(mp.re(v_)) for v_ in sure_range), dtype=np.float)
import matplotlib.pyplot as plt
plt.style.use('ggplot')
plt.rc('text', usetex=True)
fig, ax = plt.subplots(1, 1)
ax.clear()
ax.plot(alpha_d_range, sure_range_re)
ax.set_xlabel(r'\hat{\alpha}_i d_i')
ax.set_ylabel(r'SURE')
ax.set_title(r'\sigma={}, \tau={}'.format(sigma, tau))
fig.tight_layout()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment