'estimate parameters using GMM
Parameters
start : array_like
starting values for minimization
weights : array
weighting matrix for moment conditions. If weights is None, then
the identity matrix is used
Returns
paramest : array
estimated parameters
Notes
todo: add fixed parameter option, not here ???
uses scipy.optimize.fmin'

def fitgmm(self, start, weights=None, optim_method='bfgs', optim_args=None):

    if (weights is None):
        weights = self.start_weights(inv=False)
    if (optim_args is None):
        optim_args = {}
    if (optim_method == 'nm'):
        optimizer = optimize.fmin
    elif (optim_method == 'bfgs'):
        optimizer = optimize.fmin_bfgs
        optim_args['fprime'] = self.score
    elif (optim_method == 'ncg'):
        optimizer = optimize.fmin_ncg
        optim_args['fprime'] = self.score
    elif (optim_method == 'cg'):
        optimizer = optimize.fmin_cg
        optim_args['fprime'] = self.score
    elif (optim_method == 'fmin_l_bfgs_b'):
        optimizer = optimize.fmin_l_bfgs_b
        optim_args['fprime'] = self.score
    elif (optim_method == 'powell'):
        optimizer = optimize.fmin_powell
    elif (optim_method == 'slsqp'):
        optimizer = optimize.fmin_slsqp
    else:
        raise ValueError('optimizer    method    not    available')
    if DEBUG:
        print(np.linalg.det(weights))
    return optimizer(self.gmmobjective, start, args=(weights,), **optim_args)
