price = pd.read_csv('C:\\Users\\mypath\\price.csv', index_col= [0,1], usecols=[0,5,6])
yt = price.loc['AUS']
yt = yt.pct_change().dropna().values
def p(u, sigma, pi):
d = pi / (2*np.pi*sigma)**0.5 * np.exp(-(yt-u)**2 / (2*sigma**2))
return d
def Lf(u, sigma, pi):
prob = p(u[0], sigma[0], pi[0]) + p(u[1], sigma[1], pi[1])
L = np.sum(-np.log(prob))
return L
pi_init = (0.5,0.5)
sigma_init = (0.1,0.1)
u_init = (0.1,0.1)
res = opt.minimize(Lf, (u_init, sigma_init, pi_init), method='L-BFGS-B')
If i run Lf() i get a real number but when i run minimize i get the following error message:
TypeError: Lf() missing 2 required positional arguments: 'sigma' and 'pi'
This message doesn't make sense to me...