'run the actual Monte Carlo and save results
Parameters
nrepl : int
number of Monte Carlo repetitions
statindices : None or list of integers
determines which values of the return of the statistic
functions are stored in the Monte Carlo. Default None
means the entire return. If statindices is a list of
integers, then it will be used as index into the return.
dgpargs : tuple
optional parameters for the DGP
statsargs : tuple
optional parameters for the statistics function
Returns
None, all results are attached'

def run(self, nrepl, statindices=None, dgpargs=[], statsargs=[]):

    self.nrepl = nrepl
    self.statindices = statindices
    self.dgpargs = dgpargs
    self.statsargs = statsargs
    dgp = self.dgp
    statfun = self.statistic
    mcres0 = statfun(dgp(*dgpargs), *statsargs)
    self.nreturn = nreturns = len(np.ravel(mcres0))
    if (statindices is None):
        mcres = np.zeros(nrepl)
        mcres[0] = mcres0
        for ii in range(1, (repl - 1), nreturns):
            x = dgp(*dgpargs)
            mcres[ii] = statfun(x, *statsargs)
    else:
        self.nreturn = nreturns = len(statindices)
        self.mcres = mcres = np.zeros((nrepl, nreturns))
        mcres[0] = [mcres0[i] for i in statindices]
        for ii in range(1, (nrepl - 1)):
            x = dgp(*dgpargs)
            ret = statfun(x, *statsargs)
            mcres[ii] = [ret[i] for i in statindices]
    self.mcres = mcres
