

def run_model(self, key, df=None, groups=None, groupcol=None, valuecol=None, pooling=None, samples=None, burns=None, thin=None, **kwargs):
    if (key not in self.keys):
        return None
    if (df is None):
        df = self.df
    if (groups is None):
        groups = self.groups
    if (groupcol is None):
        groupcol = self.groupcol
    if (valuecol is None):
        valuecol = self.valuecol
    if (pooling is None):
        pooling = self.pooling
    if (samples is None):
        samples = key.samples
    if (burns is None):
        burns = self.burns
    if (thin is None):
        thin = self.thin
    group_map = (lambda x: (x[groupcol] in (groups or key)))
    if (pooling == 'all'):
        pooled = df[valuecol]
    elif (pooling == 'default'):
        pooled = df[df.apply(group_map, axis=1)][valuecol]
    (group1, group2) = key
    g1 = df[(df[groupcol] == group1)]
    g1 = g1[valuecol]
    g2 = df[(df[groupcol] == group2)]
    g2 = g2[valuecol]
    if (pooling == 'paired'):
        pooled = pd.DataFrame.concat([g1, g2])
    mu1 = pm.Normal('mu_1', mu=pooled.mean(), tau=((1.0 / pooled.var()) / 1000.0))
    mu2 = pm.Normal('mu_2', mu=pooled.mean(), tau=((1.0 / pooled.var()) / 1000.0))
    sig1 = pm.Uniform('sigma_1', lower=(pooled.var() / 1000.0), upper=(pooled.var() * 1000))
    sig2 = pm.Uniform('sigma_2', lower=(pooled.var() / 1000.0), upper=(pooled.var() * 1000))
    v = pm.Exponential('nu', beta=(1.0 / 29))
    t1 = pm.NoncentralT('t_1', mu=mu1, lam=(1.0 / sig1), nu=v, value=g1[:], observed=True)
    t2 = pm.NoncentralT('t_2', mu=mu2, lam=(1.0 / sig2), nu=v, value=g2[:], observed=True)
    model = pm.Model([t1, mu1, sig1, t2, mu2, sig2, v])
    mcmc = pm.MCMC(model)
    mcmc.sample(iter=samples, burn=burns, thin=thin, progress_bar=self.progress_bar)
    self.mcmcs[key] = mcmc
    self.complete_key(key)
    return mcmc

dataset/ETHPy150Open HHammond/kcbo/kcbo/statistical_tests/t_test.py TTest.run_model/VarMisuse@154/177 `self`->`key`