#This script file plots the power as a function of delta
#and n in  exercise 17 i Eriksen og Lauritzen (2004).

import scipy
import numpy
from scipy.stats import norm
import matplotlib.pyplot as plt

d = numpy.array([-6 + .1 * i for i in range(121)])
n = 50

sn = n ** .5
rbeta = 1 - norm.cdf(1.96 - sn * d / 7.5) + norm.cdf(-1.96 - sn * d / 7.5)
plt.plot(d, rbeta)
plt.show()
n = numpy.array([10 * i for i in range(71)])
sn = n ** .5
d = 1

beta = 1 - norm.cdf(1.96 - sn * d / 7.5) + norm.cdf(-1.96 - sn * d / 7.5)
plt.plot(n, beta)
plt.show()
