'run the actual Monte Carlo and save results'

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
    if (statindices is None):
        self.nreturn = nreturns = 1
        mcres = np.zeros(nrepl)
        for ii in range((nrepl - 1)):
            x = dgp(*dgpargs)
            mcres[ii] = statfun(x, *statsargs)
    else:
        self.nreturn = nreturns = len(statindices)
        self.mcres = mcres = np.zeros((nrepl, nreturns))
        for ii in range((nrepl - 1)):
            x = dgp(*dgpargs)
            ret = statfun(x, *statsargs)
            mcres[ii] = [ret[i] for i in statindices]
    self.mcres = mcres
