<jupyter_start><jupyter_text>Bayes FactorBayes factor = Posterior odds / Prior oddsThe Bayes factor does not depend on the value of the prior model weights, but the estimate will be most precise when the posterior odds are the same.<jupyter_code>drug = (101,100,102,104,102,97,105,105,98,101,100,123,105,103,100,95,102,106,
        109,102,82,102,100,102,102,101,102,102,103,103,97,97,103,101,97,104,
        96,103,124,101,101,100,101,101,104,100,101)
placebo = (99,101,100,101,102,100,97,101,104,101,102,102,100,105,88,101,100,
           104,100,100,100,101,102,103,97,101,101,100,101,99,101,100,100,
           101,100,99,101,100,102,99,100,99)

y1 = np.array(drug)
y2 = np.array(placebo)
y = pd.DataFrame(dict(value=np.r_[y1, y2], group=np.r_[['drug']*len(drug), ['placebo']*len(placebo)]))

y.hist('value', by='group', figsize=(12, 4))
mu_m = y.value.mean()
mu_s = y.value.std() * 2

with pm.Model() as model:
    group1_mean = pm.Normal('group1_mean', mu=mu_m, sd=mu_s)
    group2_mean = pm.Normal('group2_mean', mu=mu_m, sd=mu_s)
sigma_low = 1
sigma_high = 10

with model:
    group1_std = pm.Uniform('group1_std', lower=sigma_low, upper=sigma_high)
    group2_std = pm.Uniform('group2_std', lower=sigma_low, upper=sigma_high)
with model:
    v = pm.Exponential('v_minus_one', 1/29) + 1
pm.kdeplot(np.random.exponential(30, size=10000), fill_kwargs={'alpha': 0.5})
with model:
    lam1 = group1_std**-2
    lam2 = group2_std**-2

    group1 = pm.StudentT('drug', nu=v, mu=group1_mean, lam=lam1, observed=y1)
    group2 = pm.StudentT('placebo', nu=v, mu=group2_mean, lam=lam2, observed=y2)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17343173431734318, 'fraction_numerical': 0.18265682656826568, 'mean_word_length': 5.75103734439834, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '522277', 'license': 'MIT', 'n_tokens_mistral': 863, 'n_tokens_neox': 673, 'n_words': 113, 'path': 'workspace_files/resources/Data_Collection.ipynb', 'repo_name': 'son520804/Video_Composition_Project', 'size': '1626'}