'simple bootstrap to get mean and variance of estimator
see notes
Parameters
nrep : int
number of bootstrap replications
method : str
optimization method to use
disp : bool
If true, then optimization prints results
store : bool
If true, then parameter estimates for all bootstrap iterations
are attached in self.bootstrap_results
Returns
mean : array
mean of parameter estimates over bootstrap replications
std : array
standard deviation of parameter estimates over bootstrap
replications
Notes
This was mainly written to compare estimators of the standard errors of
the parameter estimates.  It uses independent random sampling from the
original endog and exog, and therefore is only correct if observations
are independently distributed.
This will be moved to apply only to models with independently
distributed observations.'

def bootstrap(self, nrep=100, method='nm', disp=0, store=1):

    results = []
    print(self.model.__class__)
    hascloneattr = (True if hasattr(self, 'cloneattr') else False)
    for i in range(nrep):
        rvsind = np.random.randint(self.nobs, size=self.nobs)
        fitmod = self.model.__class__(self.endog[rvsind], self.exog[rvsind, :])
        if hascloneattr:
            for attr in self.model.cloneattr:
                setattr(fitmod, attr, getattr(self.model, attr))
        fitres = fitmod.fit(method=method, disp=disp)
        results.append(fitres.params)
    results = np.array(results)
    if store:
        self.bootstrap_results = results
    return (results.mean(0), results.std(0), results)
